linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: "Wang, Song-Bo (Stoney)" <song-bo.wang@hp.com>,
	"mingo.kernel.org@gmail.com" <mingo.kernel.org@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Zhang, Lin-Bao (Linux Kernel R&D)" <linbao.zhang@hp.com>,
	"Pearson, Greg" <greg.pearson@hp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"suresh.b.siddha@intel.com" <suresh.b.siddha@intel.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] x86/apic: check FADT settings after enable x2apic
Date: Tue, 29 Jan 2013 13:52:31 -0800	[thread overview]
Message-ID: <CAE9FiQXe2QHacwyJx+5MQWmoGYW1Swnr5M-MSircgfA4_9e19Q@mail.gmail.com> (raw)
In-Reply-To: <20130129084914.GB5350@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Tue, Jan 29, 2013 at 12:49 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Wang, Song-Bo (Stoney) <song-bo.wang@hp.com> wrote:
>
>> [...] Due to this mode mismatch, with specific HW
>> configurations, there will be intermittent lost interrupts,
>> which could result in a hang or data loss.
>
> That's the key piece of information that was missing - which
> should be put into the changelog into a very prominent place.
>
>> Logically, there is a mismatch because the kernel missed
>> detection on HW configurations, and we should fix it, right?
>> Do we need more detailed information?
>
> No, the above sentence is more than enough and the fix looks
> nice. Note that this sentence is more useful to users than the
> rest of the changelog combined!

Please check attached.

Thanks

Yinghai

[-- Attachment #2: wang_hp_x2apic.patch --]
[-- Type: application/octet-stream, Size: 2707 bytes --]

From:	Stoney Wang <song-bo.wang@hp.com>
Subject: [PATCH] x86, apic: Check fadt x2apic phys in x2apic_phys_probe()

When some HP sytems boot without x2apic_phys, there will be intermittent
lost interrupts and could result in a hang or data loss.

Those systems only work with x2apic phys mode so BIOS set
ACPI_FADT_APIC_PHYSICAL in FADT table.
Also because all apicids are less then 255, BIOS need to pass the control
to the OS with xapic mode, according to x2apic-spec, chapter 2.9.

Current code handle x2apic when BIOS pass with xapic mode:

When user specify x2apic_phys, or FADT indicates PHYSICAL.
During madt oem check, apic driver is set with xapic logical or
xapic phys driver at first.
Later enable_IR_x2apic() will enable x2apic_mode.
After that, x2apic_phys_probe() will install right x2apic phys driver
if user specify x2apic_phys,
but will skip and let x2apic_cluster_probe to take over to install
wrong apic driver (x2apic cluster) when FADT indicates
PHYSICAL, because x2apic_phys_probe does not check FADT PHYSICAL.

Add checking x2apic_fadt_phys in x2apic_phys_probe() to fix the problem.

-v3: update the change according to Ingo.

[ changelog, and simplify code - Yinghai Lu ]
Signed-off-by: Stoney Wang <song-bo.wang@hp.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/apic/x2apic_phys.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Index: linux-2.6/arch/x86/kernel/apic/x2apic_phys.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/x2apic_phys.c
+++ linux-2.6/arch/x86/kernel/apic/x2apic_phys.c
@@ -20,18 +20,19 @@ static int set_x2apic_phys_mode(char *ar
 }
 early_param("x2apic_phys", set_x2apic_phys_mode);
 
-static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static bool x2apic_fadt_phys(void)
 {
-	if (x2apic_phys)
-		return x2apic_enabled();
-	else if ((acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) &&
-		(acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) &&
-		x2apic_enabled()) {
+	if ((acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) &&
+		(acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) {
 		printk(KERN_DEBUG "System requires x2apic physical mode\n");
-		return 1;
+		return true;
 	}
-	else
-		return 0;
+	return false;
+}
+
+static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+	return x2apic_enabled() && (x2apic_phys || x2apic_fadt_phys());
 }
 
 static void
@@ -82,7 +83,7 @@ static void init_x2apic_ldr(void)
 
 static int x2apic_phys_probe(void)
 {
-	if (x2apic_mode && x2apic_phys)
+	if (x2apic_mode && (x2apic_phys || x2apic_fadt_phys()))
 		return 1;
 
 	return apic == &apic_x2apic_phys;

  parent reply	other threads:[~2013-01-29 21:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15  1:50 [PATCH] x86/apic: check FADT settings after enable x2apic Stoney Wang
2013-01-28  5:05 ` Wang, Song-Bo (Stoney)
2013-01-28  6:57   ` Yinghai Lu
2013-01-28 10:11     ` Ingo Molnar
2013-01-28 18:10       ` Yinghai Lu
2013-01-29  7:47         ` Ingo Molnar
2013-01-29  8:43           ` Wang, Song-Bo (Stoney)
2013-01-29  8:49             ` Ingo Molnar
2013-01-29 21:30               ` Yinghai Lu
2013-01-29 21:52               ` Yinghai Lu [this message]
2013-01-31 11:32                 ` Ingo Molnar
2013-01-31 15:56                   ` Yinghai Lu
2013-02-04  6:41                   ` Wang, Song-Bo (Stoney)
2013-02-04 11:03                     ` Ingo Molnar
2013-02-04 20:29                       ` [PATCH] x86, apic: Check fadt x2apic phys in x2apic_phys_probe() Yinghai Lu
2013-02-05 12:24                         ` Ingo Molnar
2013-02-05 16:53                           ` Yinghai Lu
2013-02-06 13:16                             ` Ingo Molnar
2013-02-06 17:10                               ` Yinghai Lu
2013-02-07 18:53                                 ` [PATCH v4] " Yinghai Lu
2013-02-11 12:37                                   ` [tip:x86/urgent] x86/apic: Work around boot failure on HP ProLiant DL980 G7 Server systems tip-bot for Stoney Wang
2013-02-18  8:52                                   ` [PATCH v4] x86, apic: Check fadt x2apic phys in x2apic_phys_probe() Lin-Bao Zhang
2013-02-18 17:13                                     ` 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=CAE9FiQXe2QHacwyJx+5MQWmoGYW1Swnr5M-MSircgfA4_9e19Q@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=greg.pearson@hp.com \
    --cc=hpa@zytor.com \
    --cc=linbao.zhang@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo.kernel.org@gmail.com \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=song-bo.wang@hp.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).