* [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD()
@ 2022-11-08 5:11 nyoro.gachu
2022-11-08 8:05 ` Philippe Mathieu-Daudé
2022-11-08 9:19 ` Alex Bennée
0 siblings, 2 replies; 4+ messages in thread
From: nyoro.gachu @ 2022-11-08 5:11 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, samkergachu, Samker
From: Samker <nyoro.martin@gmail.com>
This is patch replaces WITH_QEMU_LOCK_GUARD() call with the
QEMU_LOCK_GUARD()
Signed-off-by: Samker <nyoro.martin@gmail.com>
---
softmmu/physmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index fb00596777..907491ae17 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -3115,7 +3115,7 @@ void cpu_register_map_client(QEMUBH *bh)
{
MapClient *client = g_malloc(sizeof(*client));
- WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
+ QEMU_LOCK_GUARD(&map_client_list_lock);
client->bh = bh;
QLIST_INSERT_HEAD(&map_client_list, client, link);
if (!qatomic_read(&bounce.in_use)) {
@@ -3143,7 +3143,7 @@ void cpu_unregister_map_client(QEMUBH *bh)
{
MapClient *client;
- WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
+ QEMU_LOCK_GUARD(&map_client_list_lock);
QLIST_FOREACH(client, &map_client_list, link) {
if (client->bh == bh) {
cpu_unregister_map_client_do(client);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD()
2022-11-08 5:11 [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD() nyoro.gachu
@ 2022-11-08 8:05 ` Philippe Mathieu-Daudé
2022-11-08 9:01 ` Martin Gachu
2022-11-08 9:19 ` Alex Bennée
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-08 8:05 UTC (permalink / raw)
To: nyoro.gachu, qemu-devel; +Cc: stefanha, samkergachu, Samker
Hi,
On 8/11/22 06:11, nyoro.gachu@gmail.com wrote:
> From: Samker <nyoro.martin@gmail.com>
>
> This is patch replaces WITH_QEMU_LOCK_GUARD() call with the
> QEMU_LOCK_GUARD()
>
> Signed-off-by: Samker <nyoro.martin@gmail.com>
> ---
> softmmu/physmem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index fb00596777..907491ae17 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -3115,7 +3115,7 @@ void cpu_register_map_client(QEMUBH *bh)
> {
> MapClient *client = g_malloc(sizeof(*client));
>
> - WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
> + QEMU_LOCK_GUARD(&map_client_list_lock);
> client->bh = bh;
> QLIST_INSERT_HEAD(&map_client_list, client, link);
> if (!qatomic_read(&bounce.in_use)) {
> @@ -3143,7 +3143,7 @@ void cpu_unregister_map_client(QEMUBH *bh)
> {
> MapClient *client;
>
> - WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
> + QEMU_LOCK_GUARD(&map_client_list_lock);
> QLIST_FOREACH(client, &map_client_list, link) {
> if (client->bh == bh) {
> cpu_unregister_map_client_do(client);
This patch doesn't apply...
$ git grep QEMU_LOCK_GUARD origin/master -- softmmu/physmem.c
$
On what is it based?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD()
2022-11-08 8:05 ` Philippe Mathieu-Daudé
@ 2022-11-08 9:01 ` Martin Gachu
0 siblings, 0 replies; 4+ messages in thread
From: Martin Gachu @ 2022-11-08 9:01 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, stefanha, samkergachu, Samker
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
Hi Philippe,
> This patch doesn't apply...
> $ git grep QEMU_LOCK_GUARD origin/master -- softmmu/physmem.c
> $
> On what is it based?
I initially replaced lock()/unlock() calls in the softmmu/physmem.c with
the more preferred WITH_QEMU_LOCK_GUARD() call.
However Stefan pointed out that instead I should have used QEMU_LOCK_GUARD
when I don't want to use block scope.
[-- Attachment #2: Type: text/html, Size: 922 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD()
2022-11-08 5:11 [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD() nyoro.gachu
2022-11-08 8:05 ` Philippe Mathieu-Daudé
@ 2022-11-08 9:19 ` Alex Bennée
1 sibling, 0 replies; 4+ messages in thread
From: Alex Bennée @ 2022-11-08 9:19 UTC (permalink / raw)
To: nyoro.gachu; +Cc: stefanha, samkergachu, Samker, qemu-devel
nyoro.gachu@gmail.com writes:
> From: Samker <nyoro.martin@gmail.com>
>
> This is patch replaces WITH_QEMU_LOCK_GUARD() call with the
> QEMU_LOCK_GUARD()
You could extend this description as to why ".. because it extends the
scope of the lock to the whole function rather than the non-existent
block".
Otherwise:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>
> Signed-off-by: Samker <nyoro.martin@gmail.com>
> ---
> softmmu/physmem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index fb00596777..907491ae17 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -3115,7 +3115,7 @@ void cpu_register_map_client(QEMUBH *bh)
> {
> MapClient *client = g_malloc(sizeof(*client));
>
> - WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
> + QEMU_LOCK_GUARD(&map_client_list_lock);
> client->bh = bh;
> QLIST_INSERT_HEAD(&map_client_list, client, link);
> if (!qatomic_read(&bounce.in_use)) {
> @@ -3143,7 +3143,7 @@ void cpu_unregister_map_client(QEMUBH *bh)
> {
> MapClient *client;
>
> - WITH_QEMU_LOCK_GUARD(&map_client_list_lock);
> + QEMU_LOCK_GUARD(&map_client_list_lock);
> QLIST_FOREACH(client, &map_client_list, link) {
> if (client->bh == bh) {
> cpu_unregister_map_client_do(client);
--
Alex Bennée
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-08 9:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 5:11 [PATCH] LOCK GUARDS: replace manual lock()/unlock() calls to QEMU_LOCK_GUARD() nyoro.gachu
2022-11-08 8:05 ` Philippe Mathieu-Daudé
2022-11-08 9:01 ` Martin Gachu
2022-11-08 9:19 ` Alex Bennée
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).