lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Dec 2012 17:31:47 +0200
From:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To:	Greg KH <gregkh@...uxfoundation.org>
Cc:	Miles J Penner <miles.j.penner@...el.com>,
	John Ronciak <john.ronciak@...el.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Tushar N Dave <tushar.n.dave@...el.com>,
	"Kirill A. Shutemov" <kirill@...temov.name>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Yinghai Lu <yinghai@...nel.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Amos Kong <kongjianjun@...il.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] PCI Hotplug: convert acpiphp_hp_work to use delayed work

From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>

Some broken ACPI PCI Hotplug implementations notify OS about hotplug
before devices ready to be enumerated.

Let's convert acpiphp_hp_work to delayed work. It will allow to delay
enumeration on broken hardware to workaround the issue.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 3d6d4fd..1a2b3ca 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1191,7 +1191,7 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
 }
 
 struct acpiphp_hp_work {
-	struct work_struct work;
+	struct delayed_work work;
 	acpi_handle handle;
 	u32 type;
 	void *context;
@@ -1199,7 +1199,8 @@ struct acpiphp_hp_work {
 
 static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type,
 				  void *context,
-				  void (*func)(struct work_struct *work))
+				  void (*func)(struct work_struct *work),
+				  unsigned long delay)
 {
 	struct acpiphp_hp_work *hp_work;
 	int ret;
@@ -1212,8 +1213,8 @@ static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type,
 	hp_work->type = type;
 	hp_work->context = context;
 
-	INIT_WORK(&hp_work->work, func);
-	ret = queue_work(kacpi_hotplug_wq, &hp_work->work);
+	INIT_DELAYED_WORK(&hp_work->work, func);
+	ret = queue_delayed_work(kacpi_hotplug_wq, &hp_work->work, delay);
 	if (!ret)
 		kfree(hp_work);
 }
@@ -1230,7 +1231,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work)
 	acpi_handle handle;
 	u32 type;
 
-	hp_work = container_of(work, struct acpiphp_hp_work, work);
+	hp_work = container_of(to_delayed_work(work),
+			struct acpiphp_hp_work, work);
 	handle = hp_work->handle;
 	type = hp_work->type;
 
@@ -1334,7 +1336,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type,
 	 * don't deadlock on hotplug actions.
 	 */
 	alloc_acpiphp_hp_work(handle, type, context,
-			      _handle_hotplug_event_bridge);
+			      _handle_hotplug_event_bridge, 0);
 }
 
 static void _handle_hotplug_event_func(struct work_struct *work)
@@ -1348,7 +1350,8 @@ static void _handle_hotplug_event_func(struct work_struct *work)
 	u32 type;
 	void *context;
 
-	hp_work = container_of(work, struct acpiphp_hp_work, work);
+	hp_work = container_of(to_delayed_work(work),
+			struct acpiphp_hp_work, work);
 	handle = hp_work->handle;
 	type = hp_work->type;
 	context = hp_work->context;
@@ -1410,7 +1413,7 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type,
 	 * don't deadlock on hotplug actions.
 	 */
 	alloc_acpiphp_hp_work(handle, type, context,
-			      _handle_hotplug_event_func);
+			      _handle_hotplug_event_func, 0);
 }
 
 static acpi_status
-- 
1.7.10.4

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ