From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: "Kernel Mailing List, Linux" <linux-kernel@vger.kernel.org>,
kvm <kvm@vger.kernel.org>, Steffen Eiden <seiden@linux.ibm.com>,
Alex Williamson <alex.williamson@nvidia.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH 1/3] VFIO: take reference to the KVM module
Date: Mon, 13 Apr 2026 13:32:12 +0200 [thread overview]
Message-ID: <279763ec-438a-46a2-b2fd-e5b445ab0160@redhat.com> (raw)
In-Reply-To: <adka_L18z24zsQpc@google.com>
On 4/10/26 17:45, Sean Christopherson wrote:
> On Fri, Apr 10, 2026, Paolo Bonzini wrote:
>> On Fri, Apr 10, 2026 at 4:13 PM Sean Christopherson <seanjc@google.com> wrote:
>>>
>>> +Dan
>>>> We could get rid of the reference count completely (get_file() as a
>>>> replacement for kvm_get_kvm(), get_file_active() as a replacement for
>>>> kvm_get_kvm_safe()). struct kvm would need to add a back pointer from
>>>> struct kvm to struct file,
>>>
>>> I wasn't thinking of dropping kvm_get_kvm() entirely, rather just not exporting
>>> it. Forcing internal KVM usage to grab a reference to the file doesn't add a
>>> whole lot value.
>>
>> It adds not doing things in two different ways. The kvm_file is not
>> always available (and if we need to add it, it should be added in
>> struct kvm not struct kvm_device).
>
> My thought was to deliberately avoid putting it in "kvm", because as you're
> effectively pointing out, the file really shouldn't be passed around within KVM.
>
> Aha! What if we bury it in kvm_vfio? As an acknowledgement that passing around
> a kvm_file is only intended for cases where an external, non-KVM entity needs to
> to propagate the VM reference.
That would indeed be best but it doesn't compile as there's no file
argument to device_ops.create. And adding it to device_ops is ugly as well.
Putting the backpointer in "struct kvm" seems the least bad. I'll get a
look again after finishing testing for the merge window.
Paolo
next prev parent reply other threads:[~2026-04-13 11:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 18:01 [PATCH 0/3] KVM, vfio: remove exported KVM symbols Paolo Bonzini
2026-04-07 18:01 ` [PATCH 1/3] VFIO: take reference to the KVM module Paolo Bonzini
2026-04-09 15:00 ` Steffen Eiden
2026-04-09 18:59 ` Sean Christopherson
2026-04-10 8:16 ` Paolo Bonzini
2026-04-10 14:13 ` Sean Christopherson
2026-04-10 14:34 ` Paolo Bonzini
2026-04-10 15:45 ` Sean Christopherson
2026-04-13 11:32 ` Paolo Bonzini [this message]
2026-04-13 21:21 ` Sean Christopherson
2026-04-10 22:20 ` Dan Williams
2026-04-10 18:18 ` Jason Gunthorpe
2026-04-10 18:12 ` Jason Gunthorpe
2026-04-07 18:01 ` [PATCH 2/3] KVM, vfio: remove symbol_get(kvm_get_kvm_safe) from vfio Paolo Bonzini
2026-04-09 15:01 ` Steffen Eiden
2026-04-07 18:01 ` [PATCH 3/3] KVM, vfio: remove symbol_get(kvm_put_kvm) " Paolo Bonzini
2026-04-09 15:02 ` Steffen Eiden
2026-04-11 12:26 ` kernel test robot
2026-04-07 20:16 ` [PATCH 0/3] KVM, vfio: remove exported KVM symbols Alex Williamson
2026-04-09 15:06 ` Steffen Eiden
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=279763ec-438a-46a2-b2fd-e5b445ab0160@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.williamson@nvidia.com \
--cc=dan.j.williams@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=seiden@linux.ibm.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