* Re: fix bogus hotplug cpu warning
@ 2007-08-28 9:07 Ingo Molnar
2007-08-28 9:30 ` Hugh Dickins
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2007-08-28 9:07 UTC (permalink / raw)
To: Hugh Dickins; +Cc: linux-kernel, Linus Torvalds
this commit:
commit d243769d3f83b318813a04a9592bb7cfedc6c280
Author: Hugh Dickins <hugh@veritas.com>
Date: Mon Aug 27 16:06:19 2007 +0100
fix bogus hotplug cpu warning
Fix bogus DEBUG_PREEMPT warning on x86_64, when cpu brought online
after bootup: current_is_keventd is right to note its use of
smp_processor_id is preempt-safe, but should use
raw_smp_processor_id to avoid the warning.
- int cpu = smp_processor_id(); /* preempt-safe: keventd is per-cpu */
+ int cpu = raw_smp_processor_id(); /* preempt-safe: keventd is per-cpu */
is incorrect. smp_processor_id() will _not_ warn about true per-cpu
tasks:
/*
* Kernel threads bound to a single CPU can safely use
* smp_processor_id():
*/
this_mask = cpumask_of_cpu(this_cpu);
if (cpus_equal(current->cpus_allowed, this_mask))
goto out;
so if this check triggered for the cpu-offline code it's because keventd
was _not_ per-cpu (perhaps because the cpu offline code broke its
affinity?). So your patch hides a real bug.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fix bogus hotplug cpu warning
2007-08-28 9:07 fix bogus hotplug cpu warning Ingo Molnar
@ 2007-08-28 9:30 ` Hugh Dickins
2007-08-28 10:18 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2007-08-28 9:30 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, Linus Torvalds
On Tue, 28 Aug 2007, Ingo Molnar wrote:
> this commit:
>
> commit d243769d3f83b318813a04a9592bb7cfedc6c280
> Author: Hugh Dickins <hugh@veritas.com>
> Date: Mon Aug 27 16:06:19 2007 +0100
>
> fix bogus hotplug cpu warning
>
> Fix bogus DEBUG_PREEMPT warning on x86_64, when cpu brought online
> after bootup: current_is_keventd is right to note its use of
> smp_processor_id is preempt-safe, but should use
> raw_smp_processor_id to avoid the warning.
>
> - int cpu = smp_processor_id(); /* preempt-safe: keventd is per-cpu */
> + int cpu = raw_smp_processor_id(); /* preempt-safe: keventd is per-cpu */
>
> is incorrect. smp_processor_id() will _not_ warn about true per-cpu
> tasks:
>
> /*
> * Kernel threads bound to a single CPU can safely use
> * smp_processor_id():
> */
> this_mask = cpumask_of_cpu(this_cpu);
>
> if (cpus_equal(current->cpus_allowed, this_mask))
> goto out;
>
> so if this check triggered for the cpu-offline code it's because keventd
> was _not_ per-cpu (perhaps because the cpu offline code broke its
> affinity?). So your patch hides a real bug.
No, keventd is properly per-cpu, but the task which is calling
current_is_keventd() is a normal user task, so smp_processor_id()
did warn about it. It wouldn't make much sense to have a function
current_is_keventd() if you could only call it from a keventd, would
it ;-? Take a look at it (kernel/workqueue.c), I believe what it does
is unusual (hence that comment about being "preempt-safe") but valid.
Hugh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fix bogus hotplug cpu warning
2007-08-28 9:30 ` Hugh Dickins
@ 2007-08-28 10:18 ` Ingo Molnar
0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2007-08-28 10:18 UTC (permalink / raw)
To: Hugh Dickins; +Cc: linux-kernel, Linus Torvalds
* Hugh Dickins <hugh@veritas.com> wrote:
> > so if this check triggered for the cpu-offline code it's because
> > keventd was _not_ per-cpu (perhaps because the cpu offline code
> > broke its affinity?). So your patch hides a real bug.
>
> No, keventd is properly per-cpu, but the task which is calling
> current_is_keventd() is a normal user task, so smp_processor_id() did
> warn about it. It wouldn't make much sense to have a function
> current_is_keventd() if you could only call it from a keventd, would
> it ;-? Take a look at it (kernel/workqueue.c), I believe what it does
> is unusual (hence that comment about being "preempt-safe") but valid.
ok, you are right indeed.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-28 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-28 9:07 fix bogus hotplug cpu warning Ingo Molnar
2007-08-28 9:30 ` Hugh Dickins
2007-08-28 10:18 ` Ingo Molnar
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.