All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com,
	gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com, rth@twiddle.net
Subject: Re: [PATCH 2/2] hostmem: detect host backend memory is being used properly
Date: Wed, 13 Jul 2016 12:49:31 +0200	[thread overview]
Message-ID: <e20cd32e-ce44-6c6c-fab1-8f51086e9727@redhat.com> (raw)
In-Reply-To: <20160713093044.356d052d@nial.brq.redhat.com>



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

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: gleb@kernel.org, mtosatti@redhat.com, stefanha@redhat.com,
	mst@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <e20cd32e-ce44-6c6c-fab1-8f51086e9727@redhat.com> (raw)
In-Reply-To: <20160713093044.356d052d@nial.brq.redhat.com>



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

  reply	other threads:[~2016-07-13 10:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  4:18 [PATCH 1/2] hostmem: fix QEMU crash by 'info memdev' Xiao Guangrong
2016-07-13  4:18 ` [Qemu-devel] " Xiao Guangrong
2016-07-13  4:18 ` [PATCH 2/2] hostmem: detect host backend memory is being used properly Xiao Guangrong
2016-07-13  4:18   ` [Qemu-devel] " Xiao Guangrong
2016-07-13  7:30   ` Igor Mammedov
2016-07-13  7:30     ` [Qemu-devel] " Igor Mammedov
2016-07-13 10:49     ` Paolo Bonzini [this message]
2016-07-13 10:49       ` Paolo Bonzini
2016-07-13 10:45 ` [PATCH 1/2] hostmem: fix QEMU crash by 'info memdev' Paolo Bonzini
2016-07-13 10:45   ` [Qemu-devel] " Paolo Bonzini
2016-07-13 11:29   ` Markus Armbruster
2016-07-13 11:29     ` [Qemu-devel] " Markus Armbruster
2016-07-13 11:37     ` Paolo Bonzini
2016-07-13 11:37       ` [Qemu-devel] " Paolo Bonzini
2016-07-15  6:56       ` Xiao Guangrong
2016-07-15 17:16         ` Eric Blake
2016-07-15 17:16           ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e20cd32e-ce44-6c6c-fab1-8f51086e9727@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=gleb@kernel.org \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.