From: Stefan Hajnoczi <stefanha@gmail.com>
To: nyoro.gachu@gmail.com
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
Samker <samkergachu@gmail.com>
Subject: Re: [PATCH] LockGuards: replace manual lock()/unlock() calls to WITH_QEMU_LOCK_GUARD()
Date: Sun, 6 Nov 2022 08:48:55 -0500 [thread overview]
Message-ID: <CAJSP0QWry8DBoydu0bBEJm80-RaZXfAMPepKm6NEqdt-STykHQ@mail.gmail.com> (raw)
In-Reply-To: <20221104230811.7188-1-nyoro.martin@gmail.com>
On Fri, 4 Nov 2022 at 21:04, <nyoro.gachu@gmail.com> wrote:
>
> From: Samker <samkergachu@gmail.com>
...
> Signed-off-by: M N Gachu <nyoro.gachu@gmail.com>
The author and Signed-off-by name/email are different. Do you want to
use a single name/email?
> ---
> softmmu/physmem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index d9578ccfd4..fb00596777 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -24,6 +24,7 @@
> #include "qemu/cutils.h"
> #include "qemu/cacheflush.h"
> #include "qemu/madvise.h"
> +#include "qemu/lockable.h"
>
> #ifdef CONFIG_TCG
> #include "hw/core/tcg-cpu-ops.h"
> @@ -3114,13 +3115,12 @@ void cpu_register_map_client(QEMUBH *bh)
> {
> MapClient *client = g_malloc(sizeof(*client));
>
> - qemu_mutex_lock(&map_client_list_lock);
> + WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
There is a bug here: the lock won't be held after this line because
WITH_QEMU_LOCK_GUARD() is block scoped. It requires curly braces:
WITH_QEMU_LOCK_GUARD(&lock) {
...protected code...
}
...unprotected code...
Use QEMU_LOCK_GUARD(&lock); when don't want block scope. It holds the
lock for the remainder of the function.
prev parent reply other threads:[~2022-11-06 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 23:08 [PATCH] LockGuards: replace manual lock()/unlock() calls to WITH_QEMU_LOCK_GUARD() nyoro.gachu
2022-11-06 13:48 ` Stefan Hajnoczi [this message]
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=CAJSP0QWry8DBoydu0bBEJm80-RaZXfAMPepKm6NEqdt-STykHQ@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=nyoro.gachu@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=samkergachu@gmail.com \
--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).