qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 8a947c: aio-posix: fix build failure io_uring


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 8a947c: aio-posix: fix build failure io_uring 2.2
Date: Thu, 17 Mar 2022 10:04:56 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 8a947c7a586e16a048894e1a0a73d154435e90ef
      
https://github.com/qemu/qemu/commit/8a947c7a586e16a048894e1a0a73d154435e90ef
  Author: Haiyue Wang <haiyue.wang@intel.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M util/fdmon-io_uring.c

  Log Message:
  -----------
  aio-posix: fix build failure io_uring 2.2

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>
Message-Id: <20220221162401.45415-1-haiyue.wang@intel.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: fc8796465c6cd4091efe6a2f8b353f07324f49c7
      
https://github.com/qemu/qemu/commit/fc8796465c6cd4091efe6a2f8b353f07324f49c7
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M util/aio-posix.c
    M util/aio-posix.h

  Log Message:
  -----------
  aio-posix: fix spurious ->poll_ready() callbacks in main loop

When ->poll() succeeds the AioHandler is placed on the ready list with
revents set to the magic value 0. This magic value causes
aio_dispatch_handler() to invoke ->poll_ready() instead of ->io_read()
for G_IO_IN or ->io_write() for G_IO_OUT.

This magic value 0 hack works for the IOThread where AioHandlers are
placed on ->ready_list and processed by aio_dispatch_ready_handlers().
It does not work for the main loop where all AioHandlers are processed
by aio_dispatch_handlers(), even those that are not ready and have a
revents value of 0.

As a result the main loop invokes ->poll_ready() on AioHandlers that are
not ready. These spurious ->poll_ready() calls waste CPU cycles and
could lead to crashes if the code assumes ->poll() must have succeeded
before ->poll_ready() is called (a reasonable asumption but I haven't
seen it in practice).

Stop using revents to track whether ->poll_ready() will be called on an
AioHandler. Introduce a separate AioHandler->poll_ready field instead.
This eliminates spurious ->poll_ready() calls in the main loop.

Fixes: 826cc32423db2a99d184dbf4f507c737d7e7a4ae ("aio-posix: split poll check 
from ready handler")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reported-by: Jason Wang <jasowang@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
Message-id: 20220223155703.136833-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: e1bbad58d85dff6c9d251fcf5a28658717db9988
      
https://github.com/qemu/qemu/commit/e1bbad58d85dff6c9d251fcf5a28658717db9988
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M util/aio-posix.c
    M util/aio-posix.h
    M util/fdmon-io_uring.c

  Log Message:
  -----------
  Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into 
staging

Pull request

Bug fixes for 7.0.

# gpg: Signature made Thu 17 Mar 2022 16:42:22 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  aio-posix: fix spurious ->poll_ready() callbacks in main loop
  aio-posix: fix build failure io_uring 2.2

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/1d60bb4b1460...e1bbad58d85d



reply via email to

[Prev in Thread] Current Thread [Next in Thread]