[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] system/qdev-monitor: move drain_call_rcu call under if (!de
From: |
Paolo Bonzini |
Subject: |
[PULL 02/12] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add() |
Date: |
Fri, 8 Mar 2024 15:55:44 +0100 |
From: Dmitrii Gavrilov <ds-gavr@yandex-team.ru>
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>
Message-ID: <20231103105602.90475-1-ds-gavr@yandex-team.ru>
Fixes: 7bed89958bf ("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>
---
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 a13db763e5d..874d65191ce 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -858,19 +858,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;
}
--
2.43.2
- [PULL 00/12] Misc fixes, i386 TSTEQ/TSTNE, coverity CI for 2024-03-08, Paolo Bonzini, 2024/03/08
- [PULL 02/12] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add(),
Paolo Bonzini <=
- [PULL 01/12] hw/scsi/lsi53c895a: add timer to scripts processing, Paolo Bonzini, 2024/03/08
- [PULL 03/12] meson: Remove --warn-common ldflag, Paolo Bonzini, 2024/03/08
- [PULL 04/12] hw/scsi/lsi53c895a: stop script on phase mismatch, Paolo Bonzini, 2024/03/08
- [PULL 07/12] mips: do not list individual devices from configs/, Paolo Bonzini, 2024/03/08
- [PULL 05/12] hw/intc/apic: fix memory leak, Paolo Bonzini, 2024/03/08
- [PULL 06/12] oslib-posix: fix memory leak in touch_all_pages, Paolo Bonzini, 2024/03/08
- [PULL 09/12] target/i386: use TSTEQ/TSTNE to check flags, Paolo Bonzini, 2024/03/08
- [PULL 08/12] target/i386: use TSTEQ/TSTNE to test low bits, Paolo Bonzini, 2024/03/08
- [PULL 11/12] run-coverity-scan: add --check-upload-only option, Paolo Bonzini, 2024/03/08
- [PULL 10/12] target/i386: remove mask from CCPrepare, Paolo Bonzini, 2024/03/08