xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen: xenbus: Remove create_workqueue
@ 2016-05-27 18:50 Bhaktipriya Shridhar
  0 siblings, 0 replies; 3+ messages in thread
From: Bhaktipriya Shridhar @ 2016-05-27 18:50 UTC (permalink / raw)
  To: tj; +Cc: xen-devel, linux-kernel

With concurrency managed workqueues, use of dedicated workqueues can be
replaced by using system_wq. Drop xenbus_frontend_wq by using system_wq.

Since there is only a single work item, increase of concurrency level by
switching to system_wq should not break anything.

Since the work item could be pending and the code expects it to run
once scheduled, flush_work() has been used in xenbus_dev_suspend()

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
 drivers/xen/xenbus/xenbus_probe.c          |  2 ++
 drivers/xen/xenbus/xenbus_probe_frontend.c | 15 +--------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 33a31cf..bc97019 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -592,6 +592,8 @@ int xenbus_dev_suspend(struct device *dev)

 	DPRINTK("%s", xdev->nodename);

+	cancel_work_sync(&xdev->work);
+
 	if (dev->driver == NULL)
 		return 0;
 	drv = to_xenbus_driver(dev->driver);
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index bcb53bd..611a231 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -31,7 +31,6 @@
 #include "xenbus_probe.h"


-static struct workqueue_struct *xenbus_frontend_wq;

 /* device/<type>/<id> => <type>-<id> */
 static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
@@ -109,13 +108,7 @@ static int xenbus_frontend_dev_resume(struct device *dev)
 	if (xen_store_domain_type == XS_LOCAL) {
 		struct xenbus_device *xdev = to_xenbus_device(dev);

-		if (!xenbus_frontend_wq) {
-			pr_err("%s: no workqueue to process delayed resume\n",
-			       xdev->nodename);
-			return -EFAULT;
-		}
-
-		queue_work(xenbus_frontend_wq, &xdev->work);
+		schedule_work(&xdev->work);

 		return 0;
 	}
@@ -485,12 +478,6 @@ static int __init xenbus_probe_frontend_init(void)

 	register_xenstore_notifier(&xenstore_notifier);

-	if (xen_store_domain_type == XS_LOCAL) {
-		xenbus_frontend_wq = create_workqueue("xenbus_frontend");
-		if (!xenbus_frontend_wq)
-			pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n");
-	}
-
 	return 0;
 }
 subsys_initcall(xenbus_probe_frontend_init);
--
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xen: xenbus: Remove create_workqueue
       [not found] ` <574DB946.1050609@citrix.com>
@ 2016-05-31 16:43   ` Bhaktipriya Shridhar
  0 siblings, 0 replies; 3+ messages in thread
From: Bhaktipriya Shridhar @ 2016-05-31 16:43 UTC (permalink / raw)
  To: David Vrabel; +Cc: Tejun Heo, xen-devel, Linux-Kernel@Vger. Kernel. Org

Sorry about that. Will make the corrections in v2.

Thanks,
Bhaktipriya


On Tue, May 31, 2016 at 9:48 PM, David Vrabel <david.vrabel@citrix.com> wrote:
> On 27/05/16 19:50, Bhaktipriya Shridhar wrote:
>> With concurrency managed workqueues, use of dedicated workqueues can be
>> replaced by using system_wq. Drop xenbus_frontend_wq by using system_wq.
>>
>> Since there is only a single work item, increase of concurrency level by
>> switching to system_wq should not break anything.
>>
>> Since the work item could be pending and the code expects it to run
>> once scheduled, flush_work() has been used in xenbus_dev_suspend()
>
> This says flush_work() but...
>>
>> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
>> ---
>>  drivers/xen/xenbus/xenbus_probe.c          |  2 ++
>>  drivers/xen/xenbus/xenbus_probe_frontend.c | 15 +--------------
>>  2 files changed, 3 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
>> index 33a31cf..bc97019 100644
>> --- a/drivers/xen/xenbus/xenbus_probe.c
>> +++ b/drivers/xen/xenbus/xenbus_probe.c
>> @@ -592,6 +592,8 @@ int xenbus_dev_suspend(struct device *dev)
>>
>>       DPRINTK("%s", xdev->nodename);
>>
>> +     cancel_work_sync(&xdev->work);
>
> ...cancel_work_sync() is called here.
>
> David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xen: xenbus: Remove create_workqueue
       [not found] <20160527185002.GA19321@Karyakshetra>
@ 2016-05-31 16:18 ` David Vrabel
       [not found] ` <574DB946.1050609@citrix.com>
  1 sibling, 0 replies; 3+ messages in thread
From: David Vrabel @ 2016-05-31 16:18 UTC (permalink / raw)
  To: Bhaktipriya Shridhar, tj; +Cc: xen-devel, linux-kernel

On 27/05/16 19:50, Bhaktipriya Shridhar wrote:
> With concurrency managed workqueues, use of dedicated workqueues can be
> replaced by using system_wq. Drop xenbus_frontend_wq by using system_wq.
> 
> Since there is only a single work item, increase of concurrency level by
> switching to system_wq should not break anything.
> 
> Since the work item could be pending and the code expects it to run
> once scheduled, flush_work() has been used in xenbus_dev_suspend()

This says flush_work() but...
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
> ---
>  drivers/xen/xenbus/xenbus_probe.c          |  2 ++
>  drivers/xen/xenbus/xenbus_probe_frontend.c | 15 +--------------
>  2 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
> index 33a31cf..bc97019 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -592,6 +592,8 @@ int xenbus_dev_suspend(struct device *dev)
> 
>  	DPRINTK("%s", xdev->nodename);
> 
> +	cancel_work_sync(&xdev->work);

...cancel_work_sync() is called here.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-31 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 18:50 [PATCH] xen: xenbus: Remove create_workqueue Bhaktipriya Shridhar
     [not found] <20160527185002.GA19321@Karyakshetra>
2016-05-31 16:18 ` David Vrabel
     [not found] ` <574DB946.1050609@citrix.com>
2016-05-31 16:43   ` Bhaktipriya Shridhar

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