Skip to contentSkip to conversation

Input: xen-kbdfront - signal the backend that we disconnect

PATCH In review Oleksandr Andrushchenko 2 participants 5 messages Mar 15, 2019 – Mar 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: xen-kbdfront - signal the backend that we disconnect

From: Oleksandr Andrushchenko <[email protected]>

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.

---
 drivers/input/misc/xen-kbdfront.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/misc/xen-kbdfront.c +2 -0
index 24bc5c5d876f..ecb6e719e0e2 100644
@@ -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;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 20 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

---
 drivers/input/misc/xen-kbdfront.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/misc/xen-kbdfront.c +0 -0
index 24bc5c5d876f..ecb6e719e0e2 100644

drivers/input/misc/xen-kbdfront.c static int xenkbd_connect_backend(struct xenbus_device *dev, · line 495

Quoted 8 lines
drivers/input/misc/xen-kbdfront.c +2 -0
@@ -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

#4 lore raw
In reply to Oleksandr Andrushchenko
Quoted 20 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

---
 drivers/input/misc/xen-kbdfront.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/misc/xen-kbdfront.c +0 -0
index 24bc5c5d876f..ecb6e719e0e2 100644

drivers/input/misc/xen-kbdfront.c static int xenkbd_connect_backend(struct xenbus_device *dev, · line 495

Quoted 8 lines
drivers/input/misc/xen-kbdfront.c +2 -0
@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Juergen Gross
Quoted 21 lines · Juergen Gross
Quoted 20 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

---
  drivers/input/misc/xen-kbdfront.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/input/misc/xen-kbdfront.c +0 -0
index 24bc5c5d876f..ecb6e719e0e2 100644
@@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
 
Quoted 11 lines

drivers/input/misc/xen-kbdfront.c static int xenkbd_connect_backend(struct xenbus_device *dev, · line 495

Quoted 8 lines
drivers/input/misc/xen-kbdfront.c +2 -0
  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

Quoted 2 lines

Juergen

Thank you,
Oleksandr

#3 lore raw
In reply to Juergen Gross
Quoted 21 lines · Juergen Gross
Quoted 20 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

---
  drivers/input/misc/xen-kbdfront.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/input/misc/xen-kbdfront.c +0 -0
index 24bc5c5d876f..ecb6e719e0e2 100644
@@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
 
Quoted 11 lines

drivers/input/misc/xen-kbdfront.c static int xenkbd_connect_backend(struct xenbus_device *dev, · line 495

Quoted 8 lines
drivers/input/misc/xen-kbdfront.c +2 -0
  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

Quoted 2 lines

Juergen

Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel