qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 3/8] virtio_blk_process_queued_requests: always run in a bh
Date: Tue, 12 Jul 2022 13:18:16 +0100	[thread overview]
Message-ID: <Ys1miHWFLCR1ArKm@stefanha-x1.localdomain> (raw)
In-Reply-To: <fef736a3-e5b9-762b-2605-5f04170fbf54@redhat.com>

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

On Fri, Jul 08, 2022 at 11:07:06AM +0200, Emanuele Giuseppe Esposito wrote:
> 
> 
> Am 05/07/2022 um 16:23 schrieb Stefan Hajnoczi:
> > On Thu, Jun 09, 2022 at 10:37:22AM -0400, Emanuele Giuseppe Esposito wrote:
> >> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> >> index f9224f23d2..03e10a36a4 100644
> >> --- a/hw/block/dataplane/virtio-blk.c
> >> +++ b/hw/block/dataplane/virtio-blk.c
> >> @@ -234,8 +234,16 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
> >>          goto fail_aio_context;
> >>      }
> >>  
> >> +    blk_inc_in_flight(s->conf->conf.blk);
> > 
> > Missing comment explaining why the in-flight counter is incremented and
> > where the matching decrement operation is located.
> > 
> > I think you can get away without a comment if blk_inc_in_flight() is
> > right next to aio_bh_new(), but in this case there are a few lines of
> > code in between and it becomes unclear if there is a connection.
> 
> I will simply add:
> 
>     /*
>      * virtio_blk_restart_bh() code will take care of decrementing
>      * in_flight counter.
>      */
> 
> should make sense.

Perfect.

> 
> > 
> >> +    /*
> >> +     * vblk->bh is only set in virtio_blk_dma_restart_cb, which
> >> +     * is called only on vcpu start or stop.
> >> +     * Therefore it must be null.
> >> +     */
> >> +    assert(vblk->bh == NULL);
> >>      /* Process queued requests before the ones in vring */
> > 
> > This comment makes an assumption about the order of file descriptor
> > handlers vs BHs in the event loop. I suggest removing the comment. There
> > is no reason for processing queued requests first anyway since
> > virtio-blk devices can complete requests in any order.
> > 
> 
> Ok, I guess you mean in a separate patch.

No, before this patch the comment was correct. Now it's questionable
because the (synchronous) call has been replaced with a BH.

I think it's appropriate to drop this comment in this patch.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-07-12 12:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 14:37 [PATCH 0/8] virtio-blk: removal of AioContext lock Emanuele Giuseppe Esposito
2022-06-09 14:37 ` [PATCH 1/8] virtio_queue_aio_attach_host_notifier: remove " Emanuele Giuseppe Esposito
2022-07-05 14:11   ` Stefan Hajnoczi
2022-07-08  9:01     ` Emanuele Giuseppe Esposito
2022-07-12 12:47       ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 2/8] block-backend: enable_write_cache should be atomic Emanuele Giuseppe Esposito
2022-07-05 14:16   ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 3/8] virtio_blk_process_queued_requests: always run in a bh Emanuele Giuseppe Esposito
2022-07-05 14:23   ` Stefan Hajnoczi
2022-07-08  9:07     ` Emanuele Giuseppe Esposito
2022-07-12 12:18       ` Stefan Hajnoczi [this message]
2022-06-09 14:37 ` [PATCH 4/8] virtio: categorize callbacks in GS Emanuele Giuseppe Esposito
2022-06-16 16:50   ` Michael S. Tsirkin
2022-07-05 14:25   ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 5/8] virtio-blk: mark GLOBAL_STATE_CODE functions Emanuele Giuseppe Esposito
2022-07-05 14:27   ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 6/8] virtio-blk: mark IO_CODE functions Emanuele Giuseppe Esposito
2022-07-05 14:39   ` Stefan Hajnoczi
2022-07-08  9:19     ` Emanuele Giuseppe Esposito
2022-07-12 12:26       ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 7/8] VirtIOBlock: protect rq with its own lock Emanuele Giuseppe Esposito
2022-07-05 14:45   ` Stefan Hajnoczi
2022-07-08  9:33     ` Emanuele Giuseppe Esposito
2022-07-08 11:22       ` Emanuele Giuseppe Esposito
2022-07-12 12:34         ` Stefan Hajnoczi
2022-07-12 12:29       ` Stefan Hajnoczi
2022-06-09 14:37 ` [PATCH 8/8] virtio-blk: remove unnecessary AioContext lock from function already safe Emanuele Giuseppe Esposito
2022-07-05 14:48   ` Stefan Hajnoczi

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=Ys1miHWFLCR1ArKm@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 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).