[Skiboot] [PATCH] opal-prd: Have a worker process handle page offlining

Oliver O'Halloran oohall at gmail.com
Thu Sep 17 16:20:36 AEST 2020


On Thu, Sep 17, 2020 at 3:36 PM Mahesh J Salgaonkar
<mahesh at linux.ibm.com> wrote:
>
> > +volatile bool worker_terminated;
> > +
> > +void signchild_handler(int sig)
> > +{
> > +     worker_terminated = true;
> > +}
>
> Should this handler be registered to catch SIGCHILD ? I don't
> see it is being registered.

Yeah looks like the signal registration went AWOL. I remember writing
the code to do it at some point so I must have screwed up while
rebasing.

> >  static int run_attn_loop(struct opal_prd_ctx *ctx)
> >  {
> >       struct pollfd pollfds[2];
> > @@ -2049,6 +2079,23 @@ static int run_attn_loop(struct opal_prd_ctx *ctx)
> >               process_msgq(ctx);
> >
> >               rc = poll(pollfds, 2, -1);
> > +
> > +             if (worker_terminated) {
> > +                     pid_t pid;
> > +
> > +                     worker_terminated = false;
> > +                     do {
> > +                             pid = waitpid(-1, NULL, WNOHANG);
> > +                             if (pid > 0) {
> > +                                     pr_log(LOG_DEBUG, "reaped %d\n", pid);
> > +                             } else if (rc == -1 && errno != ECHILD) {
>
> Shouldn't this be if (pid == -1 && ... ?

Yep. Although, it might actually work anyway since rc would be -1 due
to poll() being interrupted by a signal. Probably best not to rely on
that though :)

Oliver


More information about the Skiboot mailing list