From patchwork Thu Apr 4 20:23:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barret Rhoden X-Patchwork-Id: 10886271 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 0039E922 for ; Thu, 4 Apr 2019 20:24:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E198628AE3 for ; Thu, 4 Apr 2019 20:24:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D57D928AF2; Thu, 4 Apr 2019 20:24:28 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B3F528AE3 for ; Thu, 4 Apr 2019 20:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730792AbfDDUYE (ORCPT ); Thu, 4 Apr 2019 16:24:04 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:56482 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729547AbfDDUYE (ORCPT ); Thu, 4 Apr 2019 16:24:04 -0400 Received: by mail-yw1-f73.google.com with SMTP id k127so2794864ywe.23 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=Lnin2RbFDNIGW7UiZNt+A3++QAtYajK1JlY/7X616Gl8BKdfk9X895ayekQa822Lo+ kYDDHLaP/qshXZfnm/xRQNLeIIIwS7iBNL+CKkPzfNErqnwVaxzKoLXAa3EkwQDVQLUH SiCV2mEqBW2G7cNCpK6hViSZGSe86Ddk5y/9MchgNWGwYw3K2MmeSzEyHn9I9Huw1jWu 5wzWK21+efUNGHr+1SQIg/4XaR1rEGTMsWooqv9yBY0Oh4X7pNGDDbeGGKaTSDA5qg7L G1S9iSjS7gJ81mh3u2V2lT3PjerAhcYmMD+VOTKGnjpOiQNg18lfat1JhY6jvNUev8dO iBoA== X-Gm-Message-State: APjAAAV/bYBetLyUcwdkM79JLalyk6ZUT8S8kjqQIlBEZyjRQebiy6da nWls83PWU2x+HaGL9+eGx81WRUcL X-Google-Smtp-Source: APXvYqyFaoHGS3HNPj5EWd2K/BhPSlUcoTmVHBLr0Z5zTPlAZeE70MMV7qFTBOEVT7TpcMEfZut11KZU 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 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: ------------------ ------------------ 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(-) 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));