OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 1/2] vfio: take the kvm reference only for drivers that read device->kvm
Date: Thu, 05 Nov 2026 13:54:22 +0100	[thread overview]
Message-ID: <179388326205.2823727.6310123298126061442.b4-review@b4> (raw)
In-Reply-To: <20261105121733.643754-2-andrey.drobyshev@virtuozzo.com>

I won't apply this version, please send v3 with the changes below.

On Thu, 5 Nov 2026 14:17:32 +0200, Andrey Drobyshev wrote:
> Only three drivers read device->kvm after open_device(): KVMGT,
> vfio_ap and vfio-pci's zdev support. Let them say so with
> needs_kvm_ref, and take no reference for the others, which then can't
> keep a VM alive. Tested with nvidia-vgpu-vfio 595.71.03 on RTX 6000
> Ada SR-IOV VFs, a vfio-pci variant driver that doesn't read the
> pointer.

Item 1 of the cover letter reply: "after open_device()" becomes "in
open_device()", and say that device->kvm stays NULL without the flag.

Why: all three read the pointer in open_device(). vfio_ap reads it
only there and fails the open with -EINVAL when it is NULL. And
vfio_device_get_kvm_safe() returns before it sets device->kvm, so a
driver without the flag gets no pointer at all, not just no
reference. An out-of-tree driver that reads it now sees NULL.

Item 2 of the cover letter reply: say how you checked that
nvidia-vgpu-vfio does not read device->kvm.

Why: that driver is the one this change is for, and its source is not
in our tree. If it does read the pointer, it now gets NULL.

> +	/*
> +	 * Set before registration by a driver that reads device->kvm after
> +	 * open_device(): the core then keeps the KVM the device was opened
> +	 * with referenced until close_device().
> +	 */

Item 1 of the cover letter reply: the same two fixes in this comment.

> Feature: fix ms/vfio
>
> Assisted-by: LLM

Item 5 of the cover letter reply: drop the Assisted-by line here, it
goes into the cover letter. Put a blank line before Feature:.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-05 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 12:17 [Devel] [PATCH hci-8.1 v2 0/2] vfio, KVM: kvm reference leak and debugfs clash on live update Andrey Drobyshev
2026-11-05 12:17 ` [Devel] [PATCH hci-8.1 1/2] vfio: take the kvm reference only for drivers that read device->kvm Andrey Drobyshev
2026-11-05 12:23   ` no-reply
2026-11-05 12:54   ` Konstantin Khorenko [this message]
2026-11-05 12:17 ` [Devel] [PATCH hci-8.1 2/2] KVM: remove the VM's debugfs directory when its fd is released Andrey Drobyshev
2026-11-05 12:24   ` no-reply
2026-11-05 12:54   ` Konstantin Khorenko
2026-11-05 12:54 ` [Devel] [PATCH hci-8.1 v2 0/2] vfio, KVM: kvm reference leak and debugfs clash on live update Konstantin Khorenko

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=179388326205.2823727.6310123298126061442.b4-review@b4 \
    --to=khorenko@virtuozzo.com \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=devel@openvz.org \
    /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