All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@qualcomm.com>
To: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: Vegard Nossum <vegard.nossum@gmail.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Mike Travis <travis@sgi.com>, LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Gregory Haskins <ghaskins@novell.com>,
	pj@sgi.com, Ingo Molnar <mingo@elte.hu>,
	Tigran Aivazian <tigran@aivazian.fsnet.co.uk>,
	Shaohua Li <shaohua.li@intel.com>
Subject: Re: latest -git: kernel BUG at arch/x86/kernel/microcode.c:142!
Date: Thu, 24 Jul 2008 10:15:48 -0700	[thread overview]
Message-ID: <4888B8C4.20905@qualcomm.com> (raw)
In-Reply-To: <b647ffbd0807240918n78b32f63j5c54af1dca026dac@mail.gmail.com>

Dmitry Adamushko wrote:
> 2008/7/24 Dmitry Adamushko <dmitry.adamushko@gmail.com>:
>> 2008/7/24 Vegard Nossum <vegard.nossum@gmail.com>:
>>>> It's this one:
>>>>
>>>>        /* We should bind the task to the CPU */
>>>>        BUG_ON(raw_smp_processor_id() != cpu_num);
>>>>
>>>> Maybe related to recently merged per-cpu changes? (Yesterday's tests ran fine.)
>>>>
>>>> It seems 100% reproducible, so I'll start bisecting it.
>>> Ahha, after many hours of hitting various unrelated crashes,
>>> miscompiles, etc. I finally arrive at this commit:
>>>
>>> commit e761b7725234276a802322549cee5255305a0930
>>> Author: Max Krasnyansky <maxk@qualcomm.com>
>>> Date:   Tue Jul 15 04:43:49 2008 -0700
>> Yeah, there seems to be a funny situation here :-) I'd expect it to be
>> 100% reproduceable with CONFIG_MICROCODE=y.
>>
>> cpu_up() -> raw_notifier_call_chain(CPU_ONLINE, ...) ->
>>
>> (microcode's part)
>>
>> mc_cpu_callback() -> mc_sysdev_add() -> microcode_init_cpu()
>>
>> and here we have:
>>
>>        set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
> 
> btw., this is obviously bad behavior. This code plays with
> "cpus_allowed" (changes and then restores it) of pretty arbitrary
> tasks in context of which it happens to run. So it may race with
> sched_setaffinity() and negate its effect.

Agree. I came to the similar conclusion.
The solution is to either convert it to schedule_delayed_work_on() or if it's
important to update the microcode synchronously we can the whole thing to do
something like
	smp_call_function_single(cpu, collect_cpu_info);
	if (needs_update) {
		request_firmware(...);
		smp_call_function_single(cpu, update_cpu_microcode);
	}

Tigran, do we need sync update inside the hotplug handler or async update via
workqueue is fine ?

Max


Max








      reply	other threads:[~2008-07-24 17:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 10:48 latest -git: kernel BUG at arch/x86/kernel/microcode.c:142! Vegard Nossum
2008-07-24 14:02 ` Vegard Nossum
2008-07-24 14:52   ` Dmitry Adamushko
2008-07-24 16:18     ` Dmitry Adamushko
2008-07-24 17:15       ` Max Krasnyansky [this message]

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=4888B8C4.20905@qualcomm.com \
    --to=maxk@qualcomm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dmitry.adamushko@gmail.com \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pj@sgi.com \
    --cc=shaohua.li@intel.com \
    --cc=tigran@aivazian.fsnet.co.uk \
    --cc=torvalds@linux-foundation.org \
    --cc=travis@sgi.com \
    --cc=vegard.nossum@gmail.com \
    --cc=x86@kernel.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.