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 0/2] vfio: prevent kvm reference leak on qemu-update
Date: Wed, 04 Nov 2026 21:08:34 +0100	[thread overview]
Message-ID: <179382291493.2764784.410820796002692056.b4-review@b4> (raw)
In-Reply-To: <20261030144933.944360-1-andrey.drobyshev@virtuozzo.com>

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

On Fri, 30 Oct 2026 16:49:31 +0200, Andrey Drobyshev wrote:
> Andrey Drobyshev (2):
>   vfio: move an open device's kvm reference when its group gets a new
>     kvm
>   KVM: remove the VM's debugfs directory when its fd is released

What to change for v2:

1. Patch 1, code and commit message: do not change device->kvm under a
   driver that still uses it after open_device(). In tree that is
   KVMGT: it registers its page-track notifier on device->kvm at open
   and unregisters it from device->kvm at close. Check what the NVIDIA
   vGPU driver does with vdev->kvm after open and say in the message
   which driver the change was tested with.

2. Patch 1, code comment and commit message: give the real reason to
   skip NULL, the lock order (details in the patch reply), and drop
   "the new kvm, if any, arrives on its own". Update the kernel-doc of
   vfio_file_set_kvm() too.

3. Patch 1, commit message: add a Fixes tag for 2b48f52f2bff ("vfio:
   fix deadlock between group lock and kvm lock").

4. Patch 2, code: at fd release remove only the directory. Keep freeing
   debugfs_stat_data in kvm_destroy_vm(), moved out from under the
   IS_ERR(kvm->debugfs_dentry) early return. This version has a
   use-after-free.

5. Patch 2, commit message: say that the destroy uevent no longer
   carries STATS_PATH, and that the stats go away for a VM that keeps
   running on its vcpu fds after the VM fd is closed.

6. Both patches: single space after a period, in the messages and in
   the new code comments, and add the Feature: line.

7. Cover letter: write one. Say what goes wrong on a live update of a
   vGPU VM, what each patch does, and how it was tested. In the subject
   "qemu-update" becomes "live update", and "kvm reference leak" covers
   patch 1 only.

Separate, not needed for v2:

1. Patch 1 should go to mainline too, I created a task for that:
   https://virtuozzo.atlassian.net/browse/VSTOR-153437

Details on items 1-6 are in the replies to the patches.

-- 
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-04 20:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 14:49 Andrey Drobyshev
2026-10-30 14:49 ` [Devel] [PATCH hci-8.1 1/2] vfio: move an open device's kvm reference when its group gets a new kvm Andrey Drobyshev
2026-11-04 20:08   ` Konstantin Khorenko
2026-10-30 14:49 ` [Devel] [PATCH hci-8.1 2/2] KVM: remove the VM's debugfs directory when its fd is released Andrey Drobyshev
2026-11-04 20:08   ` Konstantin Khorenko
2026-11-04 20:08 ` Konstantin Khorenko [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=179382291493.2764784.410820796002692056.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