From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Subject: Re: [PATCH v4 20/28] x86, irq: More strict checking about registering ioapic Date: Mon, 21 Oct 2013 18:54:44 +0800 Message-ID: <526507F4.4090706@huawei.com> References: <1376189294-32022-1-git-send-email-yinghai@kernel.org> <1376189294-32022-21-git-send-email-yinghai@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1376189294-32022-21-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org To: Yinghai Lu Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Tony Luck , Bjorn Helgaas , "Rafael J. Wysocki" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Joerg Roedel , Konrad Rzeszutek Wilk , Sebastian Andrzej Siewior List-Id: linux-acpi@vger.kernel.org > int mp_find_ioapic_pin(int ioapic, u32 gsi) > { > struct mp_ioapic_gsi *gsi_cfg; > @@ -3888,6 +3894,11 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) > if (bad_ioapic(address)) > return; > > + /* already registered ? */ > + idx = __mp_find_ioapic(gsi_base); > + if (idx >= 0) > + return; Hi Yinghai, If you add whether ioapic was already registered check here, so we will fail to add ioapic into global ioapic_list. Then we also can not hot remove this ioapic. 1. We will call mp_register_ioapic during analyze MADT first. 2. We will try to add hotplug ioapic(which contain _GSB) to ioapic_list in acpi_pci_ioapic_add(), but will found this ioapic has been registered. Thanks! Yijing. > + > idx = find_first_zero_bit(ioapics_mask, MAX_IO_APICS); > if (idx >= MAX_IO_APICS) { > pr_warn("WARNING: Max # of I/O APICs (%d) exceeded, skipping\n", > @@ -3914,6 +3925,13 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) > * and to prevent reprogramming of IOAPIC pins (PCI GSIs). > */ > entries = io_apic_get_redir_entries(idx); > + > + if (!entries || entries > MP_MAX_IOAPIC_PIN) { > + clear_fixmap(FIX_IO_APIC_BASE_0 + idx); > + memset(&ioapics[idx], 0, sizeof(struct ioapic)); > + return; > + } > + > gsi_cfg = mp_ioapic_gsi_routing(idx); > gsi_cfg->gsi_base = gsi_base; > gsi_cfg->gsi_end = gsi_base + entries - 1; > -- Thanks! Yijing From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com ([119.145.14.65]:13642 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912Ab3JULAs (ORCPT ); Mon, 21 Oct 2013 07:00:48 -0400 Message-ID: <526507F4.4090706@huawei.com> Date: Mon, 21 Oct 2013 18:54:44 +0800 From: Yijing Wang MIME-Version: 1.0 To: Yinghai Lu CC: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Tony Luck , Bjorn Helgaas , "Rafael J. Wysocki" , , , , Joerg Roedel , "Konrad Rzeszutek Wilk" , Sebastian Andrzej Siewior Subject: Re: [PATCH v4 20/28] x86, irq: More strict checking about registering ioapic References: <1376189294-32022-1-git-send-email-yinghai@kernel.org> <1376189294-32022-21-git-send-email-yinghai@kernel.org> In-Reply-To: <1376189294-32022-21-git-send-email-yinghai@kernel.org> Content-Type: text/plain; charset="ISO-8859-1" Sender: linux-pci-owner@vger.kernel.org List-ID: > int mp_find_ioapic_pin(int ioapic, u32 gsi) > { > struct mp_ioapic_gsi *gsi_cfg; > @@ -3888,6 +3894,11 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) > if (bad_ioapic(address)) > return; > > + /* already registered ? */ > + idx = __mp_find_ioapic(gsi_base); > + if (idx >= 0) > + return; Hi Yinghai, If you add whether ioapic was already registered check here, so we will fail to add ioapic into global ioapic_list. Then we also can not hot remove this ioapic. 1. We will call mp_register_ioapic during analyze MADT first. 2. We will try to add hotplug ioapic(which contain _GSB) to ioapic_list in acpi_pci_ioapic_add(), but will found this ioapic has been registered. Thanks! Yijing. > + > idx = find_first_zero_bit(ioapics_mask, MAX_IO_APICS); > if (idx >= MAX_IO_APICS) { > pr_warn("WARNING: Max # of I/O APICs (%d) exceeded, skipping\n", > @@ -3914,6 +3925,13 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) > * and to prevent reprogramming of IOAPIC pins (PCI GSIs). > */ > entries = io_apic_get_redir_entries(idx); > + > + if (!entries || entries > MP_MAX_IOAPIC_PIN) { > + clear_fixmap(FIX_IO_APIC_BASE_0 + idx); > + memset(&ioapics[idx], 0, sizeof(struct ioapic)); > + return; > + } > + > gsi_cfg = mp_ioapic_gsi_routing(idx); > gsi_cfg->gsi_base = gsi_base; > gsi_cfg->gsi_end = gsi_base + entries - 1; > -- Thanks! Yijing