From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot Date: Tue, 11 Oct 2016 10:54:45 +0200 Message-ID: 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> <1259cdba-c137-c3da-abe2-ecf51aec6738@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, guangrong.xiao@intel.com, jike.song@intel.com, Kirti Wankhede To: Xiao Guangrong , Neo Jia , Xiaoguang Chen Return-path: Received: from mx1.redhat.com ([209.132.183.28]:51690 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbcJKIyu (ORCPT ); Tue, 11 Oct 2016 04:54:50 -0400 In-Reply-To: <1259cdba-c137-c3da-abe2-ecf51aec6738@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/10/2016 04:39, Xiao Guangrong wrote: > > > 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. Perhaps I didn't understand your suggestion, but the same mm_struct can have more than 1 struct kvm so I'm not sure that it can work. Paolo