* [PATCH v1] aio-posix: fix build failure io_uring 2.2 @ 2022-02-17 16:16 Haiyue Wang 2022-02-21 14:54 ` Stefan Hajnoczi 2022-02-21 16:24 ` [PATCH v2] " Haiyue Wang 0 siblings, 2 replies; 9+ messages in thread From: Haiyue Wang @ 2022-02-17 16:16 UTC (permalink / raw) To: qemu-devel Cc: Haiyue Wang, Fam Zheng, open list:Block I/O path, Stefan Hajnoczi The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b This leads to build failure: ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes integer from pointer without a cast [-Werror=int-conversion] 182 | io_uring_prep_poll_remove(sqe, node); | ^~~~ | | | AioHandler * In file included from /root/io/qemu/include/block/aio.h:18, from ../util/aio-posix.h:20, from ../util/fdmon-io_uring.c:49: /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument is of type ‘AioHandler *’ 415 | __u64 user_data) | ~~~~~~^~~~~~~~~ cc1: all warnings being treated as errors So convert the paramter to right type according to the io_uring define. Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> --- util/fdmon-io_uring.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index 1461dfa407..e7febbf11f 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -179,7 +179,11 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node) { struct io_uring_sqe *sqe = get_sqe(ctx); +#ifdef LIBURING_HAVE_DATA64 + io_uring_prep_poll_remove(sqe, (__u64)node); +#else io_uring_prep_poll_remove(sqe, node); +#endif } /* Add a timeout that self-cancels when another cqe becomes ready */ -- 2.35.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-17 16:16 [PATCH v1] aio-posix: fix build failure io_uring 2.2 Haiyue Wang @ 2022-02-21 14:54 ` Stefan Hajnoczi 2022-02-21 15:54 ` Peter Maydell 2022-02-21 16:43 ` Wang, Haiyue 2022-02-21 16:24 ` [PATCH v2] " Haiyue Wang 1 sibling, 2 replies; 9+ messages in thread From: Stefan Hajnoczi @ 2022-02-21 14:54 UTC (permalink / raw) To: Haiyue Wang; +Cc: Fam Zheng, qemu-devel, open list:Block I/O path [-- Attachment #1: Type: text/plain, Size: 2610 bytes --] On Fri, Feb 18, 2022 at 12:16:27AM +0800, Haiyue Wang wrote: > The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": > https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b > > This leads to build failure: > ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: > ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes integer from pointer without a cast [-Werror=int-conversion] > 182 | io_uring_prep_poll_remove(sqe, node); > | ^~~~ > | | > | AioHandler * > In file included from /root/io/qemu/include/block/aio.h:18, > from ../util/aio-posix.h:20, > from ../util/fdmon-io_uring.c:49: > /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument is of type ‘AioHandler *’ > 415 | __u64 user_data) > | ~~~~~~^~~~~~~~~ > cc1: all warnings being treated as errors > > So convert the paramter to right type according to the io_uring define. > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > --- > util/fdmon-io_uring.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c > index 1461dfa407..e7febbf11f 100644 > --- a/util/fdmon-io_uring.c > +++ b/util/fdmon-io_uring.c > @@ -179,7 +179,11 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node) > { > struct io_uring_sqe *sqe = get_sqe(ctx); > > +#ifdef LIBURING_HAVE_DATA64 > + io_uring_prep_poll_remove(sqe, (__u64)node); > +#else > io_uring_prep_poll_remove(sqe, node); > +#endif > } Thanks for the patch. I suggest using the same approach as the liburing commit to avoid the #ifdef: diff --git a/test/poll-cancel-ton.c b/test/poll-cancel-ton.c index f0875cd..05bf565 100644 --- a/test/poll-cancel-ton.c +++ b/test/poll-cancel-ton.c @@ -55,7 +55,7 @@ static int del_polls(struct io_uring *ring, int fd, int nr) sqe = io_uring_get_sqe(ring); data = sqe_index[lrand48() % nr]; - io_uring_prep_poll_remove(sqe, data); + io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)data); So the QEMU add_poll_remove_sqe() function would do: io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); Was there a reason why you chose an #ifdef instead? Thanks, Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-21 14:54 ` Stefan Hajnoczi @ 2022-02-21 15:54 ` Peter Maydell 2022-02-21 16:59 ` Wang, Haiyue 2022-02-22 8:46 ` Stefan Hajnoczi 2022-02-21 16:43 ` Wang, Haiyue 1 sibling, 2 replies; 9+ messages in thread From: Peter Maydell @ 2022-02-21 15:54 UTC (permalink / raw) To: Stefan Hajnoczi Cc: Haiyue Wang, Fam Zheng, qemu-devel, open list:Block I/O path On Mon, 21 Feb 2022 at 15:02, Stefan Hajnoczi <stefanha@redhat.com> wrote: > So the QEMU add_poll_remove_sqe() function would do: > > io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); __u64 is a linux-kernel-ism -- we should use uint64_t, I think. thanks -- PMM ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-21 15:54 ` Peter Maydell @ 2022-02-21 16:59 ` Wang, Haiyue 2022-02-22 8:46 ` Stefan Hajnoczi 1 sibling, 0 replies; 9+ messages in thread From: Wang, Haiyue @ 2022-02-21 16:59 UTC (permalink / raw) To: Peter Maydell, Stefan Hajnoczi Cc: Fam Zheng, qemu-devel@nongnu.org, open list:Block I/O path > -----Original Message----- > From: Peter Maydell <peter.maydell@linaro.org> > Sent: Monday, February 21, 2022 23:55 > To: Stefan Hajnoczi <stefanha@redhat.com> > Cc: Wang, Haiyue <haiyue.wang@intel.com>; Fam Zheng <fam@euphon.net>; qemu-devel@nongnu.org; open > list:Block I/O path <qemu-block@nongnu.org> > Subject: Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 > > On Mon, 21 Feb 2022 at 15:02, Stefan Hajnoczi <stefanha@redhat.com> wrote: > > So the QEMU add_poll_remove_sqe() function would do: > > > > io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); > > __u64 is a linux-kernel-ism -- we should use uint64_t, I think. Use '(__u64)(uintptr_t)' to follow the liburing code style ? > > thanks > -- PMM ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-21 15:54 ` Peter Maydell 2022-02-21 16:59 ` Wang, Haiyue @ 2022-02-22 8:46 ` Stefan Hajnoczi 1 sibling, 0 replies; 9+ messages in thread From: Stefan Hajnoczi @ 2022-02-22 8:46 UTC (permalink / raw) To: Peter Maydell Cc: Haiyue Wang, Fam Zheng, qemu-devel, open list:Block I/O path [-- Attachment #1: Type: text/plain, Size: 491 bytes --] On Mon, Feb 21, 2022 at 03:54:57PM +0000, Peter Maydell wrote: > On Mon, 21 Feb 2022 at 15:02, Stefan Hajnoczi <stefanha@redhat.com> wrote: > > So the QEMU add_poll_remove_sqe() function would do: > > > > io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); > > __u64 is a linux-kernel-ism -- we should use uint64_t, I think. <liburing.h> and QEMU's util/fdmon-io_uring.c are Linux-only. I think it's fine to use __u64 here exactly as defined in the liburing API. Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-21 14:54 ` Stefan Hajnoczi 2022-02-21 15:54 ` Peter Maydell @ 2022-02-21 16:43 ` Wang, Haiyue 2022-02-22 8:46 ` Stefan Hajnoczi 1 sibling, 1 reply; 9+ messages in thread From: Wang, Haiyue @ 2022-02-21 16:43 UTC (permalink / raw) To: Stefan Hajnoczi Cc: Fam Zheng, qemu-devel@nongnu.org, open list:Block I/O path > -----Original Message----- > From: Stefan Hajnoczi <stefanha@redhat.com> > Sent: Monday, February 21, 2022 22:54 > To: Wang, Haiyue <haiyue.wang@intel.com> > Cc: qemu-devel@nongnu.org; Fam Zheng <fam@euphon.net>; open list:Block I/O path <qemu-block@nongnu.org> > Subject: Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 > > On Fri, Feb 18, 2022 at 12:16:27AM +0800, Haiyue Wang wrote: > > The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": > > https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b > > > > This leads to build failure: > > ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: > > ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes > integer from pointer without a cast [-Werror=int-conversion] > > 182 | io_uring_prep_poll_remove(sqe, node); > > | ^~~~ > > | | > > | AioHandler * > > In file included from /root/io/qemu/include/block/aio.h:18, > > from ../util/aio-posix.h:20, > > from ../util/fdmon-io_uring.c:49: > > /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument > is of type ‘AioHandler *’ > > 415 | __u64 user_data) > > | ~~~~~~^~~~~~~~~ > > cc1: all warnings being treated as errors > > > > So convert the paramter to right type according to the io_uring define. > > > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > > --- > > util/fdmon-io_uring.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c > > index 1461dfa407..e7febbf11f 100644 > > --- a/util/fdmon-io_uring.c > > +++ b/util/fdmon-io_uring.c > > @@ -179,7 +179,11 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node) > > { > > struct io_uring_sqe *sqe = get_sqe(ctx); > > > > +#ifdef LIBURING_HAVE_DATA64 > > + io_uring_prep_poll_remove(sqe, (__u64)node); > > +#else > > io_uring_prep_poll_remove(sqe, node); > > +#endif > > } > > Thanks for the patch. I suggest using the same approach as the liburing > commit to avoid the #ifdef: Old version is "void *user_data", so need to use ' LIBURING_HAVE_DATA64', also, as the comment said: /* * Tell the app the have the 64-bit variants of the get/set userdata */ #define LIBURING_HAVE_DATA64 And yes, two casts seems be more safe: (__u64)(uintptr_t)node > > diff --git a/test/poll-cancel-ton.c b/test/poll-cancel-ton.c > index f0875cd..05bf565 100644 > --- a/test/poll-cancel-ton.c > +++ b/test/poll-cancel-ton.c > @@ -55,7 +55,7 @@ static int del_polls(struct io_uring *ring, int fd, int nr) > > sqe = io_uring_get_sqe(ring); > data = sqe_index[lrand48() % nr]; > - io_uring_prep_poll_remove(sqe, data); > + io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)data); > > So the QEMU add_poll_remove_sqe() function would do: > > io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); > > Was there a reason why you chose an #ifdef instead? > > Thanks, > Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 2022-02-21 16:43 ` Wang, Haiyue @ 2022-02-22 8:46 ` Stefan Hajnoczi 0 siblings, 0 replies; 9+ messages in thread From: Stefan Hajnoczi @ 2022-02-22 8:46 UTC (permalink / raw) To: Wang, Haiyue; +Cc: Fam Zheng, qemu-devel@nongnu.org, open list:Block I/O path [-- Attachment #1: Type: text/plain, Size: 2938 bytes --] On Mon, Feb 21, 2022 at 04:43:55PM +0000, Wang, Haiyue wrote: > > -----Original Message----- > > From: Stefan Hajnoczi <stefanha@redhat.com> > > Sent: Monday, February 21, 2022 22:54 > > To: Wang, Haiyue <haiyue.wang@intel.com> > > Cc: qemu-devel@nongnu.org; Fam Zheng <fam@euphon.net>; open list:Block I/O path <qemu-block@nongnu.org> > > Subject: Re: [PATCH v1] aio-posix: fix build failure io_uring 2.2 > > > > On Fri, Feb 18, 2022 at 12:16:27AM +0800, Haiyue Wang wrote: > > > The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": > > > https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b > > > > > > This leads to build failure: > > > ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: > > > ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes > > integer from pointer without a cast [-Werror=int-conversion] > > > 182 | io_uring_prep_poll_remove(sqe, node); > > > | ^~~~ > > > | | > > > | AioHandler * > > > In file included from /root/io/qemu/include/block/aio.h:18, > > > from ../util/aio-posix.h:20, > > > from ../util/fdmon-io_uring.c:49: > > > /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument > > is of type ‘AioHandler *’ > > > 415 | __u64 user_data) > > > | ~~~~~~^~~~~~~~~ > > > cc1: all warnings being treated as errors > > > > > > So convert the paramter to right type according to the io_uring define. > > > > > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > > > --- > > > util/fdmon-io_uring.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c > > > index 1461dfa407..e7febbf11f 100644 > > > --- a/util/fdmon-io_uring.c > > > +++ b/util/fdmon-io_uring.c > > > @@ -179,7 +179,11 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node) > > > { > > > struct io_uring_sqe *sqe = get_sqe(ctx); > > > > > > +#ifdef LIBURING_HAVE_DATA64 > > > + io_uring_prep_poll_remove(sqe, (__u64)node); > > > +#else > > > io_uring_prep_poll_remove(sqe, node); > > > +#endif > > > } > > > > Thanks for the patch. I suggest using the same approach as the liburing > > commit to avoid the #ifdef: > > Old version is "void *user_data", so need to use ' LIBURING_HAVE_DATA64', > also, as the comment said: > > /* > * Tell the app the have the 64-bit variants of the get/set userdata > */ > #define LIBURING_HAVE_DATA64 > > And yes, two casts seems be more safe: (__u64)(uintptr_t)node You are right. I forgot that QEMU needs to support old liburing versions too. The #ifdef is necessary. Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] aio-posix: fix build failure io_uring 2.2 2022-02-17 16:16 [PATCH v1] aio-posix: fix build failure io_uring 2.2 Haiyue Wang 2022-02-21 14:54 ` Stefan Hajnoczi @ 2022-02-21 16:24 ` Haiyue Wang 2022-02-22 9:02 ` Stefan Hajnoczi 1 sibling, 1 reply; 9+ messages in thread From: Haiyue Wang @ 2022-02-21 16:24 UTC (permalink / raw) To: qemu-devel Cc: Haiyue Wang, Fam Zheng, open list:Block I/O path, Stefan Hajnoczi The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b This leads to build failure: ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes integer from pointer without a cast [-Werror=int-conversion] 182 | io_uring_prep_poll_remove(sqe, node); | ^~~~ | | | AioHandler * In file included from /root/io/qemu/include/block/aio.h:18, from ../util/aio-posix.h:20, from ../util/fdmon-io_uring.c:49: /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument is of type ‘AioHandler *’ 415 | __u64 user_data) | ~~~~~~^~~~~~~~~ cc1: all warnings being treated as errors Use LIBURING_HAVE_DATA64 to check whether the io_uring supports 64-bit variants of the get/set userdata, to convert the paramter to the right data type. Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> --- v2: update the commit log, and change the type cast as io_uring test does. --- util/fdmon-io_uring.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index 1461dfa407..ab43052dd7 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -179,7 +179,11 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node) { struct io_uring_sqe *sqe = get_sqe(ctx); +#ifdef LIBURING_HAVE_DATA64 + io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); +#else io_uring_prep_poll_remove(sqe, node); +#endif } /* Add a timeout that self-cancels when another cqe becomes ready */ -- 2.35.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] aio-posix: fix build failure io_uring 2.2 2022-02-21 16:24 ` [PATCH v2] " Haiyue Wang @ 2022-02-22 9:02 ` Stefan Hajnoczi 0 siblings, 0 replies; 9+ messages in thread From: Stefan Hajnoczi @ 2022-02-22 9:02 UTC (permalink / raw) To: Haiyue Wang; +Cc: Fam Zheng, qemu-devel, open list:Block I/O path [-- Attachment #1: Type: text/plain, Size: 1688 bytes --] On Tue, Feb 22, 2022 at 12:24:01AM +0800, Haiyue Wang wrote: > The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": > https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b130000619cff40141bb1fc3615b > > This leads to build failure: > ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: > ../util/fdmon-io_uring.c:182:36: error: passing argument 2 of ‘io_uring_prep_poll_remove’ makes integer from pointer without a cast [-Werror=int-conversion] > 182 | io_uring_prep_poll_remove(sqe, node); > | ^~~~ > | | > | AioHandler * > In file included from /root/io/qemu/include/block/aio.h:18, > from ../util/aio-posix.h:20, > from ../util/fdmon-io_uring.c:49: > /usr/include/liburing.h:415:17: note: expected ‘__u64’ {aka ‘long long unsigned int’} but argument is of type ‘AioHandler *’ > 415 | __u64 user_data) > | ~~~~~~^~~~~~~~~ > cc1: all warnings being treated as errors > > Use LIBURING_HAVE_DATA64 to check whether the io_uring supports 64-bit > variants of the get/set userdata, to convert the paramter to the right > data type. > > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> > --- > v2: update the commit log, and change the type cast as io_uring test does. > --- > util/fdmon-io_uring.c | 4 ++++ > 1 file changed, 4 insertions(+) Thanks, applied to my block tree: https://gitlab.com/stefanha/qemu/commits/block I will update the patch in my queue if further discussion raises issues. Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-02-22 9:09 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-02-17 16:16 [PATCH v1] aio-posix: fix build failure io_uring 2.2 Haiyue Wang 2022-02-21 14:54 ` Stefan Hajnoczi 2022-02-21 15:54 ` Peter Maydell 2022-02-21 16:59 ` Wang, Haiyue 2022-02-22 8:46 ` Stefan Hajnoczi 2022-02-21 16:43 ` Wang, Haiyue 2022-02-22 8:46 ` Stefan Hajnoczi 2022-02-21 16:24 ` [PATCH v2] " Haiyue Wang 2022-02-22 9:02 ` Stefan Hajnoczi
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).