All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Warn if garbage is passed to default_wake_function()
@ 2020-07-23 20:10 Chris Wilson
  2020-07-23 20:20 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2020-07-23 20:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chris Wilson, Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot

Since the default_wake_function() passes its flags onto
try_to_wake_up(), warn if those flags collide with internal values.
Given that the supplied flags are garbage, no repair can be done but at
least alert the user to the damage they are causing.

In the belief that these errors should be picked up during testing, the
warning is only compiled in under CONFIG_SCHED_DEBUG.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7b918059332b..4be209266d8a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4481,6 +4481,7 @@ asmlinkage __visible void __sched preempt_schedule_irq(void)
 int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,
 			  void *key)
 {
+	WARN_ON_ONCE(IS_ENABLED(CONFIG_SCHED_DEBUG) && wake_flags & ~WF_SYNC);
 	return try_to_wake_up(curr->private, mode, wake_flags);
 }
 EXPORT_SYMBOL(default_wake_function);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: Warn if garbage is passed to default_wake_function()
  2020-07-23 20:10 [PATCH] sched: Warn if garbage is passed to default_wake_function() Chris Wilson
@ 2020-07-23 20:20 ` Peter Zijlstra
  2020-07-24 12:02 ` [tip: sched/core] " tip-bot2 for Chris Wilson
  2020-07-24 12:44 ` [tip: sched/urgent] " tip-bot2 for Chris Wilson
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2020-07-23 20:20 UTC (permalink / raw)
  To: Chris Wilson; +Cc: linux-kernel, Ingo Molnar, Juri Lelli, Vincent Guittot

On Thu, Jul 23, 2020 at 09:10:42PM +0100, Chris Wilson wrote:
> Since the default_wake_function() passes its flags onto
> try_to_wake_up(), warn if those flags collide with internal values.
> Given that the supplied flags are garbage, no repair can be done but at
> least alert the user to the damage they are causing.
> 
> In the belief that these errors should be picked up during testing, the
> warning is only compiled in under CONFIG_SCHED_DEBUG.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Juri Lelli <juri.lelli@redhat.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: sched/core] sched: Warn if garbage is passed to default_wake_function()
  2020-07-23 20:10 [PATCH] sched: Warn if garbage is passed to default_wake_function() Chris Wilson
  2020-07-23 20:20 ` Peter Zijlstra
@ 2020-07-24 12:02 ` tip-bot2 for Chris Wilson
  2020-07-24 12:44 ` [tip: sched/urgent] " tip-bot2 for Chris Wilson
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chris Wilson @ 2020-07-24 12:02 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Chris Wilson, Ingo Molnar, Peter Zijlstra, x86, LKML

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     da3520d750e36051ecd5847ef712659b9c68ce20
Gitweb:        https://git.kernel.org/tip/da3520d750e36051ecd5847ef712659b9c68ce20
Author:        Chris Wilson <chris@chris-wilson.co.uk>
AuthorDate:    Thu, 23 Jul 2020 21:10:42 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 24 Jul 2020 13:47:12 +02:00

sched: Warn if garbage is passed to default_wake_function()

Since the default_wake_function() passes its flags onto
try_to_wake_up(), warn if those flags collide with internal values.

Given that the supplied flags are garbage, no repair can be done but at
least alert the user to the damage they are causing.

In the belief that these errors should be picked up during testing, the
warning is only compiled in under CONFIG_SCHED_DEBUG.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: https://lore.kernel.org/r/20200723201042.18861-1-chris@chris-wilson.co.uk
---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bd8e521..637365e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4686,6 +4686,7 @@ asmlinkage __visible void __sched preempt_schedule_irq(void)
 int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,
 			  void *key)
 {
+	WARN_ON_ONCE(IS_ENABLED(CONFIG_SCHED_DEBUG) && wake_flags & ~WF_SYNC);
 	return try_to_wake_up(curr->private, mode, wake_flags);
 }
 EXPORT_SYMBOL(default_wake_function);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip: sched/urgent] sched: Warn if garbage is passed to default_wake_function()
  2020-07-23 20:10 [PATCH] sched: Warn if garbage is passed to default_wake_function() Chris Wilson
  2020-07-23 20:20 ` Peter Zijlstra
  2020-07-24 12:02 ` [tip: sched/core] " tip-bot2 for Chris Wilson
@ 2020-07-24 12:44 ` tip-bot2 for Chris Wilson
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chris Wilson @ 2020-07-24 12:44 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Chris Wilson, Ingo Molnar, Peter Zijlstra, x86, LKML

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     062d3f95b630113e1156a31f376ad36e25da29a7
Gitweb:        https://git.kernel.org/tip/062d3f95b630113e1156a31f376ad36e25da29a7
Author:        Chris Wilson <chris@chris-wilson.co.uk>
AuthorDate:    Thu, 23 Jul 2020 21:10:42 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 24 Jul 2020 14:40:25 +02:00

sched: Warn if garbage is passed to default_wake_function()

Since the default_wake_function() passes its flags onto
try_to_wake_up(), warn if those flags collide with internal values.

Given that the supplied flags are garbage, no repair can be done but at
least alert the user to the damage they are causing.

In the belief that these errors should be picked up during testing, the
warning is only compiled in under CONFIG_SCHED_DEBUG.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: https://lore.kernel.org/r/20200723201042.18861-1-chris@chris-wilson.co.uk
---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5dece9b..2142c67 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4485,6 +4485,7 @@ asmlinkage __visible void __sched preempt_schedule_irq(void)
 int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,
 			  void *key)
 {
+	WARN_ON_ONCE(IS_ENABLED(CONFIG_SCHED_DEBUG) && wake_flags & ~WF_SYNC);
 	return try_to_wake_up(curr->private, mode, wake_flags);
 }
 EXPORT_SYMBOL(default_wake_function);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-24 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 20:10 [PATCH] sched: Warn if garbage is passed to default_wake_function() Chris Wilson
2020-07-23 20:20 ` Peter Zijlstra
2020-07-24 12:02 ` [tip: sched/core] " tip-bot2 for Chris Wilson
2020-07-24 12:44 ` [tip: sched/urgent] " tip-bot2 for Chris Wilson

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.