[Top][All Lists]

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

Re: [Ping][PATCH v0] vl: flush all task from rcu queue before exiting

From: Denis Plotnikov
Subject: Re: [Ping][PATCH v0] vl: flush all task from rcu queue before exiting
Date: Wed, 10 Nov 2021 16:29:41 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 09.11.2021 20:46, Paolo Bonzini wrote:
On 11/9/21 08:23, Denis Plotnikov wrote:
Ping ping!

Looks good, but can you explain why it's okay to call it before qemu_chr_cleanup() and user_creatable_cleanup()?

I think a better solution to the ordering problem would be:

I agree, this looks better

with something like this:

diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index 7789f7be9c..f0c3ea5447 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -195,6 +195,7 @@ bool qemu_chr_fe_init(CharBackend *b,
     int tag = 0;

     if (s) {
+        object_ref(OBJECT(s));
         if (CHARDEV_IS_MUX(s)) {
             MuxChardev *d = MUX_CHARDEV(s);

@@ -241,6 +242,7 @@ void qemu_chr_fe_deinit(CharBackend *b, bool del)
             } else {
+            object_unref(obj);
         b->chr = NULL;

to keep the chardev live between qemu_chr_cleanup() and monitor_cleanup().

but frankly speaking I don't understand why we have to do ref/unref in char-fe interface functions, instead of just ref/uref-ing monitor's char device directly like this:

diff --git a/monitor/monitor.c b/monitor/monitor.c
index 21c7a68758f5..3692a8e15268 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -611,6 +611,7 @@ void monitor_data_destroy(Monitor *mon)
     qemu_chr_fe_deinit(&mon->chr, false);
+    object_unref(OBJECT(&mon->chr));
     if (monitor_is_qmp(mon)) {
         monitor_data_destroy_qmp(container_of(mon, MonitorQMP, common));
     } else {
@@ -737,6 +738,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
         error_propagate(errp, local_err);
         return -1;
+    object_ref(OBJECT(chr));
     return 0;

May be this shows the intentions better?



reply via email to

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