mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Pavel Machek <pavel@ucw.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <ak@suse.de>,
	linux-kernel@vger.kernel.org, Neil Brown <neilb@suse.de>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Ingo Molnar <mingo@elte.hu>,
	Zwane Mwaikambo <zwane@linuxpower.ca>
Subject: Re: [PATCH] x86: Document the hotplug code is incompatible with x86 irq handling
Date: Tue, 12 Jun 2007 12:19:48 -0600	[thread overview]
Message-ID: <m1bqflox17.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20070607140102.GA9094@ucw.cz> (Pavel Machek's message of "Thu, 7 Jun 2007 14:01:02 +0000")

Pavel Machek <pavel@ucw.cz> writes:

> Hi!
>
>> I just realized that except for doing the code review and noticing
>> that the current cpu hotplug code is fundamentally incompatible
>> with x86 I haven't done anything about it.  So here is my patch
>> to document what is wrong.
>> 
>> The current cpu hotplug code requires irqs to be migrated from a cpu
>> outside of irq context.  On x86 ioapics simply do not support this,
>> making the code unfixable without major redesign of the generic cpu
>> hotplug code.
>> 
>> So this patch makes CPU_HOTPLUG on x86 depend on CONFIG_BROKEN
>> and adds a WARN_ON so people that do enable it are not in doubt about
>> which part of the code is broken, even if it does work for them.
>
>
>> --- a/arch/i386/kernel/irq.c
>> +++ b/arch/i386/kernel/irq.c
>> @@ -312,6 +312,19 @@ void fixup_irqs(cpumask_t map)
>>  	unsigned int irq;
>>  	static int warned;
>>  
>> +	/* 
>> +	 * Function is so wrong at so many levels.
>> +	 * - We migrate irqs that are directed at the cpu we are
>> +	 *   removing.
>
> Is this about irq pinning?

Sorry. That should have been: We migrate irqs that are not directed at the
cpu we are removing.  (We are migrating irqs when it is unnecessary).

>> +	 * - We cannot safely migrate ioapic irqs on x86 except in
>> +	 *   side of irq context.
>
> 'inside'?
>
> Can you be more specific for this one?

Yes inside. 

An irq migration currently requires two instances of the irq firing to
complete.  Once on the source cpu once on the target cpu.

Migrating irqs while the irq is alive is a royal pain.

>> +	 * Since someone probably finds this useful just warn very
>> +	 * loudly until cpu hotplug is redesigned.
>> +	 */
>> +	WARN_ON(1);
>
> Ugh, no, this does not warn anyone. This will just make people ask me
> why they see stack trace while suspending... and we are not interested
> in the stack trace, anyway.
>
> printk(KERN_WARNING)?


Because you are calling unfixably broken code.  That should be a decent
incentive to do something else won't it?

IOAPICs do not support what the code is doing here.  There is lots of
practical evidence including bad experiences and practical tests that
support this.

I suspect the only reason you don't have problems is that the irqs are
already shut down at the source before we get to this code path.

>> index 5ce9443..a61c4f2 100644
>> --- a/arch/x86_64/Kconfig
>> +++ b/arch/x86_64/Kconfig
>> @@ -429,7 +429,7 @@ config NR_CPUS
>>  
>>  config HOTPLUG_CPU
>>  	bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
>> -	depends on SMP && HOTPLUG && EXPERIMENTAL
>> +	depends on SMP && HOTPLUG && EXPERIMENTAL && BROKEN
>>  	help
>
> Great, this will force everyone and their dog to enable broken, making
> broken useless. Please don't.

CONFIG_BROKEN is quite likely excessive but the code is totally and
unfixably broken.  So it still doesn't feel wrong to me.

Perhaps we should just disable swap suspend on SMP until we get a
design that can be implemented correctly on existing hardware.  I am
not happy with people telling me that we must keep broken code because
people with brand new SMP laptops will scream otherwise.  Since the
fundamental problems in this code path don't appear to bite people
very frequently I don't mind waiting while an alternative solution is
debugged and tested, but there is no way it makes sense to keep this
code in service more for more than a kernel release or two.

Eric

  reply	other threads:[~2007-06-12 18:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 13:32 Eric W. Biederman
2007-06-07 14:01 ` Pavel Machek
2007-06-12 18:19   ` Eric W. Biederman [this message]
2007-06-12 20:52     ` Rafael J. Wysocki
2007-06-12 21:56       ` Siddha, Suresh B
2007-06-12 22:16         ` Rafael J. Wysocki
2007-06-12 22:24           ` Siddha, Suresh B
2007-06-12 22:58             ` Rafael J. Wysocki
2007-06-22 17:27               ` Eric W. Biederman
     [not found] <fa.tUMR7tAB+jMgtfyl/LJ7U9QMgBs@ifi.uio.no>
2007-05-31 14:34 ` Robert Hancock
2007-05-31 15:47   ` Eric W. Biederman
2007-05-31 20:12     ` Rafael J. Wysocki
2007-06-01 19:48       ` Eric W. Biederman
2007-06-01 20:06         ` Rafael J. Wysocki
2007-06-01 20:29           ` Eric W. Biederman
2007-06-01 20:44             ` Rafael J. Wysocki
2007-06-01 20:34         ` Rafael J. Wysocki

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=m1bqflox17.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=neilb@suse.de \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=zwane@linuxpower.ca \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®