All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Jens Axboe <axboe@kernel.dk>, Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Jason Wessel <jason.wessel@windriver.com>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Douglas Anderson <dianders@chromium.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Pavel Machek <pavel@ucw.cz>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	John Stultz <john.stultz@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org,
	kgdb-bugreport@lists.sourceforge.net,
	linux-perf-users@vger.kernel.org, linux-pm@vger.kernel.org,
	rcu@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/6] sched: Unbreak wakeups
Date: Wed, 2 Jun 2021 12:43:59 -0700	[thread overview]
Message-ID: <20210602194359.pxujd4rx4lxv2ldm@offworld> (raw)
In-Reply-To: <20210602133040.271625424@infradead.org>

On Wed, 02 Jun 2021, Peter Zijlstra wrote:

>Remove broken task->state references and let wake_up_process() DTRT.
>
>The anti-pattern in these patches breaks the ordering of ->state vs
>COND as described in the comment near set_current_state() and can lead
>to missed wakeups:
>
>	(OoO load, observes RUNNING)<-.
>	for (;;) {                    |
>	  t->state = UNINTERRUPTIBLE; |
>	  smp_mb();          ,-----> ,' (OoO load, observed !COND)
>                             |       |
>	                     |       |	COND = 1;
>			     |	     `- if (t->state != RUNNING)
>                             |		  wake_up_process(t); // not done
>	  if (COND) ---------'
>	    break;
>	  schedule(); // forever waiting
>	}
>	t->state = TASK_RUNNING;
>
>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Reviewed-by: Davidlohr Bueso <dbueso@suse.de>

WARNING: multiple messages have this Message-ID
From: Davidlohr Bueso <dave@stgolabs.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>, Pavel Machek <pavel@ucw.cz>,
	Mike Snitzer <snitzer@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	kgdb-bugreport@lists.sourceforge.net,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>, Ben Segall <bsegall@google.com>,
	linux-mm@kvack.org, dm-devel@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	Zefan Li <lizefan.x@bytedance.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	netdev@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Alasdair Kergon <agk@redhat.com>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	kvm@vger.kernel.org, Will Deacon <will@kernel.org>,
	cgroups@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Jakub Kicinski <kuba@kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	linux-pm@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
	Jason Wessel <jason.wessel@windriver.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Borislav Petkov <bp@alien8.de>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Waiman Long <longman@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Jens Axboe <axboe@kernel.dk>, Felipe Balbi <balbi@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Douglas Anderson <dianders@chromium.org>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	rcu@vger.kernel.org,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [dm-devel] [PATCH 1/6] sched: Unbreak wakeups
Date: Wed, 2 Jun 2021 12:43:59 -0700	[thread overview]
Message-ID: <20210602194359.pxujd4rx4lxv2ldm@offworld> (raw)
In-Reply-To: <20210602133040.271625424@infradead.org>

On Wed, 02 Jun 2021, Peter Zijlstra wrote:

>Remove broken task->state references and let wake_up_process() DTRT.
>
>The anti-pattern in these patches breaks the ordering of ->state vs
>COND as described in the comment near set_current_state() and can lead
>to missed wakeups:
>
>	(OoO load, observes RUNNING)<-.
>	for (;;) {                    |
>	  t->state = UNINTERRUPTIBLE; |
>	  smp_mb();          ,-----> ,' (OoO load, observed !COND)
>                             |       |
>	                     |       |	COND = 1;
>			     |	     `- if (t->state != RUNNING)
>                             |		  wake_up_process(t); // not done
>	  if (COND) ---------'
>	    break;
>	  schedule(); // forever waiting
>	}
>	t->state = TASK_RUNNING;
>
>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Reviewed-by: Davidlohr Bueso <dbueso@suse.de>

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2021-06-02 19:44 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 13:12 [PATCH 0/6] sched: Cleanup task_struct::state Peter Zijlstra
2021-06-02 13:12 ` [dm-devel] " Peter Zijlstra
2021-06-02 13:12 ` [PATCH 1/6] sched: Unbreak wakeups Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 13:58   ` Greg Kroah-Hartman
2021-06-02 13:58     ` [dm-devel] " Greg Kroah-Hartman
2021-06-02 14:47   ` Will Deacon
2021-06-02 14:47     ` [dm-devel] " Will Deacon
2021-06-02 19:43   ` Davidlohr Bueso [this message]
2021-06-02 19:43     ` Davidlohr Bueso
2021-06-02 13:12 ` [PATCH 2/6] sched: Introduce task_is_running() Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 14:59   ` Will Deacon
2021-06-02 14:59     ` [dm-devel] " Will Deacon
2021-06-02 16:46     ` Peter Zijlstra
2021-06-02 16:46       ` [dm-devel] " Peter Zijlstra
2021-06-02 23:15   ` Davidlohr Bueso
2021-06-02 23:15     ` [dm-devel] " Davidlohr Bueso
2021-06-02 13:12 ` [PATCH 3/6] sched,perf,kvm: Fix preemption condition Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 13:59   ` Mathieu Desnoyers
2021-06-02 13:59     ` [dm-devel] [PATCH 3/6] sched, perf, kvm: " Mathieu Desnoyers
2021-06-02 13:59     ` [PATCH 3/6] sched,perf,kvm: " Mathieu Desnoyers
2021-06-02 14:10     ` Peter Zijlstra
2021-06-02 14:10       ` [dm-devel] [PATCH 3/6] sched, perf, kvm: " Peter Zijlstra
2021-06-02 14:30       ` [PATCH 3/6] sched,perf,kvm: " Mark Rutland
2021-06-02 14:30         ` [dm-devel] [PATCH 3/6] sched, perf, kvm: " Mark Rutland
2021-06-02 14:15   ` [PATCH 3/6] sched,perf,kvm: " Mathieu Desnoyers
2021-06-02 14:15     ` [dm-devel] [PATCH 3/6] sched, perf, kvm: " Mathieu Desnoyers
2021-06-02 14:15     ` [PATCH 3/6] sched,perf,kvm: " Mathieu Desnoyers
2021-06-02 14:23     ` Peter Zijlstra
2021-06-02 14:23       ` [dm-devel] [PATCH 3/6] sched, perf, kvm: " Peter Zijlstra
2021-06-02 13:12 ` [PATCH 4/6] sched: Add get_current_state() Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 14:01   ` Mathieu Desnoyers
2021-06-02 14:01     ` [dm-devel] " Mathieu Desnoyers
2021-06-02 14:01     ` Mathieu Desnoyers
2021-06-02 14:12     ` Peter Zijlstra
2021-06-02 14:12       ` [dm-devel] " Peter Zijlstra
2021-06-02 15:02   ` Will Deacon
2021-06-02 15:02     ` [dm-devel] " Will Deacon
2021-06-02 13:12 ` [PATCH 5/6] sched,timer: Use __set_current_state() Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 15:06   ` Will Deacon
2021-06-02 15:06     ` [dm-devel] " Will Deacon
2021-06-02 19:54   ` Davidlohr Bueso
2021-06-02 19:54     ` [dm-devel] " Davidlohr Bueso
2021-06-03  6:39     ` Peter Zijlstra
2021-06-03  6:39       ` [dm-devel] " Peter Zijlstra
2021-06-18 20:42   ` Thomas Gleixner
2021-06-18 20:42     ` [dm-devel] " Thomas Gleixner
2021-06-02 13:12 ` [PATCH 6/6] sched: Change task_struct::state Peter Zijlstra
2021-06-02 13:12   ` [dm-devel] " Peter Zijlstra
2021-06-02 14:06   ` Mathieu Desnoyers
2021-06-02 14:06     ` [dm-devel] " Mathieu Desnoyers
2021-06-02 14:06     ` Mathieu Desnoyers
2021-06-02 14:20     ` Peter Zijlstra
2021-06-02 14:20       ` [dm-devel] " Peter Zijlstra
2021-06-02 15:10   ` Will Deacon
2021-06-02 15:10     ` [dm-devel] " Will Deacon
2021-06-07 10:45   ` Daniel Thompson
2021-06-07 10:45     ` [dm-devel] " Daniel Thompson
2021-06-07 11:10     ` Peter Zijlstra
2021-06-07 11:10       ` [dm-devel] " Peter Zijlstra

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=20210602194359.pxujd4rx4lxv2ldm@offworld \
    --to=dave@stgolabs.net \
    --cc=acme@kernel.org \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=balbi@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=bp@alien8.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=daniel.thompson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=dianders@chromium.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=dm-devel@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@zytor.com \
    --cc=jason.wessel@windriver.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=john.stultz@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=josh@joshtriplett.org \
    --cc=juri.lelli@redhat.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=sboyd@kernel.org \
    --cc=snitzer@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH 1/6] sched: Unbreak wakeups' \
    /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

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.