mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Jiang Liu <liuj97@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Yinghai Lu <yinghai@kernel.org>, Jiang Liu <jiang.liu@huawei.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Gu Zheng <guz.fnst@cn.fujitsu.com>,
	Toshi Kani <toshi.kani@hp.com>,
	Myron Stowe <myron.stowe@redhat.com>,
	Yijing Wang <wangyijing@huawei.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Len Brown <lenb@kernel.org>,
	Feng Tang <feng.tang@intel.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [RFC PATCH v2, part3 11/11] PCI, ACPI, pci_root: use PCI bus lock to protect PCI device hotplug
Date: Thu, 16 May 2013 21:59:27 +0200	[thread overview]
Message-ID: <10972097.JVdfQZJ2zI@vostro.rjw.lan> (raw)
In-Reply-To: <1368719459-24800-12-git-send-email-jiang.liu@huawei.com>

On Thursday, May 16, 2013 11:50:59 PM Jiang Liu wrote:
> Use PCI bus lock to protect concurrent PCI device hotplug operations.
> 
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Len Brown <lenb@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Cc: Feng Tang <feng.tang@intel.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-acpi@vger.kernel.org

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  arch/ia64/pci/pci.c     |  2 +-
>  arch/x86/pci/acpi.c     |  3 ++-
>  drivers/acpi/pci_root.c | 14 ++++++++------
>  drivers/pci/Kconfig     |  2 +-
>  4 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
> index de1474f..6e91e87 100644
> --- a/arch/ia64/pci/pci.c
> +++ b/arch/ia64/pci/pci.c
> @@ -384,7 +384,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  	}
>  
>  	pci_scan_child_bus(pbus);
> -	return pbus;
> +	return pci_bus_get(pbus);
>  
>  out3:
>  	kfree(controller->window);
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index b972f04..6dddc06 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -534,7 +534,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  		 */
>  		memcpy(bus->sysdata, sd, sizeof(*sd));
>  		kfree(info);
> -		pci_bus_put(bus);
> +		BUG_ON(pci_bus_lock(bus, PCI_BUS_STATE_REMOVED - 1, true) < 0);
>  	} else {
>  		probe_pci_root_info(info, device, busnum, domain);
>  
> @@ -561,6 +561,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  			pci_set_host_bridge_release(
>  				to_pci_host_bridge(bus->bridge),
>  				release_pci_root_info, info);
> +			pci_bus_get(bus);
>  		} else {
>  			pci_free_resource_list(&resources);
>  			__release_pci_root_info(info);
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 21dda5a..eb01cc7 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -535,6 +535,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
>  	}
>  
>  	pci_bus_add_devices(root->bus);
> +	pci_bus_unlock(root->bus, true);
>  	return 1;
>  
>  end:
> @@ -546,13 +547,14 @@ static void acpi_pci_root_remove(struct acpi_device *device)
>  {
>  	struct acpi_pci_root *root = acpi_driver_data(device);
>  
> -	pci_stop_root_bus(root->bus);
> -
> -	device_set_run_wake(root->bus->bridge, false);
> -	pci_acpi_remove_bus_pm_notifier(device);
> -
> -	pci_remove_root_bus(root->bus);
> +	if (pci_bus_lock(root->bus, PCI_BUS_STATE_REMOVED - 1, true) == 0) {
> +		pci_stop_root_bus(root->bus);
> +		device_set_run_wake(root->bus->bridge, false);
> +		pci_acpi_remove_bus_pm_notifier(device);
> +		pci_remove_root_bus(root->bus);
> +	}
>  
> +	pci_bus_put(root->bus);
>  	kfree(root);
>  }
>  
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index 92e69bd..5ae3504 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -121,4 +121,4 @@ config PCI_LABEL
>  	select NLS
>  
>  config PCI_BUS_LOCK
> -	def_bool n
> +	def_bool y if (X86 || IA64)
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-05-16 19:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 15:50 [RFC PATCH v2, part3 00/11] Introduce PCI bus lock and state machine Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 01/11] PCI: introduce bus lock and state machine to serialize PCI hotplug operations Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 02/11] PCI: implement state machine for PCI bus Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 03/11] PCI: introduce a state machine to manage PCI device lifecycle Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 04/11] PCI: introduce helper function pci_stop_and_remove_device() Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 05/11] PCI: enhance PCI core logic to support PCI bus lock Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 06/11] PCI, sysfs: use PCI bus lock to serialize hotplug operations triggered by sysfs Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 07/11] PCI, xen-pcifront: use new PCI interfaces to simplify implementation Jiang Liu
2013-06-07 14:50   ` Konrad Rzeszutek Wilk
2013-06-07 15:17     ` Jiang Liu
2013-06-07 15:38     ` Konrad Rzeszutek Wilk
2013-06-07 16:50       ` Jiang Liu
2013-06-07 17:07         ` Konrad Rzeszutek Wilk
2013-06-09 16:50           ` Jiang Liu
2013-06-10 16:58             ` Konrad Rzeszutek Wilk
2013-06-10 17:08               ` Jiang Liu
2013-06-14 18:07                 ` Konrad Rzeszutek Wilk
2013-06-07 15:50     ` Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 08/11] PCI, xen-pcifront: use PCI bus lock to protect PCI device hotplug Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 09/11] PCI, acpiphp: " Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 10/11] PCI, pciehp: " Jiang Liu
2013-05-16 15:50 ` [RFC PATCH v2, part3 11/11] PCI, ACPI, pci_root: " Jiang Liu
2013-05-16 19:59   ` Rafael J. Wysocki [this message]
2013-05-22  9:48 ` [RFC PATCH v2, part3 00/11] Introduce PCI bus lock and state machine Gu Zheng
2013-05-28  4:51   ` 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=10972097.JVdfQZJ2zI@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=bhelgaas@google.com \
    --cc=feng.tang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=jiang.liu@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=mingo@redhat.com \
    --cc=myron.stowe@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.com \
    --cc=wangyijing@huawei.com \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    /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

all inboxes | Powered by JetHome®