From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: famz@redhat.com, qemu-block@nongnu.org, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 03/11] util: use RCU accessors for notifiers
Date: Thu, 6 Jul 2017 18:38:20 +0200 [thread overview]
Message-ID: <20170706163828.24082-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20170706163828.24082-1-pbonzini@redhat.com>
This provides more flexibility for its users.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
util/notify.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/util/notify.c b/util/notify.c
index 06de63a839..16fff8d07d 100644
--- a/util/notify.c
+++ b/util/notify.c
@@ -16,6 +16,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/notify.h"
+#include "qemu/rcu_queue.h"
void notifier_list_init(NotifierList *list)
{
@@ -24,19 +25,19 @@ void notifier_list_init(NotifierList *list)
void notifier_list_add(NotifierList *list, Notifier *notifier)
{
- QLIST_INSERT_HEAD(&list->notifiers, notifier, node);
+ QLIST_INSERT_HEAD_RCU(&list->notifiers, notifier, node);
}
void notifier_remove(Notifier *notifier)
{
- QLIST_REMOVE(notifier, node);
+ QLIST_REMOVE_RCU(notifier, node);
}
void notifier_list_notify(NotifierList *list, void *data)
{
Notifier *notifier, *next;
- QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
+ QLIST_FOREACH_SAFE_RCU(notifier, &list->notifiers, node, next) {
notifier->notify(notifier, data);
}
}
@@ -49,12 +50,12 @@ void notifier_with_return_list_init(NotifierWithReturnList *list)
void notifier_with_return_list_add(NotifierWithReturnList *list,
NotifierWithReturn *notifier)
{
- QLIST_INSERT_HEAD(&list->notifiers, notifier, node);
+ QLIST_INSERT_HEAD_RCU(&list->notifiers, notifier, node);
}
void notifier_with_return_remove(NotifierWithReturn *notifier)
{
- QLIST_REMOVE(notifier, node);
+ QLIST_REMOVE_RCU(notifier, node);
}
int notifier_with_return_list_notify(NotifierWithReturnList *list, void *data)
@@ -62,7 +63,7 @@ int notifier_with_return_list_notify(NotifierWithReturnList *list, void *data)
NotifierWithReturn *notifier, *next;
int ret = 0;
- QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
+ QLIST_FOREACH_SAFE_RCU(notifier, &list->notifiers, node, next) {
ret = notifier->notify(notifier, data);
if (ret != 0) {
break;
--
2.13.0
next prev parent reply other threads:[~2017-07-06 16:38 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 16:38 [Qemu-devel] [RFC PATCH 00/11] Block layer thread-safety, next part Paolo Bonzini
2017-07-06 16:38 ` [Qemu-devel] [PATCH 01/11] block: prepare write threshold code for thread safety Paolo Bonzini
2017-07-06 16:51 ` Eric Blake
2017-07-10 13:21 ` Stefan Hajnoczi
2017-07-10 16:16 ` Paolo Bonzini
2017-07-10 16:22 ` Eric Blake
2017-07-06 16:38 ` [Qemu-devel] [PATCH 02/11] block: make write-threshold thread-safe Paolo Bonzini
2017-07-06 16:52 ` Eric Blake
2017-07-10 15:42 ` Stefan Hajnoczi
2017-07-06 16:38 ` Paolo Bonzini [this message]
2017-07-10 15:52 ` [Qemu-devel] [PATCH 03/11] util: use RCU accessors for notifiers Stefan Hajnoczi
2017-07-10 16:06 ` Paolo Bonzini
2017-07-11 9:45 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 04/11] block: make before-write notifiers thread-safe Paolo Bonzini
2017-07-10 15:50 ` Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 05/11] block-backup: add reqs_lock Paolo Bonzini
2017-07-10 15:57 ` Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 06/11] block: add a few more notes on locking Paolo Bonzini
2017-07-10 15:57 ` Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 07/11] block: do not acquire AioContext in check_to_replace_node Paolo Bonzini
2017-07-10 15:58 ` Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 08/11] block: drain I/O around key management Paolo Bonzini
2017-07-10 16:01 ` Stefan Hajnoczi
2017-07-06 16:38 ` [Qemu-devel] [PATCH 09/11] block/replication: do not acquire AioContext Paolo Bonzini
2017-07-06 16:38 ` [Qemu-devel] [PATCH 10/11] block: do not take AioContext around reopen Paolo Bonzini
2017-07-06 16:38 ` [Qemu-devel] [PATCH 11/11] block/snapshot: do not take AioContext lock Paolo Bonzini
2017-07-10 16:24 ` Stefan Hajnoczi
2017-07-10 16:27 ` Paolo Bonzini
2017-07-11 9:43 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-07-11 9:48 ` Paolo Bonzini
2017-07-12 10:42 ` Stefan Hajnoczi
2017-07-06 23:48 ` [Qemu-devel] [RFC PATCH 00/11] Block layer thread-safety, next part no-reply
2017-07-07 0:06 ` Fam Zheng
2017-07-10 16:25 ` Stefan Hajnoczi
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=20170706163828.24082-4-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).