Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2518885imm; Thu, 19 Jul 2018 23:26:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYe5N/VfBna+fYuTg2AHTtbr3D0p4dWa3EM6xb/kfOWDoxx8w/07y1yKw1vXJlfP+euMdU X-Received: by 2002:a63:4c21:: with SMTP id z33-v6mr781344pga.383.1532067993542; Thu, 19 Jul 2018 23:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532067993; cv=none; d=google.com; s=arc-20160816; b=boE6Xxbpj+BrWHIzCLF0skYfEnypABRyaM4l8nxOdRBqqXXcYK+zZi8iS96w9H5sLq OWPn1cgJesSTbEXovEBxTGLNCRu6lNjGY+0WfCuKl+BCjtCMav8bwBaHOqPrqzbanUha LxKcgc21aEXEjxjPwZovJCdzqAuTsawDPGafy8k3BFZ1Y/4B4ZycVAJY9S2BGRkH6Bic fSFy/mlMYDIDeWRbuKgDn1eB5rxPxjf65lCrarkBUYWxnHyOPd8JrsH8p5NJd1H2UU3N OqFztbemIkhO+MktRye2NvnQUJfJ9SgXPQGE/y+vszmANO+2koU/Yzi44UqgB+vK6V06 Pf+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=rjdFOv8xB5fMezyinFAdWF3iyGpZcHZHsRDK6lvLBHA=; b=GJ3yLDX6hV2r9L0UaKG2p2eRmz6nZTjX1AQIUUxoU4dAj6unfouP5Pm/c4h+ed8KeC spolgAcVSHkVI0nqfBGhlsdnsBIIgnRQOnUwp5Bit7Ktp8vDwKUHkLbiwqMDPDY8TAx7 KJMXjpjql08HUkgJqN93j+QM9XP7f+oRi3agU70OVQv3J20eoxLxcxVcdXqlpYNgRy26 3FT4DVgSiIz6G2jce3I4Skfb/rWrfEfb6OxWHRjcqp894PgeLY/AmkH0PepYLeHUQsGY iBVD7vLEmVKWnPcjRAGadMuoDbWFNLoJnIojDqPF54R52MjR/0rCummuTsFIFanys+UZ 5+4g== 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 q1-v6si1024922plb.331.2018.07.19.23.26.18; Thu, 19 Jul 2018 23:26:33 -0700 (PDT) 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 S1727605AbeGTHMP (ORCPT + 99 others); Fri, 20 Jul 2018 03:12:15 -0400 Received: from mga18.intel.com ([134.134.136.126]:37619 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbeGTHMP (ORCPT ); Fri, 20 Jul 2018 03:12:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 23:25:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,377,1526367600"; d="scan'208";a="76342471" Received: from dazhang1-z97x.sh.intel.com (HELO [10.239.13.115]) ([10.239.13.115]) by orsmga002.jf.intel.com with ESMTP; 19 Jul 2018 23:25:33 -0700 Subject: Re: [PATCH V2 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, pbonzini@redhat.com, dan.j.williams@intel.com, jack@suse.cz, hch@lst.de, yu.c.zhang@intel.com, dave.jiang@intel.com Cc: linux-mm@kvack.org, rkrcmar@redhat.com, yi.z.zhang@intel.com References: From: "Zhang,Yi" Message-ID: Date: Fri, 20 Jul 2018 22:11:30 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Added Jiang,Dave, Ping for further review, comments. Thanks All Regards Yi. On 2018年07月11日 01:01, Zhang Yi wrote: > For device specific memory space, when we move these area of pfn to > memory zone, we will set the page reserved flag at that time, some of > these reserved for device mmio, and some of these are not, such as > NVDIMM pmem. > > Now, we map these dev_dax or fs_dax pages to kvm for DIMM/NVDIMM > backend, since these pages are reserved. the check of > kvm_is_reserved_pfn() misconceives those pages as MMIO. Therefor, we > introduce 2 page map types, MEMORY_DEVICE_FS_DAX/MEMORY_DEVICE_DEV_DAX, > to indentify these pages are from NVDIMM pmem. and let kvm treat these > as normal pages. > > Without this patch, Many operations will be missed due to this > mistreatment to pmem pages. For example, a page may not have chance to > be unpinned for KVM guest(in kvm_release_pfn_clean); not able to be > marked as dirty/accessed(in kvm_set_pfn_dirty/accessed) etc. > > V1: > https://lkml.org/lkml/2018/7/4/91 > > V2: > *Add documentation for MEMORY_DEVICE_DEV_DAX memory type in comment block > *Add is_dax_page() in mm.h to differentiate the pages is from DAX device. > *Remove the function kvm_is_nd_pfn(). > > Zhang Yi (4): > kvm: remove redundant reserved page check > mm: introduce memory type MEMORY_DEVICE_DEV_DAX > mm: add a function to differentiate the pages is from DAX device > memory > kvm: add a check if pfn is from NVDIMM pmem. > > drivers/dax/pmem.c | 1 + > include/linux/memremap.h | 9 +++++++++ > include/linux/mm.h | 12 ++++++++++++ > virt/kvm/kvm_main.c | 16 ++++++++-------- > 4 files changed, 30 insertions(+), 8 deletions(-) >