Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1564786imm; Fri, 7 Sep 2018 02:25:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdanBBBVoY9uviYGjUzmDi8oE84nYB8rL1y0T0dxqE3YjyRvuxtmq/p1q1qpPdwllxkdg9tF X-Received: by 2002:a63:9809:: with SMTP id q9-v6mr7124812pgd.58.1536312351219; Fri, 07 Sep 2018 02:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536312351; cv=none; d=google.com; s=arc-20160816; b=umF2EUlFv6K2FBXzDFsxOyGoONrt0IC7K/ePsPXm8VcyArof1eSUyEzwWlIO5vnk4c r8VTxfs6iKSid4rst6cIQRNNviaspMkGVolIdVZl359bc03Z/oLSdSlEZalRBj9PruQp EgniU9S1HhGQuuAXez4tuTlEzr2RYJAESi0RgGX9ooJd48zkd3WydiVpwNsyviLcn7mo PLwONkNxb4kE3SzHTJtaa1Hi19dRfLRBx3whbJEgXRwfpC4SFsmsgdyBvhA7YVjKBwe/ xLVeO3mIjItXXYHIxd+oD6Qb0LtODPgnVTE9CIs8MNXTsOjJLZeg0MCFckZLmCVrZSzO BAtQ== 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; bh=kbMd7Mix1na6RrVY+Z79yEPVpb1XaC1alk7wmIZh7Bk=; b=0Rs9Xd+OOUnUW5d92wTwwRFPEha96SQFtsfaScABgDzRwOEFl6ePw603umKNGuqwyP nEq8B/42LMc1dYQb4pjC8KpIUh8+F37tu/Auq9t20HeFVd7kgYA1wV5ILInU2XpvCJQW XUm7jpObWwPWSEosM8o+XA/rW+p5f7pCOrHD4udO3Awrv2b6IS3Fk8F34YEDI+GQCTNE bEL+FRHBDFWdS0fu8/VjxW8rWy56UZANd5IS6yI3DnOsBNroOybknuYiY3Winumrp3iC CsMlI1/sEp85w4SLMDx5kyfq+vI3000UoJxYx2dsY00DY3FK/qEL4WmyKD9SZyaKsH33 6sfA== 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 g12-v6si6925253pla.403.2018.09.07.02.25.35; Fri, 07 Sep 2018 02:25:51 -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 S1728312AbeIGOEC (ORCPT + 99 others); Fri, 7 Sep 2018 10:04:02 -0400 Received: from mga07.intel.com ([134.134.136.100]:64649 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbeIGOEC (ORCPT ); Fri, 7 Sep 2018 10:04:02 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2018 02:23:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,341,1531810800"; d="scan'208";a="255286464" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 07 Sep 2018 02:23:58 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.163]) by linux.intel.com (Postfix) with ESMTP id 3EBE25803DA; Fri, 7 Sep 2018 02:23:56 -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, dave.jiang@intel.com, yu.c.zhang@intel.com, pagupta@redhat.com, david@redhat.com, jack@suse.cz, hch@lst.de Cc: linux-mm@kvack.org, rkrcmar@redhat.com, jglisse@redhat.com, yi.z.zhang@intel.com, Zhang Yi Subject: [PATCH V5 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio Date: Sat, 8 Sep 2018 02:03:02 +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: https://lkml.org/lkml/2018/8/9/17 V4: https://lkml.org/lkml/2018/8/22/17 V5: [PATCH V3 1/4] Reviewed-by: David / Acked-by: Pankaj [PATCH V3 2/4] Reviewed-by: Jan [PATCH V3 3/4] Acked-by: Jan [PATCH V3 4/4] Added "Acked-by: Pankaj", Added in-line comments: Dave 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 | 24 ++++++++++++++++-------- 4 files changed, 37 insertions(+), 8 deletions(-) -- 2.7.4