On Wednesday 28 Feb 2024 at 10:43:27 (-0800), Elliot Berman wrote: > On Wed, Feb 28, 2024 at 01:34:15PM +0000, Quentin Perret wrote: > > Alternatively, the shared->private conversion happens in the KVM vcpu > > run loop, so we'd be in a good position to exit the VCPU_RUN ioctl with a > > new exit reason saying "can't donate that page while it's shared" and > > have userspace use MADVISE_DONTNEED or munmap, or whatever on the back > > of that. But I tend to prefer the rmap option if it's workable as that > > avoids adding new KVM userspace ABI. > > > > You'll still probably need the new exit reason saying "can't donate that > page while it's shared" if the refcount tests fail. Can use David's > iouring as example of some other part of the kernel has a reference to > the page. I can't think of anything to do other than exiting to > userspace because we don't know how to drop that extra ref. Ack, I realized that later on. I guess there may be cases where userspace doesn't know how to drop that pin, but that's not the kernel's fault and it can't do anything about it, so a userspace exit is our best chance... Thanks, Quentin