[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 59/87] hyperv: Use auto rcu_read macros
From: |
Paolo Bonzini |
Subject: |
[PULL 59/87] hyperv: Use auto rcu_read macros |
Date: |
Wed, 18 Dec 2019 13:02:25 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD
to replace the manual rcu_read_(un)lock calls.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/hyperv/hyperv.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index 6ebf31c..da8ce82 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -546,14 +546,14 @@ uint16_t hyperv_hcall_post_message(uint64_t param, bool
fast)
}
ret = HV_STATUS_INVALID_CONNECTION_ID;
- rcu_read_lock();
- QLIST_FOREACH_RCU(mh, &msg_handlers, link) {
- if (mh->conn_id == (msg->connection_id & HV_CONNECTION_ID_MASK)) {
- ret = mh->handler(msg, mh->data);
- break;
+ WITH_RCU_READ_LOCK_GUARD() {
+ QLIST_FOREACH_RCU(mh, &msg_handlers, link) {
+ if (mh->conn_id == (msg->connection_id & HV_CONNECTION_ID_MASK)) {
+ ret = mh->handler(msg, mh->data);
+ break;
+ }
}
}
- rcu_read_unlock();
unmap:
cpu_physical_memory_unmap(msg, len, 0, 0);
@@ -619,7 +619,6 @@ int hyperv_set_event_flag_handler(uint32_t conn_id,
EventNotifier *notifier)
uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
{
- uint16_t ret;
EventFlagHandler *handler;
if (unlikely(!fast)) {
@@ -645,15 +644,12 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bool
fast)
return HV_STATUS_INVALID_HYPERCALL_INPUT;
}
- ret = HV_STATUS_INVALID_CONNECTION_ID;
- rcu_read_lock();
+ RCU_READ_LOCK_GUARD();
QLIST_FOREACH_RCU(handler, &event_flag_handlers, link) {
if (handler->conn_id == param) {
event_notifier_set(handler->notifier);
- ret = 0;
- break;
+ return 0;
}
}
- rcu_read_unlock();
- return ret;
+ return HV_STATUS_INVALID_CONNECTION_ID;
}
--
1.8.3.1
- [PULL 49/87] hw/i386/pc: Convert DPRINTF() to trace events, (continued)
- [PULL 49/87] hw/i386/pc: Convert DPRINTF() to trace events, Paolo Bonzini, 2019/12/18
- [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 <=
- [PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD, Paolo Bonzini, 2019/12/18
- [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