All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Mike Frysinger <vapier@gentoo.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-kernel@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org,
	linux-pm@lists.linux-foundation.org
Subject: Re: freezer: should barriers be smp ?
Date: Wed, 13 Apr 2011 23:05:46 +0200	[thread overview]
Message-ID: <20110413210546.GC16830@elf.ucw.cz> (raw)
In-Reply-To: <BANLkTiknfeTj6GD0t-ekMoaS1QYQBVyBjQ@mail.gmail.com>

On Wed 2011-04-13 17:02:45, Mike Frysinger wrote:
> On Wed, Apr 13, 2011 at 16:58, Rafael J. Wysocki wrote:
> > On Wednesday, April 13, 2011, Mike Frysinger wrote:
> >> when we suspend/resume Blackfin SMP systems, we notice that the
> >> freezer code runs on multiple cores.  this is of course what you want
> >> -- freeze processes in parallel.  however, the code only uses non-smp
> >> based barriers which causes us problems ... our cores need software
> >> support to keep caches in sync, so our smp barriers do just that.  but
> >> the non-smp barriers do not, and so the frozen/thawed processes
> >> randomly get stuck in the wrong task state.
> >>
> >> thinking about it, shouldnt the freezer code be using smp barriers ?
> >
> > Yes, it should, but rmb() and wmb() are supposed to be SMP barriers.
> >
> > Or do you mean something different?
> 
> then what's the diff between smp_rmb() and rmb() ?
> 
> this is what i'm proposing:
> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -17,7 +17,7 @@ static inline void frozen_process(void)
>  {
>     if (!unlikely(current->flags & PF_NOFREEZE)) {
>         current->flags |= PF_FROZEN;
> -       wmb();
> +       smp_wmb();
>     }
>     clear_freeze_flag(current);
>  }
> @@ -93,7 +93,7 @@ bool freeze_task(struct task_struct *p, bool sig_only)
>      * the task as frozen and next clears its TIF_FREEZE.
>      */
>     if (!freezing(p)) {
> -       rmb();
> +       smp_rmb();
>         if (frozen(p))
>             return false;

smp_rmb() is NOP on uniprocessor.

I believe the code is correct as is.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2011-04-13 21:05 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  6:14 freezer: should barriers be smp ? Mike Frysinger
2011-04-13 20:58 ` Rafael J. Wysocki
2011-04-13 20:58 ` Rafael J. Wysocki
2011-04-13 21:02   ` Mike Frysinger
2011-04-13 21:05     ` Pavel Machek [this message]
2011-04-13 21:11       ` [uclinux-dist-devel] " Mike Frysinger
2011-04-13 21:11       ` Mike Frysinger
2011-04-13 21:53         ` Rafael J. Wysocki
2011-04-13 21:53         ` Rafael J. Wysocki
2011-04-13 22:11           ` [linux-pm] " Alan Stern
2011-04-13 22:34             ` [uclinux-dist-devel] freezer: should barriers be smp? Rafael J. Wysocki
2011-04-13 22:34             ` [linux-pm] " Rafael J. Wysocki
2011-04-14 14:55               ` Alan Stern
2011-04-14 22:34                 ` Rafael J. Wysocki
2011-04-14 22:34                 ` [linux-pm] " Rafael J. Wysocki
2011-04-15 14:32                   ` Alan Stern
2011-04-15 14:32                   ` [linux-pm] " Alan Stern
2011-04-14 14:55               ` Alan Stern
2011-04-13 22:11           ` [uclinux-dist-devel] freezer: should barriers be smp ? Alan Stern
2011-04-13 22:22           ` Mike Frysinger
2011-04-13 22:22           ` Mike Frysinger
2011-04-13 22:49             ` Rafael J. Wysocki
2011-04-13 22:49             ` Rafael J. Wysocki
2011-04-13 22:53               ` Rafael J. Wysocki
2011-04-13 22:53               ` Rafael J. Wysocki
2011-04-13 22:57               ` Mike Frysinger
2011-04-13 23:12                 ` Rafael J. Wysocki
2011-04-13 23:12                 ` Rafael J. Wysocki
2011-04-14 15:13                 ` [linux-pm] " Alan Stern
2011-04-14 22:40                   ` Rafael J. Wysocki
2011-04-14 22:40                   ` [linux-pm] " Rafael J. Wysocki
2011-04-14 15:13                 ` Alan Stern
2011-04-13 22:57               ` Mike Frysinger
2011-04-13 22:04         ` [linux-pm] [uclinux-dist-devel] " Alan Stern
2011-04-15 16:29           ` Pavel Machek
2011-04-15 16:29           ` [linux-pm] " Pavel Machek
2011-04-15 16:33             ` Mike Frysinger
2011-04-15 16:33             ` [uclinux-dist-devel] [linux-pm] " Mike Frysinger
2011-04-15 16:57               ` [uclinux-dist-devel] " Pavel Machek
2011-04-15 16:57               ` [uclinux-dist-devel] [linux-pm] " Pavel Machek
2011-04-15 23:11               ` Rafael J. Wysocki
2011-04-15 23:24                 ` Mike Frysinger
2011-04-15 23:30                   ` [uclinux-dist-devel] " Rafael J. Wysocki
2011-04-15 23:30                   ` [uclinux-dist-devel] [linux-pm] " Rafael J. Wysocki
2011-04-15 23:24                 ` [uclinux-dist-devel] " Mike Frysinger
2011-04-15 23:11               ` Rafael J. Wysocki
2011-04-13 22:04         ` Alan Stern
2011-04-13 21:05     ` Pavel Machek
2011-04-13 21:02   ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2011-04-13  6:14 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110413210546.GC16830@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rjw@sisk.pl \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.