From: Rui Wang <rui.y.wang@intel.com>
To: tglx@linutronix.de, rjw@rjwysocki.net, tony.luck@intel.com,
bhelgaas@google.com
Cc: linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, rui.y.wang@intel.com
Subject: [PATCH V2 2/3] x86/ioapic: Fix wrong pointers in ioapic_setup_resources()
Date: Wed, 8 Jun 2016 14:59:52 +0800 [thread overview]
Message-ID: <1465369193-4816-3-git-send-email-rui.y.wang@intel.com> (raw)
In-Reply-To: <1465369193-4816-1-git-send-email-rui.y.wang@intel.com>
On a 4-socket brickland, hot-removing one ioapic is fine. Hot-removing
the 2nd one causes panic in mp_unregister_ioapic() while calling
release_resource(). It is because the iomem_res pointer has already been
released when removing the first ioapic.
Fix it by assigning the correct pointers to ioapics[i].iomem_res in
ioapic_setup_resources().
To explain the use of &res[num] here: res is assigned to ioapic_resources,
and later in ioapic_insert_resources() we do
struct resource *r = ioapic_resources;
for_each_ioapic(i) {
insert_resource(&iomem_resource, r);
r++;
}
Here r is treated as an arry of struct resource, and the r++ ensures that
each element of the array is inserted separately. Thus we should call
release_resouce() on each element at &res[num].
Signed-off-by: Rui Wang <rui.y.wang@intel.com>
---
arch/x86/kernel/apic/io_apic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 84e33ff..446702e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2588,8 +2588,8 @@ static struct resource * __init ioapic_setup_resources(void)
res[num].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
mem += IOAPIC_RESOURCE_NAME_SIZE;
+ ioapics[i].iomem_res = &res[num];
num++;
- ioapics[i].iomem_res = res;
}
ioapic_resources = res;
--
1.8.3.1
next prev parent reply other threads:[~2016-06-08 6:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 6:59 [PATCH V2 0/3] ioapic hot-removal bugs Rui Wang
2016-06-08 6:59 ` [PATCH V2 1/3] x86/ioapic: Support hot-removal of IOAPICs present during boot Rui Wang
2016-06-08 8:05 ` kbuild test robot
2016-06-08 9:32 ` [PATCH V3 " Rui Wang
2016-06-10 12:57 ` Thomas Gleixner
2016-06-10 13:56 ` Rafael J. Wysocki
2016-06-10 16:43 ` Bjorn Helgaas
2016-06-12 6:06 ` Rui Wang
2016-06-16 17:09 ` Bjorn Helgaas
2016-06-22 7:13 ` Rui Wang
2016-06-22 14:53 ` Bjorn Helgaas
2016-06-24 15:18 ` Rui Wang
2016-06-22 7:40 ` [PATCH V4 " Rui Wang
2016-06-22 15:14 ` Bjorn Helgaas
2016-06-23 5:11 `
2016-06-23 17:34 ` Bjorn Helgaas
2016-06-24 15:30 ` Rui Wang
2016-06-26 3:44 ` [PATCH V5 " Rui Wang
2016-08-08 20:22 ` Bjorn Helgaas
2016-08-09 3:23 ` Rui Wang
2016-08-09 12:09 ` Rafael J. Wysocki
2016-06-08 6:59 ` Rui Wang [this message]
2016-06-08 6:59 ` [PATCH V2 3/3] x86/ioapic: Simplify ioapic_setup_resources() Rui Wang
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=1465369193-4816-3-git-send-email-rui.y.wang@intel.com \
--to=rui.y.wang@intel.com \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=tony.luck@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 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).