All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "Keir (Xen.org)" <keir@xen.org>,
	Xiantao Zhang <xiantao.zhang@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 1 of 2] x86/x2apic: Sandy-Bridge BT98 Erratum
Date: Mon, 29 Apr 2013 11:25:48 +0100	[thread overview]
Message-ID: <517E4AAC.3010004@citrix.com> (raw)
In-Reply-To: <517E53D202000078000D18AE@nat28.tlf.novell.com>

On 29/04/13 10:04, Jan Beulich wrote:
>>>> On 26.04.13 at 20:11, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>> +/* Xeon E5 Family processors (Sandy-Bridge) suffer from erratum BT98, which
>> + * affects Stepping C-1, but is reported fixed in Stepping C-2.
>> + *
>> + * This causes system instability when using x2apic and VT-d queued
>> + * invalidation.  The workaround is to disable x2apic and VT-d.
>> + */
>> +static void __init smb_bt98_erratum(void)
> snb_bt98_erratum() perhaps? And is this really limited to just one
> specific product line (usually the same microarchitecture gets used
> for multiple ones, and then the BT98 reference would become
> confusing)?

Oops - I did mean snb.  However, I would request guidance from Intel as
to what the best naming policy would be.

>
>> +{
>> +	const struct cpuinfo_x86 *c = &boot_cpu_data;
>> +
>> +	if (!(c->x86_vendor == X86_VENDOR_INTEL &&
>> +	      c->x86 == 6 &&
>> +	      c->x86_model == 0x2d &&
>> +	      c->x86_mask == 0x6))
>> +		return;
>> +
>> +	printk(KERN_WARNING
>> +	       "Disabling x2apic due to Sandy-Bridge BT98 erratum\n");
>> +
>> +	clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
>> +	x2apic_enabled = 0;
>> +
> Up here it's fine.
>
>> +	/* If the BIOS started us in x2apic mode, switch back to xapic. */
>> +	if (apic_boot_mode == APIC_MODE_X2APIC) {
>> +		uint64_t msr;
>> +
>> +		rdmsrl(MSR_IA32_APICBASE, msr);
>> +		msr &= ~(MSR_IA32_APICBASE_ENABLE|MSR_IA32_APICBASE_EXTD);
>> +		wrmsrl(MSR_IA32_APICBASE, msr);
>> +		msr |= MSR_IA32_APICBASE_ENABLE;
>> +		wrmsrl(MSR_IA32_APICBASE, msr);
>> +
>> +		apic_boot_mode = APIC_MODE_XAPIC;
>> +	}
> But how good are our chances that this won't cause subsequent
> problems? The BIOS may e.g. have assigned APIC IDs wider than
> what xAPIC can deal with. I think we ought to consider denying
> to boot in that case altogether. How does Linux deal with the
> erratum?

I guess "Works on my affected silicon" is not a good enough indicator,
although in that case it was booting in xapic mode not x2apic mode.

A quick look over linux mainline suggests that there is no workaround
present for this erratum.

As for APIC IDs, the CPU IDs are fixed, and the IO-APIC id on the PCH is
4 bits wide.  Unhelpfully, the SDM states that the BIOS should read all
the LAPIC IDs, and if any single one is greater than 255, the BIOS must
hand over to the OS in x2apic mode.

The code in this patch runs before the APs are booted, so querying their
LAPIC IDs is somewhat hard.  Alternatively, doing a synchronised switch
from x2apic to xapic once the APs are running is likely to also be
problematic, but might be our only option.

>
>> +}
>> +
>>  void __init generic_apic_probe(void) 
>>  { 
>>  	int i, changed;
>>  
>>  	record_boot_APIC_mode();
>>  
>> +        /* Must be before check_x2apic_preenabled() */
> Indentation (in case you need to resubmit anyway).
>
>> +	smb_bt98_erratum();
> Perhaps worth moving into check_x2apic_preenabled() instead,
> keeping x2apic related code as much as possible in x2apic.c?

Ok.

>
>> +
>>  	check_x2apic_preenabled();
>>  	cmdline_apic = changed = (genapic != NULL);
>>  
>

      reply	other threads:[~2013-04-29 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 18:11 [PATCH 1 of 2] x86/x2apic: Sandy-Bridge BT98 Erratum Andrew Cooper
2013-04-26 18:11 ` [PATCH 2 of 2] x86/VT-d: " Andrew Cooper
2013-04-29 15:13   ` Jan Beulich
2013-04-29 15:23     ` Andrew Cooper
2013-04-29  9:04 ` [PATCH 1 of 2] x86/x2apic: " Jan Beulich
2013-04-29 10:25   ` 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=517E4AAC.3010004@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=xiantao.zhang@intel.com \
    /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.