From patchwork Thu Aug 1 17:39:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13750769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3022EC3DA4A for ; Thu, 1 Aug 2024 17:40:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55BAF6B007B; Thu, 1 Aug 2024 13:40:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50B3A6B0082; Thu, 1 Aug 2024 13:40:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D27D6B0083; Thu, 1 Aug 2024 13:40:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1ECAD6B007B for ; Thu, 1 Aug 2024 13:40:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B9DB616074E for ; Thu, 1 Aug 2024 17:40:14 +0000 (UTC) X-FDA: 82404390348.07.DFB9FF7 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf23.hostedemail.com (Postfix) with ESMTP id D135814002C for ; Thu, 1 Aug 2024 17:40:12 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=BQILAGtT; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of 3e8irZgsKCPYYaicpjcwrleemmejc.amkjglsv-kkitYai.mpe@flex--ackerleytng.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3e8irZgsKCPYYaicpjcwrleemmejc.amkjglsv-kkitYai.mpe@flex--ackerleytng.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722534007; a=rsa-sha256; cv=none; b=t2iKtELAgz5yYOYQZn9ZwmKgI9gw7LaQJOiDGFpmSzB19rLtAUDex2T83U7wuVwUm15ncX avmqU9TlAVYK4Bpyq8jBoml/4TYKMWaJVeLa8DWisNv/lOq0GcTUG6Klq865ITNXKR6pfv SEsTW/dqyb7bY42iU3CwRtMaGvwIQY0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=BQILAGtT; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of 3e8irZgsKCPYYaicpjcwrleemmejc.amkjglsv-kkitYai.mpe@flex--ackerleytng.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3e8irZgsKCPYYaicpjcwrleemmejc.amkjglsv-kkitYai.mpe@flex--ackerleytng.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722534007; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=L9VNzcyRkgABAvNu7jY6d4RP7mTe7rlkrOwsOOfnmQw=; b=ESLlj5hzeoS1ccPQhNRAcKV5gu4tb7mVdjnlJ5UFMRzdmS7WBDp5rdu5euX6ADFZeK1Bgq DXZlpnKN05j1teY2YCUb0GiBuZnM7oLvDDTlA479Bp3rVpUpHh354YWKnFlF8y+PnSDCBc Ur+SKU+Io7lJAtHSlXy0fG+EZ/uEl1E= Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2cb639aa911so7472497a91.3 for ; Thu, 01 Aug 2024 10:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722534011; x=1723138811; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=L9VNzcyRkgABAvNu7jY6d4RP7mTe7rlkrOwsOOfnmQw=; b=BQILAGtT5bUwX6J+FMexdWvfJiHktpL/6jc75ItwUDtcVjHv3lsHW1rdvLk61omb32 tyBWEv5PhrbN89mGZUtxUw9ZMkbm71smdL5m9+O1gxxrwwNEYe2pO3x3NI92WuJDQTMJ NTUlg08Grml+UOhYiHzgPd25xwRxzniOgKWFsb2erdVU09fB83GqZeBnQEcTqb89isih CRzhpKd6d8xTuyojO42difshp58q8URe/WPFNem6ey9GezIk0u33vQWcnthM/EDkYcQ4 N2JwP/y1vHN0mAVKygSBETWv39iFHA5SNYqtfScdYyN4HZyNqq3P120qGrGxVdD2nQHe tI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722534011; x=1723138811; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L9VNzcyRkgABAvNu7jY6d4RP7mTe7rlkrOwsOOfnmQw=; b=vIgJyOwMjDkCkLpmrWmq931J7WqDNzh/2Xs/QyRl9sCwDR4I+slYjiAHM0M0bTp1MN 53HMpwiDXo9pYqVcVqfC+dlftmtoedrYEucXIlsXYvTNL9iuCTm5BWPMaDswkVMwPUhg UncQG/ND0SdFa12S5iDjh5c6IbJL8oV5rRdW1Zq+bnxGj25tgjOu2f5ODTa/ijDOPhQx nU80q8q604c0ZEjvuT2XgsEISZaWjM1NF5TUaOdFVED21jD8vFfy1QkCtfRlMxsMlaQw Zd/MBcuvslEKPkk4CUeP2qWac/9lR8lrv49Uq7mKfG6ji+FHZvt/x3b3OVi6HsLwwuDe olSA== X-Forwarded-Encrypted: i=1; AJvYcCVGUJ1RZ9f+8hR6J5CLOw/eDjyGc/DdLWEZKOSXBZLSPhUK9FliIZNgwXrDbHWqETfDHAO5Hr+Aq5JE5hQpkK2NYdI= X-Gm-Message-State: AOJu0YzD77LSdAA4D5pQ1a9pXsHL7WXXOmaAlW6zsj7pRRMAc1M3OF6O /pgI6X2EtZJIAV5P2s3CVNjq1XI58mdfhL5bDbmuNQHr6jJqN6mYegOvRBRUipzzPGDrBYTRZgS PssAGBFogOun3Jk9L45Marw== X-Google-Smtp-Source: AGHT+IGhpTZuKcEDE5QRQXsOfcY0PWgiRoUFns4CRvhbi/uTvBIXM/nvEmpt5cbQN5GWFoFa60I9eNfSq5lwKOiQpw== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:13f8]) (user=ackerleytng job=sendgmr) by 2002:a17:90b:e8a:b0:2cf:deef:4261 with SMTP id 98e67ed59e1d1-2cff954f844mr31201a91.7.1722534011252; Thu, 01 Aug 2024 10:40:11 -0700 (PDT) Date: Thu, 1 Aug 2024 17:39:55 +0000 In-Reply-To: <20240501085210.2213060-3-michael.roth@amd.com> Mime-Version: 1.0 References: <20240501085210.2213060-3-michael.roth@amd.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog Message-ID: <20240801173955.1975034-1-ackerleytng@google.com> Subject: [PATCH] Fixes: f32fb32820b1 ("KVM: x86: Add hook for determining max NPT mapping level") From: Ackerley Tng To: michael.roth@amd.com Cc: ak@linux.intel.com, alpergun@google.com, ardb@kernel.org, ashish.kalra@amd.com, bp@alien8.de, dave.hansen@linux.intel.com, dovmurik@linux.ibm.com, hpa@zytor.com, jarkko@kernel.org, jmattson@google.com, vannapurve@google.com, erdemaktas@google.com, jroedel@suse.de, kirill@shutemov.name, kvm@vger.kernel.org, liam.merwick@oracle.com, linux-coco@lists.linux.dev, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, luto@kernel.org, mingo@redhat.com, nikunj.dadhania@amd.com, pankaj.gupta@amd.com, pbonzini@redhat.com, peterz@infradead.org, pgonda@google.com, rientjes@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, slp@redhat.com, srinivas.pandruvada@linux.intel.com, tglx@linutronix.de, thomas.lendacky@amd.com, tobin@ibm.com, tony.luck@intel.com, vbabka@suse.cz, vkuznets@redhat.com, x86@kernel.org, Ackerley Tng X-Rspam-User: X-Rspamd-Queue-Id: D135814002C X-Rspamd-Server: rspam01 X-Stat-Signature: brn45taxdenubxwtyetwgn5ggeapjmm1 X-HE-Tag: 1722534012-106179 X-HE-Meta: U2FsdGVkX1/Fl9oiHYYKFdLtLZJeXyl5SHqXToK+DpQsw+UBQPsfv3cdiXCGu6nJna9nLqGOQZGW+OfpruI4khDF6kaFWwgzObU7f6PLLeH1PpHXUbw4KCmeaJuk7033v79+j4lbe5gI6n+FiDNM2g9qXwW20t2ldQKLRdsTro2CnIr9bXsgCKFa0iu63AOnHA9Ha5A11fWF38UV9kjH8WJMYu1yluEAXx+gCccjOonJVsRH/NmydE+IZwOSciHjDhz/HWQ65j9adU9/BGMSALKXb0wcNWujGn1yZf+Eturd6EIv6IYySW/OO0Zp6bTfFEOgjMKz/H/4PVigU4eKR4A5glD3ZAVcn2HX67lAWpprfhA0pcSA2xEJzxtqWhNu1uqXexbUD1PlP/UNkSM2rTqQBiuqgMmtr8LHG8a9ElPcVT+7LGatUcUdyRgb76n+z87rYKmhc2omYuVVcZ63KaPXMu6ZC7yapMnoHT4HvSvgnbehxRkkqiofBZAL7mIsAUlJgsj9Wuwn8AHWyKlrh6xHQvoJc/yKHiR/eZqbk5MS86XcWiXsGO3vgK0g7sjE+dD9U2REZIGYxmD6XK51IOni1pa/AmGJFOasKL5eGjZWwbiQHxX2QMoNntTAlOyQWEIER0W1bwxsRPU03gFHIqrh0iL/I5S7JUToJ7r3h8l5WblLIziz1R95Tod/W+Ftr3FH3I83X8Ya04eWQ1iAiT2W3TQJf2kgZBlqmgFZ/W0MUUHCPLhvUqQssxnPSMzCDG2/SWOExQOxR3iUs7b3a18XCjZ36BUS48XheY6r/mmQypvW39U49oZmR3IoBQQahnliOWNLh6wlV1KsF/uUtuRV4fquQ8ahwIx7f1bEuo7c1F2VFJZtnvR57Jv5UzmZgZFTQUy5DA52sm8nD2CXA+gQo1oRWypgzvqhl/FDYSjk+dwlfwCjd60QKukCz5PcNpnrk/PttTkZX0nYQDP lx5xoE8b wdd6noUgES0NuG7ZCKNuh/aQcC3Wr7mIfYpg3pTU34pU2ypj1aunpL4hCQArSW+k2p3sI+XMAud+V1nzbiV+hS4E3bSzVGa7WS+M1WHlfx0OSprr0QcC56syz2f4FW4HW1sCL1ht+szqThrWAM+QEFgDWlRshsOJ9t6hZE9SvFt+o6LKLIUanjCudlE0iEIejECGmeKCJqv+1p7dMGJDel70ZTN2klavLRqxblrCBYR9yVweRFYTQQshZrBn2xQu4+LtXlfggDp955lGBCQcZf6F25N5Gi9yFuMQRjaH+S2TLrWmt4kOurgyLp8euo7cmCOTGcVX8kAxYGsD9RnQfHYElP6mhCMCv1yFHIim+BLceBueWpc40I9n7vz3n+jH1YZ4taG7E/wBLdiexHQlKncXTw3E4wNbHseqIi848kYxrBaMAPmeKggsLqsnLn6eGeMUNotxIo55ZvNV5KlGiwyoHjlZSH2X0X65vJol9HYP/WlakEexpYpshEirI9X5id5qwhH12MOpgcxnvd04rmftkrYXdoXHMWs1k5J0q+hWvuuR5Hu2Pvrnoow== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The `if (req_max_level)` test was meant ignore req_max_level if PG_LEVEL_NONE was returned. Hence, this function should return max_level instead of the ignored req_max_level. Signed-off-by: Ackerley Tng Change-Id: I403898aacc379ed98ba5caa41c9f1c52f277adc2 --- arch/x86/kvm/mmu/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 901be9e420a4..e6b73774645d 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4335,7 +4335,7 @@ static u8 kvm_max_private_mapping_level(struct kvm *kvm, kvm_pfn_t pfn, if (req_max_level) max_level = min(max_level, req_max_level); - return req_max_level; + return max_level; } static int kvm_faultin_pfn_private(struct kvm_vcpu *vcpu,