From patchwork Wed Jul 25 08:32:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Chen X-Patchwork-Id: 10543683 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 1C28A139A for ; Wed, 25 Jul 2018 08:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0733F29AFE for ; Wed, 25 Jul 2018 08:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDA4029B1A; Wed, 25 Jul 2018 08:33:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9EE2729AFE for ; Wed, 25 Jul 2018 08:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728553AbeGYJnl (ORCPT ); Wed, 25 Jul 2018 05:43:41 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43664 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728501AbeGYJnl (ORCPT ); Wed, 25 Jul 2018 05:43:41 -0400 Received: by mail-pg1-f193.google.com with SMTP id v13-v6so4819747pgr.10; Wed, 25 Jul 2018 01:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=rj+UF/Kt1DiytsI62ALlP9pSFqblTTsClk8ZrsGloSs=; b=eO4uvPpTEr93GNMaaQXQ7c1evCAOSpdDytyJQxwdm1JWo4gIBf/Pk+iTJ6QgCYPVhZ lS0HtHFlfTRNQAE7mXJ6ZaFd+SQ/jtWCBAoRzVkbM2Gc9kmkFhNfUulojD7zpXdcTJvW GHTHEg93tmX5WIFqmNle9A6NFVrjvsYCP6wTg8uNS1VZZoQASyxdoFw/3WbIfzQuOHs8 w1XgCwhTqxd1ld7NhPq1dKcJBVtA/B4mZwPx4RNgRip5/TMHjkJwoR2wKV+DTPMSY0a5 arhkZLLfwuh9Zb5LR/9cl1XWHV08E6WaP27Pc+ndZUjR0m55i+w+PnGcI7D1wdkIxMa5 CArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rj+UF/Kt1DiytsI62ALlP9pSFqblTTsClk8ZrsGloSs=; b=EbdjOs3zTYZte5sC4XJZKbcdmO7Pue5QFgkut9Wxjn4Ox9EezxtQMlyRHpvVa/mnEH S68fs4e4QwOrlJfEQ/UsF5Tz6KwjK3auqfout6B3veDKcwEJ4zG1p0NzWEjBZkkQg/A+ 3QL8GvYHqmkQ/MAFxNavWywV+Ri9hiTRjL+K/803WfVPcg6SWDtSsXfmV3mzGr3816F0 jSzyiA32jtCXYKw4Ni6lCP1aZlNdwfIB4QRXI66AcfFz/QG79t9nMRfCAJfKQTCUVj/c AnKXUBc6qw+szn21iNTbUSPq/7p78sPUhGxBr6DMCCgFlEKsgHY/7k61smpBKoclH/EL 3AEg== X-Gm-Message-State: AOUpUlHRP+Y3KeiBKlgXCxb9zr/tqYjy1uk7NWqKoOGgI9ZZR3KXnMS1 GkX6ysZLEpN2PhhWf7CVkow= X-Google-Smtp-Source: AAOMgpdq3dbcUBxz6ywMPf+vv3NOa2AwqBSMN5AfKFAJLMecZwGTUbYMIjS4VxaU1wgZVK42NGWe7g== X-Received: by 2002:a63:d54e:: with SMTP id v14-v6mr9103229pgi.264.1532507583940; Wed, 25 Jul 2018 01:33:03 -0700 (PDT) Received: from localhost.localdomain ([173.254.200.131]) by smtp.googlemail.com with ESMTPSA id v22-v6sm32587225pfi.60.2018.07.25.01.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 01:33:03 -0700 (PDT) From: Liang Chen To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Liang Chen Subject: [PATCH] KVM: x86: Skip pae_root shadow allocation if tdp enabled Date: Wed, 25 Jul 2018 16:32:14 +0800 Message-Id: <20180725083214.7703-1-liangchen.linux@gmail.com> X-Mailer: git-send-email 2.9.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Considering the fact that the pae_root shadow is not needed when tdp is in use, skip the pae_root shadow page allocation to allow mmu creation even not being able to obtain memory from DMA32 zone when particular cgroup cpuset.mems or mempolicy control is applied. Signed-off-by: Liang Chen --- arch/x86/kvm/mmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d594690..af8cc1e 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -5029,6 +5029,9 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu) struct page *page; int i; + if (tdp_enabled) + return 0; + /* * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64. * Therefore we need to allocate shadow page tables in the first