Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1504072imm; Wed, 8 Aug 2018 19:15:12 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyG3ckbylVT+P0zMC8lDJ/0Ley8TjunJWkFa2esF7mr6L7QfiVCM6COLLi891QWr1YEQ4V6 X-Received: by 2002:a63:3c0c:: with SMTP id j12-v6mr208814pga.440.1533780912881; Wed, 08 Aug 2018 19:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533780912; cv=none; d=google.com; s=arc-20160816; b=MVGa+wTv4AaOgf0lgHukSO6N6aE/QplqW1mrZwSldZuI6iV3mPIVH1vyyYsQBR23fY FPuefr2/2KTguHloQYiYoSlQclylENFGxstD3bvcCcgRks+Duegfaxjpjy5WE18l+kBN d4mEQUeprBp5h1ag3h09g/6Awv5nubVtkrw5nwXUn9GXsLmADKV+MGrUYvlldoDZAV+G WngCZoXkpcrcCXtgux4Xb2nKajdg5NKE6p6+2z/5I+7Qgarr+uI/WNs5Ql+yXzJefuKr rCLYnqNsNrop6CrCYiKKsBBux8TVat/1cmFGcWUj4cUXGUFFpIuaMFYqAX50NEbJ/Pdc ZClw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lM9cZi3YWmO1qwu2xeq25O8HPpVxBDyegNMsN8I+YTk=; b=02uxjKvvngtdWwz1iQjx2FwtxU8NNISATGH2Gx074G57VEP1IJji5b/DsFsnc3TOSk oOMm8cYdnny5Tv5AR2+03N0DEv0yCAwbUZQW+P/Ft9UAL3vpVvBgQntarRXFM79w1EzU QBky5MyI8miiC4XXZ6NLJrB6x9hPOcqi4lC4rJ9VPQ1OuUT8ZcWX1bJcTM9p+3puzayy GQ5w/E4LH40gfARZ+kigkGH/GlKUxmPnp+xy9CdLumtLEIySlHp2t0dZeecgV+zwIJ9x 0nIrvaaZNPA0Q+RC38a1d6Cxw8QpWm9mtEIs13ooFG6s9VJIHU0iL+S25Oi4hSsap1vu FVjw== 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 t19-v6si4611727pgu.285.2018.08.08.19.14.57; Wed, 08 Aug 2018 19:15:12 -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 S1727211AbeHIEga (ORCPT + 99 others); Thu, 9 Aug 2018 00:36:30 -0400 Received: from mga01.intel.com ([192.55.52.88]:32156 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725757AbeHIEg3 (ORCPT ); Thu, 9 Aug 2018 00:36:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2018 19:14:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,213,1531810800"; d="scan'208";a="74999464" Received: from linux.intel.com ([10.54.29.200]) by fmsmga002.fm.intel.com with ESMTP; 08 Aug 2018 19:14:05 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.78]) by linux.intel.com (Postfix) with ESMTP id 84DCF5801BD; Wed, 8 Aug 2018 19:14:03 -0700 (PDT) From: Zhang Yi 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 Cc: linux-mm@kvack.org, rkrcmar@redhat.com, yi.z.zhang@intel.com, Zhang Yi Subject: [PATCH V3 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio Date: Thu, 9 Aug 2018 18:52:48 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: https://lkml.org/lkml/2018/7/10/135 V3: [PATCH V3 1/4] Needs Comments. [PATCH V3 2/4] Update the description of MEMORY_DEVICE_DEV_DAX: Jan [PATCH V3 3/4] Acked-by: Jan in V2 [PATCH V3 4/4] Needs Comments. 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 | 8 ++++++++ include/linux/mm.h | 12 ++++++++++++ virt/kvm/kvm_main.c | 16 ++++++++-------- 4 files changed, 29 insertions(+), 8 deletions(-) -- 2.7.4