qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix QEMU compilation on Debian 10
@ 2023-04-05 12:59 David 'Digit' Turner
  2023-04-05 12:59 ` [PATCH 1/2] Fix libvhost-user.c compilation David 'Digit' Turner
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David 'Digit' Turner @ 2023-04-05 12:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: David 'Digit' Turner

QEMU does not compile on an old Debian 10 system for the
following reasons:

- Several sources include recent kernel headers that are
  not provided by this system, and not listed in
  linux-headers/

- The libvhost-user.c source file ends up including a
  system kernel header, instead of the up-to-date
  standard-headers/ version that contains the right
  macro definition.

David 'Digit' Turner (2):
  Fix libvhost-user.c compilation.
  Add missing Linux kernel headers.

 linux-headers/linux/const.h               |  36 +++++++
 linux-headers/linux/memfd.h               |  35 +++++++
 linux-headers/linux/nvme_ioctl.h          | 114 ++++++++++++++++++++++
 linux-headers/linux/vfio.h                |  15 +--
 scripts/update-linux-headers.sh           |   4 +-
 subprojects/libvhost-user/libvhost-user.c |   6 ++
 6 files changed, 202 insertions(+), 8 deletions(-)
 create mode 100644 linux-headers/linux/const.h
 create mode 100644 linux-headers/linux/memfd.h
 create mode 100644 linux-headers/linux/nvme_ioctl.h

-- 
2.40.0.348.gf938b09366-goog



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

* [PATCH 1/2] Fix libvhost-user.c compilation.
  2023-04-05 12:59 [PATCH 0/2] Fix QEMU compilation on Debian 10 David 'Digit' Turner
@ 2023-04-05 12:59 ` David 'Digit' Turner
  2023-04-07  7:56   ` Michael S. Tsirkin
  2023-04-05 12:59 ` [PATCH 2/2] Add missing Linux kernel headers David 'Digit' Turner
  2023-04-26 19:10 ` [PATCH 0/2] Fix QEMU compilation on Debian 10 Paolo Bonzini
  2 siblings, 1 reply; 11+ messages in thread
From: David 'Digit' Turner @ 2023-04-05 12:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: David 'Digit' Turner, Michael S. Tsirkin

The source file uses VIRTIO_F_VERSION_1 which is
not defined by <linux/virtio_config.h> on Debian 10.

The system-provided <linux/virtio_config.h> which
does not include the macro definition is included
through <linux/vhost.h>, so fix the issue by including
the standard-headers version before that.

Signed-off-by: David 'Digit' Turner <digit@google.com>
---
 subprojects/libvhost-user/libvhost-user.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index 0200b78e8e..0a5768cb55 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -32,6 +32,12 @@
 #include <sys/mman.h>
 #include <endian.h>
 
+/* Necessary to provide VIRTIO_F_VERSION_1 on system
+ * with older linux headers. Must appear before
+ * <linux/vhost.h> below.
+ */
+#include "standard-headers/linux/virtio_config.h"
+
 #if defined(__linux__)
 #include <sys/syscall.h>
 #include <fcntl.h>
-- 
2.40.0.348.gf938b09366-goog



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

* [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 12:59 [PATCH 0/2] Fix QEMU compilation on Debian 10 David 'Digit' Turner
  2023-04-05 12:59 ` [PATCH 1/2] Fix libvhost-user.c compilation David 'Digit' Turner
@ 2023-04-05 12:59 ` David 'Digit' Turner
  2023-04-05 13:06   ` Cornelia Huck
  2023-04-26 19:10 ` [PATCH 0/2] Fix QEMU compilation on Debian 10 Paolo Bonzini
  2 siblings, 1 reply; 11+ messages in thread
From: David 'Digit' Turner @ 2023-04-05 12:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: David 'Digit' Turner, Michael S. Tsirkin, Cornelia Huck,
	Paolo Bonzini

Add <linux/memfd.h>, used by hw/display/virtio-gpu-udmabuf.c
Add <linux/nvme_ioctl.h>, used by qga/commands-posix.c
Add <linux/const.h> used by kvm-all.c, which requires
the _BITUL() macro definition to be available.

Without these, QEMU will not compile on Debian 10 systems.

The script has then been run against the official
6.2.8 kernel source tree (current stable release),
which explains why comments in <linux/vfio.h>
have been updated too.

Signed-off-by: David 'Digit' Turner <digit@google.com>
---
 linux-headers/linux/const.h      |  36 ++++++++++
 linux-headers/linux/memfd.h      |  35 ++++++++++
 linux-headers/linux/nvme_ioctl.h | 114 +++++++++++++++++++++++++++++++
 linux-headers/linux/vfio.h       |  15 ++--
 scripts/update-linux-headers.sh  |   4 +-
 5 files changed, 196 insertions(+), 8 deletions(-)
 create mode 100644 linux-headers/linux/const.h
 create mode 100644 linux-headers/linux/memfd.h
 create mode 100644 linux-headers/linux/nvme_ioctl.h

diff --git a/linux-headers/linux/const.h b/linux-headers/linux/const.h
new file mode 100644
index 0000000000..5e48987251
--- /dev/null
+++ b/linux-headers/linux/const.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code.  Therefore we cannot annotate them always with
+ * 'UL' and other type specifiers unilaterally.  We
+ * use the following macros to deal with this.
+ *
+ * Similarly, _AT() will cast an expression with a type in C, but
+ * leave it unchanged in asm.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)	X
+#define _AT(T,X)	X
+#else
+#define __AC(X,Y)	(X##Y)
+#define _AC(X,Y)	__AC(X,Y)
+#define _AT(T,X)	((T)(X))
+#endif
+
+#define _UL(x)		(_AC(x, UL))
+#define _ULL(x)		(_AC(x, ULL))
+
+#define _BITUL(x)	(_UL(1) << (x))
+#define _BITULL(x)	(_ULL(1) << (x))
+
+#define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
+
+#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
+#endif /* _LINUX_CONST_H */
diff --git a/linux-headers/linux/memfd.h b/linux-headers/linux/memfd.h
new file mode 100644
index 0000000000..39ed783fac
--- /dev/null
+++ b/linux-headers/linux/memfd.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _LINUX_MEMFD_H
+#define _LINUX_MEMFD_H
+
+#include <asm-generic/hugetlb_encode.h>
+
+/* flags for memfd_create(2) (unsigned int) */
+#define MFD_CLOEXEC		0x0001U
+#define MFD_ALLOW_SEALING	0x0002U
+#define MFD_HUGETLB		0x0004U
+
+/*
+ * Huge page size encoding when MFD_HUGETLB is specified, and a huge page
+ * size other than the default is desired.  See hugetlb_encode.h.
+ * All known huge page size encodings are provided here.  It is the
+ * responsibility of the application to know which sizes are supported on
+ * the running system.  See mmap(2) man page for details.
+ */
+#define MFD_HUGE_SHIFT	HUGETLB_FLAG_ENCODE_SHIFT
+#define MFD_HUGE_MASK	HUGETLB_FLAG_ENCODE_MASK
+
+#define MFD_HUGE_64KB	HUGETLB_FLAG_ENCODE_64KB
+#define MFD_HUGE_512KB	HUGETLB_FLAG_ENCODE_512KB
+#define MFD_HUGE_1MB	HUGETLB_FLAG_ENCODE_1MB
+#define MFD_HUGE_2MB	HUGETLB_FLAG_ENCODE_2MB
+#define MFD_HUGE_8MB	HUGETLB_FLAG_ENCODE_8MB
+#define MFD_HUGE_16MB	HUGETLB_FLAG_ENCODE_16MB
+#define MFD_HUGE_32MB	HUGETLB_FLAG_ENCODE_32MB
+#define MFD_HUGE_256MB	HUGETLB_FLAG_ENCODE_256MB
+#define MFD_HUGE_512MB	HUGETLB_FLAG_ENCODE_512MB
+#define MFD_HUGE_1GB	HUGETLB_FLAG_ENCODE_1GB
+#define MFD_HUGE_2GB	HUGETLB_FLAG_ENCODE_2GB
+#define MFD_HUGE_16GB	HUGETLB_FLAG_ENCODE_16GB
+
+#endif /* _LINUX_MEMFD_H */
diff --git a/linux-headers/linux/nvme_ioctl.h b/linux-headers/linux/nvme_ioctl.h
new file mode 100644
index 0000000000..f8df31dbc4
--- /dev/null
+++ b/linux-headers/linux/nvme_ioctl.h
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Definitions for the NVM Express ioctl interface
+ * Copyright (c) 2011-2014, Intel Corporation.
+ */
+
+#ifndef _LINUX_NVME_IOCTL_H
+#define _LINUX_NVME_IOCTL_H
+
+#include <linux/types.h>
+
+struct nvme_user_io {
+	__u8	opcode;
+	__u8	flags;
+	__u16	control;
+	__u16	nblocks;
+	__u16	rsvd;
+	__u64	metadata;
+	__u64	addr;
+	__u64	slba;
+	__u32	dsmgmt;
+	__u32	reftag;
+	__u16	apptag;
+	__u16	appmask;
+};
+
+struct nvme_passthru_cmd {
+	__u8	opcode;
+	__u8	flags;
+	__u16	rsvd1;
+	__u32	nsid;
+	__u32	cdw2;
+	__u32	cdw3;
+	__u64	metadata;
+	__u64	addr;
+	__u32	metadata_len;
+	__u32	data_len;
+	__u32	cdw10;
+	__u32	cdw11;
+	__u32	cdw12;
+	__u32	cdw13;
+	__u32	cdw14;
+	__u32	cdw15;
+	__u32	timeout_ms;
+	__u32	result;
+};
+
+struct nvme_passthru_cmd64 {
+	__u8	opcode;
+	__u8	flags;
+	__u16	rsvd1;
+	__u32	nsid;
+	__u32	cdw2;
+	__u32	cdw3;
+	__u64	metadata;
+	__u64	addr;
+	__u32	metadata_len;
+	union {
+		__u32	data_len; /* for non-vectored io */
+		__u32	vec_cnt; /* for vectored io */
+	};
+	__u32	cdw10;
+	__u32	cdw11;
+	__u32	cdw12;
+	__u32	cdw13;
+	__u32	cdw14;
+	__u32	cdw15;
+	__u32	timeout_ms;
+	__u32   rsvd2;
+	__u64	result;
+};
+
+/* same as struct nvme_passthru_cmd64, minus the 8b result field */
+struct nvme_uring_cmd {
+	__u8	opcode;
+	__u8	flags;
+	__u16	rsvd1;
+	__u32	nsid;
+	__u32	cdw2;
+	__u32	cdw3;
+	__u64	metadata;
+	__u64	addr;
+	__u32	metadata_len;
+	__u32	data_len;
+	__u32	cdw10;
+	__u32	cdw11;
+	__u32	cdw12;
+	__u32	cdw13;
+	__u32	cdw14;
+	__u32	cdw15;
+	__u32	timeout_ms;
+	__u32   rsvd2;
+};
+
+#define nvme_admin_cmd nvme_passthru_cmd
+
+#define NVME_IOCTL_ID		_IO('N', 0x40)
+#define NVME_IOCTL_ADMIN_CMD	_IOWR('N', 0x41, struct nvme_admin_cmd)
+#define NVME_IOCTL_SUBMIT_IO	_IOW('N', 0x42, struct nvme_user_io)
+#define NVME_IOCTL_IO_CMD	_IOWR('N', 0x43, struct nvme_passthru_cmd)
+#define NVME_IOCTL_RESET	_IO('N', 0x44)
+#define NVME_IOCTL_SUBSYS_RESET	_IO('N', 0x45)
+#define NVME_IOCTL_RESCAN	_IO('N', 0x46)
+#define NVME_IOCTL_ADMIN64_CMD	_IOWR('N', 0x47, struct nvme_passthru_cmd64)
+#define NVME_IOCTL_IO64_CMD	_IOWR('N', 0x48, struct nvme_passthru_cmd64)
+#define NVME_IOCTL_IO64_CMD_VEC	_IOWR('N', 0x49, struct nvme_passthru_cmd64)
+
+/* io_uring async commands: */
+#define NVME_URING_CMD_IO	_IOWR('N', 0x80, struct nvme_uring_cmd)
+#define NVME_URING_CMD_IO_VEC	_IOWR('N', 0x81, struct nvme_uring_cmd)
+#define NVME_URING_CMD_ADMIN	_IOWR('N', 0x82, struct nvme_uring_cmd)
+#define NVME_URING_CMD_ADMIN_VEC _IOWR('N', 0x83, struct nvme_uring_cmd)
+
+#endif /* _LINUX_NVME_IOCTL_H */
diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
index c59692ce0b..4a534edbdc 100644
--- a/linux-headers/linux/vfio.h
+++ b/linux-headers/linux/vfio.h
@@ -49,7 +49,11 @@
 /* Supports VFIO_DMA_UNMAP_FLAG_ALL */
 #define VFIO_UNMAP_ALL			9
 
-/* Supports the vaddr flag for DMA map and unmap */
+/*
+ * Supports the vaddr flag for DMA map and unmap.  Not supported for mediated
+ * devices, so this capability is subject to change as groups are added or
+ * removed.
+ */
 #define VFIO_UPDATE_VADDR		10
 
 /*
@@ -1343,8 +1347,7 @@ struct vfio_iommu_type1_info_dma_avail {
  * Map process virtual addresses to IO virtual addresses using the
  * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required.
  *
- * If flags & VFIO_DMA_MAP_FLAG_VADDR, update the base vaddr for iova, and
- * unblock translation of host virtual addresses in the iova range.  The vaddr
+ * If flags & VFIO_DMA_MAP_FLAG_VADDR, update the base vaddr for iova. The vaddr
  * must have previously been invalidated with VFIO_DMA_UNMAP_FLAG_VADDR.  To
  * maintain memory consistency within the user application, the updated vaddr
  * must address the same memory object as originally mapped.  Failure to do so
@@ -1395,9 +1398,9 @@ struct vfio_bitmap {
  * must be 0.  This cannot be combined with the get-dirty-bitmap flag.
  *
  * If flags & VFIO_DMA_UNMAP_FLAG_VADDR, do not unmap, but invalidate host
- * virtual addresses in the iova range.  Tasks that attempt to translate an
- * iova's vaddr will block.  DMA to already-mapped pages continues.  This
- * cannot be combined with the get-dirty-bitmap flag.
+ * virtual addresses in the iova range.  DMA to already-mapped pages continues.
+ * Groups may not be added to the container while any addresses are invalid.
+ * This cannot be combined with the get-dirty-bitmap flag.
  */
 struct vfio_iommu_type1_dma_unmap {
 	__u32	argsz;
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index b1ad99cba8..e21225baf3 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -160,8 +160,8 @@ done
 
 rm -rf "$output/linux-headers/linux"
 mkdir -p "$output/linux-headers/linux"
-for header in kvm.h vfio.h vfio_ccw.h vfio_zdev.h vhost.h \
-              psci.h psp-sev.h userfaultfd.h mman.h vduse.h; do
+for header in const.h kvm.h vfio.h vfio_ccw.h vfio_zdev.h vhost.h \
+              psci.h psp-sev.h userfaultfd.h memfd.h mman.h nvme_ioctl.h vduse.h; do
     cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
 done
 
-- 
2.40.0.348.gf938b09366-goog



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

* Re: [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 12:59 ` [PATCH 2/2] Add missing Linux kernel headers David 'Digit' Turner
@ 2023-04-05 13:06   ` Cornelia Huck
  2023-04-05 13:42     ` David Turner
  0 siblings, 1 reply; 11+ messages in thread
From: Cornelia Huck @ 2023-04-05 13:06 UTC (permalink / raw)
  To: David 'Digit' Turner, qemu-devel
  Cc: David 'Digit' Turner, Michael S. Tsirkin, Paolo Bonzini

On Wed, Apr 05 2023, "David 'Digit' Turner" <digit@google.com> wrote:

> Add <linux/memfd.h>, used by hw/display/virtio-gpu-udmabuf.c
> Add <linux/nvme_ioctl.h>, used by qga/commands-posix.c
> Add <linux/const.h> used by kvm-all.c, which requires
> the _BITUL() macro definition to be available.
>
> Without these, QEMU will not compile on Debian 10 systems.

Hm, I wonder why we hadn't seen errors in the CI then.

>
> The script has then been run against the official
> 6.2.8 kernel source tree (current stable release),
> which explains why comments in <linux/vfio.h>
> have been updated too.

I think we usually run the script against a release or release
candidate, not stable.

>
> Signed-off-by: David 'Digit' Turner <digit@google.com>
> ---
>  linux-headers/linux/const.h      |  36 ++++++++++
>  linux-headers/linux/memfd.h      |  35 ++++++++++
>  linux-headers/linux/nvme_ioctl.h | 114 +++++++++++++++++++++++++++++++
>  linux-headers/linux/vfio.h       |  15 ++--
>  scripts/update-linux-headers.sh  |   4 +-
>  5 files changed, 196 insertions(+), 8 deletions(-)
>  create mode 100644 linux-headers/linux/const.h
>  create mode 100644 linux-headers/linux/memfd.h
>  create mode 100644 linux-headers/linux/nvme_ioctl.h



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

* Re: [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 13:06   ` Cornelia Huck
@ 2023-04-05 13:42     ` David Turner
  2023-04-05 15:54       ` Cornelia Huck
  0 siblings, 1 reply; 11+ messages in thread
From: David Turner @ 2023-04-05 13:42 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: qemu-devel, Michael S. Tsirkin, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

On Wed, Apr 5, 2023 at 3:06 PM Cornelia Huck <cohuck@redhat.com> wrote:

> On Wed, Apr 05 2023, "David 'Digit' Turner" <digit@google.com> wrote:
>
> > Add <linux/memfd.h>, used by hw/display/virtio-gpu-udmabuf.c
> > Add <linux/nvme_ioctl.h>, used by qga/commands-posix.c
> > Add <linux/const.h> used by kvm-all.c, which requires
> > the _BITUL() macro definition to be available.
> >
> > Without these, QEMU will not compile on Debian 10 systems.
>
> Hm, I wonder why we hadn't seen errors in the CI then.
>

No idea either, but fwiw, I am building on a docker.io/debian:10-slim
container.

>
> > The script has then been run against the official
> > 6.2.8 kernel source tree (current stable release),
> > which explains why comments in <linux/vfio.h>
> > have been updated too.
>
> I think we usually run the script against a release or release
> candidate, not stable.
>
> I meant that this was run against the headers of the 6.2.8 official
release, which was listed as "stable" on https://kernel.org/ (that page now
lists the 6.2.9 release btw)
I'd be happy to re-run it against a different set if you can tell me which
one (and where to get it, just in case).

>
> > Signed-off-by: David 'Digit' Turner <digit@google.com>
> > ---
> >  linux-headers/linux/const.h      |  36 ++++++++++
> >  linux-headers/linux/memfd.h      |  35 ++++++++++
> >  linux-headers/linux/nvme_ioctl.h | 114 +++++++++++++++++++++++++++++++
> >  linux-headers/linux/vfio.h       |  15 ++--
> >  scripts/update-linux-headers.sh  |   4 +-
> >  5 files changed, 196 insertions(+), 8 deletions(-)
> >  create mode 100644 linux-headers/linux/const.h
> >  create mode 100644 linux-headers/linux/memfd.h
> >  create mode 100644 linux-headers/linux/nvme_ioctl.h
>
>

[-- Attachment #2: Type: text/html, Size: 2833 bytes --]

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

* Re: [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 13:42     ` David Turner
@ 2023-04-05 15:54       ` Cornelia Huck
  2023-04-05 16:41         ` Peter Maydell
  0 siblings, 1 reply; 11+ messages in thread
From: Cornelia Huck @ 2023-04-05 15:54 UTC (permalink / raw)
  To: David Turner; +Cc: qemu-devel, Michael S. Tsirkin, Paolo Bonzini

On Wed, Apr 05 2023, David Turner <digit@google.com> wrote:

> On Wed, Apr 5, 2023 at 3:06 PM Cornelia Huck <cohuck@redhat.com> wrote:
>
>> On Wed, Apr 05 2023, "David 'Digit' Turner" <digit@google.com> wrote:
>> > The script has then been run against the official
>> > 6.2.8 kernel source tree (current stable release),
>> > which explains why comments in <linux/vfio.h>
>> > have been updated too.
>>
>> I think we usually run the script against a release or release
>> candidate, not stable.
>>
>> I meant that this was run against the headers of the 6.2.8 official
> release, which was listed as "stable" on https://kernel.org/ (that page now
> lists the 6.2.9 release btw)
> I'd be happy to re-run it against a different set if you can tell me which
> one (and where to get it, just in case).

I think most people actually run it against a checkout of Linus' git
tree, preferrably either the latest -rc version (or the latest release
during the kernel merge window) -- people usually run the script because
they want to use some new interfaces that were recently introduced to
the kernel. (This also ensures linear history, although I don't think
that's too much of a problem.)

Just make sure you note the exact version (or git hash), then it's
fine. Might also be worth splitting this into adding the new files to
the script and actually updating the headers.



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

* Re: [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 15:54       ` Cornelia Huck
@ 2023-04-05 16:41         ` Peter Maydell
  2023-04-05 17:22           ` David Turner
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2023-04-05 16:41 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: David Turner, qemu-devel, Michael S. Tsirkin, Paolo Bonzini

On Wed, 5 Apr 2023 at 16:55, Cornelia Huck <cohuck@redhat.com> wrote:
>
> On Wed, Apr 05 2023, David Turner <digit@google.com> wrote:
>
> > On Wed, Apr 5, 2023 at 3:06 PM Cornelia Huck <cohuck@redhat.com> wrote:
> >
> >> On Wed, Apr 05 2023, "David 'Digit' Turner" <digit@google.com> wrote:
> >> > The script has then been run against the official
> >> > 6.2.8 kernel source tree (current stable release),
> >> > which explains why comments in <linux/vfio.h>
> >> > have been updated too.
> >>
> >> I think we usually run the script against a release or release
> >> candidate, not stable.
> >>
> >> I meant that this was run against the headers of the 6.2.8 official
> > release, which was listed as "stable" on https://kernel.org/ (that page now
> > lists the 6.2.9 release btw)
> > I'd be happy to re-run it against a different set if you can tell me which
> > one (and where to get it, just in case).
>
> I think most people actually run it against a checkout of Linus' git
> tree, preferrably either the latest -rc version (or the latest release
> during the kernel merge window) -- people usually run the script because
> they want to use some new interfaces that were recently introduced to
> the kernel. (This also ensures linear history, although I don't think
> that's too much of a problem.)

Yeah, I think the requirement is just "it has to be against some commit
that is on the mainline of the upstream kernel", it doesn't inherently
have to be an rc or a full point release. The assumption we're making
here is that ABI is stable once a change hits Linus' git tree, and
not stable before that.

The other requirement is "don't go backwards", ie don't sync to a
commit that pre-dates whatever the last commit we synced to is.

The last sync we did was to ceaa837f96ad ("Linux 6.2-rc8").

thanks
-- PMM


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

* Re: [PATCH 2/2] Add missing Linux kernel headers.
  2023-04-05 16:41         ` Peter Maydell
@ 2023-04-05 17:22           ` David Turner
  0 siblings, 0 replies; 11+ messages in thread
From: David Turner @ 2023-04-05 17:22 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Cornelia Huck, qemu-devel, Michael S. Tsirkin, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 2174 bytes --]

On Wed, Apr 5, 2023 at 6:41 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Wed, 5 Apr 2023 at 16:55, Cornelia Huck <cohuck@redhat.com> wrote:
> >
> > On Wed, Apr 05 2023, David Turner <digit@google.com> wrote:
> >
> > > On Wed, Apr 5, 2023 at 3:06 PM Cornelia Huck <cohuck@redhat.com>
> wrote:
> > >
> > >> On Wed, Apr 05 2023, "David 'Digit' Turner" <digit@google.com> wrote:
> > >> > The script has then been run against the official
> > >> > 6.2.8 kernel source tree (current stable release),
> > >> > which explains why comments in <linux/vfio.h>
> > >> > have been updated too.
> > >>
> > >> I think we usually run the script against a release or release
> > >> candidate, not stable.
> > >>
> > >> I meant that this was run against the headers of the 6.2.8 official
> > > release, which was listed as "stable" on https://kernel.org/ (that
> page now
> > > lists the 6.2.9 release btw)
> > > I'd be happy to re-run it against a different set if you can tell me
> which
> > > one (and where to get it, just in case).
> >
> > I think most people actually run it against a checkout of Linus' git
> > tree, preferrably either the latest -rc version (or the latest release
> > during the kernel merge window) -- people usually run the script because
> > they want to use some new interfaces that were recently introduced to
> > the kernel. (This also ensures linear history, although I don't think
> > that's too much of a problem.)
>
> Yeah, I think the requirement is just "it has to be against some commit
> that is on the mainline of the upstream kernel", it doesn't inherently
> have to be an rc or a full point release. The assumption we're making
> here is that ABI is stable once a change hits Linus' git tree, and
> not stable before that.
>
> The other requirement is "don't go backwards", ie don't sync to a
> commit that pre-dates whatever the last commit we synced to is.
>
> The last sync we did was to ceaa837f96ad ("Linux 6.2-rc8").
>
> Thank you, that makes perfect sense, I have sent another series of patches
(with the headers updade as a separate patch for consistency)

thanks
> -- PMM
>

[-- Attachment #2: Type: text/html, Size: 3281 bytes --]

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

* Re: [PATCH 1/2] Fix libvhost-user.c compilation.
  2023-04-05 12:59 ` [PATCH 1/2] Fix libvhost-user.c compilation David 'Digit' Turner
@ 2023-04-07  7:56   ` Michael S. Tsirkin
  2023-04-26 19:13     ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Michael S. Tsirkin @ 2023-04-07  7:56 UTC (permalink / raw)
  To: David 'Digit' Turner; +Cc: qemu-devel

On Wed, Apr 05, 2023 at 02:59:19PM +0200, David 'Digit' Turner wrote:
> The source file uses VIRTIO_F_VERSION_1 which is
> not defined by <linux/virtio_config.h> on Debian 10.
> 
> The system-provided <linux/virtio_config.h> which
> does not include the macro definition is included
> through <linux/vhost.h>, so fix the issue by including
> the standard-headers version before that.
> 
> Signed-off-by: David 'Digit' Turner <digit@google.com>

I don't get it. ./linux-headers/linux/vhost.h does not seem
to use <linux/virtio_config.h> for me.
In fact nothing does:
$ git grep linux/virtio_config.h
include/hw/virtio/virtio.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/vhost_types.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_9p.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_balloon.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_blk.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_console.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_crypto.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_fs.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_mem.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_net.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_pmem.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_rng.h:#include "standard-headers/linux/virtio_config.h"
include/standard-headers/linux/virtio_vsock.h:#include "standard-headers/linux/virtio_config.h"
linux-headers/linux/virtio_config.h:#include "standard-headers/linux/virtio_config.h"
scripts/update-linux-headers.sh:cat <<EOF >$output/linux-headers/linux/virtio_config.h
scripts/update-linux-headers.sh:#include "standard-headers/linux/virtio_config.h"
subprojects/libvduse/libvduse.c:#include "linux-headers/linux/virtio_config.h"
tests/qtest/fuzz/virtio_net_fuzz.c:#include "standard-headers/linux/virtio_config.h"
tests/qtest/libqos/virtio-gpio.c:#include "standard-headers/linux/virtio_config.h"
tests/qtest/libqos/virtio-pci-modern.c:#include "standard-headers/linux/virtio_config.h"
tests/qtest/libqos/virtio.c:#include "standard-headers/linux/virtio_config.h"




> ---
>  subprojects/libvhost-user/libvhost-user.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
> index 0200b78e8e..0a5768cb55 100644
> --- a/subprojects/libvhost-user/libvhost-user.c
> +++ b/subprojects/libvhost-user/libvhost-user.c
> @@ -32,6 +32,12 @@
>  #include <sys/mman.h>
>  #include <endian.h>
>  
> +/* Necessary to provide VIRTIO_F_VERSION_1 on system
> + * with older linux headers. Must appear before
> + * <linux/vhost.h> below.
> + */
> +#include "standard-headers/linux/virtio_config.h"
> +
>  #if defined(__linux__)
>  #include <sys/syscall.h>
>  #include <fcntl.h>
> -- 
> 2.40.0.348.gf938b09366-goog



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

* Re: [PATCH 0/2] Fix QEMU compilation on Debian 10
  2023-04-05 12:59 [PATCH 0/2] Fix QEMU compilation on Debian 10 David 'Digit' Turner
  2023-04-05 12:59 ` [PATCH 1/2] Fix libvhost-user.c compilation David 'Digit' Turner
  2023-04-05 12:59 ` [PATCH 2/2] Add missing Linux kernel headers David 'Digit' Turner
@ 2023-04-26 19:10 ` Paolo Bonzini
  2 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2023-04-26 19:10 UTC (permalink / raw)
  To: David 'Digit' Turner; +Cc: qemu-devel

Queued, thanks.

Paolo



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

* Re: [PATCH 1/2] Fix libvhost-user.c compilation.
  2023-04-07  7:56   ` Michael S. Tsirkin
@ 2023-04-26 19:13     ` Paolo Bonzini
  0 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2023-04-26 19:13 UTC (permalink / raw)
  To: Michael S. Tsirkin, David 'Digit' Turner; +Cc: qemu-devel

On 4/7/23 09:56, Michael S. Tsirkin wrote:
> On Wed, Apr 05, 2023 at 02:59:19PM +0200, David 'Digit' Turner wrote:
>> The source file uses VIRTIO_F_VERSION_1 which is
>> not defined by <linux/virtio_config.h> on Debian 10.
>>
>> The system-provided <linux/virtio_config.h> which
>> does not include the macro definition is included
>> through <linux/vhost.h>, so fix the issue by including
>> the standard-headers version before that.
>>
>> Signed-off-by: David 'Digit' Turner <digit@google.com>
> 
> I don't get it. ./linux-headers/linux/vhost.h does not seem
> to use <linux/virtio_config.h> for me.

The issue is that subprojects/libvhost-user/libvhost-user.c includes 
linux/vhost.h.  Probably should be changed to 
linux-headers/linux/vhost.h, but David's patch makes sense because 
libvhost-user.c does use a symbol from virtio_config.h.

Paolo

> $ git grep linux/virtio_config.h
> include/hw/virtio/virtio.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/vhost_types.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_9p.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_balloon.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_blk.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_console.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_crypto.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_fs.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_mem.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_net.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_pmem.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_rng.h:#include "standard-headers/linux/virtio_config.h"
> include/standard-headers/linux/virtio_vsock.h:#include "standard-headers/linux/virtio_config.h"
> linux-headers/linux/virtio_config.h:#include "standard-headers/linux/virtio_config.h"
> scripts/update-linux-headers.sh:cat <<EOF >$output/linux-headers/linux/virtio_config.h
> scripts/update-linux-headers.sh:#include "standard-headers/linux/virtio_config.h"
> subprojects/libvduse/libvduse.c:#include "linux-headers/linux/virtio_config.h"
> tests/qtest/fuzz/virtio_net_fuzz.c:#include "standard-headers/linux/virtio_config.h"
> tests/qtest/libqos/virtio-gpio.c:#include "standard-headers/linux/virtio_config.h"
> tests/qtest/libqos/virtio-pci-modern.c:#include "standard-headers/linux/virtio_config.h"
> tests/qtest/libqos/virtio.c:#include "standard-headers/linux/virtio_config.h"
> 
> 
> 
> 
>> ---
>>   subprojects/libvhost-user/libvhost-user.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
>> index 0200b78e8e..0a5768cb55 100644
>> --- a/subprojects/libvhost-user/libvhost-user.c
>> +++ b/subprojects/libvhost-user/libvhost-user.c
>> @@ -32,6 +32,12 @@
>>   #include <sys/mman.h>
>>   #include <endian.h>
>>   
>> +/* Necessary to provide VIRTIO_F_VERSION_1 on system
>> + * with older linux headers. Must appear before
>> + * <linux/vhost.h> below.
>> + */
>> +#include "standard-headers/linux/virtio_config.h"
>> +
>>   #if defined(__linux__)
>>   #include <sys/syscall.h>
>>   #include <fcntl.h>
>> -- 
>> 2.40.0.348.gf938b09366-goog
> 
> 



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

end of thread, other threads:[~2023-04-26 19:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 12:59 [PATCH 0/2] Fix QEMU compilation on Debian 10 David 'Digit' Turner
2023-04-05 12:59 ` [PATCH 1/2] Fix libvhost-user.c compilation David 'Digit' Turner
2023-04-07  7:56   ` Michael S. Tsirkin
2023-04-26 19:13     ` Paolo Bonzini
2023-04-05 12:59 ` [PATCH 2/2] Add missing Linux kernel headers David 'Digit' Turner
2023-04-05 13:06   ` Cornelia Huck
2023-04-05 13:42     ` David Turner
2023-04-05 15:54       ` Cornelia Huck
2023-04-05 16:41         ` Peter Maydell
2023-04-05 17:22           ` David Turner
2023-04-26 19:10 ` [PATCH 0/2] Fix QEMU compilation on Debian 10 Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).