From: "Michael S. Tsirkin" <mst@redhat.com>
To: Max Gurtovoy <mgurtovoy@nvidia.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
virtualization@lists.linux.dev, axboe@kernel.dk,
kvm@vger.kernel.org, linux-block@vger.kernel.org,
oren@nvidia.com
Subject: Re: [PATCH 1/1] virtio_blk: implement init_hctx MQ operation
Date: Sat, 3 Aug 2024 08:39:38 -0400 [thread overview]
Message-ID: <20240803083824-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <a10e97ce-792a-410f-b68e-d00292987b3a@nvidia.com>
On Sat, Aug 03, 2024 at 01:07:27AM +0300, Max Gurtovoy wrote:
>
> On 01/08/2024 20:56, Stefan Hajnoczi wrote:
> > On Thu, Aug 01, 2024 at 06:56:44PM +0300, Max Gurtovoy wrote:
> > > On 01/08/2024 18:43, Michael S. Tsirkin wrote:
> > > > On Thu, Aug 01, 2024 at 06:39:16PM +0300, Max Gurtovoy wrote:
> > > > > On 01/08/2024 18:29, Michael S. Tsirkin wrote:
> > > > > > On Thu, Aug 01, 2024 at 06:17:21PM +0300, Max Gurtovoy wrote:
> > > > > > > On 01/08/2024 18:13, Michael S. Tsirkin wrote:
> > > > > > > > On Thu, Aug 01, 2024 at 06:11:37PM +0300, Max Gurtovoy wrote:
> > > > > > > > > In this operation set the driver data of the hctx to point to the virtio
> > > > > > > > > block queue. By doing so, we can use this reference in the and reduce
> > > > > > > > in the .... ?
> > > > > > > sorry for the type.
> > > > > > >
> > > > > > > should be :
> > > > > > >
> > > > > > > "By doing so, we can use this reference and reduce the number of operations in the fast path."
> > > > > > ok. what kind of benefit do you see with this patch?
> > > > > As mentioned. This is a micro optimization that reduce the number of
> > > > > instructions/dereferences in the fast path.
> > > > By how much? How random code tweaks affect object code is unpredictable.
> > > > Pls show results of objdump to prove it does anything
> > > > useful.
> > > This is the way all modern block drivers such as NVMe PCI/RDMA/TCP use the
> > > driver_data.
> > >
> > > These drivers don't have driver specific mechanisms to find the queue from
> > > the hctx->queue->queuedata like vblk driver has for some unknown reason.
> > >
> > > It is pretty easy to review this patch and see its benefits, isn't it ?
> > >
> > > It is not expected to provide extreme perf improvement.
> > >
> > > It is introduced for aligning the driver to use common MQ mechanisms and
> > > reduce dereferences.
> > >
> > > This is not "random code tweaks".
> > If you cannot observe a performance change, then adjusting the commit
> > description to explain this as a code cleanup to reduce dereferences and
> > local variables, improving code readability seems fine to me. I think
> > it's a nice cleanup when presented as such rather than a performance
> > optimization.
> >
> > Stefan
>
> Sure. Please check the bellow adjustment:
>
> virtio_blk: implement init_hctx MQ operation
>
> Set the driver data of the hardware context (hctx) to point directly to
> the virtio block queue. This cleanup improves code readability, reduces
> the number of dereferences, and minimizes local variables in the fast
> path.
I'd drop the local variables part, it is not at all clear why is that
a win.
--
MST
next prev parent reply other threads:[~2024-08-03 12:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 15:11 [PATCH 1/1] virtio_blk: implement init_hctx MQ operation Max Gurtovoy
2024-08-01 15:13 ` Michael S. Tsirkin
2024-08-01 15:17 ` Max Gurtovoy
2024-08-01 15:29 ` Michael S. Tsirkin
2024-08-01 15:39 ` Max Gurtovoy
2024-08-01 15:43 ` Michael S. Tsirkin
[not found] ` <6a8f0c72-ba77-42c3-8d85-6bb23a23f025@nvidia.com>
2024-08-01 17:46 ` Michael S. Tsirkin
2024-08-01 17:56 ` Stefan Hajnoczi
2024-08-02 22:07 ` Max Gurtovoy
2024-08-03 12:39 ` Michael S. Tsirkin [this message]
2024-08-03 17:54 ` Max Gurtovoy
2024-08-07 13:19 ` Stefan Hajnoczi
2024-08-07 13:34 ` Michael S. Tsirkin
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=20240803083824-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=axboe@kernel.dk \
--cc=kvm@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=mgurtovoy@nvidia.com \
--cc=oren@nvidia.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
/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).