kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonardo Bras <leonardo@linux.ibm.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Paul Mackerras" <paulus@ozlabs.org>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Add separate helper for putting borrowed reference to kvm
Date: Thu, 28 Nov 2019 13:29:00 -0300	[thread overview]
Message-ID: <45e643bce58e0f7c9646bb6c548c4e9f026f1fa8.camel@linux.ibm.com> (raw)
In-Reply-To: <20191128010001.GJ22227@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On Wed, 2019-11-27 at 17:00 -0800, Sean Christopherson wrote:
> > Sorry, I missed some information on above example. 
> > Suppose on that example that the reorder changes take place so that
> > kvm_put_kvm{,_no_destroy}() always happens after the last usage of kvm
> > (in the same syscall, let's say).
> 
> That can't happen, because the ioctl() holds a reference to KVM via its
> file descriptor for /dev/kvm, and ioctl() in turn prevents the fd from
> being closed.
> 
> > Before T1 and T2, refcount = 1;
> 
> This is what's impossible.  T1 must have an existing reference to get
> into the ioctl(), and that reference cannot be dropped until the ioctl()
> completes (and by completes I mean returns to userspace). Assuming no
> other bugs, i.e. T2 has its own reference, then refcount >= 2.
> 

Thanks for explaining, I think I get it now.

Best regards,
Leonardo Bras

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-11-28 16:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 22:58 [PATCH] KVM: Add separate helper for putting borrowed reference to kvm Sean Christopherson
2019-10-22 13:49 ` Paolo Bonzini
2019-11-26 16:44 ` Leonardo Bras
2019-11-26 17:14   ` Sean Christopherson
2019-11-26 17:53     ` Leonardo Bras
2019-11-27 16:38       ` Paolo Bonzini
2019-11-27 18:24         ` Leonardo Bras
2019-11-27 18:32           ` Paolo Bonzini
2019-11-27 19:25             ` Leonardo Bras
2019-11-27 19:47               ` Sean Christopherson
2019-11-27 20:15                 ` Leonardo Bras
2019-11-27 21:57                   ` Leonardo Bras
2019-11-28  1:00                     ` Sean Christopherson
2019-11-28 16:29                       ` Leonardo Bras [this message]
2019-11-28 13:49                     ` Paolo Bonzini
2019-11-28 16:04                       ` Leonardo Bras
2019-11-26 17:57     ` Leonardo Bras

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=45e643bce58e0f7c9646bb6c548c4e9f026f1fa8.camel@linux.ibm.com \
    --to=leonardo@linux.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@ozlabs.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).