lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201004290019.26381.rjw@sisk.pl>
Date:	Thu, 29 Apr 2010 00:19:26 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Arve Hjønnevåg <arve@...roid.com>
Cc:	Oleg Nesterov <oleg@...hat.com>,
	linux-pm@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	Alan Stern <stern@...land.harvard.edu>,
	Tejun Heo <tj@...nel.org>, Pavel Machek <pavel@....cz>,
	Len Brown <len.brown@...el.com>
Subject: Re: [PATCH 6/8] PM: Add suspend blocking work.

On Thursday 29 April 2010, Arve Hjønnevåg wrote:
> 2010/4/28 Rafael J. Wysocki <rjw@...k.pl>:
> > On Wednesday 28 April 2010, Oleg Nesterov wrote:
> >> On 04/27, Arve Hjønnevåg wrote:
> >> >
> >> > Allow work to be queued that will block suspend while it is pending
> >> > or executing. To get the same functionality in the calling code often
> >> > requires a separate suspend_blocker for pending and executing work, or
> >> > additional state and locking. This implementation does add additional
> >> > state and locking, but this can be removed later if we add support for
> >> > suspend blocking work to the core workqueue code.
> >>
> >> I think this patch is fine.
> >>
> >> Just one silly question,
> >>
> >> > +int queue_suspend_blocking_work(struct workqueue_struct *wq,
> >> > +                           struct suspend_blocking_work *work)
> >> > +{
> >> > +   int ret;
> >> > +   unsigned long flags;
> >> > +
> >> > +   spin_lock_irqsave(&work->lock, flags);
> >> > +   suspend_block(&work->suspend_blocker);
> >> > +   ret = queue_work(wq, &work->work);
> >> > +   if (ret)
> >> > +           work->active++;
> >>
> >> why not
> >>
> >>       ret = queue_work(wq, &work->work);
> >>       if (ret) {
> >>               suspend_block(&work->suspend_blocker);
> >>               work->active++;
> >>       }
> >>
> >> ?
> >>
> >> Afaics, we can't race with work->func() doing unblock, we hold work-lock.
> >> And this way the code looks more clear.
> >
> > Agreed.  Arve, any objections to doing that?
> >
> 
> I need to fix the race, but I can easily fix it in
> cancel_suspend_blocking_work_sync instead. If the suspend blocker is
> active for a long time, and DEBUG_SUSPEND_BLOCKER is enabled, we can
> tell if the work is constantly re-queued or if the workqueue is stuck.

Well, perhaps that's worth adding a comment to the code.  The debug part is not
immediately visible from the code itself.

Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ