From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot Date: Tue, 11 Oct 2016 10:39:04 +0800 Message-ID: <1259cdba-c137-c3da-abe2-ecf51aec6738@linux.intel.com> References: <1475998904-13456-1-git-send-email-xiaoguang.chen@intel.com> <1475998904-13456-2-git-send-email-xiaoguang.chen@intel.com> <20161009083134.GA19090@nvidia.com> <20161010180140.GA27757@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, guangrong.xiao@intel.com, jike.song@intel.com, Kirti Wankhede To: Paolo Bonzini , Neo Jia , Xiaoguang Chen Return-path: Received: from mga05.intel.com ([192.55.52.43]:33048 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbcJKCpl (ORCPT ); Mon, 10 Oct 2016 22:45:41 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 10/11/2016 02:32 AM, Paolo Bonzini wrote: > > > On 10/10/2016 20:01, Neo Jia wrote: >>> Hi Neo, >>> >>> AFAIK this is needed because KVMGT doesn't paravirtualize the PPGTT, >>> while nVidia does. >> >> Hi Paolo and Xiaoguang, >> >> I am just wondering how device driver can register a notifier so he can be >> notified for write-protected pages when writes are happening. > > It can't yet, but the API is ready for that. kvm_vfio_set_group is > currently where a struct kvm_device* and struct vfio_group* touch. Given > a struct kvm_device*, dev->kvm provides the struct kvm to be passed to > kvm_page_track_register_notifier. So I guess you could add a callback > that passes the struct kvm_device* to the mdev device. > > Xiaoguang and Guangrong, what were your plans? We discussed it briefly > at KVM Forum but I don't remember the details. > Your suggestion was that pass kvm fd to KVMGT via VFIO, so that we can figure out the kvm instance based on the fd. We got a new idea, how about search the kvm instance by mm_struct, it can work as KVMGT is running in the vcpu context and it is much more straightforward.