[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD
From: |
Paolo Bonzini |
Subject: |
[PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD |
Date: |
Wed, 18 Dec 2019 13:02:26 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
The automatic rcu read lock maintenance works quite
nicely in this case where it previously relied on a comment to
delimit the lifetime and now has a block.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/qsp.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/util/qsp.c b/util/qsp.c
index 6226541..7d5147f 100644
--- a/util/qsp.c
+++ b/util/qsp.c
@@ -598,7 +598,6 @@ static void qsp_ht_delete(void *p, uint32_t h, void *htp)
static void qsp_mktree(GTree *tree, bool callsite_coalesce)
{
- QSPSnapshot *snap;
struct qht ht, coalesce_ht;
struct qht *htp;
@@ -610,20 +609,19 @@ static void qsp_mktree(GTree *tree, bool
callsite_coalesce)
* We must remain in an RCU read-side critical section until we're done
* with the snapshot.
*/
- rcu_read_lock();
- snap = atomic_rcu_read(&qsp_snapshot);
+ WITH_RCU_READ_LOCK_GUARD() {
+ QSPSnapshot *snap = atomic_rcu_read(&qsp_snapshot);
- /* Aggregate all results from the global hash table into a local one */
- qht_init(&ht, qsp_entry_no_thread_cmp, QSP_INITIAL_SIZE,
- QHT_MODE_AUTO_RESIZE | QHT_MODE_RAW_MUTEXES);
- qht_iter(&qsp_ht, qsp_aggregate, &ht);
+ /* Aggregate all results from the global hash table into a local one */
+ qht_init(&ht, qsp_entry_no_thread_cmp, QSP_INITIAL_SIZE,
+ QHT_MODE_AUTO_RESIZE | QHT_MODE_RAW_MUTEXES);
+ qht_iter(&qsp_ht, qsp_aggregate, &ht);
- /* compute the difference wrt the snapshot, if any */
- if (snap) {
- qsp_diff(&snap->ht, &ht);
+ /* compute the difference wrt the snapshot, if any */
+ if (snap) {
+ qsp_diff(&snap->ht, &ht);
+ }
}
- /* done with the snapshot; RCU can reclaim it */
- rcu_read_unlock();
htp = &ht;
if (callsite_coalesce) {
--
1.8.3.1
- [PULL 50/87] x86: move more x86-generic functions out of PC files, (continued)
- [PULL 50/87] x86: move more x86-generic functions out of PC files, Paolo Bonzini, 2019/12/18
- [PULL 51/87] acpi: move PC stubs out of stubs/, Paolo Bonzini, 2019/12/18
- [PULL 52/87] pc: stubify x86 iommu, Paolo Bonzini, 2019/12/18
- [PULL 53/87] hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler(), Paolo Bonzini, 2019/12/18
- [PULL 55/87] hw/isa/isa-bus: cleanup irq functions, Paolo Bonzini, 2019/12/18
- [PULL 54/87] hw/i386: Simplify ioapic_init_gsi(), Paolo Bonzini, 2019/12/18
- [PULL 57/87] hw/i386/pc: Inline port92_init(), Paolo Bonzini, 2019/12/18
- [PULL 56/87] hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string, Paolo Bonzini, 2019/12/18
- [PULL 58/87] hw/i386/pc: Extract the port92 device, Paolo Bonzini, 2019/12/18
- [PULL 59/87] hyperv: Use auto rcu_read macros, Paolo Bonzini, 2019/12/18
- [PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD,
Paolo Bonzini <=
- [PULL 61/87] memory: use RCU_READ_LOCK_GUARD, Paolo Bonzini, 2019/12/18
- [PULL 62/87] colo: fix return without releasing RCU, Paolo Bonzini, 2019/12/18
- [PULL 63/87] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG, Paolo Bonzini, 2019/12/18
- [PULL 65/87] docs: tweak kernel-doc for QEMU coding standards, Paolo Bonzini, 2019/12/18
- [PULL 66/87] docs/conf.py: Enable use of kerneldoc sphinx extension, Paolo Bonzini, 2019/12/18
- [PULL 67/87] Makefile: disable Sphinx nitpicking, Paolo Bonzini, 2019/12/18
- [PULL 71/87] docs: add memory API reference, Paolo Bonzini, 2019/12/18
- [PULL 69/87] docs: Create bitops.rst as example of kernel-docs, Paolo Bonzini, 2019/12/18
- [PULL 68/87] bitops.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18
- [PULL 70/87] memory.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18