From: Thomas Gleixner <tglx@linutronix.de>
To: Fenghua Yu <fenghua.yu@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>, H Peter Anvin <hpa@zytor.com>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Tony Luck <tony.luck@intel.com>,
Asit K Mallick <asit.k.mallick@intel.com>,
Suresh B Siddha <suresh.b.siddha@intel.com>,
Len Brown <lenb@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/8] x86, common.c, smpboot.c: Init BSP during BSP online and don't offline BSP if irq is bound to it
Date: Wed, 5 Oct 2011 21:13:33 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.02.1110052054040.18778@ionos> (raw)
In-Reply-To: <1317832759-10223-6-git-send-email-fenghua.yu@intel.com>
On Wed, 5 Oct 2011, Fenghua Yu wrote:
> From: Fenghua Yu <fenghua.yu@intel.com>
>
> During BSP online, enable x2apic and initialize BSP. Don't offline BSP if
> any irq is bound to it.
>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---
> arch/x86/include/asm/processor.h | 1 +
> arch/x86/kernel/cpu/common.c | 13 ++++++++++---
> arch/x86/kernel/smpboot.c | 38 +++++++++++++++++++++++++++++++-------
> 3 files changed, 42 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 0d1171c..d648cae 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -161,6 +161,7 @@ extern struct pt_regs *idle_regs(struct pt_regs *);
>
> extern void early_cpu_init(void);
> extern void identify_boot_cpu(void);
> +extern void identify_boot_cpu_online(void);
> extern void identify_secondary_cpu(struct cpuinfo_x86 *);
> extern void print_cpu_info(struct cpuinfo_x86 *);
> extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 6218439..2ceefb9 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -911,6 +911,14 @@ void __init identify_boot_cpu(void)
> #endif
> }
>
> +void __cpuinit identify_boot_cpu_online(void)
> +{
> + numa_add_cpu(smp_processor_id());
> +#ifdef CONFIG_X86_32
> + enable_sep_cpu();
> +#endif
Why this change? This has nothing to do with the changelog. And we
have 3 other call sites for enable_sep_cpu().
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 9f548cb..cdfa425 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -50,6 +50,7 @@
> #include <linux/tboot.h>
> #include <linux/stackprotector.h>
> #include <linux/gfp.h>
> +#include <linux/kernel_stat.h>
What is this include for?
> #include <asm/acpi.h>
> #include <asm/desc.h>
> @@ -136,8 +137,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
> atomic_t init_deasserted;
>
> /*
> - * Report back to the Boot Processor.
> - * Running on AP.
> + * Report back to the Boot Processor during boot time or to the caller processor
> + * during CPU online.
> */
> static void __cpuinit smp_callin(void)
> {
> @@ -224,6 +225,13 @@ static void __cpuinit smp_callin(void)
> smp_store_cpu_info(cpuid);
>
> /*
> + * This function won't run on the BSP during boot time. It run
> + * on BSP only when BSP is offlined and onlined again.
> + */
> + if (cpuid == 0)
> + identify_boot_cpu_online();
Again, what's the point? numa_add_cpu() is called in identify_cpu()
already and you just added that crap here because you failed to fix
smp_store_cpu_info(). That whole patch set is just a sloppy hack which
leaves tons of cpu0 assumptions all over the place instead of cleaning
them up completely.
> + if (cpu == 0) {
> + int i;
> + for (i = 0; i < NR_IRQS; i++) {
> + struct irq_desc *desc = irq_to_desc(i);
> +
> + if (!desc)
> + continue;
> +
> + if (irqd_irq_disabled(&desc->irq_data))
> + continue;
> +
> + if (!irq_can_set_affinity(i)) {
> + pr_debug("irq%d can't move out of BSP\n", i);
> + return -EBUSY;
> + }
This is just disgusting.
Have you ever looked at other code which iterates over the interrupt
descriptors and if yes have you noticed that all that code uses
iterator functions for a fcking good reason? Hint SPARSE_IRQ
What gives you the guarantee that the interrupt is not going to be
enabled right after you offlined the cpu? Do you really think that
chekcing whether the interrupt is disabled is sufficient ????
Is there any guarantee, that an interrupt which is currently not
assigned is going to be requested after you offlined cpu0 ?
We know upfront whether we are using interrupt chips which are not
capable of irq affinity settings. So why the hell do you want to poke
in the interrupt descriptors?
Thanks,
tglx
next prev parent reply other threads:[~2011-10-05 19:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 16:39 [PATCH 0/8] Online/offline BSP on x86 Fenghua Yu
2011-10-05 16:39 ` [PATCH 1/8] x86, apic.c: Disable irq0 if CPU enables ARAT for local apic timer Fenghua Yu
2011-10-05 18:47 ` Thomas Gleixner
2011-10-05 19:12 ` Yu, Fenghua
2011-10-05 19:38 ` Thomas Gleixner
2011-10-05 20:11 ` Yu, Fenghua
2011-10-06 2:43 ` Andi Kleen
2011-10-05 16:39 ` [PATCH 2/8] x86/mtrr/main.c: Ask the first online CPU to save mtrr Fenghua Yu
2011-10-05 19:03 ` Srivatsa S. Bhat
2011-10-05 16:39 ` [PATCH 3/8] x86, i387.c: thread xstate is initialized only on BSP once Fenghua Yu
2011-10-05 18:49 ` Thomas Gleixner
2011-10-05 19:53 ` Yu, Fenghua
2011-10-05 16:39 ` [PATCH 4/8] kernel/workqueue.c: unbound work queue rescuer runs on first cpu in cpumask_online_cpu Fenghua Yu
2011-10-05 18:52 ` Thomas Gleixner
2011-10-05 19:19 ` Peter Zijlstra
2011-10-05 20:00 ` Tejun Heo
2011-10-05 16:39 ` [PATCH 5/8] x86, common.c, smpboot.c: Init BSP during BSP online and don't offline BSP if irq is bound to it Fenghua Yu
2011-10-05 19:13 ` Thomas Gleixner [this message]
2011-10-05 16:39 ` [PATCH 6/8] x86, topology.c: Enable CPU0 online/offline Fenghua Yu
2011-10-05 19:20 ` Thomas Gleixner
2011-10-05 23:05 ` Yu, Fenghua
2011-11-03 22:47 ` Yu, Fenghua
2011-11-07 2:11 ` Len Brown
2011-11-07 21:02 ` Yu, Fenghua
2011-10-05 16:39 ` [PATCH 7/8] kernel/power/main.c: Not suspend/resume if CPU0 is offlined Fenghua Yu
2011-10-05 18:37 ` Srivatsa S. Bhat
2011-10-05 19:22 ` Thomas Gleixner
2011-10-05 16:39 ` [PATCH 8/8] kernel/cpu.c: Define bsp_hotpluggable variable Fenghua Yu
2011-10-05 19:25 ` Thomas Gleixner
2011-10-05 20:25 ` Yu, Fenghua
2011-10-05 21:19 ` Thomas Gleixner
2011-10-05 19:16 ` [PATCH 0/8] Online/offline BSP on x86 Peter Zijlstra
2011-10-05 19:22 ` Yu, Fenghua
2011-10-05 19:28 ` Peter Zijlstra
2011-10-05 20:29 ` Yu, Fenghua
2011-10-05 20:37 ` 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=alpine.LFD.2.02.1110052054040.18778@ionos \
--to=tglx@linutronix.de \
--cc=asit.k.mallick@intel.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suresh.b.siddha@intel.com \
--cc=tony.luck@intel.com \
--cc=zwane@arm.linux.org.uk \
/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
Powered by JetHome