mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add()
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 in7bed89958b
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> Message-ID: <20231103105602.90475-1-ds-gavr@yandex-team.ru> Fixes:7bed89958b
("device_core: use drain_call_rcu in in qmp_device_add", 2020-10-12) Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9876359990
commit
012b170173
1 changed files with 11 additions and 12 deletions
|
@ -858,19 +858,18 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dev = qdev_device_add(opts, errp);
|
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) {
|
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);
|
qemu_opts_del(opts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue