Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1601538yba; Thu, 4 Apr 2019 14:12:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqz348nEIye3cpMBHppuywBV9zLw1GL+QdIgP0M/wCZYZsMZS+cpZtM0/dmvSHIOydtSN9CD X-Received: by 2002:a17:902:704a:: with SMTP id h10mr3671914plt.83.1554412350292; Thu, 04 Apr 2019 14:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554412350; cv=none; d=google.com; s=arc-20160816; b=BJXw+EP78nAC8vZCp/bQ2P+N3XkUoqueX+wIRj+zLiyCFEGhoP+miG1rrWNj9OHRsT pLsJLcTLiKMON2OOZQCM4BOw3y9rdwHmX0aSVRBs/Jv7gNZ/dmWX0IVOqA8EjGsqMCPx LBY4dlaKT9TD64UBtDY3GwCC7LzI4qR8buxhQI6/XUhRjdbdxaauZ/gkwwq8qF7RVTgs CZL/KDscRuJABhhNtvOXMhJQOe1Pc/18nDetUJrJBY1VKQSDJzb0zy8MzP6Lhi+WIt/T wvgnNCuKvcB7D6crYvLLkYUWLmnophU8jqeiyKrD7D52yy3xlQ9e1px8JSNiVp+2a/Po TUpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=6sOLFOHDFXTunsmV2eys8G03orm7eMnBLakMzQ3gFIk=; b=K94Hsgrh3CVXYzxusuyulat3dsHM3Q6iuEEgKpHEb/YDcuc3tqj1+t2w+Zf5TEtm/U /eaFC9gomJM+DiLuAJyA7pqVDGkehwiCOBI32SeIfeOQpysy/FEl9yOy2s+LUcwAMmdJ 84neXGQ5sqFPan7oJCZF4x23R7vqeFDv00B6hcVyWh1yTRArT6GW3ajwrcHl/vENOTUW pNi5ipzvR6AvvG6IpuRYHq17xPFi18Fb+oJDk+daPZBp326YaxVEE+n5sAktvwsEhRvi hjcNcwAbW80ChZffz9W+iVP06hQ8brcK500O43/Xo+ChzOmoE7BjnKGnbkdVTViolB8Z vo6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YJ9aqoeo; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si17361118pga.350.2019.04.04.14.12.15; Thu, 04 Apr 2019 14:12:30 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=YJ9aqoeo; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730818AbfDDUYE (ORCPT + 99 others); Thu, 4 Apr 2019 16:24:04 -0400 Received: from mail-yb1-f201.google.com ([209.85.219.201]:33105 "EHLO mail-yb1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729433AbfDDUYE (ORCPT ); Thu, 4 Apr 2019 16:24:04 -0400 Received: by mail-yb1-f201.google.com with SMTP id j8so2749972ybh.0 for ; Thu, 04 Apr 2019 13:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=6sOLFOHDFXTunsmV2eys8G03orm7eMnBLakMzQ3gFIk=; b=YJ9aqoeoFLzb44VJhlBW4d+pUzTWv8Y4dv+lDJDet7pRuQLNX3Avj7jZotZIP4X48Y 3quXy49xmIk4MwD3zbWNJ3S729pU9QktfmM0XvucPbp09R/+jj1agexdoAYnnxb9LR+d n86JIj2W9+YIF4xDrx9pPJoiR6cdWqScopMOq7q7GMysWESNhSg31u5qRi4PMx0Knv0n bZ7w+ra/oe33/NE/uNFwGzzL8Ubhmq2Fskv5mihTWLTn4QIFHxSj4uGqadwe4ZvihwRZ D8OvJHFOOEO02tc3+KB145tpjldMMhqpFj0n6OQFiC2kxuhwq/5Y6nph19kfuX4SNagw vHqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=6sOLFOHDFXTunsmV2eys8G03orm7eMnBLakMzQ3gFIk=; b=JhUGUvEr0oWc5bI61OlPKk5G+Bno3xsdo4sQAcVSakjUORzxb9mKvpztA2zqW3yhKF 7qTKmyS2F6OfsbdXSVpqd4E7w3E0QGMHOx2FMCEflJoJM8u9d441mruUsX2OwnMKMLwN tQUCVaotb+PvVdpULMOoTt0l72xyVt1iY6OAIL2XleBJqO6os/aavE127merGNuxbAO3 a+u3un7dC5hEhsr7o7+GN7vu4X1mA4MscGCkBuMxC5SDFw+bAb1fHombvDwnznKPpl+P /B29FfdygTKH21ibBh7fo2BNZC5RmHASsI1wZT0jDuUSYys1GnSSTmQnL/mHyPVI4bQN EOjQ== X-Gm-Message-State: APjAAAXcYQYOLIegpSQhT4xj+0feNHs9vHBl42ljFAk+VkBl4+gJ7P2H CA7lR8Fw6y7s76QqAaw/XVs6scV0 X-Received: by 2002:a81:6184:: with SMTP id v126mr1721915ywb.17.1554409443175; Thu, 04 Apr 2019 13:24:03 -0700 (PDT) Date: Thu, 4 Apr 2019 16:23:42 -0400 Message-Id: <20190404202345.133553-1-brho@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH v3 0/3] kvm: Use huge pages for DAX-backed files From: Barret Rhoden To: Paolo Bonzini , Dan Williams , David Hildenbrand , Dave Jiang , Alexander Duyck Cc: linux-nvdimm@lists.01.org, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, yu.c.zhang@intel.com, yi.z.zhang@intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series depends on DAX pages not being PageReserved. Once that is in place, these changes will let KVM use huge pages with DAX-backed files. From previous discussions[1], it sounds like DAX might not need to keep the PageReserved bit, but that it hadn't been sorted out yet. Without the PageReserved change, KVM and DAX still work with these patches, simply without huge pages - which is the current situation. If you want to test the huge-page functionality as if DAX pages weren't PageReserved for KVM, this hack does the trick: ------------------ diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index c44985375e7f..ee539eec1fb8 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -153,6 +153,10 @@ __weak int kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, bool kvm_is_reserved_pfn(kvm_pfn_t pfn) { + // XXX hack + if (is_zone_device_page(pfn_to_page(pfn))) + return false; + if (pfn_valid(pfn)) return PageReserved(pfn_to_page(pfn)); ------------------ Perhaps if we are going to leave DAX pages marked PageReserved, then I can make that hack into a proper commit and have KVM alone treat DAX pages as if they are not reserved. v2 -> v3: v2: https://lore.kernel.org/lkml/20181114215155.259978-1-brho@google.com/ - Updated Acks/Reviewed-by - Rebased onto linux-next v1 -> v2: https://lore.kernel.org/lkml/20181109203921.178363-1-brho@google.com/ - Updated Acks/Reviewed-by - Minor touchups - Added patch to remove redundant PageReserved() check - Rebased onto linux-next RFC/discussion thread: https://lore.kernel.org/lkml/20181029210716.212159-1-brho@google.com/ [1] https://lore.kernel.org/lkml/ee8cc068-903c-d87e-f418-ade46786249e@redhat.com/ Barret Rhoden (3): mm: make dev_pagemap_mapping_shift() externally visible kvm: Use huge pages for DAX-backed files kvm: remove redundant PageReserved() check arch/x86/kvm/mmu.c | 33 +++++++++++++++++++++++++++++++-- include/linux/mm.h | 3 +++ mm/memory-failure.c | 38 +++----------------------------------- mm/util.c | 34 ++++++++++++++++++++++++++++++++++ virt/kvm/kvm_main.c | 8 ++------ 5 files changed, 73 insertions(+), 43 deletions(-) -- 2.21.0.392.gf8f6787159e-goog