From patchwork Wed Oct 9 15:49:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 1994984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VNph5JNM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=pQGIZ8/I; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XNyQ54Tl3z1xsv for ; Thu, 10 Oct 2024 03:04:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZmE+0+V2tyd414KrS0rBHwvGpMKSHZy9iDu2/c7F7Pg=; b=VNph5JNMel1pwq hqQP8EmJ7m2gt6YzyckBTZoM+2LsSgnTDYQW5JiNF8rlSfGqjSzGzCYrRjKF7Q2pwx2eDq+wIibaB VOy/e7jtSbyCPxO2sre+a9ZfDn/H1mpyXQLy2HEGkU2UvgpA4BsBcF9XOF/+w8JLXkXi7L/ZyZxL2 n1nSKyolkyPOGVPSCOgq3yLlb9ngm1yfmh3+BZKQk6LYW++gR2yBqqI+5jBxNrYdb23ZuFHKMG9HZ Imk6NgU236zdRV+8eEIv+eRwZJTG87P/5ysn2iS4SqdnU+4Jdp2XioJ7lzAJzMa+UH1/8TfjiTt0B NeL+oXhn6Ap1rVLXfBwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syZB6-00000009rbE-1M4b; Wed, 09 Oct 2024 16:04:44 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syYx3-00000009o9b-3U8o for kvm-riscv@lists.infradead.org; Wed, 09 Oct 2024 15:50:15 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e28c3fb4c84so5475467276.3 for ; Wed, 09 Oct 2024 08:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728489012; x=1729093812; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=BR1gG58gw5F7E+LpSzoPu+wX+wiyja7ptJ1fl5K+zYE=; b=pQGIZ8/ItOX1aLlfzAYEKKw0hseHlQKP7bZ4BB/xdCVUeF+Q3nKQCVbfV6pIhe9LP+ aKVr1xFsMH461/3W4I4k5rw76xRannLf1ITyH8tp5ztNK1A7EqZ9//0/s72xKzu2DYZK xxP9/iUVA9vxVxDVkIU0DWlkW2P5UGz9Ma6rjdiCCDTQM6KhJmrFJJ3jqp9NYm4d3yTk GwwqYxpt+nolONzBi0Z8wsuuvS0ahC+i9ymgKfVxnY8vWBYHmUYu8l4VGianNrVc4j+Y Kgl4V4+6Q+GSgwW0BCY/KVUB4CQYkKg5MJg32Ujl7eEh2ZQDIalosLV5ynJs3OiZrPI0 pTyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728489012; x=1729093812; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BR1gG58gw5F7E+LpSzoPu+wX+wiyja7ptJ1fl5K+zYE=; b=NyhA6Ev63UpYpUbiFszjyjEdVrbCueVWVvC8eBQNuc+0K/6z9jI4J9LNfn/ZdvzxCH Blb8oLow+iQywbZoLj/sWwx/bFUas9okmJIlZUmVS/9EBhwHVmczerhtNpMYflMJRXZT 64nc2A/SWhIg1gPfrTuSNz3LRUhyVCCK0NxbKa23JgOJ0Q1JjoWKAzMO0Ollo9KbN2PU Wk0Ub21Ze7Pk5Oa3N32+Tm0VBuhaYyss1f1Ern4T5HLhrdULKUk+94ab3MxoE04ao/1T 9Q2VLR0P1zl3We/fXvr8h1xJfVbDt6DYRrQZQfyHinzMIpHkqAcp+FMrek8lAG1oZEU0 bc6w== X-Forwarded-Encrypted: i=1; AJvYcCUc3geLtnIgcHwXGYUabjZ3TLJXttoTOYkkOM9D1CkgOKK1XTeT9ZM+oPEbS7keKAO6jB00d/kDwd4=@lists.infradead.org X-Gm-Message-State: AOJu0Yyucno1TDeCc8rFuusKI9Iqqb3Ije1PqnBZm2GkoAb2St0qF8nV UlZIDzreNODBJZF2Ky3HBsZTigsENRdLfNNGOfiRZbnnpdsM3zx4hzK5U85MUFAT4pA5FX3lKZT wzg== X-Google-Smtp-Source: AGHT+IHLwQuTuSKn2K83jzMORxhmnJG2QJIDSetKispH+vrqgQjqJfiOQ3+gOO6ZQgZWYqSyd9aEi5B6J6c= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a25:6948:0:b0:e29:6a6:ed83 with SMTP id 3f1490d57ef6-e2906a6f043mr903276.11.1728489011277; Wed, 09 Oct 2024 08:50:11 -0700 (PDT) Date: Wed, 9 Oct 2024 08:49:47 -0700 In-Reply-To: <20241009154953.1073471-1-seanjc@google.com> Mime-Version: 1.0 References: <20241009154953.1073471-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241009154953.1073471-9-seanjc@google.com> Subject: [PATCH v3 08/14] KVM: selftests: Compute number of extra pages needed in mmu_stress_test From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Christopherson , Andrew Jones , James Houghton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_085013_966751_CDE4AE2F X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -9.5 (---------) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Create mmu_stress_tests's VM with the correct number of extra pages needed to map all of memory in the guest. The bug hasn't been noticed before as the test currently runs only on x86, which maps gues [...] Content analysis details: (-9.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b49 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Create mmu_stress_tests's VM with the correct number of extra pages needed to map all of memory in the guest. The bug hasn't been noticed before as the test currently runs only on x86, which maps guest memory with 1GiB pages, i.e. doesn't need much memory in the guest for page tables. Reviewed-by: James Houghton Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/mmu_stress_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/mmu_stress_test.c b/tools/testing/selftests/kvm/mmu_stress_test.c index 847da23ec1b1..5467b12f5903 100644 --- a/tools/testing/selftests/kvm/mmu_stress_test.c +++ b/tools/testing/selftests/kvm/mmu_stress_test.c @@ -209,7 +209,13 @@ int main(int argc, char *argv[]) vcpus = malloc(nr_vcpus * sizeof(*vcpus)); TEST_ASSERT(vcpus, "Failed to allocate vCPU array"); - vm = vm_create_with_vcpus(nr_vcpus, guest_code, vcpus); + vm = __vm_create_with_vcpus(VM_SHAPE_DEFAULT, nr_vcpus, +#ifdef __x86_64__ + max_mem / SZ_1G, +#else + max_mem / vm_guest_mode_params[VM_MODE_DEFAULT].page_size, +#endif + guest_code, vcpus); max_gpa = vm->max_gfn << vm->page_shift; TEST_ASSERT(max_gpa > (4 * slot_size), "MAXPHYADDR <4gb ");