From: Yinghai Lu <yinghai@kernel.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Dave Airlie <airlied@gmail.com>,
Iranna D Ankad <iranna.ankad@in.ibm.com>,
Gary Hade <garyhade@us.ibm.com>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Thomas Renninger <trenn@suse.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: oops in ioapic_write_entry
Date: Wed, 04 Aug 2010 15:06:06 -0700 [thread overview]
Message-ID: <4C59E44E.5040800@kernel.org> (raw)
In-Reply-To: <m162zq86ck.fsf@fess.ebiederm.org>
Please check if this one address your concerns.
Thanks
Yinghai
---
arch/x86/kernel/mpparse.c | 88 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 77 insertions(+), 11 deletions(-)
Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -173,17 +173,17 @@ static int __init mp_irq_mpc_intsrc_cmp(
{
if (mp_irq->dstapic != m->dstapic)
return 1;
- if (mp_irq->type != m->type)
+ if (mp_irq->dstirq != m->dstirq)
return 2;
- if (mp_irq->irqtype != m->irqtype)
+ if (mp_irq->srcbus != m->srcbus)
return 3;
- if (mp_irq->irqflag != m->irqflag)
+ if (mp_irq->type != m->type)
return 4;
- if (mp_irq->srcbus != m->srcbus)
+ if (mp_irq->irqtype != m->irqtype)
return 5;
- if (mp_irq->srcbusirq != m->srcbusirq)
+ if (mp_irq->irqflag != m->irqflag)
return 6;
- if (mp_irq->dstirq != m->dstirq)
+ if (mp_irq->srcbusirq != m->srcbusirq)
return 7;
return 0;
@@ -195,9 +195,45 @@ static void __init MP_intsrc_info(struct
print_MP_intsrc_info(m);
+ /*
+ * All BUS, and IOAPIC entries are processed already
+ */
+
+ /* check if dstapic is right */
+ for (i = 0; i < nr_ioapics; i++) {
+ if (mp_ioapics[i].apicid == m->dstapic)
+ break;
+ }
+ if (i == nr_ioapics) {
+ apic_printk(APIC_VERBOSE, "intsrc with wrong apic id is skipped\n");
+ return;
+ }
+
for (i = 0; i < mp_irq_entries; i++) {
- if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m))
+ int ret = mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m);
+
+ /* duplicated entries ? */
+ if (!ret) {
+ apic_printk(APIC_VERBOSE, "Duplicated intsrc is skipped\n");
return;
+ }
+
+ /* same apic/pin, but different bus */
+ if (ret == 3) {
+ /* overwrite wrong legacy one */
+ if (test_bit(mp_irqs[i].srcbus, mp_bus_not_pci) &&
+ !test_bit(m->srcbus, mp_bus_not_pci)) {
+ apic_printk(APIC_VERBOSE, "Wrong legacy entry with same apic/pin is removed\n");
+ assign_to_mp_irq(m, &mp_irqs[i]);
+ return;
+ }
+ /* dump this legacy one */
+ if (!test_bit(mp_irqs[i].srcbus, mp_bus_not_pci) &&
+ test_bit(m->srcbus, mp_bus_not_pci)) {
+ apic_printk(APIC_VERBOSE, "Wrong legacy entry is skipped\n");
+ return;
+ }
+ }
}
assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
@@ -280,8 +316,8 @@ static int __init smp_read_mpc(struct mp
char str[16];
char oem[10];
- int count = sizeof(*mpc);
- unsigned char *mpt = ((unsigned char *)mpc) + count;
+ int count;
+ unsigned char *mpt;
if (!smp_check_mpc(mpc, oem, str))
return 0;
@@ -305,8 +341,9 @@ static int __init smp_read_mpc(struct mp
/*
* Now process the configuration blocks.
*/
+ count = sizeof(*mpc);
+ mpt = ((unsigned char *)mpc) + count;
x86_init.mpparse.mpc_record(0);
-
while (count < mpc->length) {
switch (*mpt) {
case MP_PROCESSOR:
@@ -324,7 +361,7 @@ static int __init smp_read_mpc(struct mp
skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
break;
case MP_INTSRC:
- MP_intsrc_info((struct mpc_intsrc *)mpt);
+ /* check that next pass */
skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
break;
case MP_LINTSRC:
@@ -337,6 +374,35 @@ static int __init smp_read_mpc(struct mp
count = mpc->length;
break;
}
+ x86_init.mpparse.mpc_record(1);
+ }
+
+ /* second pass for INTSRC */
+ count = sizeof(*mpc);
+ mpt = ((unsigned char *)mpc) + count;
+ x86_init.mpparse.mpc_record(0);
+ while (count < mpc->length) {
+ switch (*mpt) {
+ case MP_PROCESSOR:
+ skip_entry(&mpt, &count, sizeof(struct mpc_cpu));
+ break;
+ case MP_BUS:
+ skip_entry(&mpt, &count, sizeof(struct mpc_bus));
+ break;
+ case MP_IOAPIC:
+ skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
+ break;
+ case MP_INTSRC:
+ MP_intsrc_info((struct mpc_intsrc *)mpt);
+ skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
+ break;
+ case MP_LINTSRC:
+ skip_entry(&mpt, &count, sizeof(struct mpc_lintsrc));
+ break;
+ default:
+ count = mpc->length;
+ break;
+ }
x86_init.mpparse.mpc_record(1);
}
next prev parent reply other threads:[~2010-08-04 22:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 5:28 oops in ioapic_write_entry Dave Airlie
2010-08-02 6:49 ` Yinghai Lu
2010-08-02 23:17 ` Dave Airlie
2010-08-03 1:32 ` Yinghai Lu
2010-08-03 1:34 ` Yinghai Lu
2010-08-03 3:13 ` Eric W. Biederman
2010-08-03 7:19 ` Yinghai Lu
2010-08-03 8:00 ` Eric W. Biederman
2010-08-03 8:04 ` Yinghai Lu
2010-08-03 8:56 ` Eric W. Biederman
2010-08-03 9:01 ` Yinghai Lu
2010-08-03 9:15 ` Eric W. Biederman
2010-08-03 9:36 ` Yinghai Lu
2010-08-03 11:08 ` Eric W. Biederman
2010-08-03 19:45 ` Yinghai Lu
2010-08-03 20:02 ` Yinghai Lu
2010-08-03 21:38 ` Eric W. Biederman
2010-08-03 23:12 ` Dave Airlie
2010-08-04 0:00 ` Yinghai Lu
2010-08-04 1:19 ` Eric W. Biederman
2010-08-04 7:33 ` Ingo Molnar
2010-08-04 8:59 ` Yinghai Lu
2010-08-04 9:26 ` Ingo Molnar
2010-08-04 12:12 ` Eric W. Biederman
2010-08-04 19:22 ` Yinghai Lu
2010-08-04 20:34 ` Eric W. Biederman
2010-08-04 22:06 ` Yinghai Lu [this message]
2010-08-03 8:00 ` Yinghai Lu
2010-08-03 8:27 ` Eric W. Biederman
2010-08-03 3:26 ` Eric W. Biederman
[not found] ` <AANLkTi=qtLkY0=h77=EVL+y1q41b_cMBODvL4Hu6A6wL@mail.gmail.com>
2010-08-03 6:00 ` Eric W. Biederman
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=4C59E44E.5040800@kernel.org \
--to=yinghai@kernel.org \
--cc=airlied@gmail.com \
--cc=ebiederm@xmission.com \
--cc=garyhade@us.ibm.com \
--cc=hpa@zytor.com \
--cc=iranna.ankad@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=trenn@suse.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