All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect
@ 2019-03-15  9:23 Oleksandr Andrushchenko
  2019-03-22 11:03 ` [PATCH] " Juergen Gross
  2019-03-22 11:03 ` [Xen-devel][PATCH] " Juergen Gross
  0 siblings, 2 replies; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-03-15  9:23 UTC (permalink / raw)
  To: xen-devel, linux-input, linux-kernel, dmitry.torokhov, jgross,
	boris.ostrovsky
  Cc: andr2000, Volodymyr_Babchuk, Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

While disconnecting from the backend we clean up shared resources
(event channel, ring buffer), but never let the backend know about
that. This may lead to inconsistent backend state and/or shared
resources use.
Fix this by explicitly letting the backend know that frontend has
destroyed shared resources by changing its Xen bus state accordingly.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
 drivers/input/misc/xen-kbdfront.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 24bc5c5d876f..ecb6e719e0e2 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
 
 static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 {
+	xenbus_switch_state(info->xbdev, XenbusStateClosing);
+
 	if (info->irq >= 0)
 		unbind_from_irqhandler(info->irq, info);
 	info->irq = -1;
-- 
2.21.0


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

* Re: [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect
  2019-03-15  9:23 [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect Oleksandr Andrushchenko
  2019-03-22 11:03 ` [PATCH] " Juergen Gross
@ 2019-03-22 11:03 ` Juergen Gross
  2019-03-22 11:09   ` [PATCH] " Oleksandr Andrushchenko
  2019-03-22 11:09   ` [Xen-devel][PATCH] " Oleksandr Andrushchenko
  1 sibling, 2 replies; 5+ messages in thread
From: Juergen Gross @ 2019-03-22 11:03 UTC (permalink / raw)
  To: Oleksandr Andrushchenko, xen-devel, linux-input, linux-kernel,
	dmitry.torokhov, boris.ostrovsky
  Cc: Volodymyr_Babchuk, Oleksandr Andrushchenko

On 15/03/2019 10:23, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> 
> While disconnecting from the backend we clean up shared resources
> (event channel, ring buffer), but never let the backend know about
> that. This may lead to inconsistent backend state and/or shared
> resources use.
> Fix this by explicitly letting the backend know that frontend has
> destroyed shared resources by changing its Xen bus state accordingly.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> ---
>  drivers/input/misc/xen-kbdfront.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 24bc5c5d876f..ecb6e719e0e2 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>  
>  static void xenkbd_disconnect_backend(struct xenkbd_info *info)
>  {
> +	xenbus_switch_state(info->xbdev, XenbusStateClosing);
> +
>  	if (info->irq >= 0)
>  		unbind_from_irqhandler(info->irq, info);
>  	info->irq = -1;
> 

As already stated for the related netfront patch: I'm not sure this
is really what we want. Have you tested xl save/restore or migration
of the guest with your patch applied?


Juergen

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

* Re: [PATCH] Input: xen-kbdfront - signal the backend that we disconnect
  2019-03-15  9:23 [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect Oleksandr Andrushchenko
@ 2019-03-22 11:03 ` Juergen Gross
  2019-03-22 11:03 ` [Xen-devel][PATCH] " Juergen Gross
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Gross @ 2019-03-22 11:03 UTC (permalink / raw)
  To: Oleksandr Andrushchenko, xen-devel, linux-input, linux-kernel,
	dmitry.torokhov, boris.ostrovsky
  Cc: Volodymyr_Babchuk, Oleksandr Andrushchenko

On 15/03/2019 10:23, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> 
> While disconnecting from the backend we clean up shared resources
> (event channel, ring buffer), but never let the backend know about
> that. This may lead to inconsistent backend state and/or shared
> resources use.
> Fix this by explicitly letting the backend know that frontend has
> destroyed shared resources by changing its Xen bus state accordingly.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> ---
>  drivers/input/misc/xen-kbdfront.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 24bc5c5d876f..ecb6e719e0e2 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>  
>  static void xenkbd_disconnect_backend(struct xenkbd_info *info)
>  {
> +	xenbus_switch_state(info->xbdev, XenbusStateClosing);
> +
>  	if (info->irq >= 0)
>  		unbind_from_irqhandler(info->irq, info);
>  	info->irq = -1;
> 

As already stated for the related netfront patch: I'm not sure this
is really what we want. Have you tested xl save/restore or migration
of the guest with your patch applied?


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect
  2019-03-22 11:03 ` [Xen-devel][PATCH] " Juergen Gross
  2019-03-22 11:09   ` [PATCH] " Oleksandr Andrushchenko
@ 2019-03-22 11:09   ` Oleksandr Andrushchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-03-22 11:09 UTC (permalink / raw)
  To: Juergen Gross, xen-devel, linux-input, linux-kernel,
	dmitry.torokhov, boris.ostrovsky
  Cc: Volodymyr_Babchuk, Oleksandr Andrushchenko

On 3/22/19 1:03 PM, Juergen Gross wrote:
> On 15/03/2019 10:23, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>
>> While disconnecting from the backend we clean up shared resources
>> (event channel, ring buffer), but never let the backend know about
>> that. This may lead to inconsistent backend state and/or shared
>> resources use.
>> Fix this by explicitly letting the backend know that frontend has
>> destroyed shared resources by changing its Xen bus state accordingly.
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>> ---
>>   drivers/input/misc/xen-kbdfront.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
>> index 24bc5c5d876f..ecb6e719e0e2 100644
>> --- a/drivers/input/misc/xen-kbdfront.c
>> +++ b/drivers/input/misc/xen-kbdfront.c
>> @@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>>   
>>   static void xenkbd_disconnect_backend(struct xenkbd_info *info)
>>   {
>> +	xenbus_switch_state(info->xbdev, XenbusStateClosing);
>> +
>>   	if (info->irq >= 0)
>>   		unbind_from_irqhandler(info->irq, info);
>>   	info->irq = -1;
>>
> As already stated for the related netfront patch: I'm not sure this
> is really what we want. Have you tested xl save/restore or migration
> of the guest with your patch applied?
Well, it comes out that this is not enough and needs much more work,
so please let's abandon this patch
>
> Juergen
Thank you,
Oleksandr

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

* Re: [PATCH] Input: xen-kbdfront - signal the backend that we disconnect
  2019-03-22 11:03 ` [Xen-devel][PATCH] " Juergen Gross
@ 2019-03-22 11:09   ` Oleksandr Andrushchenko
  2019-03-22 11:09   ` [Xen-devel][PATCH] " Oleksandr Andrushchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Oleksandr Andrushchenko @ 2019-03-22 11:09 UTC (permalink / raw)
  To: Juergen Gross, xen-devel, linux-input, linux-kernel,
	dmitry.torokhov, boris.ostrovsky
  Cc: Volodymyr_Babchuk, Oleksandr Andrushchenko

On 3/22/19 1:03 PM, Juergen Gross wrote:
> On 15/03/2019 10:23, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>
>> While disconnecting from the backend we clean up shared resources
>> (event channel, ring buffer), but never let the backend know about
>> that. This may lead to inconsistent backend state and/or shared
>> resources use.
>> Fix this by explicitly letting the backend know that frontend has
>> destroyed shared resources by changing its Xen bus state accordingly.
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>> ---
>>   drivers/input/misc/xen-kbdfront.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
>> index 24bc5c5d876f..ecb6e719e0e2 100644
>> --- a/drivers/input/misc/xen-kbdfront.c
>> +++ b/drivers/input/misc/xen-kbdfront.c
>> @@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
>>   
>>   static void xenkbd_disconnect_backend(struct xenkbd_info *info)
>>   {
>> +	xenbus_switch_state(info->xbdev, XenbusStateClosing);
>> +
>>   	if (info->irq >= 0)
>>   		unbind_from_irqhandler(info->irq, info);
>>   	info->irq = -1;
>>
> As already stated for the related netfront patch: I'm not sure this
> is really what we want. Have you tested xl save/restore or migration
> of the guest with your patch applied?
Well, it comes out that this is not enough and needs much more work,
so please let's abandon this patch
>
> Juergen
Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-03-22 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  9:23 [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect Oleksandr Andrushchenko
2019-03-22 11:03 ` [PATCH] " Juergen Gross
2019-03-22 11:03 ` [Xen-devel][PATCH] " Juergen Gross
2019-03-22 11:09   ` [PATCH] " Oleksandr Andrushchenko
2019-03-22 11:09   ` [Xen-devel][PATCH] " Oleksandr Andrushchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.