From patchwork Mon Dec 3 19:25:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10710401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1611E18A7 for ; Mon, 3 Dec 2018 19:25:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07FC32A962 for ; Mon, 3 Dec 2018 19:25:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFD3D2AF6C; Mon, 3 Dec 2018 19:25:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 859202AD54 for ; Mon, 3 Dec 2018 19:25:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90D4E6B6ABD; Mon, 3 Dec 2018 14:25:23 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8BB926B6ABE; Mon, 3 Dec 2018 14:25:23 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AA2B6B6ABF; Mon, 3 Dec 2018 14:25:23 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 3661D6B6ABD for ; Mon, 3 Dec 2018 14:25:23 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id b8so11994138pfe.10 for ; Mon, 03 Dec 2018 11:25:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=nkqXuF0ytvC3SApjipIZqEerutFLAk8vjd0jB+y1gf8=; b=kbU9iOJ777pToM7XFRXObEs/DC3r2rr63Db4ttcM+e6bCtdFZ0Eam623fGATbg08C5 y1okb9ToGpG7XVdxVDarNLj3RgriblNolEFrYZiZhMhqthDfsIlxeKMQtvxQLnfTpJSL UIVak1WVlhU8u0258ggELSJ7lTr5KQUuiSl/oQnw1Yiaxbb6t9IxfzF0zSWoNr0dRJy6 kFqPizoOgN7+NnVSWHT7PoCLCskkLRCvEmPoxSUoCmXOys57XGOQzGBD3WgzxzURxdMT qKJ/l7ytpcblOTNz2o4ydrPj5a8tOHYGdBhtR1UCIAEjFeL1CEoKmdhdx4NAh0IypTaZ Chbw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AA+aEWaB7ShPJLPC6QOZYUijqNXW9Q0U9YQIXph4Rxvri8Nn/JK9DOll t85IqprCwfS1qeL8hVm0FkPQFVs1hTZyrUKOfLCmG1E1wespERXO23c1WHsDdbmkSYxA4ONu8Xz MHII5FW3vH7tt5MDkuipPIbdxoDDJLCdwrlDLwPVz8DKDWjYA0Nq/SsrsqypyecUTUw== X-Received: by 2002:a63:1157:: with SMTP id 23mr14435652pgr.245.1543865122852; Mon, 03 Dec 2018 11:25:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/VcvXA1J9BUZcIXiKyuiIndubyZeXR73bvGiwrfnUljyiCcvMAktMKzn7WmNrDX6738ytKt X-Received: by 2002:a63:1157:: with SMTP id 23mr14435618pgr.245.1543865121950; Mon, 03 Dec 2018 11:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543865121; cv=none; d=google.com; s=arc-20160816; b=gCGnAyMSyZg06mKQI15cuFT7p8mR9Ds46AJsHijTFiqEgp4jO6UmdaHE6jo1AKmRh2 NTQNDNghGcwTVll7LBWouOMFzi4DY4ZcBWyD54xCUb+sZIR0crXRHoFfZ1sDTEZNfnun V8amh8/mayun48UJG+F6dECWtTy8QVVdFESjPalBC38Qi8sZRnDYpQ7j3Kk5Z8FTop0d W2sDs4gK+r2pkMIIMwtl6Ce4D3chRAWWjdzNOPkoTj+xVRscB7vhfY3zd1CVrhs4we2m zrqlKKvtgz3p9XU2jyiTANpeIzzbBqiRXfcXKrt1VGb/ahf4Q/pDaARuRds6xe1QeO1u /XyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:message-id:date :cc:to:from:subject; bh=nkqXuF0ytvC3SApjipIZqEerutFLAk8vjd0jB+y1gf8=; b=Pl4Q6fVCgfd45IZ+Jr0cwHuU3wAjPJCpJfRQvGAeqxfuoWlqLwqWmwjaY3P7zPj3z5 K3TuZs896Jd472hCBHvVJU5Qty52OUW4HxA+h6b0nMWpmMCX6xLCoKemLPywJqTQ7IIl DeJOGzsHuCR+JPnftnkEVlR3J5ll3/i856ktw9zXPgDIXZOLgO9sktYUfVea+M78n7KO ypdI9xPOZLHlhlt/kC4DvLH/F3KVmU8vofFuroCiCkiTlxivZt9WA1QuusQ+coRCuVIU 3qNoK8EADgDTTlWqDsoLNsSrWRR2c3EModoka+/SBrabazHWnCLV5FWagbiS42eYGPoz PbCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id f63si16103419pfg.136.2018.12.03.11.25.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 11:25:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of alexander.h.duyck@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=alexander.h.duyck@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2018 11:25:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,311,1539673200"; d="scan'208";a="115600452" Received: from ahduyck-desk1.amr.corp.intel.com ([10.7.198.76]) by orsmga001.jf.intel.com with ESMTP; 03 Dec 2018 11:25:20 -0800 Subject: [PATCH RFC 0/3] Fix KVM misinterpreting Reserved page as an MMIO page From: Alexander Duyck To: dan.j.williams@intel.com, pbonzini@redhat.com, yi.z.zhang@linux.intel.com, brho@google.com, kvm@vger.kernel.org, linux-nvdimm@lists.01.org Cc: 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 Date: Mon, 03 Dec 2018 11:25:20 -0800 Message-ID: <154386493754.27193.1300965403157243427.stgit@ahduyck-desk1.amr.corp.intel.com> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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. --- 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(-) --