Skip to contentSkip to conversation

Fix for the xen-bus driver

PATCH Superseded Anthony PERARD 3 participants 15 messages Aug 21, 2019 – Aug 22, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix for the xen-bus driver

Cheers,

Anthony PERARD (2):
xen-bus: Fix backend state transition on device reset
xen-bus: Avoid rewriting identical values to xenstore

 hw/xen/xen-bus.c | 41 +++++++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 14 deletions(-)
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH 1/2 xen-bus: Fix backend state transition on device reset

When a frontend want to reset its state and the backend one, it start with setting "Closing", then wait for the backend (QEMU) to do the same.

But when QEMU is setting "Closing" to its state, it trigger an event (xenstore watch) that re-execute xen_device_backend_changed() and set the backend state to "Closed". QEMU should wait for the frontend to set "Closed" before doing the same.

Before setting "Closed" to the backend_state, we are also going to check if the frontend was responsible for the transition to "Closing".

Fixes b6af8926fb858c4f1426e5acb2cfc1f0580ec98a

---
Cc: [email protected]

---
 hw/xen/xen-bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/xen/xen-bus.c +3 -1
index e40500242d..982eca4533 100644
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);
     }
Signature · 7 lines
Anthony PERARD


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

Re: [Qemu-devel] [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 33 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 21 August 2019 10:20
To: [email protected]
Cc: Anthony Perard <[email protected]>; [email protected]; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Subject: [PATCH 1/2] xen-bus: Fix backend state transition on device reset

When a frontend want to reset its state and the backend one, it start with setting "Closing", then wait for the backend (QEMU) to do the same.

But when QEMU is setting "Closing" to its state, it trigger an event (xenstore watch) that re-execute xen_device_backend_changed() and set the backend state to "Closed". QEMU should wait for the frontend to set "Closed" before doing the same.

Before setting "Closed" to the backend_state, we are also going to check if the frontend was responsible for the transition to "Closing".

Fixes b6af8926fb858c4f1426e5acb2cfc1f0580ec98a

---
Cc: [email protected]

---
 hw/xen/xen-bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/xen/xen-bus.c +0 -0
index e40500242d..982eca4533 100644
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*

hw/xen/xen-bus.c static void xen_device_backend_changed(void *opaque) · line 549

Quoted 10 lines
hw/xen/xen-bus.c +3 -1
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);

Actually, I wonder whether it is better to 'whitelist' here? AFAIK the only valid frontend states whether the backend should set itself 'closed' are 'closed' (i.e. the frontend is finished) and 'initialising' (the frontend was never there).

Paul

Quoted 3 lines
hw/xen/xen-bus.c +0 -1
     }
--

Anthony PERARD

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

#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 10 lines · Paul Durrant
Quoted 10 lines
hw/xen/xen-bus.c +1 -1
index e40500242d..982eca4533 100644
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
Quoted 8 lines

hw/xen/xen-bus.c static void xen_device_backend_changed(void *opaque) · line 549

Quoted 6 lines
hw/xen/xen-bus.c +2 -0
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);

Actually, I wonder whether it is better to 'whitelist' here? AFAIK the only valid frontend states whether the backend should set itself 'closed' are 'closed' (i.e. the frontend is finished) and 'initialising' (the frontend was never there).

Let's see, what are the reason backend=Closing?
- frontend changed to Closing (because it wants to disconnect)
- toolstack(libxl) or QEMU(unplug request) set the state to Closing, but also online to 0.

What should the backend do in both case:
- frontend alive: backend should wait
frontend state might be InitWait, Initialised, Connected, Closing.
- frontend not existing or disconnected: backend can skip waiting and go to the next step, Closed.
frontend might be Initialising, Closed.
But there are also Unknown, Reconfiguring and Reconfigured which are probably errors.

So, the whitelist with Closed and Initialising is a good start, but what about the Unknown state? (QEMU doesn't have backends were the state Reconfigur* is possible, so they can be mapped to Unknown for now).

Cheers,

Signature · 6 lines
Anthony PERARD

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

Re: [Qemu-devel] [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 45 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 10:51
To: Paul Durrant <[email protected]>
Cc: [email protected]; [email protected]; Stefano Stabellini <[email protected]>; xen- [email protected]
Subject: Re: [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 10 lines · Paul Durrant
Quoted 10 lines
hw/xen/xen-bus.c +1 -1
index e40500242d..982eca4533 100644
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
Quoted 8 lines

hw/xen/xen-bus.c static void xen_device_backend_changed(void *opaque) · line 549

Quoted 6 lines
hw/xen/xen-bus.c +2 -0
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);

Actually, I wonder whether it is better to 'whitelist' here? AFAIK the only valid frontend states

whether the backend should set itself 'closed' are 'closed' (i.e. the frontend is finished) and 'initialising' (the frontend was never there).

Let's see, what are the reason backend=Closing?
- frontend changed to Closing (because it wants to disconnect)
- toolstack(libxl) or QEMU(unplug request) set the state to Closing, but also online to 0.

What should the backend do in both case:
- frontend alive: backend should wait
frontend state might be InitWait, Initialised, Connected, Closing.
- frontend not existing or disconnected: backend can skip waiting and go to the next step, Closed.
frontend might be Initialising, Closed.
But there are also Unknown, Reconfiguring and Reconfigured which are probably errors.

Quoted 3 lines

So, the whitelist with Closed and Initialising is a good start, but what about the Unknown state? (QEMU doesn't have backends were the state Reconfigur* is possible, so they can be mapped to Unknown for now).

I guess we should consider Unknown (basically a missing xenstore state key) to mean either an admin, or the frontend has screwed up or is malicious so I think we just close down the backend straight away. So maybe listing InitWait, Initialised, Connected, and Closing as frontend states that are 'good' (i.e. we wait in anticipation of the frontend eventually getting to Closed) and then say all other states result in immediate close of the backend. Probably worth having a helper function for saying whether a state is good or not.

Cheers,

Paul

Quoted 5 lines

Cheers,

--
Anthony PERARD

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

#5 lore raw

Re: [Qemu-devel] [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 45 lines · Paul Durrant
Quoted 45 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 10:51
To: Paul Durrant <[email protected]>
Cc: [email protected]; [email protected]; Stefano Stabellini <[email protected]>; xen- [email protected]
Subject: Re: [PATCH 1/2] xen-bus: Fix backend state transition on device reset

Quoted 10 lines · Paul Durrant
Quoted 10 lines
hw/xen/xen-bus.c +1 -1
index e40500242d..982eca4533 100644
@@ -540,9 +540,11 @@ static void xen_device_backend_changed(void *opaque)
     /*
      * If the toolstack (or unplug request callback) has set the backend
      * state to Closing, but there is no active frontend (i.e. the
-     * state is not Connected) then set the backend state to Closed.
+     * state is not Connected or Closing) then set the backend state
Quoted 8 lines

hw/xen/xen-bus.c static void xen_device_backend_changed(void *opaque) · line 549

Quoted 6 lines
hw/xen/xen-bus.c +2 -0
+     * to Closed.
      */
     if (xendev->backend_state == XenbusStateClosing &&
+        xendev->frontend_state != XenbusStateClosing &&
         xendev->frontend_state != XenbusStateConnected) {
         xen_device_backend_set_state(xendev, XenbusStateClosed);

Actually, I wonder whether it is better to 'whitelist' here? AFAIK the only valid frontend states

whether the backend should set itself 'closed' are 'closed' (i.e. the frontend is finished) and 'initialising' (the frontend was never there).

Let's see, what are the reason backend=Closing?
- frontend changed to Closing (because it wants to disconnect)
- toolstack(libxl) or QEMU(unplug request) set the state to Closing, but also online to 0.

What should the backend do in both case:
- frontend alive: backend should wait
frontend state might be InitWait, Initialised, Connected, Closing.
- frontend not existing or disconnected: backend can skip waiting and go to the next step, Closed.
frontend might be Initialising, Closed.
But there are also Unknown, Reconfiguring and Reconfigured which are probably errors.

Quoted 5 lines
Quoted 3 lines

So, the whitelist with Closed and Initialising is a good start, but what about the Unknown state? (QEMU doesn't have backends were the state Reconfigur* is possible, so they can be mapped to Unknown for now).

I guess we should consider Unknown (basically a missing xenstore state key) to mean either an admin, or the frontend has screwed up or is malicious so I think we just close down the backend straight away. So maybe listing InitWait, Initialised, Connected, and Closing as frontend states that are 'good' (i.e. we wait in anticipation of the frontend eventually getting to Closed) and then say all other states result in immediate close of the backend. Probably worth having a helper function for saying whether a state is good or not.

Sounds good, but I'll use "active" instead of "good" to name the helper as that feels more accurate to me. Also "active" is already used in the comment. I'll name the new helper xen_device_state_is_active().

Thanks,

Signature · 6 lines
Anthony PERARD

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

PATCH 2/2 xen-bus: Avoid rewriting identical values to xenstore

In reply to Anthony PERARD

When QEMU receive a xenstore watch event suggesting that the "state" or "online" status of the frontend or the backend changed, it record this in its own state but it also re-write the value back into xenstore even so there were no changed. This trigger an unnecessary xenstore watch event which QEMU will process again (and maybe the frontend as well).

---
 hw/xen/xen-bus.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)
hw/xen/xen-bus.c +24 -13
index 982eca4533..c83f07424a 100644
@@ -481,20 +481,27 @@ static int xen_device_backend_scanf(XenDevice *xendev, const char *key,
     return rc;
 }
 
-void xen_device_backend_set_state(XenDevice *xendev,
-                                  enum xenbus_state state)
+static bool xen_device_backend_record_state(XenDevice *xendev,
+                                            enum xenbus_state state)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
     if (xendev->backend_state == state) {
-        return;
+        return false;
     }
 
     trace_xen_device_backend_state(type, xendev->name,
                                    xs_strstate(state));
 
     xendev->backend_state = state;
-    xen_device_backend_printf(xendev, "state", "%u", state);
+    return true;
+}
+
+void xen_device_backend_set_state(XenDevice *xendev,
+                                  enum xenbus_state state)
+{
+    if (xen_device_backend_record_state(xendev, state))
+        xen_device_backend_printf(xendev, "state", "%u", state);
 }
 
 enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
@@ -502,7 +509,8 @@ enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
     return xendev->backend_state;
 }
 
-static void xen_device_backend_set_online(XenDevice *xendev, bool online)
+static void xen_device_backend_set_online(XenDevice *xendev, bool online,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
@@ -513,7 +521,8 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)
     trace_xen_device_backend_online(type, xendev->name, online);
 
     xendev->backend_online = online;
-    xen_device_backend_printf(xendev, "online", "%u", online);
+    if (export)
+        xen_device_backend_printf(xendev, "online", "%u", online);
 }
 
 static void xen_device_backend_changed(void *opaque)
@@ -529,13 +538,13 @@ static void xen_device_backend_changed(void *opaque)
         state = XenbusStateUnknown;
     }
 
-    xen_device_backend_set_state(xendev, state);
+    xen_device_backend_record_state(xendev, state);
 
     if (xen_device_backend_scanf(xendev, "online", "%u", &online) != 1) {
         online = 0;
     }
 
-    xen_device_backend_set_online(xendev, !!online);
+    xen_device_backend_set_online(xendev, !!online, false);
 
     /*
      * If the toolstack (or unplug request callback) has set the backend
@@ -683,7 +692,8 @@ int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
 }
 
 static void xen_device_frontend_set_state(XenDevice *xendev,
-                                          enum xenbus_state state)
+                                          enum xenbus_state state,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
@@ -695,7 +705,8 @@ static void xen_device_frontend_set_state(XenDevice *xendev,
                                     xs_strstate(state));
 
     xendev->frontend_state = state;
-    xen_device_frontend_printf(xendev, "state", "%u", state);
+    if (export)
+        xen_device_frontend_printf(xendev, "state", "%u", state);
 }
 
 static void xen_device_frontend_changed(void *opaque)
@@ -711,7 +722,7 @@ static void xen_device_frontend_changed(void *opaque)
         state = XenbusStateUnknown;
     }
 
-    xen_device_frontend_set_state(xendev, state);
+    xen_device_frontend_set_state(xendev, state, false);
 
     if (state == XenbusStateInitialising &&
         xendev->backend_state == XenbusStateClosed &&
@@ -1146,7 +1157,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
                               xendev->frontend_id);
     xen_device_backend_printf(xendev, "hotplug-status", "connected");
 
-    xen_device_backend_set_online(xendev, true);
+    xen_device_backend_set_online(xendev, true, true);
     xen_device_backend_set_state(xendev, XenbusStateInitWait);
 
     xen_device_frontend_printf(xendev, "backend", "%s",
@@ -1154,7 +1165,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
     xen_device_frontend_printf(xendev, "backend-id", "%u",
                                xenbus->backend_id);
 
-    xen_device_frontend_set_state(xendev, XenbusStateInitialising);
+    xen_device_frontend_set_state(xendev, XenbusStateInitialising, true);
 
     xendev->exit.notify = xen_device_exit;
     qemu_add_exit_notifier(&xendev->exit);
Signature · 7 lines
Anthony PERARD


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

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 66 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 21 August 2019 10:20
To: [email protected]
Cc: Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Subject: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

When QEMU receive a xenstore watch event suggesting that the "state" or "online" status of the frontend or the backend changed, it record this in its own state but it also re-write the value back into xenstore even so there were no changed. This trigger an unnecessary xenstore watch event which QEMU will process again (and maybe the frontend as well).

---
 hw/xen/xen-bus.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)
hw/xen/xen-bus.c +13 -5
index 982eca4533..c83f07424a 100644
@@ -481,20 +481,27 @@ static int xen_device_backend_scanf(XenDevice *xendev, const char *key,
     return rc;
 }
 
-void xen_device_backend_set_state(XenDevice *xendev,
-                                  enum xenbus_state state)
+static bool xen_device_backend_record_state(XenDevice *xendev,
+                                            enum xenbus_state state)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
     if (xendev->backend_state == state) {
-        return;
+        return false;
     }
 
     trace_xen_device_backend_state(type, xendev->name,
                                    xs_strstate(state));
 
     xendev->backend_state = state;
-    xen_device_backend_printf(xendev, "state", "%u", state);
+    return true;
+}
+
+void xen_device_backend_set_state(XenDevice *xendev,
+                                  enum xenbus_state state)
+{
+    if (xen_device_backend_record_state(xendev, state))
+        xen_device_backend_printf(xendev, "state", "%u", state);
 }
 
 enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
@@ -502,7 +509,8 @@ enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
     return xendev->backend_state;
 }
 
-static void xen_device_backend_set_online(XenDevice *xendev, bool online)
+static void xen_device_backend_set_online(XenDevice *xendev, bool online,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 

hw/xen/xen-bus.c static void xen_device_backend_set_online(XenDevice *xendev, bool online) · line 527

Quoted 8 lines
hw/xen/xen-bus.c +2 -1
@@ -513,7 +521,8 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)
     trace_xen_device_backend_online(type, xendev->name, online);
 
     xendev->backend_online = online;
-    xen_device_backend_printf(xendev, "online", "%u", online);
+    if (export)
+        xen_device_backend_printf(xendev, "online", "%u", online);
 }
 

Perhaps the behaviour of backend_set_state() and backend_set_online() could be the same? I.e. they both take an 'export' (or perhaps 'publish'?) parameter and only write xenstore if that is true. (I realise that would involve modifying xen-block to pass 'true' as the extra export/publish param, but I think it would be neater overall).

Quoted 5 lines
hw/xen/xen-bus.c +0 -0
 static void xen_device_backend_changed(void *opaque)
@@ -529,13 +538,13 @@ static void xen_device_backend_changed(void *opaque)
         state = XenbusStateUnknown;
     }
 

hw/xen/xen-bus.c static void xen_device_backend_changed(void *opaque) · line 548

Quoted 10 lines
hw/xen/xen-bus.c +2 -2
-    xen_device_backend_set_state(xendev, state);
+    xen_device_backend_record_state(xendev, state);
 
     if (xen_device_backend_scanf(xendev, "online", "%u", &online) != 1) {
         online = 0;
     }
 
-    xen_device_backend_set_online(xendev, !!online);
+    xen_device_backend_set_online(xendev, !!online, false);
 

You could then pass 'false' here in both cases.

Quoted 41 lines
hw/xen/xen-bus.c +6 -4
     /*
      * If the toolstack (or unplug request callback) has set the backend
@@ -683,7 +692,8 @@ int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
 }
 
 static void xen_device_frontend_set_state(XenDevice *xendev,
-                                          enum xenbus_state state)
+                                          enum xenbus_state state,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
@@ -695,7 +705,8 @@ static void xen_device_frontend_set_state(XenDevice *xendev,
                                     xs_strstate(state));
 
     xendev->frontend_state = state;
-    xen_device_frontend_printf(xendev, "state", "%u", state);
+    if (export)
+        xen_device_frontend_printf(xendev, "state", "%u", state);
 }
 
 static void xen_device_frontend_changed(void *opaque)
@@ -711,7 +722,7 @@ static void xen_device_frontend_changed(void *opaque)
         state = XenbusStateUnknown;
     }
 
-    xen_device_frontend_set_state(xendev, state);
+    xen_device_frontend_set_state(xendev, state, false);
 
     if (state == XenbusStateInitialising &&
         xendev->backend_state == XenbusStateClosed &&
@@ -1146,7 +1157,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
                               xendev->frontend_id);
     xen_device_backend_printf(xendev, "hotplug-status", "connected");
 
-    xen_device_backend_set_online(xendev, true);
+    xen_device_backend_set_online(xendev, true, true);
     xen_device_backend_set_state(xendev, XenbusStateInitWait);
 
     xen_device_frontend_printf(xendev, "backend", "%s",

hw/xen/xen-bus.c static void xen_device_realize(DeviceState *dev, Error **errp) · line 1169

Quoted 6 lines
hw/xen/xen-bus.c +1 -1
@@ -1154,7 +1165,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)
     xen_device_frontend_printf(xendev, "backend-id", "%u",
                                xenbus->backend_id);
 
-    xen_device_frontend_set_state(xendev, XenbusStateInitialising);
+    xen_device_frontend_set_state(xendev, XenbusStateInitialising, true);
 

And similarly pass 'true' here for all three cases.

What do you think?

Paul

Quoted 4 lines
hw/xen/xen-bus.c +0 -1
     xendev->exit.notify = xen_device_exit;
     qemu_add_exit_notifier(&xendev->exit);
--

Anthony PERARD

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

#8 lore raw

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 68 lines · Paul Durrant
Quoted 68 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 21 August 2019 10:20
To: [email protected]
Cc: Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Subject: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

When QEMU receive a xenstore watch event suggesting that the "state" or "online" status of the frontend or the backend changed, it record this in its own state but it also re-write the value back into xenstore even so there were no changed. This trigger an unnecessary xenstore watch event which QEMU will process again (and maybe the frontend as well).

---
 hw/xen/xen-bus.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)
hw/xen/xen-bus.c +13 -5
index 982eca4533..c83f07424a 100644
@@ -481,20 +481,27 @@ static int xen_device_backend_scanf(XenDevice *xendev, const char *key,
     return rc;
 }
 
-void xen_device_backend_set_state(XenDevice *xendev,
-                                  enum xenbus_state state)
+static bool xen_device_backend_record_state(XenDevice *xendev,
+                                            enum xenbus_state state)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
     if (xendev->backend_state == state) {
-        return;
+        return false;
     }
 
     trace_xen_device_backend_state(type, xendev->name,
                                    xs_strstate(state));
 
     xendev->backend_state = state;
-    xen_device_backend_printf(xendev, "state", "%u", state);
+    return true;
+}
+
+void xen_device_backend_set_state(XenDevice *xendev,
+                                  enum xenbus_state state)
+{
+    if (xen_device_backend_record_state(xendev, state))
+        xen_device_backend_printf(xendev, "state", "%u", state);
 }
 
 enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
@@ -502,7 +509,8 @@ enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
     return xendev->backend_state;
 }
 
-static void xen_device_backend_set_online(XenDevice *xendev, bool online)
+static void xen_device_backend_set_online(XenDevice *xendev, bool online,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
@@ -513,7 +521,8 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)
     trace_xen_device_backend_online(type, xendev->name, online);
 
Quoted 8 lines

hw/xen/xen-bus.c static void xen_device_backend_set_online(XenDevice *xendev, bool online) · line 527

Quoted 6 lines
hw/xen/xen-bus.c +2 -1
     xendev->backend_online = online;
-    xen_device_backend_printf(xendev, "online", "%u", online);
+    if (export)
+        xen_device_backend_printf(xendev, "online", "%u", online);
 }
 

Perhaps the behaviour of backend_set_state() and backend_set_online() could be the same? I.e. they both take an 'export' (or perhaps 'publish'?) parameter and only write xenstore if that is true. (I realise that would involve modifying xen-block to pass 'true' as the extra export/publish param, but I think it would be neater overall).

I've actually did it this way for backend_set_state() because the only reason to update internal states without writing that state into xenstore is because the xenstore state changed, so {front,back}end_changed() are the only function that don't want/need to write the new state into xenstore. I wanted to avoid misuse of the extra export/publish param in future backend drivers.

As for frontend_set_state() and backend_set_online(), they are only used in xen-bus.c, creating a new function didn't seems as needed.

I kind of think that maybe I should go further and also have frontend_record_state() is it could be possible to have frontend drivers in QEMU. (and maybe record_online so they all looks the same.)

So, would you prefer to have the extra param to *_set_*() that should be "true" outside of *_changed(), or the extra functions like I did with backend_{set,record}_state() ?

Thanks,

Signature · 6 lines
Anthony PERARD

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

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 95 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 11:22
To: Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 68 lines · Paul Durrant
Quoted 68 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 21 August 2019 10:20
To: [email protected]
Cc: Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Subject: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

When QEMU receive a xenstore watch event suggesting that the "state" or "online" status of the frontend or the backend changed, it record this in its own state but it also re-write the value back into xenstore even so there were no changed. This trigger an unnecessary xenstore watch event which QEMU will process again (and maybe the frontend as well).

---
 hw/xen/xen-bus.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)
hw/xen/xen-bus.c +13 -5
index 982eca4533..c83f07424a 100644
@@ -481,20 +481,27 @@ static int xen_device_backend_scanf(XenDevice *xendev, const char *key,
     return rc;
 }
 
-void xen_device_backend_set_state(XenDevice *xendev,
-                                  enum xenbus_state state)
+static bool xen_device_backend_record_state(XenDevice *xendev,
+                                            enum xenbus_state state)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
     if (xendev->backend_state == state) {
-        return;
+        return false;
     }
 
     trace_xen_device_backend_state(type, xendev->name,
                                    xs_strstate(state));
 
     xendev->backend_state = state;
-    xen_device_backend_printf(xendev, "state", "%u", state);
+    return true;
+}
+
+void xen_device_backend_set_state(XenDevice *xendev,
+                                  enum xenbus_state state)
+{
+    if (xen_device_backend_record_state(xendev, state))
+        xen_device_backend_printf(xendev, "state", "%u", state);
 }
 
 enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
@@ -502,7 +509,8 @@ enum xenbus_state xen_device_backend_get_state(XenDevice *xendev)
     return xendev->backend_state;
 }
 
-static void xen_device_backend_set_online(XenDevice *xendev, bool online)
+static void xen_device_backend_set_online(XenDevice *xendev, bool online,
+                                          bool export)
 {
     const char *type = object_get_typename(OBJECT(xendev));
 
@@ -513,7 +521,8 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)
     trace_xen_device_backend_online(type, xendev->name, online);
 
Quoted 8 lines

hw/xen/xen-bus.c static void xen_device_backend_set_online(XenDevice *xendev, bool online) · line 527

Quoted 6 lines
hw/xen/xen-bus.c +2 -1
     xendev->backend_online = online;
-    xen_device_backend_printf(xendev, "online", "%u", online);
+    if (export)
+        xen_device_backend_printf(xendev, "online", "%u", online);
 }
 

Perhaps the behaviour of backend_set_state() and backend_set_online() could be the same? I.e. they

both take an 'export' (or perhaps 'publish'?) parameter and only write xenstore if that is true. (I realise that would involve modifying xen-block to pass 'true' as the extra export/publish param, but I think it would be neater overall).

I've actually did it this way for backend_set_state() because the only reason to update internal states without writing that state into xenstore is because the xenstore state changed, so {front,back}end_changed() are the only function that don't want/need to write the new state into xenstore. I wanted to avoid misuse of the extra export/publish param in future backend drivers.

Quoted 7 lines

As for frontend_set_state() and backend_set_online(), they are only used in xen-bus.c, creating a new function didn't seems as needed.

I kind of think that maybe I should go further and also have frontend_record_state() is it could be possible to have frontend drivers in QEMU. (and maybe record_online so they all looks the same.)

I guess I don't like the term 'record'... I'd really like to stick with 'set'...

Quoted 4 lines

So, would you prefer to have the extra param to *_set_*() that should be "true" outside of *_changed(), or the extra functions like I did with backend_{set,record}_state() ?

...so I prefer the extra param.

But, now I look at the code again without your patch applied I don't actually see the problem it is trying to fix. The functions xen_device_[back|front]end_set_state return early if the state being set matches the existing state and hence never get to the line where the state is written to xenstore.

Paul

Quoted 4 lines

Thanks,

--
Anthony PERARD

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

#10 lore raw

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 1 line · Paul Durrant

But, now I look at the code again without your patch applied I don't actually see the problem it is trying to fix. The functions xen_device_[back|front]end_set_state return early if the state being set matches the existing state and hence never get to the line where the state is written to xenstore.

Let's see:
* step 1 (initial states in xenstore and QEMU) xenstore/frontend/state = 4
xendev->frontend_state = 4
* step 2 (frontend changes state in xenstore) xenstore/frontend/state = 5
* step 3 (watch event received by QEMU) xen_device_frontend_changed()
state = read(xenstore/frontend/state) (state=5) xen_device_frontend_set_state(state)
xendev->frontend_state != state (4!=5)
xendev->frontend_state = state xenstore/frontend/state = state
* step 4
# watch event triggers xen_device_frontend_changed() again but # this time xendev->frontend_state == xenstore/frontend_state

This is how QEMU writes to xenstore an identical value.

That behavior might be an issue if the frontend changes the value after QEMU have read it but before QEMU writes it again.

Also, it's nice to avoid extra work.

Signature · 6 lines
Anthony PERARD

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

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 29 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 12:18
To: Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 1 line · Paul Durrant

But, now I look at the code again without your patch applied I don't actually see the problem it is

trying to fix. The functions xen_device_[back|front]end_set_state return early if the state being set matches the existing state and hence never get to the line where the state is written to xenstore.

Let's see:
* step 1 (initial states in xenstore and QEMU) xenstore/frontend/state = 4
xendev->frontend_state = 4
* step 2 (frontend changes state in xenstore) xenstore/frontend/state = 5
* step 3 (watch event received by QEMU) xen_device_frontend_changed()
state = read(xenstore/frontend/state) (state=5) xen_device_frontend_set_state(state)
xendev->frontend_state != state (4!=5)
xendev->frontend_state = state xenstore/frontend/state = state
* step 4
# watch event triggers xen_device_frontend_changed() again but # this time xendev->frontend_state == xenstore/frontend_state

Quoted 4 lines

This is how QEMU writes to xenstore an identical value.

That behavior might be an issue if the frontend changes the value after QEMU have read it but before QEMU writes it again.

Ah, ok, so the problem is actually limited to frontend state because that is written by both frontend and backend, so whether QEMU writes an updated frontend state to xenstore needs to be controlled. It's only called in two places xen_device_frontend_changed() and xen_device_realize(). The write to xenstore should be avoided in the former case, but not the latter. So adding a 'publish' boolean and using that to determine whether the write to xenstore is done seems like the right approach. But I don't think any change is needed to xen_device_backend_set_online() or xen_device_backend_set_state(), is it?

Paul

Quoted 5 lines

Also, it's nice to avoid extra work.

--
Anthony PERARD

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

#12 lore raw

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 25 lines · Paul Durrant
Quoted 25 lines

From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 12:18

Quoted 1 line · Paul Durrant

But, now I look at the code again without your patch applied I don't actually see the problem it is

trying to fix. The functions xen_device_[back|front]end_set_state return early if the state being set matches the existing state and hence never get to the line where the state is written to xenstore.

Let's see:
* step 1 (initial states in xenstore and QEMU) xenstore/frontend/state = 4
xendev->frontend_state = 4
* step 2 (frontend changes state in xenstore) xenstore/frontend/state = 5
* step 3 (watch event received by QEMU) xen_device_frontend_changed()
state = read(xenstore/frontend/state) (state=5) xen_device_frontend_set_state(state)
xendev->frontend_state != state (4!=5)
xendev->frontend_state = state xenstore/frontend/state = state
* step 4
# watch event triggers xen_device_frontend_changed() again but # this time xendev->frontend_state == xenstore/frontend_state

Quoted 6 lines
Quoted 4 lines

This is how QEMU writes to xenstore an identical value.

That behavior might be an issue if the frontend changes the value after QEMU have read it but before QEMU writes it again.

Ah, ok, so the problem is actually limited to frontend state because that is written by both frontend and backend, so whether QEMU writes an updated frontend state to xenstore needs to be controlled. It's only called in two places xen_device_frontend_changed() and xen_device_realize(). The write to xenstore should be avoided in the former case, but not the latter. So adding a 'publish' boolean and using that to determine whether the write to xenstore is done seems like the right approach. But I don't think any change is needed to xen_device_backend_set_online() or xen_device_backend_set_state(), is it?

I guess it's not that much of a issue for backend_set_*(), the double write would only happen when the toolstack try to tear down the backend, so it would happen only once.

Alright, I'll only change frontend_set_state() and use 'publish'.

Signature · 6 lines
Anthony PERARD

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

Re: [Qemu-devel] [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 48 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 14:18
To: Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] xen-bus: Avoid rewriting identical values to xenstore

Quoted 5 lines · Paul Durrant
Quoted 5 lines

From: Anthony PERARD <[email protected]>
Sent: 22 August 2019 12:18

Quoted 1 line · Paul Durrant

But, now I look at the code again without your patch applied I don't actually see the problem it

is

Quoted 1 line
Quoted 1 line

trying to fix. The functions xen_device_[back|front]end_set_state return early if the state being

set

Quoted 19 lines
Quoted 19 lines

matches the existing state and hence never get to the line where the state is written to xenstore.

Let's see:
* step 1 (initial states in xenstore and QEMU) xenstore/frontend/state = 4
xendev->frontend_state = 4
* step 2 (frontend changes state in xenstore) xenstore/frontend/state = 5
* step 3 (watch event received by QEMU) xen_device_frontend_changed()
state = read(xenstore/frontend/state) (state=5) xen_device_frontend_set_state(state)
xendev->frontend_state != state (4!=5)
xendev->frontend_state = state xenstore/frontend/state = state
* step 4
# watch event triggers xen_device_frontend_changed() again but # this time xendev->frontend_state == xenstore/frontend_state

Quoted 6 lines
Quoted 4 lines

This is how QEMU writes to xenstore an identical value.

That behavior might be an issue if the frontend changes the value after QEMU have read it but before QEMU writes it again.

Ah, ok, so the problem is actually limited to frontend state because that is written by both

frontend and backend, so whether QEMU writes an updated frontend state to xenstore needs to be controlled. It's only called in two places xen_device_frontend_changed() and xen_device_realize(). The write to xenstore should be avoided in the former case, but not the latter. So adding a 'publish' boolean and using that to determine whether the write to xenstore is done seems like the right approach. But I don't think any change is needed to xen_device_backend_set_online() or xen_device_backend_set_state(), is it?

Quoted 5 lines

I guess it's not that much of a issue for backend_set_*(), the double write would only happen when the toolstack try to tear down the backend, so it would happen only once.

Alright, I'll only change frontend_set_state() and use 'publish'.

Thanks :-)

Paul

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

#14 lore raw
In reply to Anthony PERARD
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Subject: [Qemu-devel] [PATCH 0/2] Fix for the xen-bus driver
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Submodule 'capstone' (https://git.qemu.org/git/capstone.git) registered for path 'capstone'
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Submodule 'roms/QemuMacDrivers' (https://git.qemu.org/git/QemuMacDrivers.git) registered for path 'roms/QemuMacDrivers' Submodule 'roms/SLOF' (https://git.qemu.org/git/SLOF.git) registered for path 'roms/SLOF'
Submodule 'roms/edk2' (https://git.qemu.org/git/edk2.git) registered for path 'roms/edk2'
Submodule 'roms/ipxe' (https://git.qemu.org/git/ipxe.git) registered for path 'roms/ipxe'
Submodule 'roms/openbios' (https://git.qemu.org/git/openbios.git) registered for path 'roms/openbios'
Submodule 'roms/openhackware' (https://git.qemu.org/git/openhackware.git) registered for path 'roms/openhackware'
Submodule 'roms/opensbi' (https://git.qemu.org/git/opensbi.git) registered for path 'roms/opensbi'
Submodule 'roms/qemu-palcode' (https://git.qemu.org/git/qemu-palcode.git) registered for path 'roms/qemu-palcode'
Submodule 'roms/seabios' (https://git.qemu.org/git/seabios.git/) registered for path 'roms/seabios'
Submodule 'roms/seabios-hppa' (https://git.qemu.org/git/seabios-hppa.git) registered for path 'roms/seabios-hppa'
Submodule 'roms/sgabios' (https://git.qemu.org/git/sgabios.git) registered for path 'roms/sgabios'
Submodule 'roms/skiboot' (https://git.qemu.org/git/skiboot.git) registered for path 'roms/skiboot'
Submodule 'roms/u-boot' (https://git.qemu.org/git/u-boot.git) registered for path 'roms/u-boot'
Submodule 'roms/u-boot-sam460ex' (https://git.qemu.org/git/u-boot-sam460ex.git) registered for path 'roms/u-boot-sam460ex' Submodule 'slirp' (https://git.qemu.org/git/libslirp.git) registered for path 'slirp'
Submodule 'tests/fp/berkeley-softfloat-3' (https://git.qemu.org/git/berkeley-softfloat-3.git) registered for path 'tests/fp/berkeley-softfloat-3' Submodule 'tests/fp/berkeley-testfloat-3' (https://git.qemu.org/git/berkeley-testfloat-3.git) registered for path 'tests/fp/berkeley-testfloat-3' Submodule 'ui/keycodemapdb' (https://git.qemu.org/git/keycodemapdb.git) registered for path 'ui/keycodemapdb'
Cloning into 'capstone'...
Submodule path 'capstone': checked out '22ead3e0bfdb87516656453336160e0a37b066bf'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '88f18909db731a627456f26d779445f84e449536'
Cloning into 'roms/QemuMacDrivers'...
Submodule path 'roms/QemuMacDrivers': checked out '90c488d5f4a407342247b9ea869df1c2d9c8e266'
Cloning into 'roms/SLOF'...
Submodule path 'roms/SLOF': checked out 'ba1ab360eebe6338bb8d7d83a9220ccf7e213af3'
Cloning into 'roms/edk2'...
Submodule path 'roms/edk2': checked out '20d2e5a125e34fc8501026613a71549b2a1a3e54'
Submodule 'SoftFloat' (https://github.com/ucb-bar/berkeley-softfloat-3.git) registered for path 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3' Submodule 'CryptoPkg/Library/OpensslLib/openssl' (https://github.com/openssl/openssl) registered for path 'CryptoPkg/Library/OpensslLib/openssl' Cloning into 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3'...
Submodule path 'roms/edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037' Cloning into 'CryptoPkg/Library/OpensslLib/openssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl': checked out '50eaac9f3337667259de725451f201e784599687' Submodule 'boringssl' (https://boringssl.googlesource.com/boringssl) registered for path 'boringssl'
Submodule 'krb5' (https://github.com/krb5/krb5) registered for path 'krb5'
Submodule 'pyca.cryptography' (https://github.com/pyca/cryptography.git) registered for path 'pyca-cryptography'
Cloning into 'boringssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl': checked out '2070f8ad9151dc8f3a73bffaa146b5e6937a583f' Cloning into 'krb5'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5': checked out 'b9ad6c49505c96a088326b62a52568e3484f2168' Cloning into 'pyca-cryptography'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/pyca-cryptography': checked out '09403100de2f6f1cdd0d484dcb8e620f1c335c8f' Cloning into 'roms/ipxe'...
Submodule path 'roms/ipxe': checked out 'de4565cbe76ea9f7913a01f331be3ee901bb6e17'
Cloning into 'roms/openbios'...
Submodule path 'roms/openbios': checked out 'c79e0ecb84f4f1ee3f73f521622e264edd1bf174'
Cloning into 'roms/openhackware'...
Submodule path 'roms/openhackware': checked out 'c559da7c8eec5e45ef1f67978827af6f0b9546f5'
Cloning into 'roms/opensbi'...
Submodule path 'roms/opensbi': checked out 'ce228ee0919deb9957192d723eecc8aaae2697c6'
Cloning into 'roms/qemu-palcode'...
Submodule path 'roms/qemu-palcode': checked out 'bf0e13698872450164fa7040da36a95d2d4b326f'
Cloning into 'roms/seabios'...
Submodule path 'roms/seabios': checked out 'a5cab58e9a3fb6e168aba919c5669bea406573b4'
Cloning into 'roms/seabios-hppa'...
Submodule path 'roms/seabios-hppa': checked out '0f4fe84658165e96ce35870fd19fc634e182e77b'
Cloning into 'roms/sgabios'...
Submodule path 'roms/sgabios': checked out 'cbaee52287e5f32373181cff50a00b6c4ac9015a'
Cloning into 'roms/skiboot'...
Submodule path 'roms/skiboot': checked out '261ca8e779e5138869a45f174caa49be6a274501'
Cloning into 'roms/u-boot'...
Submodule path 'roms/u-boot': checked out 'd3689267f92c5956e09cc7d1baa4700141662bff'
Cloning into 'roms/u-boot-sam460ex'...
Submodule path 'roms/u-boot-sam460ex': checked out '60b3916f33e617a815973c5a6df77055b2e3a588'
Cloning into 'slirp'...
Submodule path 'slirp': checked out '126c04acbabd7ad32c2b018fe10dfac2a3bc1210'
Cloning into 'tests/fp/berkeley-softfloat-3'...
Submodule path 'tests/fp/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037'
Cloning into 'tests/fp/berkeley-testfloat-3'...
Submodule path 'tests/fp/berkeley-testfloat-3': checked out '5a59dcec19327396a011a17fd924aed4fec416b3'
Cloning into 'ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce'
Switched to a new branch 'test'
7fa63a8 xen-bus: Avoid rewriting identical values to xenstore
9b67c6b xen-bus: Fix backend state transition on device reset

=== OUTPUT BEGIN ===
1/2 Checking commit 9b67c6bd437c (xen-bus: Fix backend state transition on device reset) 2/2 Checking commit 7fa63a840f11 (xen-bus: Avoid rewriting identical values to xenstore)
ERROR: braces {} are necessary for all arms of this statement
#47: FILE: hw/xen/xen-bus.c:503:
+ if (xen_device_backend_record_state(xendev, state))
[...]

ERROR: braces {} are necessary for all arms of this statement #67: FILE: hw/xen/xen-bus.c:524:
+ if (export)
[...]

ERROR: braces {} are necessary for all arms of this statement #103: FILE: hw/xen/xen-bus.c:708:
+ if (export)
[...]

total: 3 errors, 0 warnings, 106 lines checked

Patch 2/2 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]