linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: "bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"apw@canonical.com" <apw@canonical.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"driverdev-devel@linuxdriverproject.org"
	<driverdev-devel@linuxdriverproject.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
	"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	Jack Morgenstein <jackm@mellanox.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [PATCH v3 4/6] PCI: hv: remove hbus->enum_sem
Date: Tue, 6 Mar 2018 18:21:53 +0000	[thread overview]
Message-ID: <20180306182128.23281-5-decui@microsoft.com> (raw)
In-Reply-To: <20180306182128.23281-1-decui@microsoft.com>

Since we serialize the present/eject work items now, we don't need the
semaphore any more.

This is suggested by Michael Kelley.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jack Morgenstein <jackm@mellanox.com>
Cc: stable@vger.kernel.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Michael Kelley (EOSG) <Michael.H.Kelley@microsoft.com>
---
 drivers/pci/host/pci-hyperv.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index aaee41faf55f..3a385212f666 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -447,7 +447,6 @@ struct hv_pcibus_device {
 	spinlock_t device_list_lock;	/* Protect lists below */
 	void __iomem *cfg_addr;
=20
-	struct semaphore enum_sem;
 	struct list_head resources_for_children;
=20
 	struct list_head children;
@@ -1592,12 +1591,8 @@ static struct hv_pci_dev *get_pcichild_wslot(struct =
hv_pcibus_device *hbus,
  * It must also treat the omission of a previously observed device as
  * notification that the device no longer exists.
  *
- * Note that this function is a work item, and it may not be
- * invoked in the order that it was queued.  Back to back
- * updates of the list of present devices may involve queuing
- * multiple work items, and this one may run before ones that
- * were sent later. As such, this function only does something
- * if is the last one in the queue.
+ * Note that this function is serialized with hv_eject_device_work(),
+ * because both are pushed to the ordered workqueue hbus->wq.
  */
 static void pci_devices_present_work(struct work_struct *work)
 {
@@ -1618,11 +1613,6 @@ static void pci_devices_present_work(struct work_str=
uct *work)
=20
 	INIT_LIST_HEAD(&removed);
=20
-	if (down_interruptible(&hbus->enum_sem)) {
-		put_hvpcibus(hbus);
-		return;
-	}
-
 	/* Pull this off the queue and process it if it was the last one. */
 	spin_lock_irqsave(&hbus->device_list_lock, flags);
 	while (!list_empty(&hbus->dr_list)) {
@@ -1639,7 +1629,6 @@ static void pci_devices_present_work(struct work_stru=
ct *work)
 	spin_unlock_irqrestore(&hbus->device_list_lock, flags);
=20
 	if (!dr) {
-		up(&hbus->enum_sem);
 		put_hvpcibus(hbus);
 		return;
 	}
@@ -1726,7 +1715,6 @@ static void pci_devices_present_work(struct work_stru=
ct *work)
 		break;
 	}
=20
-	up(&hbus->enum_sem);
 	put_hvpcibus(hbus);
 	kfree(dr);
 }
@@ -2460,7 +2448,6 @@ static int hv_pci_probe(struct hv_device *hdev,
 	spin_lock_init(&hbus->config_lock);
 	spin_lock_init(&hbus->device_list_lock);
 	spin_lock_init(&hbus->retarget_msi_interrupt_lock);
-	sema_init(&hbus->enum_sem, 1);
 	init_completion(&hbus->remove_event);
 	hbus->wq =3D alloc_ordered_workqueue("hv_pci_%x", 0,
 					   hbus->sysdata.domain);
--=20
2.7.4

  parent reply	other threads:[~2018-03-06 18:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 18:21 [PATCH v3 0/6] some fixes to the pci-hyperv driver Dexuan Cui
2018-03-06 18:21 ` [PATCH v3 1/6] PCI: hv: fix a comment typo in _hv_pcifront_read_config() Dexuan Cui
2018-03-09 19:36   ` Haiyang Zhang
2018-03-06 18:21 ` [PATCH v3 2/6] PCI: hv: hv_eject_device_work(): remove the bogus test Dexuan Cui
2018-03-06 18:29   ` Michael Kelley (EOSG)
2018-03-09 19:37   ` Haiyang Zhang
2018-03-06 18:21 ` [PATCH v3 3/6] PCI: hv: serialize the present/eject work items Dexuan Cui
2018-03-06 18:30   ` Michael Kelley (EOSG)
2018-03-09 19:37   ` Haiyang Zhang
2018-03-06 18:21 ` Dexuan Cui [this message]
2018-03-06 18:31   ` [PATCH v3 4/6] PCI: hv: remove hbus->enum_sem Michael Kelley (EOSG)
2018-03-09 19:37   ` Haiyang Zhang
2018-03-06 18:21 ` [PATCH v3 5/6] PCI: hv: hv_pci_devices_present(): only queue a new work when necessary Dexuan Cui
2018-03-06 18:31   ` Michael Kelley (EOSG)
2018-03-09 19:37   ` Haiyang Zhang
2018-03-06 18:21 ` [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg() Dexuan Cui
2018-03-06 18:32   ` Michael Kelley (EOSG)
2018-03-07 12:34   ` Lorenzo Pieralisi
2018-03-07 21:40     ` Dexuan Cui
2018-03-13 18:23       ` Dexuan Cui
2018-03-13 18:31         ` Lorenzo Pieralisi
2018-03-14 11:50         ` Lorenzo Pieralisi
2018-03-14 17:17           ` Dexuan Cui
2018-03-09 19:38   ` Haiyang Zhang

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=20180306182128.23281-5-decui@microsoft.com \
    --to=decui@microsoft.com \
    --cc=Michael.H.Kelley@microsoft.com \
    --cc=apw@canonical.com \
    --cc=bhelgaas@google.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=jackm@mellanox.com \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=olaf@aepfle.de \
    --cc=stable@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.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).