All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiang Liu <jiang.liu@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	x86@kernel.org, Tony Luck <tony.luck@intel.com>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code
Date: Wed, 21 Jan 2015 09:50:02 +0800	[thread overview]
Message-ID: <54BF05CA.9070506@linux.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1501161203340.5526@nanos>

On 2015/1/16 19:05, Thomas Gleixner wrote:
> On Fri, 16 Jan 2015, Thomas Gleixner wrote:
>> On Fri, 16 Jan 2015, Jiang Liu wrote:
>>> 5) x86_32, UP, IO_APIC disabled
>>> 5.1) boot: panic with following call stack:
>>> do_ono_initcall()->APIC_init_uniprocessor()->setup_local_APIC().
>>> I can't capture the full log message due to lack of serial console.
>>> It seems we have trouble with:
>>> early_initcall(APIC_init_uniprocessor);
>>
>> Hmm, worked here. Lemme find some other machine.
> 
> Found the issue, won't work. But I still want to remove that x86
> nonsense from init. So we need to do it different.
> 
> Subject: init: Get rid of x86isms
> From: Thomas Gleixner <tglx@linutronix.de>
> Date: Wed, 14 Jan 2015 14:59:48 +0100
> 
> Provide a config option and make the UP smp_init() implementation
> depend on it and confine this to x86.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/Kconfig            |    4 ++++
>  arch/x86/kernel/apic/apic.c |    7 +++++++
>  include/linux/smp.h         |    6 ++++++
>  init/main.c                 |   13 -------------
>  4 files changed, 17 insertions(+), 13 deletions(-)
> 
> Index: tip/arch/x86/Kconfig
> ===================================================================
> --- tip.orig/arch/x86/Kconfig
> +++ tip/arch/x86/Kconfig
> @@ -855,6 +855,10 @@ config SCHED_MC
>  
>  source "kernel/Kconfig.preempt"
>  
> +config UP_SMP_INIT
> +       def_bool y
> +       depends on X86_UP_APIC
> +
>  config X86_UP_APIC
>  	bool "Local APIC support on uniprocessors"
>  	depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
> Index: tip/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- tip.orig/arch/x86/kernel/apic/apic.c
> +++ tip/arch/x86/kernel/apic/apic.c
> @@ -2265,6 +2265,13 @@ int __init APIC_init_uniprocessor(void)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_UP_SMP_INIT
> +void smp_init(void)
> +{
> +	APIC_init_uniprocessor();
> +}
> +#endif
> +
>  /*
>   * Power management
>   */
> Index: tip/include/linux/smp.h
> ===================================================================
> --- tip.orig/include/linux/smp.h
> +++ tip/include/linux/smp.h
> @@ -151,6 +151,12 @@ smp_call_function_any(const struct cpuma
>  static inline void kick_all_cpus_sync(void) {  }
>  static inline void wake_up_all_idle_cpus(void) {  }
>  
> +#ifdef CONFIG_UP_SMP_INIT
> +extern void __init smp_init(void);
> +#else
> +static inline void smp_init(void) { }
> +#endif
> +
>  #endif /* !SMP */
>  
>  /*
> Index: tip/init/main.c
> ===================================================================
> --- tip.orig/init/main.c
> +++ tip/init/main.c
> @@ -87,10 +87,6 @@
>  #include <asm/sections.h>
>  #include <asm/cacheflush.h>
>  
> -#ifdef CONFIG_X86_LOCAL_APIC
> -#include <asm/smp.h>
> -#endif
> -
>  static int kernel_init(void *);
>  
>  extern void init_IRQ(void);
> @@ -351,15 +347,6 @@ __setup("rdinit=", rdinit_setup);
>  
>  #ifndef CONFIG_SMP
>  static const unsigned int setup_max_cpus = NR_CPUS;
> -#ifdef CONFIG_X86_LOCAL_APIC
> -static void __init smp_init(void)
> -{
> -	APIC_init_uniprocessor();
> -}
> -#else
> -#define smp_init()	do { } while (0)
> -#endif
> -
>  static inline void setup_nr_cpu_ids(void) { }
>  static inline void smp_prepare_cpus(unsigned int maxcpus) { }
>  #endif
Hi Thomas,
	With above patch applied, it just gives a blank screen
instead of a panic when booting on my problematic laptop.
Now I have found the root cause of the failure on my laptop.
	On i386, it triggers  BUG_ON(!apic->apic_id_registered())
in function setup_local_APIC() because apic_bsp_up_setup() is called
too late. So we need a simple patch as below. With following patch
applied, it boots successfully with your original patch.
Regards,
Gerry
--------------------------------------------------------------------
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 6f3067807376..791148864a48 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2245,10 +2245,9 @@ int __init apic_bsp_setup(bool upmode)
        int id;

        connect_bsp_APIC();
-       setup_local_APIC();
-
        if (upmode)
                apic_bsp_up_setup();
+       setup_local_APIC();

        if (x2apic_mode)
                id = apic_read(APIC_LDR);
---------------------------------------------------------------------
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

  parent reply	other threads:[~2015-01-21  1:50 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 21:22 [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code Thomas Gleixner
2015-01-15 21:22 ` [patch 01/23] x86/apic: Avoid open coded x2apic detection Thomas Gleixner
2015-01-16  9:59   ` Borislav Petkov
2015-01-22 11:39     ` Thomas Gleixner
2015-01-23 16:13       ` Thomas Gleixner
2015-01-22 14:24   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 02/23] x86/apic: Make x2apic_mode depend on CONFIG_X86_X2APIC Thomas Gleixner
2015-01-16 10:50   ` Borislav Petkov
2015-01-22 14:24   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 03/23] x86/apic: Move x2apic code to one place Thomas Gleixner
2015-01-16 10:55   ` Borislav Petkov
2015-01-22 14:25   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 04/23] x86/ioapic: Check x2apic really Thomas Gleixner
2015-01-16 11:10   ` Borislav Petkov
2015-01-16 11:15     ` Borislav Petkov
2015-01-22 14:25   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 05/23] x86/apic: Make disable x2apic work really Thomas Gleixner
2015-01-16 11:17   ` Borislav Petkov
2015-01-22 14:25   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 06/23] x86/apic: Check x2apic early Thomas Gleixner
2015-01-16  8:07   ` Jiang Liu
2015-01-22 14:26   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 07/23] x86/x2apic: Move code in conditional region Thomas Gleixner
2015-01-16 11:56   ` Borislav Petkov
2015-01-22 14:26   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 08/23] x86/x2apic: Clarify remapping mode for x2apic enablement Thomas Gleixner
2015-01-16 14:19   ` Borislav Petkov
2015-01-22 14:26   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 09/23] x86/x2apic: Add proper state tracking Thomas Gleixner
2015-01-16 18:58   ` Borislav Petkov
2015-01-22 14:27   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 10/23] x86/x2apic: Disable x2apic from nox2apic setup Thomas Gleixner
2015-01-16 19:01   ` Borislav Petkov
2015-01-22 14:27   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 11/23] x86/x2apic: Split enable and setup function Thomas Gleixner
2015-01-16 19:00   ` Borislav Petkov
2015-01-22 13:08     ` Thomas Gleixner
2015-01-22 14:28   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 12/23] x86/x2apic: Use state information for disable Thomas Gleixner
2015-01-16 19:01   ` Borislav Petkov
2015-01-22 14:28   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 13/23] x86/smpboot: Move smpboot inlines to code Thomas Gleixner
2015-01-16 19:01   ` Borislav Petkov
2015-01-22 14:28   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 14/23] x86/ioapic: Provide stub functions for IOAPIC=n Thomas Gleixner
2015-01-16 19:02   ` Borislav Petkov
2015-01-22 14:29   ` [tip:x86/apic] x86/ioapic: Provide stub functions for IOAPIC%3Dn tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 15/23] x86/ioapic: Add proper checks to setp/enable_IO_APIC() Thomas Gleixner
2015-01-16 19:02   ` Borislav Petkov
2015-01-22 14:29   ` [tip:x86/apic] x86/ioapic: Add proper checks to setp/ enable_IO_APIC() tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 16/23] x86/apic: Sanitize ioapic handling Thomas Gleixner
2015-01-16 19:02   ` Borislav Petkov
2015-01-22 14:29   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 17/23] x86/smpboot: Cleanup " Thomas Gleixner
2015-01-16 19:03   ` Borislav Petkov
2015-01-22 14:30   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 18/23] x86/apic: Move apic_init_uniprocessor code Thomas Gleixner
2015-01-16 19:03   ` Borislav Petkov
2015-01-22 14:30   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 19/23] init: Get rid of x86isms Thomas Gleixner
2015-01-22 14:30   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 20/23] x86/smpboot: Move apic init code to apic.c Thomas Gleixner
2015-01-16 19:04   ` Borislav Petkov
2015-01-22 14:31   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 21/23] x86/smpboot: Sanitize uniprocessor init Thomas Gleixner
2015-01-16 19:04   ` Borislav Petkov
2015-01-22 14:31   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 22/23] x86/apic: Reuse apic_bsp_setup() for UP APIC setup Thomas Gleixner
2015-01-16 19:04   ` Borislav Petkov
2015-01-22 14:31   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 23/23] x86: Consolidate boot cpu timer setup Thomas Gleixner
2015-01-16 19:04   ` Borislav Petkov
2015-01-22 14:32   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-16  9:37 ` [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code Jiang Liu
2015-01-16 10:21   ` Thomas Gleixner
2015-01-16 10:35     ` Jiang Liu
2015-01-16 11:05     ` Thomas Gleixner
2015-01-16 19:03       ` Borislav Petkov
2015-01-21  1:50       ` Jiang Liu [this message]
2015-01-21  9:33         ` Thomas Gleixner

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=54BF05CA.9070506@linux.intel.com \
    --to=jiang.liu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.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.