From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: "KEXEC: correctly revert x2apic state when kexecing" broken?
Date: Wed, 22 May 2013 18:36:51 +0100 [thread overview]
Message-ID: <519D0233.300@citrix.com> (raw)
In-Reply-To: <519CF16802000078000D8252@nat28.tlf.novell.com>
On 22/05/13 15:25, Jan Beulich wrote:
> Andrew,
>
> we just got a report of a crash that very much looks like an effect
> from this patch. In particular, by reverting to xAPIC mode,
> disconnect_bsp_APIC() (called via disable_IO_APIC(), getting
> invoked _after_ __stop_this_cpu(), which is what causes the fiddling
> with the APIC mode by calling disable_local_APIC()) will use MMIO
> accesses to the APIC page, yet that one would never have got
> mapped by init_apic_mappings() if x2apic_enabled got set to
> non-zero before.
>
> The problem appears to be the use of current_cpu_data by
> current_local_apic_mode(): The former becomes valid only in the
> call tree coming through smp_prepare_cpus(), which is _long_
> after generic_apic_probe(). Was that patch really tested on a
> system with x2APIC pre-enabled?
I cant remember for certain. I think it was just on systems which
turned on x2apic and left hardware set up, causing interrupt format
errors for the kdump kernel.
I would certainly agree with your assessment of the problem
>
> In any case - thoughts about the patch below? I wonder whether
> always using boot_cpu_data wouldn't even be better (considering
> that we do so for various other features too).
I would just go straight for boot_cpu_data. Most other things in __init
functions do.
~Andrew
>
> Jan
>
> x86: fix boot time APIC mode detection
>
> current_cpu_data becomes valid only relatively late in the boot
> process, so looking there for a particular feature early in the game
> would generally give the appearance of the feature being unavailable.
>
> Getting this wrong means that at kexec time the system would get
> returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access
> the APIC page, which on systems with x2APIC pre-enabled will never get
> set up.
>
> Signed-off-by: Jan Beulich<jbeulich@suse.com>
>
> --- a/xen/arch/x86/apic.c
> +++ b/xen/arch/x86/apic.c
> @@ -1474,7 +1474,9 @@ enum apic_mode current_local_apic_mode(v
>
> /* Reading EXTD bit from the MSR is only valid if CPUID
> * says so, else reserved */
> - if ( cpu_has(¤t_cpu_data, X86_FEATURE_X2APIC)
> + if ( (system_state>= SYS_STATE_active ?
> + cpu_has(¤t_cpu_data, X86_FEATURE_X2APIC) :
> + boot_cpu_has(X86_FEATURE_X2APIC))
> && (msr_contents& MSR_IA32_APICBASE_EXTD) )
> return APIC_MODE_X2APIC;
>
>
>
>
prev parent reply other threads:[~2013-05-22 17:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 14:25 "KEXEC: correctly revert x2apic state when kexecing" broken? Jan Beulich
2013-05-22 17:36 ` Andrew Cooper [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=519D0233.300@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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.