From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753061AbcGDGnn (ORCPT ); Mon, 4 Jul 2016 02:43:43 -0400 Received: from mga02.intel.com ([134.134.136.20]:1643 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752690AbcGDGnm (ORCPT ); Mon, 4 Jul 2016 02:43:42 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,573,1459839600"; d="scan'208";a="729229832" Subject: Re: [PATCH 0/2] KVM: MMU: support VMAs that got remap_pfn_range-ed To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1467291711-3230-1-git-send-email-pbonzini@redhat.com> Cc: Kirti Wankhede , Neo Jia , Andrea Arcangeli , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= From: Xiao Guangrong Message-ID: <577A049A.4000402@linux.intel.com> Date: Mon, 4 Jul 2016 14:39:22 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1467291711-3230-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/30/2016 09:01 PM, Paolo Bonzini wrote: > The vGPU folks would like to trap the first access to a BAR by setting > vm_ops on the VMAs produced by mmap-ing a VFIO device. The fault handler > then can use remap_pfn_range to place some non-reserved pages in the VMA. Why does it require fetching the pfn when the fault is triggered rather than when mmap() is called? Why the memory mapped by this mmap() is not a portion of MMIO from underlayer physical device? If it is a valid system memory, is this interface really needed to implemented in vfio? (you at least need to set VM_MIXEDMAP if it mixed system memory with MMIO) IIUC, the kernel assumes that VM_PFNMAP is a continuous memory, e.g, like current KVM and vaddr_get_pfn() in vfio, but it seems nvdia's patchset breaks this semantic as ops->validate_map_request() can adjust the physical address arbitrarily. (again, the name 'validate' should be changed to match the thing as it is really doing)