All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc Hartmayer" <mhartmay@linux.ibm.com>
To: Dmitrii Gavrilov <ds-gavr@yandex-team.ru>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"berrange@redhat.com" <berrange@redhat.com>,
	"eduardo@habkost.net" <eduardo@habkost.net>,
	"mlevitsk@redhat.com" <mlevitsk@redhat.com>,
	"vsementsov@yandex-team.ru" <vsementsov@yandex-team.ru>,
	"yc-core@yandex-team.ru" <yc-core@yandex-team.ru>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Benjamin Block <bblock@linux.ibm.com>
Subject: Re: [PATCH] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add()
Date: Fri, 26 Apr 2024 13:01:42 +0200	[thread overview]
Message-ID: <87v844ie09.fsf@linux.ibm.com> (raw)
In-Reply-To: <121531714120162@mail.yandex-team.ru>

On Fri, Apr 26, 2024 at 11:57 AM +0300, Dmitrii Gavrilov <ds-gavr@yandex-team.ru> wrote:
> 26.04.2024, 11:17, "Marc Hartmayer" <mhartmay@linux.ibm.com>:
>
>  On Fri, Nov 03, 2023 at 01:56 PM +0300, Dmitrii Gavrilov <ds-gavr@yandex-team.ru> wrote:
>
>   Original goal of addition of drain_call_rcu to qmp_device_add was to cover
>   the failure case of qdev_device_add. It seems call of drain_call_rcu was
>   misplaced in 7bed89958bfbf40df what led to waiting for pending RCU callbacks
>   under happy path too. What led to overall performance degradation of
>   qmp_device_add.
>
>   In this patch call of drain_call_rcu moved under handling of failure of
>   qdev_device_add.
>
>   Signed-off-by: Dmitrii Gavrilov <ds-gavr@yandex-team.ru>
>
>  I don't know the exact reason, but this commit caused udev events to
>  show up much slower than before (~3s vs. ~23s) when a virtio-scsi device
>  is hotplugged (I’ve tested this only on s390x). Importantly, this only
>  happens when asynchronous SCSI scanning is disabled in the *guest*
>  kernel (scsi_mod.scan=sync or CONFIG_SCSI_SCAN_ASYNC=n).
>
>  The `udevadm monitor` output captured while hotplugging the device
>  (using QEMU 012b170173bc ("system/qdev-monitor: move drain_call_rcu call
>  under if (!dev) in qmp_device_add()")):
>

[…snip…]

>  Any ideas?
>
>  Thanks in advance.
>
>  Kind regards,
>   Marc
>
> Hello!
>  
> Thank you for mentioning this.
>  
> At first glance it seems that using scsi in synchonous mode caues the global
> QEMU mutex lock until the scanning phase is complete. Prior to 012b170173bc
> ("system/qdev-monitor: move drain_call_rcu call under if (!dev) in
> qmp_device_add()") on each device adition the lock would be forcibly removed
> allowing callbacks (including UDEV ones) to be processed after a new device
> is added.
>  
> I`ll try to investigate this furter. But currently it appears to me like
> performance or observability dilemma.

I tried the test on my local laptop (x86_64) and there seems to be no
issue (I used the kernel cmdline option scsi_mod.scan=sync for the
guest) - guest and host kernel == 6.8.7. But please double check.

>  
> Is behaviour you mentioning consistant?

Yep, at least for more than 50 iterations (I stopped the test then).

>  
> Best regards,
> Dmitrii
-- 
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


  reply	other threads:[~2024-04-26 11:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 10:56 [PATCH] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add() Dmitrii Gavrilov
2023-11-07  7:28 ` Vladimir Sementsov-Ogievskiy
2023-11-07  7:32 ` Michael S. Tsirkin
2023-11-07  9:01   ` Vladimir Sementsov-Ogievskiy
2024-02-28 17:12 ` Vladimir Sementsov-Ogievskiy
2024-02-29 21:24 ` Paolo Bonzini
2024-04-26  8:16 ` Marc Hartmayer
2024-04-26  8:57   ` Dmitrii Gavrilov
2024-04-26 11:01     ` Marc Hartmayer [this message]
2024-04-30 14:27 ` Igor Mammedov
2024-04-30 19:33   ` boris.ostrovsky

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=87v844ie09.fsf@linux.ibm.com \
    --to=mhartmay@linux.ibm.com \
    --cc=bblock@linux.ibm.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=ds-gavr@yandex-team.ru \
    --cc=eduardo@habkost.net \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    --cc=yc-core@yandex-team.ru \
    /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.