mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, dmatlack@google.com
Subject: Re: [PATCH] KVM: allow struct kvm to outlive the file descriptors
Date: Wed, 2 Mar 2022 18:48:16 +0100	[thread overview]
Message-ID: <a0eee64e-763a-0db3-29d1-e19ee80ba1ee@redhat.com> (raw)
In-Reply-To: <Yh+trXegvWs+e5l3@google.com>

On 3/2/22 18:47, Sean Christopherson wrote:
>> +	/* This is safe, since we have a reference from open(). */
>> +	__module_get(THIS_MODULE);
> This isn't sufficient.  For x86, it only grabs a reference to kvm.ko, not the
> vendor module.  Instead, we can do:
> 
> 	if (!try_module_get(kvm_chardev_ops.owner))
> 		return ERR_PTR(-EINVAL);
> 
> And then on top, revert commit revert ("KVM: set owner of cpu and vm file operations").
> vCPUs file descriptors hold reference to the VM, which means they indirectly hold a
> reference to the module. So once the "real" bug of struct kvm not holding a reference
> to the module is fixed, grabbing a reference when a VM/vCPU inode is opened becomes
> unnecessary.
> 

Got it, I'll wait for David to post the right thing. :)

Paolo


      reply	other threads:[~2022-03-02 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 17:43 Paolo Bonzini
2022-03-02 17:47 ` Sean Christopherson
2022-03-02 17:48   ` Paolo Bonzini [this message]

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=a0eee64e-763a-0db3-29d1-e19ee80ba1ee@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.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

all inboxes | Powered by JetHome®