qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] rcu: Call drain_call_rcu at exit


From: Akihiko Odaki
Subject: Re: [PATCH] rcu: Call drain_call_rcu at exit
Date: Sat, 11 Jan 2025 14:40:04 +0900
User-agent: Mozilla Thunderbird

Hi Paolo,

Please review this patch.

Regards,
Akihiko Odaki

On 2024/10/13 16:31, Akihiko Odaki wrote:
call_rcu() callbacks may have potential memory leaks, but QEMU may
sometimes exit before draining the callbacks and leave the leaks
undetected by LeakSanitizer. For example, PCI devices register a
call_rcu() callback by calling address_space_destroy() and they will
not be freed until it gets drained. This hides memory leaks that
is going to happen when PCI devices loose references to the memory
allocations.

Call drain_call_rcu at exit to expose memory leaks by call_rcu()
callbacks deterministically.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
  util/rcu.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/util/rcu.c b/util/rcu.c
index fa32c942e4bb..118a974e3438 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -415,6 +415,7 @@ static void rcu_init_complete(void)
      qemu_thread_create(&thread, "call_rcu", call_rcu_thread,
                         NULL, QEMU_THREAD_DETACHED);
+ atexit(drain_call_rcu);
      rcu_register_thread();
  }
---
base-commit: 31669121a01a14732f57c49400bc239cf9fd505f
change-id: 20241013-rcu-b4864052a103

Best regards,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]