From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race
Date: Tue, 10 Mar 2015 23:51:55 +0100 [thread overview]
Message-ID: <54FF758B.5080107@de.ibm.com> (raw)
In-Reply-To: <1426002357-6889-1-git-send-email-pbonzini@redhat.com>
Am 10.03.2015 um 16:45 schrieb Paolo Bonzini:
[...]
>
> Moral of the story: I should refrain from writing more clever stuff.
> At least it looks like it is not too clever to be undebuggable.
>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Fixes: c740ad92d0d958fa785e5d7aa1b67ecaf30a6a54
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> include/qemu/queue.h | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/include/qemu/queue.h b/include/qemu/queue.h
> index 8094150..f781aa2 100644
> --- a/include/qemu/queue.h
> +++ b/include/qemu/queue.h
> @@ -197,11 +197,12 @@ struct { \
> (head)->slh_first = (elm); \
> } while (/*CONSTCOND*/0)
>
> -#define QSLIST_INSERT_HEAD_ATOMIC(head, elm, field) do { \
> - do { \
> - (elm)->field.sle_next = (head)->slh_first; \
> - } while (atomic_cmpxchg(&(head)->slh_first, (elm)->field.sle_next, \
> - (elm)) != (elm)->field.sle_next); \
> +#define QSLIST_INSERT_HEAD_ATOMIC(head, elm, field) do { \
> + typeof(elm) save_sle_next; \
> + do { \
> + save_sle_next = (elm)->field.sle_next = (head)->slh_first; \
> + } while (atomic_cmpxchg(&(head)->slh_first, save_sle_next, (elm)) != \
> + save_sle_next); \
> } while (/*CONSTCOND*/0)
>
> #define QSLIST_MOVE_ATOMIC(dest, src) do { \
>
next prev parent reply other threads:[~2015-03-10 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 15:45 [Qemu-devel] [PATCH] queue: fix QSLIST_INSERT_HEAD_ATOMIC race Paolo Bonzini
2015-03-10 22:51 ` Christian Borntraeger [this message]
2015-03-12 13:34 ` Stefan Hajnoczi
2015-03-12 13:35 ` 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=54FF758B.5080107@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.