mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	stable <stable@kernel.org>
Subject: Re: [PATCH] x86: fix x2apic preenabled system with kexec
Date: Thu, 15 Jul 2010 11:16:24 -0700	[thread overview]
Message-ID: <1279217784.2751.7.camel@sbs-t61.sc.intel.com> (raw)
In-Reply-To: <4C3EB22B.3000701@kernel.org>

On Thu, 2010-07-15 at 00:00 -0700, Yinghai Lu wrote:
> Found one x2apic system kexec loop test failed 
> when CONFIG_NMI_WATCHDOG=y (old) or CONFIG_LOCKUP_DETECTOR=y (current tip)
> 
> first kernel can kexec second kernel, but second kernel can not kexec third one.
> 
> it can be duplicated on another system with BIOS preenabled x2apic.
> First kernel can not kexec second kernel.
> 
> It turns out, when kernel boot with pre-enabled x2apic, it will not execute
> disable_local_APIC on shutdown path.
> 
> when init_apic_mappings() is called in setup_arch, it will skip setting of
> apic_phys when x2apic_mode is set. ( x2apic_mode is much early check_x2apic())
> Then later, disable_local_APIC() will bail out early because !apic_phys.
> 
> So check !x2apic_mode in x2apic_mode in disable_local_APIC with !apic_phys.

Thanks for the nice debug work! As we still have NMI enabled, it looks
like we get a NMI during kexec and as we reset gdt/idt before kexec
launch, we might get a triple fault causing the system to reboot.

> another solution could be updating init_apic_mappings() to set apic_phys even
> for preenabled x2apic system. Actually even for x2apic system, that lapic
> address is mapped already in early stage.

Below patch is the right one. We should probably unmap apic_phys mapping
when x2apic is enabled by the OS.


> BTW: is there any x2apic preenabled system with apicid of boot cpu > 255?

I am not sure. There might be one. Is there any bug which can't handle
this condition?

> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: stable@kernel.org

For this patch:

Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>

> ---
>  arch/x86/kernel/apic/apic.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/apic.c
> +++ linux-2.6/arch/x86/kernel/apic/apic.c
> @@ -921,7 +921,7 @@ void disable_local_APIC(void)
>  	unsigned int value;
>  
>  	/* APIC hasn't been mapped yet */
> -	if (!apic_phys)
> +	if (!x2apic_mode && !apic_phys)
>  		return;
>  
>  	clear_local_APIC();




  reply	other threads:[~2010-07-15 18:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13  2:59 tip/master broken with x2apic and kexec Yinghai Lu
2010-07-13  3:29 ` Yinghai Lu
2010-07-13  6:40   ` H. Peter Anvin
2010-07-14  0:54   ` [tip:x86/alternatives] x86, alternatives: Fix one more open-coded 8-bit alternative number tip-bot for H. Peter Anvin
2010-07-14  0:54     ` [tip:x86/alternatives] x86, alternatives: BUG on encountering an invalid CPU feature number tip-bot for H. Peter Anvin
2010-07-13 22:00 ` tip/master broken with x2apic and kexec H. Peter Anvin
2010-07-13 23:27   ` Yinghai Lu
2010-07-14 20:35     ` Yinghai Lu
2010-07-14 21:05       ` Don Zickus
2010-07-14 22:07         ` Yinghai Lu
2010-07-14 21:23       ` Yinghai Lu
2010-07-14 22:57         ` Yinghai Lu
2010-07-15  0:03           ` Suresh Siddha
2010-07-15  2:01             ` Yinghai Lu
2010-07-15  7:00             ` [PATCH] x86: fix x2apic preenabled system with kexec Yinghai Lu
2010-07-15 18:16               ` Suresh Siddha [this message]
2010-07-15 20:10                 ` Yinghai Lu
2010-07-15 20:40                   ` Yinghai Lu
2010-07-17  0:48               ` [tip:x86/urgent] x86: Fix " tip-bot for Yinghai Lu

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=1279217784.2751.7.camel@sbs-t61.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dzickus@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yinghai@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 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®