Skip to contentSkip to conversation

Fix build of Xen support + cleanup

PATCH Superseded Anthony PERARD 5 participants 11 messages Jun 18, 2019 – Jun 20, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fix build of Xen support + cleanup

Hi,

Fix the build in osstest and some cleanup

For reference:

Recent flight failure:
https://lists.xenproject.org/archives/html/xen-devel/2019-06/msg01022.html

Bisect result:
https://lists.xenproject.org/archives/html/xen-devel/2019-06/msg01029.html

Thanks.

Anthony PERARD (4):
xen: Fix build with public headers
xen: Import other xen/io/*.h
xen: Drop includes of xen/hvm/params.h
xen: Avoid VLA

 hw/9pfs/xen-9pfs.h                       |    4 +-
 hw/block/xen_blkif.h                     |    5 +-
 hw/char/xen_console.c                    |    2 +-
 hw/display/xenfb.c                       |    7 +-
 hw/i386/xen/xen-hvm.c                    |   16 +-
 hw/i386/xen/xen-mapcache.c               |    2 -
 hw/net/xen_nic.c                         |    2 +-
 hw/usb/xen-usb.c                         |    3 +-
 hw/xen/xen-legacy-backend.c              |    2 -
 include/hw/xen/interface/grant_table.h   |   36 +
 include/hw/xen/interface/io/blkif.h      |  712 +++++++++++++++
 include/hw/xen/interface/io/console.h    |   46 +
 include/hw/xen/interface/io/fbif.h       |  156 ++++
 include/hw/xen/interface/io/kbdif.h      |  566 ++++++++++++
 include/hw/xen/interface/io/netif.h      | 1010 ++++++++++++++++++++++
 include/hw/xen/interface/io/protocols.h  |   42 +
 include/hw/xen/{ => interface}/io/ring.h |    0
 include/hw/xen/interface/io/usbif.h      |  254 ++++++
 include/hw/xen/interface/io/xenbus.h     |   70 ++
 include/hw/xen/xen_common.h              |    2 +-
 20 files changed, 2914 insertions(+), 23 deletions(-)
 create mode 100644 include/hw/xen/interface/grant_table.h
 create mode 100644 include/hw/xen/interface/io/blkif.h
 create mode 100644 include/hw/xen/interface/io/console.h
 create mode 100644 include/hw/xen/interface/io/fbif.h
 create mode 100644 include/hw/xen/interface/io/kbdif.h
 create mode 100644 include/hw/xen/interface/io/netif.h
 create mode 100644 include/hw/xen/interface/io/protocols.h
 rename include/hw/xen/{ => interface}/io/ring.h (100%)
 create mode 100644 include/hw/xen/interface/io/usbif.h
 create mode 100644 include/hw/xen/interface/io/xenbus.h
Signature · 7 lines
Anthony PERARD


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

PATCH v2 1/4 xen: Fix build with public headers

Following 37677d7db3 "Clean up a few header guard symbols", QEMU start to fail to build:

In file included from ~/xen/tools/../tools/include/xen/io/blkif.h:31:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:5,
                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/../tools/include/xen/io/ring.h:68:0: error: "__CONST_RING_SIZE" redefined [-Werror]
#define __CONST_RING_SIZE(_s, _sz) \

In file included from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:4:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/qemu-xen-dir/include/hw/xen/io/ring.h:66:0: note: this is the location of the previous definition
#define __CONST_RING_SIZE(_s, _sz) \

The issue is that some public xen headers have been imported (by f65eadb639 "xen: import ring.h from xen") but not all. With the change in the guards symbole, the ring.h header start to be imported twice.

Fix the build by importing blkif.h and usbif.h and there dependencies. Some cleanup have been done on those files.

Subsequent patches will import other Xen public headers.

ring.h have been moved to "hw/xen/interface/" along with blkif.h and usbif.h as those describe interface (and would allow to also import a xen.h header if that was necessary).

xen-mapcache.c doesn't needs grant_table.h.

---
 hw/9pfs/xen-9pfs.h                       |   2 +-
 hw/block/xen_blkif.h                     |   3 +-
 hw/usb/xen-usb.c                         |   3 +-
 hw/xen/xen-legacy-backend.c              |   2 -
 include/hw/xen/interface/grant_table.h   |  36 ++
 include/hw/xen/interface/io/blkif.h      | 712 +++++++++++++++++++++++
 include/hw/xen/{ => interface}/io/ring.h |   0
 include/hw/xen/interface/io/usbif.h      | 254 ++++++++
 8 files changed, 1005 insertions(+), 7 deletions(-)
 create mode 100644 include/hw/xen/interface/grant_table.h
 create mode 100644 include/hw/xen/interface/io/blkif.h
 rename include/hw/xen/{ => interface}/io/ring.h (100%)
 create mode 100644 include/hw/xen/interface/io/usbif.h
hw/9pfs/xen-9pfs.h +1 -1
index fbdee3d843..92dc87e9e0 100644
@@ -14,7 +14,7 @@
 #define HW_9PFS_XEN_9PFS_H
 
 #include <xen/io/protocols.h>
-#include "hw/xen/io/ring.h"
+#include "hw/xen/interface/io/ring.h"
 
 /*
  * Do not merge into xen-9p-backend.c: clang doesn't allow unused static
hw/block/xen_blkif.h +1 -2
index a353693ea0..5a1094d793 100644
@@ -1,8 +1,7 @@
 #ifndef XEN_BLKIF_H
 #define XEN_BLKIF_H
 
-#include "hw/xen/io/ring.h"
-#include <xen/io/blkif.h>
+#include "hw/xen/interface/io/blkif.h"
 #include <xen/io/protocols.h>
 
 /*
hw/usb/xen-usb.c +1 -2
index b20d0cfadf..dfbb418e77 100644
@@ -32,8 +32,7 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
 
-#include "hw/xen/io/ring.h"
-#include <xen/io/usbif.h>
+#include "hw/xen/interface/io/usbif.h"
 
 /*
  * Check for required support of usbif.h: USBIF_SHORT_NOT_OK was the last
hw/xen/xen-legacy-backend.c +0 -2
index 36fd1e9b09..3715c94fa6 100644
@@ -34,8 +34,6 @@
 #include "hw/xen/xen_pvdev.h"
 #include "monitor/qdev.h"
 
-#include <xen/grant_table.h>
-
 DeviceState *xen_sysdev;
 BusState *xen_sysbus;
 
include/hw/xen/interface/grant_table.h new file +36 -0
new file mode 100644
index 0000000000..302e404814
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * grant_table.h
+ *
+ * Interface for granting foreign access to page frames, and receiving
+ * page-ownership transfers.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2004, K A Fraser
+ */
+
+#ifndef XEN_PUBLIC_GRANT_TABLE_H
+#define XEN_PUBLIC_GRANT_TABLE_H
+
+/*
+ * Reference to a grant entry in a specified domain's grant table.
+ */
+typedef uint32_t grant_ref_t;
+
+#endif /* XEN_PUBLIC_GRANT_TABLE_H */
include/hw/xen/interface/io/blkif.h new file +712 -0

712 lines not on this page · raw message

include/hw/xen/interface/io/ring.h renamed from include/hw/xen/io/ring.h +0 -0
similarity index 100%
rename from include/hw/xen/io/ring.h
rename to include/hw/xen/interface/io/ring.h
include/hw/xen/interface/io/usbif.h new file +254 -0

254 lines not on this page · raw message

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 v2 1/4] xen: Fix build with public headers

Quoted 9 lines · Anthony PERARD

Following 37677d7db3 "Clean up a few header guard symbols", QEMU start to fail to build:

In file included from ~/xen/tools/../tools/include/xen/io/blkif.h:31:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:5,
                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/../tools/include/xen/io/ring.h:68:0: error: "__CONST_RING_SIZE" redefined [-Werror]
#define __CONST_RING_SIZE(_s, _sz) \

Quoted 8 lines

In file included from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:4:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/qemu-xen-dir/include/hw/xen/io/ring.h:66:0: note: this is the location of the previous definition
#define __CONST_RING_SIZE(_s, _sz) \

The issue is that some public xen headers have been imported (by f65eadb639 "xen: import ring.h from xen") but not all. With the change in the guards symbole, the ring.h header start to be imported twice.

Ah, so the include/hw/xen/io/ring.h file in tree is a copy of /usr/include/xen/io/ring.h from xen-devel. Previously both these used "#ifndef __XEN_PUBLIC_IO_RING_H__". After the header guard cleanup in 37677d7db3, our local copy used a different header guard from the installed copy & thus we're not protected from dual inclusion.

IMHO the right solutions here are either

- Don't copy public Xen headers into our tree
- Keep our Xen header copies identical to the originals

Importing public headers and then changing them locally is the worst thing to do. With that in mind I think we should revert the part of commit 37677d7db3 that touched the imported Xen headers.

Regards,
Daniel

Signature · 8 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

Re: [Qemu-devel] [PATCH v2 1/4] xen: Fix build with public headers

Quoted 26 lines · Daniel P. Berrangé
Quoted 9 lines · Anthony PERARD

Following 37677d7db3 "Clean up a few header guard symbols", QEMU start to fail to build:

In file included from ~/xen/tools/../tools/include/xen/io/blkif.h:31:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:5,
                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/../tools/include/xen/io/ring.h:68:0: error: "__CONST_RING_SIZE" redefined [-Werror]
#define __CONST_RING_SIZE(_s, _sz) \

Quoted 8 lines

In file included from ~/xen/tools/qemu-xen-dir/hw/block/xen_blkif.h:4:0,

                 from ~/xen/tools/qemu-xen-dir/hw/block/xen-block.c:22:

~/xen/tools/qemu-xen-dir/include/hw/xen/io/ring.h:66:0: note: this is the location of the previous definition
#define __CONST_RING_SIZE(_s, _sz) \

The issue is that some public xen headers have been imported (by f65eadb639 "xen: import ring.h from xen") but not all. With the change in the guards symbole, the ring.h header start to be imported twice.

Ah, so the include/hw/xen/io/ring.h file in tree is a copy of /usr/include/xen/io/ring.h from xen-devel. Previously both these used "#ifndef __XEN_PUBLIC_IO_RING_H__". After the header guard cleanup in 37677d7db3, our local copy used a different header guard from the installed copy & thus we're not protected from dual inclusion.

Quoted 8 lines

IMHO the right solutions here are either

- Don't copy public Xen headers into our tree
- Keep our Xen header copies identical to the originals

Importing public headers and then changing them locally is the worst thing to do. With that in mind I think we should revert the part of commit 37677d7db3 that touched the imported Xen headers.

Yes, it's propably a better thing to do. So, I'm going to update the series and do:
- revert part of 37677d7db3
- import the public headers that depends on ring.h. Or in other words, the one that describe an interface with a guest.
I'll do some modification on the headers but only to remove the stuff that QEMU doesn't need (like how to make an hypercall).

Thanks,

Signature · 6 lines
Anthony PERARD

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

PATCH v2 2/4 xen: Import other xen/io/*.h

In reply to Anthony PERARD

Following "xen: Fix build with public headers", import other Xen public headers that are describing interfaces.

Import fbif.h, kbdif.h, netif.h, console.h, xenbus.h, protocols.h.

While editing xenfb.c, remove the include of event_channel.h as it isn't needed.

The headers are cleaned up a bit while importing them. The header guard symbols are changed to match QEMU's coding style, some other part of the file that QEMU doesn't use are removed.

---
 hw/9pfs/xen-9pfs.h                      |    2 +-
 hw/block/xen_blkif.h                    |    2 +-
 hw/char/xen_console.c                   |    2 +-
 hw/display/xenfb.c                      |    7 +-
 hw/net/xen_nic.c                        |    2 +-
 include/hw/xen/interface/io/console.h   |   46 ++
 include/hw/xen/interface/io/fbif.h      |  156 ++++
 include/hw/xen/interface/io/kbdif.h     |  566 +++++++++++++
 include/hw/xen/interface/io/netif.h     | 1010 +++++++++++++++++++++++
 include/hw/xen/interface/io/protocols.h |   42 +
 include/hw/xen/interface/io/xenbus.h    |   70 ++
 include/hw/xen/xen_common.h             |    2 +-
 12 files changed, 1898 insertions(+), 9 deletions(-)
 create mode 100644 include/hw/xen/interface/io/console.h
 create mode 100644 include/hw/xen/interface/io/fbif.h
 create mode 100644 include/hw/xen/interface/io/kbdif.h
 create mode 100644 include/hw/xen/interface/io/netif.h
 create mode 100644 include/hw/xen/interface/io/protocols.h
 create mode 100644 include/hw/xen/interface/io/xenbus.h
hw/9pfs/xen-9pfs.h +1 -1
index 92dc87e9e0..241e2216a4 100644
@@ -13,7 +13,7 @@
 #ifndef HW_9PFS_XEN_9PFS_H
 #define HW_9PFS_XEN_9PFS_H
 
-#include <xen/io/protocols.h>
+#include "hw/xen/interface/io/protocols.h"
 #include "hw/xen/interface/io/ring.h"
 
 /*
hw/block/xen_blkif.h +1 -1
index 5a1094d793..99733529c1 100644
@@ -2,7 +2,7 @@
 #define XEN_BLKIF_H
 
 #include "hw/xen/interface/io/blkif.h"
-#include <xen/io/protocols.h>
+#include "hw/xen/interface/io/protocols.h"
 
 /*
  * Not a real protocol.  Used to generate ring structs which contain
hw/char/xen_console.c +1 -1
index 91f34ef06c..47e1092263 100644
@@ -28,7 +28,7 @@
 #include "chardev/char-fe.h"
 #include "hw/xen/xen-legacy-backend.h"
 
-#include <xen/io/console.h>
+#include "hw/xen/interface/io/console.h"
 
 struct buffer {
     uint8_t *data;
hw/display/xenfb.c +3 -4
index 6202f1150e..3c79913b31 100644
@@ -32,10 +32,9 @@
 #include "ui/console.h"
 #include "hw/xen/xen-legacy-backend.h"
 
-#include <xen/event_channel.h>
-#include <xen/io/fbif.h>
-#include <xen/io/kbdif.h>
-#include <xen/io/protocols.h>
+#include "hw/xen/interface/io/fbif.h"
+#include "hw/xen/interface/io/kbdif.h"
+#include "hw/xen/interface/io/protocols.h"
 
 #include "trace.h"
 
hw/net/xen_nic.c +1 -1
index 37cda8e4be..ffb3b5898d 100644
@@ -30,7 +30,7 @@
 #include "net/util.h"
 #include "hw/xen/xen-legacy-backend.h"
 
-#include <xen/io/netif.h>
+#include "hw/xen/interface/io/netif.h"
 
 /* ------------------------------------------------------------- */
 
include/hw/xen/interface/io/console.h new file +46 -0

46 lines not on this page · raw message

include/hw/xen/interface/io/fbif.h new file +156 -0

156 lines not on this page · raw message

include/hw/xen/interface/io/kbdif.h new file +566 -0

566 lines not on this page · raw message

include/hw/xen/interface/io/netif.h new file +1010 -0

1,010 lines not on this page · raw message

include/hw/xen/interface/io/protocols.h new file +42 -0

42 lines not on this page · raw message

include/hw/xen/interface/io/xenbus.h new file +70 -0

70 lines not on this page · raw message

include/hw/xen/xen_common.h +1 -1
index 9a8155e172..0504b43659 100644
@@ -12,7 +12,7 @@
 
 #include <xenctrl.h>
 #include <xenstore.h>
-#include <xen/io/xenbus.h>
+#include "hw/xen/interface/io/xenbus.h"
 
 #include "hw/hw.h"
 #include "hw/xen/xen.h"
Signature · 7 lines
Anthony PERARD


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

PATCH v2 3/4 xen: Drop includes of xen/hvm/params.h

In reply to Anthony PERARD

xen-mapcache.c doesn't needs params.h.

xen-hvm.c uses defines available in params.h but so is xen_common.h which is included before. HVM_PARAM_* flags are only needed to make xc_hvm_param_{get,set} calls so including only xenctrl.h, which is where the definition the function is, should be enough. (xenctrl.h does include params.h)

---

Notes:
v2:
- new patch replacing "xen: Import Xen public headers used by xen-hvm.c"
- only drop includes of params.h, and don't import the other two; ioreq.h is an interface with Xen; e820.h is just used by QEMU to figure out the guest memory layout without proper communication with the Xen toolstacks or something like that.

 hw/i386/xen/xen-hvm.c      | 1 -
 hw/i386/xen/xen-mapcache.c | 2 --
 2 files changed, 3 deletions(-)
hw/i386/xen/xen-hvm.c +0 -1
index 2939122e7c..ae3deb4ef3 100644
@@ -27,7 +27,6 @@
 #include "exec/address-spaces.h"
 
 #include <xen/hvm/ioreq.h>
-#include <xen/hvm/params.h>
 #include <xen/hvm/e820.h>
 
 //#define DEBUG_XEN_HVM
hw/i386/xen/xen-mapcache.c +0 -2
index 254759f776..dc73c86c61 100644
@@ -17,8 +17,6 @@
 #include "hw/xen/xen-legacy-backend.h"
 #include "qemu/bitmap.h"
 
-#include <xen/hvm/params.h>
-
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 
Signature · 7 lines
Anthony PERARD


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

Re: [Qemu-devel] [PATCH v2 3/4] xen: Drop includes of xen/hvm/params.h

Quoted 10 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 18 June 2019 12:24
To: [email protected]
Cc: Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; Stefano Stabellini <[email protected]>; [email protected]
Subject: [PATCH v2 3/4] xen: Drop includes of xen/hvm/params.h

xen-mapcache.c doesn't needs params.h.

Quoted 7 lines

xen-hvm.c uses defines available in params.h but so is xen_common.h which is included before. HVM_PARAM_* flags are only needed to make xc_hvm_param_{get,set} calls so including only xenctrl.h, which is where the definition the function is, should be enough. (xenctrl.h does include params.h)

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

#7 lore raw

PATCH v2 4/4 xen: Avoid VLA

In reply to Anthony PERARD

Avoid using a variable length array.

We allocate the `dirty_bitmap' buffer only once when we start tracking for dirty bits.

---

Notes:
v2:
- Allocate the bitmap buffer only once when we start tracking dirty bits. (instead of at every function call)

Was suggested by Peter here:
<CAFEAcA88+A2oCkQnxKDEdpmfCZSmPzWMBg01wDDV68bMZoY5Jg@mail.gmail.com> "should we try to stop using variable length arrays?"

 hw/i386/xen/xen-hvm.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
hw/i386/xen/xen-hvm.c +11 -4
index ae3deb4ef3..469f1260a4 100644
@@ -119,6 +119,8 @@ typedef struct XenIOState {
     DeviceListener device_listener;
     hwaddr free_phys_offset;
     const XenPhysmap *log_for_dirtybit;
+    /* Buffer used by xen_sync_dirty_bitmap */
+    unsigned long *dirty_bitmap;
 
     Notifier exit;
     Notifier suspend;
@@ -464,6 +466,8 @@ static int xen_remove_from_physmap(XenIOState *state,
     QLIST_REMOVE(physmap, list);
     if (state->log_for_dirtybit == physmap) {
         state->log_for_dirtybit = NULL;
+        g_free(state->dirty_bitmap);
+        state->dirty_bitmap = NULL;
     }
     g_free(physmap);
 
@@ -614,7 +618,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
 {
     hwaddr npages = size >> TARGET_PAGE_BITS;
     const int width = sizeof(unsigned long) * 8;
-    unsigned long bitmap[DIV_ROUND_UP(npages, width)];
+    size_t bitmap_size = DIV_ROUND_UP(npages, width);
     int rc, i, j;
     const XenPhysmap *physmap = NULL;
 
@@ -626,13 +630,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
 
     if (state->log_for_dirtybit == NULL) {
         state->log_for_dirtybit = physmap;
+        state->dirty_bitmap = g_new(unsigned long, bitmap_size);
     } else if (state->log_for_dirtybit != physmap) {
         /* Only one range for dirty bitmap can be tracked. */
         return;
     }
 
     rc = xen_track_dirty_vram(xen_domid, start_addr >> TARGET_PAGE_BITS,
-                              npages, bitmap);
+                              npages, state->dirty_bitmap);
     if (rc < 0) {
 #ifndef ENODATA
 #define ENODATA  ENOENT
@@ -646,8 +651,8 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
         return;
     }
 
-    for (i = 0; i < ARRAY_SIZE(bitmap); i++) {
-        unsigned long map = bitmap[i];
+    for (i = 0; i < bitmap_size; i++) {
+        unsigned long map = state->dirty_bitmap[i];
         while (map != 0) {
             j = ctzl(map);
             map &= ~(1ul << j);
@@ -677,6 +682,8 @@ static void xen_log_stop(MemoryListener *listener, MemoryRegionSection *section,
 
     if (old & ~new & (1 << DIRTY_MEMORY_VGA)) {
         state->log_for_dirtybit = NULL;
+        g_free(state->dirty_bitmap);
+        state->dirty_bitmap = NULL;
         /* Disable dirty bit tracking */
         xen_track_dirty_vram(xen_domid, 0, 0, NULL);
     }
Signature · 7 lines
Anthony PERARD


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

Re: [Qemu-devel] [PATCH v2 4/4] xen: Avoid VLA

Quoted 5 lines · Anthony PERARD

Avoid using a variable length array.

We allocate the `dirty_bitmap' buffer only once when we start tracking for dirty bits.

Quoted 75 lines

---

Notes:
v2:
- Allocate the bitmap buffer only once when we start tracking dirty bits. (instead of at every function call)

Was suggested by Peter here:
<CAFEAcA88+A2oCkQnxKDEdpmfCZSmPzWMBg01wDDV68bMZoY5Jg@mail.gmail.com> "should we try to stop using variable length arrays?"

 hw/i386/xen/xen-hvm.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
hw/i386/xen/xen-hvm.c +9 -4
index ae3deb4ef3..469f1260a4 100644
@@ -119,6 +119,8 @@ typedef struct XenIOState {
     DeviceListener device_listener;
     hwaddr free_phys_offset;
     const XenPhysmap *log_for_dirtybit;
+    /* Buffer used by xen_sync_dirty_bitmap */
+    unsigned long *dirty_bitmap;
 
     Notifier exit;
     Notifier suspend;
@@ -464,6 +466,8 @@ static int xen_remove_from_physmap(XenIOState *state,
     QLIST_REMOVE(physmap, list);
     if (state->log_for_dirtybit == physmap) {
         state->log_for_dirtybit = NULL;
+        g_free(state->dirty_bitmap);
+        state->dirty_bitmap = NULL;
     }
     g_free(physmap);
 
@@ -614,7 +618,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
 {
     hwaddr npages = size >> TARGET_PAGE_BITS;
     const int width = sizeof(unsigned long) * 8;
-    unsigned long bitmap[DIV_ROUND_UP(npages, width)];
+    size_t bitmap_size = DIV_ROUND_UP(npages, width);
     int rc, i, j;
     const XenPhysmap *physmap = NULL;
 
@@ -626,13 +630,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
 
     if (state->log_for_dirtybit == NULL) {
         state->log_for_dirtybit = physmap;
+        state->dirty_bitmap = g_new(unsigned long, bitmap_size);
     } else if (state->log_for_dirtybit != physmap) {
         /* Only one range for dirty bitmap can be tracked. */
         return;
     }
 
     rc = xen_track_dirty_vram(xen_domid, start_addr >> TARGET_PAGE_BITS,
-                              npages, bitmap);
+                              npages, state->dirty_bitmap);
     if (rc < 0) {
 #ifndef ENODATA
 #define ENODATA  ENOENT
@@ -646,8 +651,8 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
         return;
     }
 
-    for (i = 0; i < ARRAY_SIZE(bitmap); i++) {
-        unsigned long map = bitmap[i];
+    for (i = 0; i < bitmap_size; i++) {
+        unsigned long map = state->dirty_bitmap[i];
         while (map != 0) {
             j = ctzl(map);
             map &= ~(1ul << j);

hw/i386/xen/xen-hvm.c static void xen_log_stop(MemoryListener *listener, MemoryRegionSection *section, · line 689

Quoted 8 lines
hw/i386/xen/xen-hvm.c +2 -0
@@ -677,6 +682,8 @@ static void xen_log_stop(MemoryListener *listener, MemoryRegionSection *section,
 
     if (old & ~new & (1 << DIRTY_MEMORY_VGA)) {
         state->log_for_dirtybit = NULL;
+        g_free(state->dirty_bitmap);
+        state->dirty_bitmap = NULL;
         /* Disable dirty bit tracking */
         xen_track_dirty_vram(xen_domid, 0, 0, NULL);
     }

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

Reviewed-by on v2 4/4
#9 lore raw

Re: [Qemu-devel] [PATCH v2 4/4] xen: Avoid VLA

In reply to Anthony PERARD
Quoted 8 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 18 June 2019 12:24
To: [email protected]
Cc: Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; Stefano Stabellini <[email protected]>; [email protected]
Subject: [PATCH v2 4/4] xen: Avoid VLA

Quoted 6 lines

Avoid using a variable length array.

We allocate the `dirty_bitmap' buffer only once when we start tracking for dirty bits.

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

#10 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:

Subject: [Xen-devel] [PATCH v2 0/4] Fix build of Xen support + cleanup
Type: series
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 ===

From https://github.com/patchew-project/qemu
076243ffe6..cdfaa2720f master -> master
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
386b6f4c2b xen: Avoid VLA
8fe6212aee xen: Drop includes of xen/hvm/params.h
38f6494e18 xen: Import other xen/io/*.h
895b834690 xen: Fix build with public headers

=== OUTPUT BEGIN ===
1/4 Checking commit 895b83469074 (xen: Fix build with public headers)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #95:
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#100: FILE: include/hw/xen/interface/grant_table.h:1:
+/******************************************************************************

WARNING: Block comments use a leading /* on a separate line
#142: FILE: include/hw/xen/interface/io/blkif.h:1:
+/******************************************************************************

ERROR: spaces required around that '<<' (ctx:VxV) #805: FILE: include/hw/xen/interface/io/blkif.h:664:
+#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */

                                ^

WARNING: architecture specific defines should be avoided #821: FILE: include/hw/xen/interface/io/blkif.h:680:
+#ifdef __i386__

ERROR: code indent should never use tabs #968: FILE: include/hw/xen/interface/io/usbif.h:105:
+^IUSB_VER_UNKNOWN = 0,$

ERROR: code indent should never use tabs #969: FILE: include/hw/xen/interface/io/usbif.h:106:
+^IUSB_VER_USB11,$

ERROR: code indent should never use tabs #970: FILE: include/hw/xen/interface/io/usbif.h:107:
+^IUSB_VER_USB20,$

ERROR: code indent should never use tabs #971: FILE: include/hw/xen/interface/io/usbif.h:108:
+^IUSB_VER_USB30,^I/* not supported yet */$

ERROR: code indent should never use tabs #977: FILE: include/hw/xen/interface/io/usbif.h:114:
+ * - port number:^Ibits 0-4$

ERROR: code indent should never use tabs #978: FILE: include/hw/xen/interface/io/usbif.h:115:
+ *^I^I^I^I(USB_MAXCHILDREN is 31)$

ERROR: code indent should never use tabs #980: FILE: include/hw/xen/interface/io/usbif.h:117:
+ * - operation flag:^Ibit 5$

ERROR: code indent should never use tabs #981: FILE: include/hw/xen/interface/io/usbif.h:118:
+ *^I^I^I^I(0 = submit urb,$

ERROR: code indent should never use tabs #982: FILE: include/hw/xen/interface/io/usbif.h:119:
+ *^I^I^I^I 1 = unlink urb)$

ERROR: code indent should never use tabs #984: FILE: include/hw/xen/interface/io/usbif.h:121:
+ * - direction:^I^Ibit 7$

ERROR: code indent should never use tabs #985: FILE: include/hw/xen/interface/io/usbif.h:122:
+ *^I^I^I^I(0 = Host-to-Device [Out]$

ERROR: code indent should never use tabs #986: FILE: include/hw/xen/interface/io/usbif.h:123:
+ *^I^I^I^I 1 = Device-to-Host [In])$

ERROR: code indent should never use tabs #988: FILE: include/hw/xen/interface/io/usbif.h:125:
+ * - device address:^Ibits 8-14$

ERROR: code indent should never use tabs #990: FILE: include/hw/xen/interface/io/usbif.h:127:
+ * - endpoint:^I^Ibits 15-18$

ERROR: code indent should never use tabs #992: FILE: include/hw/xen/interface/io/usbif.h:129:
+ * - pipe type:^Ibits 30-31$

ERROR: code indent should never use tabs #993: FILE: include/hw/xen/interface/io/usbif.h:130:
+ *^I^I^I^I(00 = isochronous, 01 = interrupt,$

ERROR: code indent should never use tabs #994: FILE: include/hw/xen/interface/io/usbif.h:131:
+ *^I^I^I^I 10 = control, 11 = bulk)$

ERROR: code indent should never use tabs #997: FILE: include/hw/xen/interface/io/usbif.h:134:
+#define USBIF_PIPE_PORT_MASK^I0x0000001f$

ERROR: code indent should never use tabs #998: FILE: include/hw/xen/interface/io/usbif.h:135:
+#define USBIF_PIPE_UNLINK^I0x00000020$

ERROR: code indent should never use tabs #999: FILE: include/hw/xen/interface/io/usbif.h:136:
+#define USBIF_PIPE_DIR^I^I0x00000080$

ERROR: code indent should never use tabs #1000: FILE: include/hw/xen/interface/io/usbif.h:137:
+#define USBIF_PIPE_DEV_MASK^I0x0000007f$

ERROR: code indent should never use tabs #1001: FILE: include/hw/xen/interface/io/usbif.h:138:
+#define USBIF_PIPE_DEV_SHIFT^I8$

ERROR: code indent should never use tabs #1002: FILE: include/hw/xen/interface/io/usbif.h:139:
+#define USBIF_PIPE_EP_MASK^I0x0000000f$

ERROR: code indent should never use tabs #1003: FILE: include/hw/xen/interface/io/usbif.h:140:
+#define USBIF_PIPE_EP_SHIFT^I15$

ERROR: code indent should never use tabs #1004: FILE: include/hw/xen/interface/io/usbif.h:141:
+#define USBIF_PIPE_TYPE_MASK^I0x00000003$

ERROR: code indent should never use tabs #1005: FILE: include/hw/xen/interface/io/usbif.h:142:
+#define USBIF_PIPE_TYPE_SHIFT^I30$

ERROR: code indent should never use tabs #1006: FILE: include/hw/xen/interface/io/usbif.h:143:
+#define USBIF_PIPE_TYPE_ISOC^I0$

ERROR: code indent should never use tabs #1007: FILE: include/hw/xen/interface/io/usbif.h:144:
+#define USBIF_PIPE_TYPE_INT^I1$

ERROR: code indent should never use tabs #1008: FILE: include/hw/xen/interface/io/usbif.h:145:
+#define USBIF_PIPE_TYPE_CTRL^I2$

ERROR: code indent should never use tabs #1009: FILE: include/hw/xen/interface/io/usbif.h:146:
+#define USBIF_PIPE_TYPE_BULK^I3$

ERROR: code indent should never use tabs
#1011: FILE: include/hw/xen/interface/io/usbif.h:148:
+#define usbif_pipeportnum(pipe)^I^I^I((pipe) & USBIF_PIPE_PORT_MASK)$

ERROR: code indent should never use tabs
#1012: FILE: include/hw/xen/interface/io/usbif.h:149:
+#define usbif_setportnum_pipe(pipe, portnum)^I((pipe) | (portnum))$

ERROR: code indent should never use tabs
#1014: FILE: include/hw/xen/interface/io/usbif.h:151:
+#define usbif_pipeunlink(pipe)^I^I^I((pipe) & USBIF_PIPE_UNLINK)$

ERROR: code indent should never use tabs
#1015: FILE: include/hw/xen/interface/io/usbif.h:152:
+#define usbif_pipesubmit(pipe)^I^I^I(!usbif_pipeunlink(pipe))$

ERROR: code indent should never use tabs
#1016: FILE: include/hw/xen/interface/io/usbif.h:153:
+#define usbif_setunlink_pipe(pipe)^I^I((pipe) | USBIF_PIPE_UNLINK)$

ERROR: code indent should never use tabs
#1018: FILE: include/hw/xen/interface/io/usbif.h:155:
+#define usbif_pipein(pipe)^I^I^I((pipe) & USBIF_PIPE_DIR)$

ERROR: code indent should never use tabs
#1019: FILE: include/hw/xen/interface/io/usbif.h:156:
+#define usbif_pipeout(pipe)^I^I^I(!usbif_pipein(pipe))$

ERROR: code indent should never use tabs #1021: FILE: include/hw/xen/interface/io/usbif.h:158:
+#define usbif_pipedevice(pipe)^I^I^I\$

ERROR: code indent should never use tabs
#1022: FILE: include/hw/xen/interface/io/usbif.h:159:
+^I^I(((pipe) >> USBIF_PIPE_DEV_SHIFT) & USBIF_PIPE_DEV_MASK)$

ERROR: code indent should never use tabs #1024: FILE: include/hw/xen/interface/io/usbif.h:161:
+#define usbif_pipeendpoint(pipe)^I^I\$

ERROR: code indent should never use tabs
#1025: FILE: include/hw/xen/interface/io/usbif.h:162:
+^I^I(((pipe) >> USBIF_PIPE_EP_SHIFT) & USBIF_PIPE_EP_MASK)$

ERROR: code indent should never use tabs #1027: FILE: include/hw/xen/interface/io/usbif.h:164:
+#define usbif_pipetype(pipe)^I^I^I\$

ERROR: code indent should never use tabs
#1028: FILE: include/hw/xen/interface/io/usbif.h:165:
+^I^I(((pipe) >> USBIF_PIPE_TYPE_SHIFT) & USBIF_PIPE_TYPE_MASK)$

ERROR: code indent should never use tabs
#1029: FILE: include/hw/xen/interface/io/usbif.h:166:
+#define usbif_pipeisoc(pipe)^I(usbif_pipetype(pipe) == USBIF_PIPE_TYPE_ISOC)$

ERROR: code indent should never use tabs
#1030: FILE: include/hw/xen/interface/io/usbif.h:167:
+#define usbif_pipeint(pipe)^I(usbif_pipetype(pipe) == USBIF_PIPE_TYPE_INT)$

ERROR: code indent should never use tabs
#1031: FILE: include/hw/xen/interface/io/usbif.h:168:
+#define usbif_pipectrl(pipe)^I(usbif_pipetype(pipe) == USBIF_PIPE_TYPE_CTRL)$

ERROR: code indent should never use tabs
#1032: FILE: include/hw/xen/interface/io/usbif.h:169:
+#define usbif_pipebulk(pipe)^I(usbif_pipetype(pipe) == USBIF_PIPE_TYPE_BULK)$

ERROR: code indent should never use tabs #1035: FILE: include/hw/xen/interface/io/usbif.h:172:
+#define USBIF_MAX_PORTNR^I31$

ERROR: code indent should never use tabs #1036: FILE: include/hw/xen/interface/io/usbif.h:173:
+#define USBIF_RING_SIZE^I4096$

ERROR: code indent should never use tabs #1042: FILE: include/hw/xen/interface/io/usbif.h:179:
+^Igrant_ref_t gref;$

ERROR: code indent should never use tabs #1043: FILE: include/hw/xen/interface/io/usbif.h:180:
+^Iuint16_t offset;$

ERROR: code indent should never use tabs #1044: FILE: include/hw/xen/interface/io/usbif.h:181:
+^Iuint16_t length;$

ERROR: code indent should never use tabs #1048: FILE: include/hw/xen/interface/io/usbif.h:185:
+^Iuint16_t id; /* request id */$

ERROR: code indent should never use tabs
#1049: FILE: include/hw/xen/interface/io/usbif.h:186:
+^Iuint16_t nr_buffer_segs; /* number of urb->transfer_buffer segments */$

ERROR: code indent should never use tabs #1051: FILE: include/hw/xen/interface/io/usbif.h:188:
+^I/* basic urb parameter */$

ERROR: code indent should never use tabs #1052: FILE: include/hw/xen/interface/io/usbif.h:189:
+^Iuint32_t pipe;$

ERROR: code indent should never use tabs #1053: FILE: include/hw/xen/interface/io/usbif.h:190:
+^Iuint16_t transfer_flags;$

ERROR: code indent should never use tabs #1054: FILE: include/hw/xen/interface/io/usbif.h:191:
+#define USBIF_SHORT_NOT_OK^I0x0001$

ERROR: code indent should never use tabs #1055: FILE: include/hw/xen/interface/io/usbif.h:192:
+^Iuint16_t buffer_length;$

ERROR: code indent should never use tabs #1056: FILE: include/hw/xen/interface/io/usbif.h:193:
+^Iunion {$

ERROR: code indent should never use tabs #1057: FILE: include/hw/xen/interface/io/usbif.h:194:
+^I^Iuint8_t ctrl[8]; /* setup_packet (Ctrl) */$

ERROR: code indent should never use tabs #1059: FILE: include/hw/xen/interface/io/usbif.h:196:
+^I^Istruct {$

ERROR: code indent should never use tabs
#1060: FILE: include/hw/xen/interface/io/usbif.h:197:
+^I^I^Iuint16_t interval; /* maximum (1024*8) in usb core */$

ERROR: code indent should never use tabs #1061: FILE: include/hw/xen/interface/io/usbif.h:198:
+^I^I^Iuint16_t start_frame; /* start frame */$

ERROR: code indent should never use tabs
#1062: FILE: include/hw/xen/interface/io/usbif.h:199:
+^I^I^Iuint16_t number_of_packets; /* number of ISO packet */$

ERROR: line over 90 characters
#1063: FILE: include/hw/xen/interface/io/usbif.h:200:
+ uint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */

ERROR: code indent should never use tabs
#1063: FILE: include/hw/xen/interface/io/usbif.h:200:
+^I^I^Iuint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */$

ERROR: code indent should never use tabs #1064: FILE: include/hw/xen/interface/io/usbif.h:201:
+^I^I} isoc;$

ERROR: code indent should never use tabs #1066: FILE: include/hw/xen/interface/io/usbif.h:203:
+^I^Istruct {$

ERROR: code indent should never use tabs
#1067: FILE: include/hw/xen/interface/io/usbif.h:204:
+^I^I^Iuint16_t interval; /* maximum (1024*8) in usb core */$

ERROR: code indent should never use tabs #1068: FILE: include/hw/xen/interface/io/usbif.h:205:
+^I^I^Iuint16_t pad[3];$

ERROR: code indent should never use tabs #1069: FILE: include/hw/xen/interface/io/usbif.h:206:
+^I^I} intr;$

ERROR: code indent should never use tabs #1071: FILE: include/hw/xen/interface/io/usbif.h:208:
+^I^Istruct {$

ERROR: code indent should never use tabs #1072: FILE: include/hw/xen/interface/io/usbif.h:209:
+^I^I^Iuint16_t unlink_id; /* unlink request id */$

ERROR: code indent should never use tabs #1073: FILE: include/hw/xen/interface/io/usbif.h:210:
+^I^I^Iuint16_t pad[3];$

ERROR: code indent should never use tabs #1074: FILE: include/hw/xen/interface/io/usbif.h:211:
+^I^I} unlink;$

ERROR: code indent should never use tabs #1076: FILE: include/hw/xen/interface/io/usbif.h:213:
+^I} u;$

ERROR: code indent should never use tabs #1078: FILE: include/hw/xen/interface/io/usbif.h:215:
+^I/* urb data segments */$

ERROR: code indent should never use tabs
#1079: FILE: include/hw/xen/interface/io/usbif.h:216:
+^Istruct usbif_request_segment seg[USBIF_MAX_SEGMENTS_PER_REQUEST];$

ERROR: code indent should never use tabs #1084: FILE: include/hw/xen/interface/io/usbif.h:221:
+^Iuint16_t id; /* request id */$

ERROR: code indent should never use tabs #1085: FILE: include/hw/xen/interface/io/usbif.h:222:
+^Iuint16_t start_frame; /* start frame (ISO) */$

ERROR: code indent should never use tabs #1086: FILE: include/hw/xen/interface/io/usbif.h:223:
+^Iint32_t status; /* status (non-ISO) */$

ERROR: code indent should never use tabs #1087: FILE: include/hw/xen/interface/io/usbif.h:224:
+^Iint32_t actual_length; /* actual transfer length */$

ERROR: code indent should never use tabs #1088: FILE: include/hw/xen/interface/io/usbif.h:225:
+^Iint32_t error_count; /* number of ISO errors */$

WARNING: line over 80 characters
#1092: FILE: include/hw/xen/interface/io/usbif.h:229:
+DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct usbif_urb_response);

ERROR: code indent should never use tabs #1099: FILE: include/hw/xen/interface/io/usbif.h:236:
+^Iuint16_t id;$

ERROR: code indent should never use tabs #1104: FILE: include/hw/xen/interface/io/usbif.h:241:
+^Iuint16_t id; /* request id */$

ERROR: code indent should never use tabs #1105: FILE: include/hw/xen/interface/io/usbif.h:242:
+^Iuint8_t portnum; /* port number */$

ERROR: code indent should never use tabs #1106: FILE: include/hw/xen/interface/io/usbif.h:243:
+^Iuint8_t speed; /* usb_device_speed */$

ERROR: code indent should never use tabs #1107: FILE: include/hw/xen/interface/io/usbif.h:244:
+#define USBIF_SPEED_NONE^I0$

ERROR: code indent should never use tabs #1108: FILE: include/hw/xen/interface/io/usbif.h:245:
+#define USBIF_SPEED_LOW^I^I1$

ERROR: code indent should never use tabs #1109: FILE: include/hw/xen/interface/io/usbif.h:246:
+#define USBIF_SPEED_FULL^I2$

ERROR: code indent should never use tabs #1110: FILE: include/hw/xen/interface/io/usbif.h:247:
+#define USBIF_SPEED_HIGH^I3$

WARNING: line over 80 characters
#1114: FILE: include/hw/xen/interface/io/usbif.h:251:
+DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct usbif_conn_response);

total: 93 errors, 6 warnings, 1036 lines checked

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

2/4 Checking commit 38f6494e182e (xen: Import other xen/io/*.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #94:
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#99: FILE: include/hw/xen/interface/io/console.h:1:
+/******************************************************************************

ERROR: spaces required around that '-' (ctx:VxV) #130: FILE: include/hw/xen/interface/io/console.h:32:
+#define MASK_XENCONS_IDX(idx, ring) ((idx) & (sizeof(ring)-1))

                                                           ^

ERROR: open brace '{' following struct go on the same line #195: FILE: include/hw/xen/interface/io/fbif.h:45:
+struct xenfb_update
+{

ERROR: open brace '{' following struct go on the same line #210: FILE: include/hw/xen/interface/io/fbif.h:60:
+struct xenfb_resize
+{

ERROR: open brace '{' following union go on the same line #222: FILE: include/hw/xen/interface/io/fbif.h:72:
+union xenfb_out_event
+{

ERROR: open brace '{' following struct go on the same line #248: FILE: include/hw/xen/interface/io/fbif.h:98:
+struct xenfb_refresh_period
+{

WARNING: Block comments use a leading /* on a separate line #250: FILE: include/hw/xen/interface/io/fbif.h:100:
+ uint32_t period; /* period of refresh, in ms,

WARNING: Block comments use a trailing */ on a separate line #251: FILE: include/hw/xen/interface/io/fbif.h:101:
+ * XENFB_NO_REFRESH if no refresh is needed */

ERROR: open brace '{' following union go on the same line #257: FILE: include/hw/xen/interface/io/fbif.h:107:
+union xenfb_in_event
+{

ERROR: open brace '{' following struct go on the same line #282: FILE: include/hw/xen/interface/io/fbif.h:132:
+struct xenfb_page
+{

ERROR: open brace '{' following struct go on the same line #583: FILE: include/hw/xen/interface/io/kbdif.h:271:
+struct xenkbd_motion
+{

ERROR: open brace '{' following struct go on the same line #610: FILE: include/hw/xen/interface/io/kbdif.h:298:
+struct xenkbd_key
+{

ERROR: open brace '{' following struct go on the same line #641: FILE: include/hw/xen/interface/io/kbdif.h:329:
+struct xenkbd_position
+{

ERROR: open brace '{' following union go on the same line #815: FILE: include/hw/xen/interface/io/kbdif.h:503:
+union xenkbd_in_event
+{

ERROR: open brace '{' following union go on the same line #845: FILE: include/hw/xen/interface/io/kbdif.h:533:
+union xenkbd_out_event
+{

ERROR: open brace '{' following struct go on the same line #873: FILE: include/hw/xen/interface/io/kbdif.h:561:
+struct xenkbd_page
+{

WARNING: Block comments use a leading /* on a separate line
#885: FILE: include/hw/xen/interface/io/netif.h:1:
+/******************************************************************************

ERROR: spaces required around that '<<' (ctx:VxV) #1257: FILE: include/hw/xen/interface/io/netif.h:373:
+#define XEN_NETIF_CTRLF_GREF_readonly (1U<<_XEN_NETIF_CTRLF_GREF_readonly)

                                             ^

ERROR: spaces required around that '<<' (ctx:VxV) #1772: FILE: include/hw/xen/interface/io/netif.h:888:
+#define NETTXF_csum_blank (1U<<_NETTXF_csum_blank)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1776: FILE: include/hw/xen/interface/io/netif.h:892:
+#define NETTXF_data_validated (1U<<_NETTXF_data_validated)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1780: FILE: include/hw/xen/interface/io/netif.h:896:
+#define NETTXF_more_data (1U<<_NETTXF_more_data)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1784: FILE: include/hw/xen/interface/io/netif.h:900:
+#define NETTXF_extra_info (1U<<_NETTXF_extra_info)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV)
#1806: FILE: include/hw/xen/interface/io/netif.h:922:
+#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)

                                       ^

ERROR: spaces required around that '<<' (ctx:VxV) #1855: FILE: include/hw/xen/interface/io/netif.h:971:
+#define NETRXF_data_validated (1U<<_NETRXF_data_validated)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1859: FILE: include/hw/xen/interface/io/netif.h:975:
+#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1863: FILE: include/hw/xen/interface/io/netif.h:979:
+#define NETRXF_more_data (1U<<_NETRXF_more_data)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1867: FILE: include/hw/xen/interface/io/netif.h:983:
+#define NETRXF_extra_info (1U<<_NETRXF_extra_info)

                                   ^

ERROR: spaces required around that '<<' (ctx:VxV) #1871: FILE: include/hw/xen/interface/io/netif.h:987:
+#define NETRXF_gso_prefix (1U<<_NETRXF_gso_prefix)

                                   ^

WARNING: Block comments use a leading /* on a separate line
#1901: FILE: include/hw/xen/interface/io/protocols.h:1:
+/******************************************************************************

WARNING: architecture specific defines should be avoided #1932: FILE: include/hw/xen/interface/io/protocols.h:32:
+#if defined(__i386__)

WARNING: Block comments use a leading /* on a separate line
#1949: FILE: include/hw/xen/interface/io/xenbus.h:1:
+/*****************************************************************************

total: 24 errors, 8 warnings, 1943 lines checked

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

3/4 Checking commit 8fe6212aee61 (xen: Drop includes of xen/hvm/params.h) 4/4 Checking commit 386b6f4c2bb2 (xen: Avoid VLA)
=== 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]
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel