[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] hostmem: detect host backend memory is bein
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] hostmem: detect host backend memory is being used properly |
Date: |
Wed, 13 Jul 2016 12:49:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 13/07/2016 09:30, Igor Mammedov wrote:
> I wonder if it could be cleaner to extend QOM API with
>
> object_get_refcount();
>
> and then add
>
> bool hostmem_is_busy()
> {
> return object_get_refcount() > 1;
> }
>
> that would work as not used used hostmem would have ref counter == 1
> and when front-end starts to use it, it calls
> qdev_prop_allow_set_link_before_realize()
> which rises ref counter of backend to 2.
>
> Also see a comment below.
I disagree---there are many reasons why a refcount can be > 1, and given
that we use RCU the release of the reference can be delayed arbitrarily.
Paolo