From: Kevin Wolf <kwolf@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>, "Fam Zheng" <fam@euphon.net>,
qemu-arm@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
qemu-block@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Raphael Norwitz" <raphael.norwitz@nutanix.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro
Date: Tue, 31 Oct 2023 17:42:37 +0100 [thread overview]
Message-ID: <ZUEufXxY8xXdZj9z@redhat.com> (raw)
In-Reply-To: <20231031134856.GL7636@redhat.com>
Am 31.10.2023 um 14:48 hat Richard W.M. Jones geschrieben:
> On Tue, Oct 31, 2023 at 02:17:56PM +0100, Kevin Wolf wrote:
> > Am 17.10.2023 um 16:01 hat Philippe Mathieu-Daudé geschrieben:
> > > Access QOM parent with the proper QOM VIRTIO_SCSI_COMMON() macro.
> > >
> > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > > ---
> > > hw/scsi/virtio-scsi.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> > > index 45b95ea070..fa53f0902c 100644
> > > --- a/hw/scsi/virtio-scsi.c
> > > +++ b/hw/scsi/virtio-scsi.c
> > > @@ -761,7 +761,7 @@ static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req)
> > >
> > > static int virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)
> > > {
> > > - VirtIOSCSICommon *vs = &s->parent_obj;
> > > + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
> > > SCSIDevice *d;
> > > int rc;
> >
> > Why is a dynamic cast more "proper" than a static type-safe access, even
> > more so in a hot I/O path?
> >
> > Rich Jones posted a flamegraph the other day that surprised me because
> > object_class_dynamic_class_assert() and object_dynamic_cast_assert()
> > were shown to be a big part of scsi_req_new(). In the overall
> > performance, it's probably dwarved by other issues, but unnecessary
> > little things can add up, too.
>
> I think Kevin is referring to one of these flamegraphs:
>
> http://oirase.annexia.org/tmp/2023-kvm-build-on-device.svg
> http://oirase.annexia.org/tmp/2023-kvm-build.svg
>
> Here's a zoom showing scsi_req_new (hopefully this URL is stable ...):
>
> http://oirase.annexia.org/tmp/2023-kvm-build-on-device.svg?s=scsi_req_new&x=512.9&y=501
Oh, this one (kvm-build-on-device) doesn't even show the object cast.
I was looking at kvm-build, it seems, where both the class and the
object cast are visible:
http://oirase.annexia.org/tmp/2023-kvm-build.svg?s=scsi_req_new&x=455.4&y=533
Kevin
next prev parent reply other threads:[~2023-10-31 16:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 14:01 [PATCH 0/7] hw: Few more QOM/QDev cleanups Philippe Mathieu-Daudé
2023-10-17 14:01 ` [PATCH 1/7] hw/virtio/virtio-pmem: Replace impossible check by assertion Philippe Mathieu-Daudé
2023-10-17 17:20 ` Manos Pitsidianakis
2023-10-17 14:01 ` [PATCH 2/7] hw/block/vhost-user-blk: Use DEVICE() / VIRTIO_DEVICE() macros Philippe Mathieu-Daudé
2023-10-17 17:15 ` Manos Pitsidianakis
2023-10-17 20:09 ` Mark Cave-Ayland
2023-10-17 14:01 ` [PATCH 3/7] hw/display/virtio-gpu: Use VIRTIO_DEVICE() macro Philippe Mathieu-Daudé
2023-10-17 17:19 ` Manos Pitsidianakis
2023-10-17 20:10 ` Mark Cave-Ayland
2023-10-17 14:01 ` [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro Philippe Mathieu-Daudé
2023-10-17 17:19 ` Manos Pitsidianakis
2023-10-17 20:13 ` Mark Cave-Ayland
2023-10-31 13:17 ` Kevin Wolf
2023-10-31 13:21 ` Peter Maydell
2023-10-31 13:48 ` Richard W.M. Jones
2023-10-31 16:35 ` Kevin Wolf
2023-10-31 16:42 ` Kevin Wolf [this message]
2023-10-31 16:48 ` Richard W.M. Jones
2023-10-17 14:01 ` [PATCH 5/7] hw/dma: Declare link using static DEFINE_PROP_LINK() macro Philippe Mathieu-Daudé
2023-10-17 20:16 ` Mark Cave-Ayland
2023-10-17 14:01 ` [PATCH 6/7] hw/net: " Philippe Mathieu-Daudé
2023-10-17 20:17 ` Mark Cave-Ayland
2023-10-17 14:01 ` [PATCH 7/7] hw/usb: " Philippe Mathieu-Daudé
2023-10-17 20:19 ` Mark Cave-Ayland
2023-10-17 14:09 ` [PATCH 0/7] hw: Few more QOM/QDev cleanups Michael S. Tsirkin
2023-10-19 21:41 ` Philippe Mathieu-Daudé
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=ZUEufXxY8xXdZj9z@redhat.com \
--to=kwolf@redhat.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=rjones@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 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).