[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro |
Date: |
Tue, 31 Oct 2023 14:17:56 +0100 |
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.
Kevin
- Re: [PATCH 1/7] hw/virtio/virtio-pmem: Replace impossible check by assertion, (continued)
- [PATCH 2/7] hw/block/vhost-user-blk: Use DEVICE() / VIRTIO_DEVICE() macros, Philippe Mathieu-Daudé, 2023/10/17
- [PATCH 3/7] hw/display/virtio-gpu: Use VIRTIO_DEVICE() macro, Philippe Mathieu-Daudé, 2023/10/17
- [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Philippe Mathieu-Daudé, 2023/10/17
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Manos Pitsidianakis, 2023/10/17
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Mark Cave-Ayland, 2023/10/17
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro,
Kevin Wolf <=
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Peter Maydell, 2023/10/31
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Richard W.M. Jones, 2023/10/31
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Kevin Wolf, 2023/10/31
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Kevin Wolf, 2023/10/31
- Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Richard W.M. Jones, 2023/10/31
[PATCH 7/7] hw/usb: Declare link using static DEFINE_PROP_LINK() macro, Philippe Mathieu-Daudé, 2023/10/17
[PATCH 5/7] hw/dma: Declare link using static DEFINE_PROP_LINK() macro, Philippe Mathieu-Daudé, 2023/10/17
[PATCH 6/7] hw/net: Declare link using static DEFINE_PROP_LINK() macro, Philippe Mathieu-Daudé, 2023/10/17