* [PATCH] xenbus: frontend resume cleanup
@ 2013-07-09 13:29 Aurelien Chartier
2013-07-09 13:54 ` David Vrabel
2013-07-09 14:02 ` Konrad Rzeszutek Wilk
0 siblings, 2 replies; 4+ messages in thread
From: Aurelien Chartier @ 2013-07-09 13:29 UTC (permalink / raw)
To: xen-devel; +Cc: Aurelien Chartier, david.vrabel, jbeulich
Only create the delayed resume workqueue if we are running in the same domain
as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
---
drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 6ed8a9d..131267d 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)
return -EFAULT;
}
- INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
queue_work(xenbus_frontend_wq, &xdev->work);
return 0;
@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)
return xenbus_dev_resume(dev);
}
+static int xenbus_frontend_dev_probe(struct device *dev)
+{
+ if (xen_store_domain_type == XS_LOCAL) {
+ struct xenbus_device *xdev = to_xenbus_device(dev);
+ INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
+ }
+
+ return xenbus_dev_probe(dev);
+}
+
static const struct dev_pm_ops xenbus_pm_ops = {
.suspend = xenbus_dev_suspend,
.resume = xenbus_frontend_dev_resume,
@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = {
.name = "xen",
.match = xenbus_match,
.uevent = xenbus_uevent_frontend,
- .probe = xenbus_dev_probe,
+ .probe = xenbus_frontend_dev_probe,
.remove = xenbus_dev_remove,
.shutdown = xenbus_dev_shutdown,
.dev_attrs = xenbus_dev_attrs,
@@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)
register_xenstore_notifier(&xenstore_notifier);
- xenbus_frontend_wq = create_workqueue("xenbus_frontend");
+ 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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xenbus: frontend resume cleanup
2013-07-09 13:29 [PATCH] xenbus: frontend resume cleanup Aurelien Chartier
@ 2013-07-09 13:54 ` David Vrabel
2013-07-09 14:02 ` Konrad Rzeszutek Wilk
1 sibling, 0 replies; 4+ messages in thread
From: David Vrabel @ 2013-07-09 13:54 UTC (permalink / raw)
To: Aurelien Chartier; +Cc: jbeulich, xen-devel
On 09/07/13 14:29, Aurelien Chartier wrote:
> Only create the delayed resume workqueue if we are running in the same domain
> as xenstored and issue a warning if the workqueue creation fails.
>
> Move the work initialization to the device probe so it is done only once.
>
> Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xenbus: frontend resume cleanup
2013-07-09 13:29 [PATCH] xenbus: frontend resume cleanup Aurelien Chartier
2013-07-09 13:54 ` David Vrabel
@ 2013-07-09 14:02 ` Konrad Rzeszutek Wilk
2013-07-09 14:54 ` Aurelien Chartier
1 sibling, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-07-09 14:02 UTC (permalink / raw)
To: Aurelien Chartier; +Cc: david.vrabel, jbeulich, xen-devel
On Tue, Jul 09, 2013 at 02:29:35PM +0100, Aurelien Chartier wrote:
> Only create the delayed resume workqueue if we are running in the same domain
> as xenstored and issue a warning if the workqueue creation fails.
>
> Move the work initialization to the device probe so it is done only once.
>
> Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
> ---
> drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
> index 6ed8a9d..131267d 100644
> --- a/drivers/xen/xenbus/xenbus_probe_frontend.c
> +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
> @@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)
> return -EFAULT;
> }
>
> - INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
> queue_work(xenbus_frontend_wq, &xdev->work);
>
> return 0;
> @@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)
> return xenbus_dev_resume(dev);
> }
>
> +static int xenbus_frontend_dev_probe(struct device *dev)
> +{
> + if (xen_store_domain_type == XS_LOCAL) {
> + struct xenbus_device *xdev = to_xenbus_device(dev);
> + INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
> + }
> +
> + return xenbus_dev_probe(dev);
> +}
> +
> static const struct dev_pm_ops xenbus_pm_ops = {
> .suspend = xenbus_dev_suspend,
> .resume = xenbus_frontend_dev_resume,
> @@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = {
> .name = "xen",
> .match = xenbus_match,
> .uevent = xenbus_uevent_frontend,
> - .probe = xenbus_dev_probe,
> + .probe = xenbus_frontend_dev_probe,
> .remove = xenbus_dev_remove,
> .shutdown = xenbus_dev_shutdown,
> .dev_attrs = xenbus_dev_attrs,
> @@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)
>
> register_xenstore_notifier(&xenstore_notifier);
>
> - xenbus_frontend_wq = create_workqueue("xenbus_frontend");
> + 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");
> + }
>
Nice patch. I am going to take it but rework the line above - the rule about 80 characters
does not apply to any printk so it can all be in one line. Will rework it when I commit it in.
> return 0;
> }
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xenbus: frontend resume cleanup
2013-07-09 14:02 ` Konrad Rzeszutek Wilk
@ 2013-07-09 14:54 ` Aurelien Chartier
0 siblings, 0 replies; 4+ messages in thread
From: Aurelien Chartier @ 2013-07-09 14:54 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: david.vrabel, jbeulich, xen-devel
On 09/07/13 15:02, Konrad Rzeszutek Wilk wrote:
> On Tue, Jul 09, 2013 at 02:29:35PM +0100, Aurelien Chartier wrote:
>> Only create the delayed resume workqueue if we are running in the same domain
>> as xenstored and issue a warning if the workqueue creation fails.
>>
>> Move the work initialization to the device probe so it is done only once.
>>
>> Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
>> ---
>> drivers/xen/xenbus/xenbus_probe_frontend.c | 20 +++++++++++++++++---
>> 1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
>> index 6ed8a9d..131267d 100644
>> --- a/drivers/xen/xenbus/xenbus_probe_frontend.c
>> +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
>> @@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev)
>> return -EFAULT;
>> }
>>
>> - INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
>> queue_work(xenbus_frontend_wq, &xdev->work);
>>
>> return 0;
>> @@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev)
>> return xenbus_dev_resume(dev);
>> }
>>
>> +static int xenbus_frontend_dev_probe(struct device *dev)
>> +{
>> + if (xen_store_domain_type == XS_LOCAL) {
>> + struct xenbus_device *xdev = to_xenbus_device(dev);
>> + INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
>> + }
>> +
>> + return xenbus_dev_probe(dev);
>> +}
>> +
>> static const struct dev_pm_ops xenbus_pm_ops = {
>> .suspend = xenbus_dev_suspend,
>> .resume = xenbus_frontend_dev_resume,
>> @@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = {
>> .name = "xen",
>> .match = xenbus_match,
>> .uevent = xenbus_uevent_frontend,
>> - .probe = xenbus_dev_probe,
>> + .probe = xenbus_frontend_dev_probe,
>> .remove = xenbus_dev_remove,
>> .shutdown = xenbus_dev_shutdown,
>> .dev_attrs = xenbus_dev_attrs,
>> @@ -474,7 +483,12 @@ static int __init xenbus_probe_frontend_init(void)
>>
>> register_xenstore_notifier(&xenstore_notifier);
>>
>> - xenbus_frontend_wq = create_workqueue("xenbus_frontend");
>> + 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");
>> + }
>>
> Nice patch. I am going to take it but rework the line above - the rule about 80 characters
> does not apply to any printk so it can all be in one line. Will rework it when I commit it in.
I did not think there was an exception, good to know.
Thanks Konrad !
>
>> return 0;
>> }
>> --
>> 1.7.10.4
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-09 14:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09 13:29 [PATCH] xenbus: frontend resume cleanup Aurelien Chartier
2013-07-09 13:54 ` David Vrabel
2013-07-09 14:02 ` Konrad Rzeszutek Wilk
2013-07-09 14:54 ` Aurelien Chartier
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).