qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Dmitrii Gavrilov <ds-gavr@yandex-team.ru>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, berrange@redhat.com,
	eduardo@habkost.net, mlevitsk@redhat.com,
	vsementsov@yandex-team.ru, yc-core@yandex-team.ru,
	boris.ostrovsky@oracle.com
Subject: Re: [PATCH] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add()
Date: Tue, 30 Apr 2024 16:27:39 +0200	[thread overview]
Message-ID: <20240430162739.7a6e65de@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <20231103105602.90475-1-ds-gavr@yandex-team.ru>

On Fri,  3 Nov 2023 13:56:02 +0300
Dmitrii Gavrilov <ds-gavr@yandex-team.ru> wrote:

Seems related to cpu hotpug issues,
CCing Boris for awareness.

> 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>
> ---
>  system/qdev-monitor.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
> index 1b8005a..dc7b02d 100644
> --- a/system/qdev-monitor.c
> +++ b/system/qdev-monitor.c
> @@ -856,19 +856,18 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
>          return;
>      }
>      dev = qdev_device_add(opts, errp);
> -
> -    /*
> -     * Drain all pending RCU callbacks. This is done because
> -     * some bus related operations can delay a device removal
> -     * (in this case this can happen if device is added and then
> -     * removed due to a configuration error)
> -     * to a RCU callback, but user might expect that this interface
> -     * will finish its job completely once qmp command returns result
> -     * to the user
> -     */
> -    drain_call_rcu();
> -
>      if (!dev) {
> +        /*
> +         * Drain all pending RCU callbacks. This is done because
> +         * some bus related operations can delay a device removal
> +         * (in this case this can happen if device is added and then
> +         * removed due to a configuration error)
> +         * to a RCU callback, but user might expect that this interface
> +         * will finish its job completely once qmp command returns result
> +         * to the user
> +         */
> +        drain_call_rcu();
> +
>          qemu_opts_del(opts);
>          return;
>      }



  parent reply	other threads:[~2024-04-30 14:28 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
2024-04-30 14:27 ` Igor Mammedov [this message]
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=20240430162739.7a6e65de@imammedo.users.ipa.redhat.com \
    --to=imammedo@redhat.com \
    --cc=berrange@redhat.com \
    --cc=boris.ostrovsky@oracle.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 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).