All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Jagannathan Raman" <jag.raman@oracle.com>,
	"Aarushi Mehta" <mehta.aaru20@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	qemu-block@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	virtio-fs@redhat.com, "Hanna Reitz" <hreitz@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>, "Peter Xu" <peterx@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Qiuhao Li" <Qiuhao.Li@outlook.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Bandan Das" <bsd@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Julia Suvorova" <jusual@redhat.com>,
	"Darren Kenny" <darren.kenny@oracle.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"John G Johnson" <john.g.johnson@oracle.com>,
	"Nikolay Tenev" <nt@storpool.com>
Subject: [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug()
Date: Wed, 15 Jun 2022 16:51:28 +0100	[thread overview]
Message-ID: <20220615155129.1025811-18-stefanha@redhat.com> (raw)
In-Reply-To: <20220615155129.1025811-1-stefanha@redhat.com>

Every laio_io_plug() call has a matching laio_io_unplug() call. There is
a plugged counter that tracks the number of levels of plugging and
allows for nesting.

The plugged counter must reflect the balance between laio_io_plug() and
laio_io_unplug() calls accurately. Otherwise I/O stalls occur since
io_submit(2) calls are skipped while plugged.

Reported-by: Nikolay Tenev <nt@storpool.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20220609164712.1539045-2-stefanha@redhat.com
Cc: Stefano Garzarella <sgarzare@redhat.com>
Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to laio_io_unplug()")
[Stefano Garzarella suggested adding a Fixes tag.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/linux-aio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index 4c423fcccf..6078da7e42 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -363,8 +363,10 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
                     uint64_t dev_max_batch)
 {
     assert(s->io_q.plugged);
+    s->io_q.plugged--;
+
     if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
-        (--s->io_q.plugged == 0 &&
+        (!s->io_q.plugged &&
          !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
         ioq_submit(s);
     }
-- 
2.36.1



WARNING: multiple messages have this Message-ID (diff)
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Jagannathan Raman" <jag.raman@oracle.com>,
	"Aarushi Mehta" <mehta.aaru20@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	qemu-block@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	virtio-fs@redhat.com, "Hanna Reitz" <hreitz@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>, "Peter Xu" <peterx@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Qiuhao Li" <Qiuhao.Li@outlook.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Bandan Das" <bsd@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Julia Suvorova" <jusual@redhat.com>,
	"Darren Kenny" <darren.kenny@oracle.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"John G Johnson" <john.g.johnson@oracle.com>,
	"Nikolay Tenev" <nt@storpool.com>
Subject: [Virtio-fs] [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug()
Date: Wed, 15 Jun 2022 16:51:28 +0100	[thread overview]
Message-ID: <20220615155129.1025811-18-stefanha@redhat.com> (raw)
In-Reply-To: <20220615155129.1025811-1-stefanha@redhat.com>

Every laio_io_plug() call has a matching laio_io_unplug() call. There is
a plugged counter that tracks the number of levels of plugging and
allows for nesting.

The plugged counter must reflect the balance between laio_io_plug() and
laio_io_unplug() calls accurately. Otherwise I/O stalls occur since
io_submit(2) calls are skipped while plugged.

Reported-by: Nikolay Tenev <nt@storpool.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20220609164712.1539045-2-stefanha@redhat.com
Cc: Stefano Garzarella <sgarzare@redhat.com>
Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to laio_io_unplug()")
[Stefano Garzarella suggested adding a Fixes tag.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/linux-aio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index 4c423fcccf..6078da7e42 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -363,8 +363,10 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
                     uint64_t dev_max_batch)
 {
     assert(s->io_q.plugged);
+    s->io_q.plugged--;
+
     if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
-        (--s->io_q.plugged == 0 &&
+        (!s->io_q.plugged &&
          !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
         ioq_submit(s);
     }
-- 
2.36.1


  parent reply	other threads:[~2022-06-15 16:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 15:51 [PULL 00/18] Block patches Stefan Hajnoczi
2022-06-15 15:51 ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 01/18] MAINTAINERS: update Vladimir's address and repositories Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 02/18] Use io_uring_register_ring_fd() to skip fd operations Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 03/18] qdev: unplug blocker for devices Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 04/18] remote/machine: add HotplugHandler for remote machine Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 05/18] remote/machine: add vfio-user property Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 06/18] vfio-user: build library Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-07-12  8:39   ` Daniel P. Berrangé
2022-07-12  8:39     ` [Virtio-fs] " Daniel P. Berrangé
2022-07-12 15:27     ` Jag Raman
2022-07-12 15:27       ` [Virtio-fs] " Jag Raman
2022-07-12 15:44       ` Daniel P. Berrangé
2022-07-12 15:44         ` [Virtio-fs] " Daniel P. Berrangé
2022-07-12 17:13         ` Jag Raman
2022-07-12 17:13           ` [Virtio-fs] " Jag Raman
2022-07-21 10:25   ` Daniel P. Berrangé
2022-07-21 10:25     ` [Virtio-fs] " Daniel P. Berrangé
2022-07-25 14:45     ` Jag Raman
2022-07-25 14:45       ` [Virtio-fs] " Jag Raman
2022-07-25 14:50       ` Daniel P. Berrangé
2022-07-25 14:50         ` [Virtio-fs] " Daniel P. Berrangé
2022-07-25 15:00         ` Jag Raman
2022-07-25 15:00           ` [Virtio-fs] " Jag Raman
2022-06-15 15:51 ` [PULL 07/18] vfio-user: define vfio-user-server object Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 08/18] vfio-user: instantiate vfio-user context Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 09/18] vfio-user: find and init PCI device Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 10/18] vfio-user: run vfio-user context Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 11/18] vfio-user: handle PCI config space accesses Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 12/18] vfio-user: IOMMU support for remote device Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 13/18] vfio-user: handle DMA mappings Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 14/18] vfio-user: handle PCI BAR accesses Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 15/18] vfio-user: handle device interrupts Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 16/18] vfio-user: handle reset of remote device Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 15:51 ` Stefan Hajnoczi [this message]
2022-06-15 15:51   ` [Virtio-fs] [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug() Stefan Hajnoczi
2022-06-15 15:51 ` [PULL 18/18] linux-aio: explain why max batch is checked " Stefan Hajnoczi
2022-06-15 15:51   ` [Virtio-fs] " Stefan Hajnoczi
2022-06-15 23:02 ` [PULL 00/18] Block patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615155129.1025811-18-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=Qiuhao.Li@outlook.com \
    --cc=alex.bennee@linaro.org \
    --cc=alxndr@bu.edu \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=bsd@redhat.com \
    --cc=darren.kenny@oracle.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=elena.ufimtseva@oracle.com \
    --cc=f4bug@amsat.org \
    --cc=hreitz@redhat.com \
    --cc=jag.raman@oracle.com \
    --cc=john.g.johnson@oracle.com \
    --cc=jusual@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mehta.aaru20@gmail.com \
    --cc=mst@redhat.com \
    --cc=nt@storpool.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sgarzare@redhat.com \
    --cc=thuth@redhat.com \
    --cc=virtio-fs@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.