Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7915172imu; Mon, 3 Dec 2018 23:00:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaFZHffwEdjN3SvS9NdaT4Lwb4pFvodWr7BPy6D2ad5e8ehx5f7rJf2JCcO3vZIAXEZXkd X-Received: by 2002:a62:6ec8:: with SMTP id j191mr18947551pfc.198.1543906823091; Mon, 03 Dec 2018 23:00:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543906823; cv=none; d=google.com; s=arc-20160816; b=DIEUdnCpsCQzbCy4lr9mFsgtBYKR1/+gABV4QJNLNzDpa7pGcb0IRjIS9nCi62i04Y h7xA6XIMkKSiKb3z5GAOt/+dHsS9g0BL4a7b5tRRzo7At/6COqtjNMfYLNCQilzisN/x UdD82qFGJLOiChf6Dv0mDYTWy920gpXLN1VPw7gAIAxKAUGTiVvRHKTmU0jugl8wEKSK YYvVdjTS2Wd2jHJSHvR24Wdus31YIhiSnWJPzUoQl/2cb6S1QbrrY+Ode17rK9C9c6UA 6f0WOe7ryyeyEKt9G/Iy4YNb9fdBpYTTVMJO79eK4f2X+7L7mlsrFrhDKWkTVHqRiPtY iWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=n5DwFrDLxzDbK6R902IepWlK+0UmGMZN26jfy8lpdno=; b=HATZpY8WASqfGIkH7VESVKL0uWe3rTFOAq7C6KTpNz8fb8MNttXkGQhcJ2TOfqPGL2 o4PHckTw64lCZ9Wxj/rzz22mjeIXCMQ8+GVUcIgMofKmvXdnZ8bSTJ2YqzSvX++iou9/ +7WslDcWowSplW7HC+BwzQLm78eRPgdW9KUOjTh0hG1BWwRJtn8o+l7wMz7bcQ2e6i2e e2rNukc1rFxsNqs3UeJP3BVzhbb9DFyncRXmori7ITEica1YRj7SuZ8NqUgP98Hp7Tc6 5dcI1VaLvVLL5dV5vI0Qr8Oq/Dj5Qlh6wU0JeLHRgq6j12j44c88GSN+0ymI/itCz4F+ QGfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si14131400pgg.44.2018.12.03.23.00.07; Mon, 03 Dec 2018 23:00:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbeLDG7d (ORCPT + 99 others); Tue, 4 Dec 2018 01:59:33 -0500 Received: from mga06.intel.com ([134.134.136.31]:3228 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbeLDG7d (ORCPT ); Tue, 4 Dec 2018 01:59:33 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2018 22:59:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,313,1539673200"; d="scan'208";a="126879544" Received: from linux.intel.com ([10.54.29.200]) by fmsmga001.fm.intel.com with ESMTP; 03 Dec 2018 22:59:31 -0800 Received: from tiger-server (dazhang1-ssd.sh.intel.com [10.239.48.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id EE272580375; Mon, 3 Dec 2018 22:59:28 -0800 (PST) Date: Tue, 4 Dec 2018 14:59:15 +0800 From: Yi Zhang To: Alexander Duyck Cc: dan.j.williams@intel.com, pbonzini@redhat.com, brho@google.com, kvm@vger.kernel.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, dave.jiang@intel.com, yu.c.zhang@intel.com, pagupta@redhat.com, david@redhat.com, jack@suse.cz, hch@lst.de, rkrcmar@redhat.com, jglisse@redhat.com Subject: Re: [PATCH RFC 0/3] Fix KVM misinterpreting Reserved page as an MMIO page Message-ID: <20181204065914.GB73736@tiger-server> Mail-Followup-To: Alexander Duyck , dan.j.williams@intel.com, pbonzini@redhat.com, brho@google.com, kvm@vger.kernel.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, dave.jiang@intel.com, yu.c.zhang@intel.com, pagupta@redhat.com, david@redhat.com, jack@suse.cz, hch@lst.de, rkrcmar@redhat.com, jglisse@redhat.com References: <154386493754.27193.1300965403157243427.stgit@ahduyck-desk1.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <154386493754.27193.1300965403157243427.stgit@ahduyck-desk1.amr.corp.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-12-03 at 11:25:20 -0800, Alexander Duyck wrote: > I have loosely based this patch series off of the following patch series > from Zhang Yi: > https://lore.kernel.org/lkml/cover.1536342881.git.yi.z.zhang@linux.intel.com > > The original set had attempted to address the fact that DAX pages were > treated like MMIO pages which had resulted in reduced performance. It > attempted to address this by ignoring the PageReserved flag if the page > was either a DEV_DAX or FS_DAX page. > > I am proposing this as an alternative to that set. The main reason for this > is because I believe there are a few issues that were overlooked with that > original set. Specifically KVM seems to have two different uses for the > PageReserved flag. One being whether or not we can pin the memory, the other > being if we should be marking the pages as dirty or accessed. I believe > only the pinning really applies so I have split the uses of > kvm_is_reserved_pfn and updated the function uses to determine support for > page pinning to include a check of the pgmap to see if it supports pinning. kvm is not the only one users of the dax page. A similar user of PageReserved to look at is: drivers/vfio/vfio_iommu_type1.c:is_invalid_reserved_pfn( vfio is also want to know the page is capable for pinning. I throught that you have removed the reserved flag on the dax page in https://patchwork.kernel.org/patch/10707267/ is something I missing here? > > --- > > Alexander Duyck (3): > kvm: Split use cases for kvm_is_reserved_pfn to kvm_is_refcounted_pfn > mm: Add support for exposing if dev_pagemap supports refcount pinning > kvm: Add additional check to determine if a page is refcounted > > > arch/x86/kvm/mmu.c | 6 +++--- > drivers/nvdimm/pfn_devs.c | 2 ++ > include/linux/kvm_host.h | 2 +- > include/linux/memremap.h | 5 ++++- > include/linux/mm.h | 11 +++++++++++ > virt/kvm/kvm_main.c | 34 +++++++++++++++++++++++++--------- > 6 files changed, 46 insertions(+), 14 deletions(-) > > --