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 v3 0/1] vfio: kvm reference leak on live update
Date: Thu, 05 Nov 2026 18:51:18 +0100	[thread overview]
Message-ID: <179390107828.2925323.247920460637301249.b4-review@b4> (raw)
In-Reply-To: <20261105141759.750676-1-andrey.drobyshev@virtuozzo.com>

Applying with these fixes on my side:
- commit message: KVMGT reads device->kvm while the guest runs too,
  not only in open_device() and at close;
- struct vfio_device comment: the flag is for a driver that uses
  device->kvm while the device is open, not only in open_device();
- the comments before the kvm get in vfio_df_group_open() and
  vfio_df_ioctl_bind_iommufd(): the pointer is saved only when the
  driver set needs_kvm_ref.

On Thu, 5 Nov 2026 16:17:58 +0200, Andrey Drobyshev wrote:
> Andrey Drobyshev (1):
>   vfio: take the kvm reference only for drivers that read device->kvm

Thanks, the code is right, and the test with this patch alone answers
the patch 2 question.

The first two fixes undo a mistake of mine: item 1 of my v2 reply said
"in open_device(), not after it". That holds for vfio_ap and zdev, but
KVMGT also calls kvm_write_track_add_gfn() on device->kvm while the
guest runs. Details are in the reply to the patch.

For the mainline version (VSTOR-153437): all three drivers already
take their own reference on the kvm in open_device(). So upstream may
prefer the core to hold its reference only across open_device() and
drop it right after, with no flag at all. Worth raising there.

-- 
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 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 14:17 Andrey Drobyshev
2026-11-05 14:17 ` [Devel] [PATCH hci-8.1 v3 1/1] vfio: take the kvm reference only for drivers that read device->kvm Andrey Drobyshev
2026-11-05 14:22   ` no-reply
2026-11-05 17:51   ` Konstantin Khorenko
2026-11-05 17:51 ` Konstantin Khorenko [this message]
2026-11-05 17:51 ` [Devel] [PATCH hci-8.1 v3 0/1] vfio: kvm reference leak 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=179390107828.2925323.247920460637301249.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