qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v2 11/25] include/block/blockjob.h: global state API


From: Emanuele Giuseppe Esposito
Subject: Re: [RFC PATCH v2 11/25] include/block/blockjob.h: global state API
Date: Fri, 8 Oct 2021 09:20:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1


+/*
+ * Global state (GS) API. These functions run under the BQL lock.
+ *
+ * If a function modifies the graph, it also uses drain and/or
+ * aio_context_acquire/release to be sure it has unique access.
+ * aio_context locking is needed together with BQL because of
+ * the thread-safe I/O API that concurrently runs and accesses
+ * the graph without the BQL.
+ *
+ * It is important to note that not all of these functions are
+ * necessarily limited to running under the BQL, but they would
+ * require additional auditing and may small thread-safety changes
+ * to move them into the I/O API. Often it's not worth doing that
+ * work since the APIs are only used with the BQL held at the
+ * moment, so they have been placed in the GS API (for now).
+ *
+ * All functions below must use this assertion:
+ * g_assert(qemu_in_main_thread());
+ * to catch when they are accidentally called without the BQL.
+ */

This is comment is duplicated in many places. I suggest explaining it in
one place and using references in the other files:

   /*
    * Global state (GS) API. These functions run under the BQL lock.
    *
    * See include/block/block.h for more information about the GS API.
    */


Good idea. Should I also do that for I/O, or it's not worth for very few lines?

Thank you,
Emanuele




reply via email to

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