Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp268612imm; Tue, 21 Aug 2018 19:18:37 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzthXXUy3IeVC+0E73ZljsfAgORhT2QY+SFsM5Io35nid5xzvnK2QLCaIyBFRd7F0+bJGHp X-Received: by 2002:a63:9e0a:: with SMTP id s10-v6mr49718522pgd.326.1534904317845; Tue, 21 Aug 2018 19:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534904317; cv=none; d=google.com; s=arc-20160816; b=I2jw+dINZIUmt+6Jg0hedu7I7YzkC2Zqt2VA9d1gYYFIixHaBt7NDkOJ/trFGBLeYi Ahf/SDpPwj1IHCXi6mAYGoWsQgykGRbqCmPc7SOKd4s0LMVDHLKOOOpCw5DF+Lunv+XO 88YhhJS9dr4sgCyoouAFYYQNrEWWYq6MOXYEdt5429FuQb/jDWz2agpRyFNCsF8wfxpE 5x886/jDjmMvi9IUdz+S3tENYuvt6Rd9bNkMvkaEvHs33bI8t77vK8WhXpnOMAjWqtA+ Fl5Qt7TX79SI+roF8SEOzpWGxHvJAUcntYZ3r5GBFVnB7BXfD5Q4MuvS4guuW3AxeFWn yrPw== 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=wanBcbq/yF+jBQEp+neJiKsEo/O9XaVJFA4o+oKSU0M=; b=zlxWZJAUTbsdMzaBqtPfSHbTay3QEmvQZ0LTtxylphZNzj4ieN+pxd3LVLVZijPFjR YGpmZBg2senMuxM4t6+pvYIIpIOwgyPPaPZqkToHi1h+z5hhRek/FeY0stTg83Sqi/Oa HV7SdeOPwOg99org/eUDQGzTLewGfcgb6KsUzghijXolLV90nCZ8ru6kBU3cWogYhm/s y0MpzmfwjY7cjY3Td+44Syhji4ux2SEuU0HexAmVH30+qArhgDxCOBxmWpJWlRt5Z9FE BCvupm/TboCvkVGAQlJLx0yOWy9PVwC0rpFJmwIRgrCt4pCnQDOheDcsuN21Kqh0t7Jy J5FQ== 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 n8-v6si460399pgl.101.2018.08.21.19.18.21; Tue, 21 Aug 2018 19:18:37 -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 S1727233AbeHVFjQ (ORCPT + 99 others); Wed, 22 Aug 2018 01:39:16 -0400 Received: from mga14.intel.com ([192.55.52.115]:63348 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbeHVFjP (ORCPT ); Wed, 22 Aug 2018 01:39:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2018 19:16:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,272,1531810800"; d="scan'208";a="83404287" Received: from linux.intel.com ([10.54.29.200]) by fmsmga001.fm.intel.com with ESMTP; 21 Aug 2018 19:16:25 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.163]) by linux.intel.com (Postfix) with ESMTP id B7C3E5802C8; Tue, 21 Aug 2018 19:16:22 -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 V4 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio Date: Wed, 22 Aug 2018 18:55:17 +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: [PATCH V3 1/4] Added "Reviewed-by: David / Acked-by: Pankaj" [PATCH V3 2/4] Added "Reviewed-by: Jan" [PATCH V3 3/4] Added "Acked-by: Jan" [PATCH V3 4/4] Fix several typos 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