[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 9 Sep 2014 14:37:18 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Jiang Liu <jiang.liu@...ux.intel.com>
cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
Yinghai Lu <yinghai@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Grant Likely <grant.likely@...aro.org>, x86@...nel.org,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
Prarit Bhargava <prarit@...hat.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Tony Luck <tony.luck@...el.com>,
Joerg Roedel <joro@...tes.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-acpi@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
linux-pm@...r.kernel.org
Subject: Re: [Patch v4 14/16] x86, irq: Introduce helper to check whether an
IOAPIC has been registered
On Thu, 28 Aug 2014, Jiang Liu wrote:
> Introduce acpi_ioapic_registered() to check whether an IOAPIC has already
> been registered, it will be used when enabling IOAPIC hotplug.
>
> Signed-off-by: Jiang Liu <jiang.liu@...ux.intel.com>
> ---
> arch/x86/include/asm/io_apic.h | 1 +
> arch/x86/kernel/acpi/boot.c | 11 +++++++++++
> arch/x86/kernel/apic/io_apic.c | 11 +++++++++++
> include/linux/acpi.h | 1 +
> 4 files changed, 24 insertions(+)
>
> diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
> index ce63cf34c93c..0db2b7037e4b 100644
> --- a/arch/x86/include/asm/io_apic.h
> +++ b/arch/x86/include/asm/io_apic.h
> @@ -191,6 +191,7 @@ extern void mp_unmap_irq(int irq);
> extern int mp_register_ioapic(int id, u32 address, u32 gsi_base,
> struct ioapic_domain_cfg *cfg);
> extern int mp_unregister_ioapic(u32 gsi_base);
> +extern int mp_ioapic_registered(u32 gsi_base);
> extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
> irq_hw_number_t hwirq);
> extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq);
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index 560a6d1cb0f4..6aa796f77b71 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -810,6 +810,17 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
> }
> EXPORT_SYMBOL(acpi_unregister_ioapic);
>
> +int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)
> +{
> + int ret;
> +
> + down_write(&acpi_ioapic_rwsem);
Why down_write? You are merily checking whether the thing is
registered already.
> + ret = mp_ioapic_registered(gsi_base);
> + up_write(&acpi_ioapic_rwsem);
> +
> + return ret;
> +}
So I assume that this is for a particular caller in the apci ioapic
hotplug code and that call site has its own serialization. Otherwise
the return value is not protected at all.
Please add a Docbook comment to that function, and document the
locking rules as thats pretty non obvious.
The such is missing in some other patches as well.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists