[libvirt] [PATCH] qemu: update threading info about domain object refs

Jonathon Jongsma posted 1 patch 2 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190904172330.610-1-jjongsma@redhat.com
src/qemu/THREADS.txt | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)

[libvirt] [PATCH] qemu: update threading info about domain object refs

Posted by Jonathon Jongsma 2 weeks ago
Since commit fd9ef3b31e, virDomainFindByUUIDRef() no longer exists and
all virDomainObjListFindBy*() functions now increment the reference
count.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
 src/qemu/THREADS.txt | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/qemu/THREADS.txt b/src/qemu/THREADS.txt
index d17f3f4e0c..aa428fda6a 100644
--- a/src/qemu/THREADS.txt
+++ b/src/qemu/THREADS.txt
@@ -25,27 +25,17 @@ There are a number of locks on various objects
 
   * virDomainObjPtr
 
-    Will be locked after calling any of the virDomainObjListFindBy{ID,Name,UUID}
-    methods.  However, preferred method is qemuDomObjFromDomain() that uses
-    virDomainFindByUUIDRef() which also increases the reference counter and
-    finds the domain in the domain list without blocking all other lookups.
-    When the domain is locked and the reference increased, the preferred way of
-    decrementing the reference counter and unlocking the domain is using the
+    Will be locked and the reference counter will be increased after calling
+    any of the virDomainObjListFindBy{ID,Name,UUID} methods. The preferred way
+    of decrementing the reference counter and unlocking the domain is using the
     virDomainObjEndAPI() function.
 
     Lock must be held when changing/reading any variable in the virDomainObjPtr
 
-    If the lock needs to be dropped & then re-acquired for a short period of
-    time, the reference count must be incremented first using virDomainObjRef().
-    There is no need to increase the reference count if qemuDomObjFromDomain()
-    was used for looking up the domain.  In this case there is one reference
-    already added by that function.
-
     This lock must not be held for anything which sleeps/waits (i.e. monitor
     commands).
 
 
-
   * qemuMonitorPrivatePtr: Job conditions
 
     Since virDomainObjPtr lock must not be held during sleeps, the job
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: update threading info about domain object refs

Posted by Daniel Henrique Barboza 2 weeks ago

On 9/4/19 2:23 PM, Jonathon Jongsma wrote:
> Since commit fd9ef3b31e, virDomainFindByUUIDRef() no longer exists and
> all virDomainObjListFindBy*() functions now increment the reference
> count.
>
> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> ---
>   src/qemu/THREADS.txt | 16 +++-------------
>   1 file changed, 3 insertions(+), 13 deletions(-)

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

> diff --git a/src/qemu/THREADS.txt b/src/qemu/THREADS.txt
> index d17f3f4e0c..aa428fda6a 100644
> --- a/src/qemu/THREADS.txt
> +++ b/src/qemu/THREADS.txt
> @@ -25,27 +25,17 @@ There are a number of locks on various objects
>   
>     * virDomainObjPtr
>   
> -    Will be locked after calling any of the virDomainObjListFindBy{ID,Name,UUID}
> -    methods.  However, preferred method is qemuDomObjFromDomain() that uses
> -    virDomainFindByUUIDRef() which also increases the reference counter and
> -    finds the domain in the domain list without blocking all other lookups.
> -    When the domain is locked and the reference increased, the preferred way of
> -    decrementing the reference counter and unlocking the domain is using the
> +    Will be locked and the reference counter will be increased after calling
> +    any of the virDomainObjListFindBy{ID,Name,UUID} methods. The preferred way
> +    of decrementing the reference counter and unlocking the domain is using the
>       virDomainObjEndAPI() function.
>   
>       Lock must be held when changing/reading any variable in the virDomainObjPtr
>   
> -    If the lock needs to be dropped & then re-acquired for a short period of
> -    time, the reference count must be incremented first using virDomainObjRef().
> -    There is no need to increase the reference count if qemuDomObjFromDomain()
> -    was used for looking up the domain.  In this case there is one reference
> -    already added by that function.
> -
>       This lock must not be held for anything which sleeps/waits (i.e. monitor
>       commands).
>   
>   
> -
>     * qemuMonitorPrivatePtr: Job conditions
>   
>       Since virDomainObjPtr lock must not be held during sleeps, the job

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: update threading info about domain object refs

Posted by Pavel Hrdina 1 week ago
On Fri, Sep 06, 2019 at 09:54:29AM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 9/4/19 2:23 PM, Jonathon Jongsma wrote:
> > Since commit fd9ef3b31e, virDomainFindByUUIDRef() no longer exists and
> > all virDomainObjListFindBy*() functions now increment the reference
> > count.
> > 
> > Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> > ---
> >   src/qemu/THREADS.txt | 16 +++-------------
> >   1 file changed, 3 insertions(+), 13 deletions(-)
> 
> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>

and pushed, thanks.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list