From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751298AbcBWLu1 (ORCPT ); Tue, 23 Feb 2016 06:50:27 -0500 Received: from mga04.intel.com ([192.55.52.120]:36180 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746AbcBWLuZ (ORCPT ); Tue, 23 Feb 2016 06:50:25 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,489,1449561600"; d="scan'208";a="919239758" Message-ID: <56CC477A.4040606@intel.com> Date: Tue, 23 Feb 2016 19:50:18 +0800 From: Jike Song User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Paolo Bonzini CC: Xiao Guangrong , gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, kai huang , Andrea Arcangeli , Kevin Tian Subject: Re: [PATCH v3 00/11] KVM: x86: track guest page access References: <1455449503-20993-1-git-send-email-guangrong.xiao@linux.intel.com> <56C703C3.5070201@redhat.com> <56CADD6D.2040603@linux.intel.com> <56CBCBC1.8050902@intel.com> <1457505373.27893292.1456221705730.JavaMail.zimbra@redhat.com> In-Reply-To: <1457505373.27893292.1456221705730.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2016 06:01 PM, Paolo Bonzini wrote: > ----- Original Message ----- >> From: "Jike Song" >> To: "Xiao Guangrong" >> Cc: "Paolo Bonzini" , gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org, >> linux-kernel@vger.kernel.org, "kai huang" , "Andrea Arcangeli" , >> "Kevin Tian" >> Sent: Tuesday, February 23, 2016 4:02:25 AM >> Subject: Re: [PATCH v3 00/11] KVM: x86: track guest page access >> >> +Kevin >> >> On 02/22/2016 06:05 PM, Xiao Guangrong wrote: >>> >>> On 02/19/2016 08:00 PM, Paolo Bonzini wrote: >>>> >>>> I still have a doubt: how are you going to handle invalidation of GPU >>>> shadow page tables if a device (emulated in QEMU or even vhost) does DMA >>>> to the PPGTT? >>> >>> I think Jike is the better one to answer this question, Jike, could you >>> please clarify it? :) >>> >> >> Sure :) >> >> Actually in guest PPGTT is manipulated by CPU rather than GPU. The >> PPGTT page table itself are plain memory, composed & modified by the >> GPU driver, i.e. by CPU in Non-Root mode. >> >> Given that, we write-protected guest PPGTT, when VM writes PPGTT, EPT >> violation rather than DMA fault happens. > I may still misunderstand you, so apologize in advance .. > I am not talking of DMA faults; I am talking of a guest that reads > from disk into the PPGTT. into PPGTT the page table itself? as said by Kevin in another mail, this is NOT SUPPORTED. > This is emulated DMA, and your approach of > tracking guest page access from KVM means that you are not handling > this. Is this right? Right, our tacking mechanism cares only CPU write, not Device write. However, there is *NO* DMA emulation, just similar to passthrough. The device(IGD) is only cable of r/w memory according the shadowed PPGTT, which is managed by VGPU device-model, guaranteed only memory that owned by this vgpu can be mapped. All we need is to track CPU writes from guest. > If so, what happens if the guest does this > kind of operation (for example because it is not using the PPGTT > anymore)? KVMGT should not be confused the next time it works on > that PPGTT page. As explained above, the device-model won't allow such things to happen. > > Paolo > -- Thanks, Jike