Message ID | 20221111103436.22381-1-yan.y.zhao@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add track_remove_slot and remove track_flush_slot | expand |
On Fri, Nov 11, 2022, Yan Zhao wrote: > KVMGT only cares about when a slot is indeed removed. > So switch to use track_remove_slot which is called when a slot is removed. This should capture the original motivation, i.e. that the existing ->track_flush_slot() hook is theoretically flawed. I think it also makes sense to call out that KVMGT undoubtedly does the wrong thing if a memslot is moved, but that (a) KVMGT has never supported moving memslots and (b) there's no sane use case for moving memslots that might be used by the guest for the GTT. Bonus points if you can figure out a way to capture the restriction in the docs, e.g. somewhere in gpu/i915.rst? Lastly, provide a link to the original discussion which provides even more context. Link: https://lore.kernel.org/all/20221108084416.11447-1-yan.y.zhao@intel.com > Cc: Zhenyu Wang <zhenyuw@linux.intel.com> > Suggested-by: Sean Christopherson <seanjc@google.com> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> > ---
On Fri, Nov 11, 2022 at 05:07:35PM +0000, Sean Christopherson wrote: > On Fri, Nov 11, 2022, Yan Zhao wrote: > > KVMGT only cares about when a slot is indeed removed. > > So switch to use track_remove_slot which is called when a slot is removed. > > This should capture the original motivation, i.e. that the existing > ->track_flush_slot() hook is theoretically flawed. I think it also makes sense > to call out that KVMGT undoubtedly does the wrong thing if a memslot is moved, > but that (a) KVMGT has never supported moving memslots and (b) there's no sane > use case for moving memslots that might be used by the guest for the GTT. > > Bonus points if you can figure out a way to capture the restriction in the docs, > e.g. somewhere in gpu/i915.rst? > > Lastly, provide a link to the original discussion which provides even more context. > > Link: https://lore.kernel.org/all/20221108084416.11447-1-yan.y.zhao@intel.com > Got it. I'll do it next time! Thanks Yan > > Cc: Zhenyu Wang <zhenyuw@linux.intel.com> > > Suggested-by: Sean Christopherson <seanjc@google.com> > > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> > > ---
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 714221f9a131..9582d047471f 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -109,7 +109,7 @@ struct gvt_dma { static void kvmgt_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *val, int len, struct kvm_page_track_notifier_node *node); -static void kvmgt_page_track_flush_slot(struct kvm *kvm, +static void kvmgt_page_track_remove_slot(struct kvm *kvm, struct kvm_memory_slot *slot, struct kvm_page_track_notifier_node *node); @@ -673,7 +673,7 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev) gvt_cache_init(vgpu); vgpu->track_node.track_write = kvmgt_page_track_write; - vgpu->track_node.track_flush_slot = kvmgt_page_track_flush_slot; + vgpu->track_node.track_remove_slot = kvmgt_page_track_remove_slot; kvm_get_kvm(vgpu->vfio_device.kvm); kvm_page_track_register_notifier(vgpu->vfio_device.kvm, &vgpu->track_node); @@ -1617,7 +1617,7 @@ static void kvmgt_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, (void *)val, len); } -static void kvmgt_page_track_flush_slot(struct kvm *kvm, +static void kvmgt_page_track_remove_slot(struct kvm *kvm, struct kvm_memory_slot *slot, struct kvm_page_track_notifier_node *node) {
KVMGT only cares about when a slot is indeed removed. So switch to use track_remove_slot which is called when a slot is removed. Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)