Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp132474iof; Sun, 5 Jun 2022 23:19:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYeYLgbTK3JwVzKJALA2MDYbOrMmZTSHr1TRxTQFVTvYzq58zxcalz04OWZsnzeyWAKlSb X-Received: by 2002:a17:903:18a:b0:167:621b:d6e8 with SMTP id z10-20020a170903018a00b00167621bd6e8mr10541358plg.113.1654496372969; Sun, 05 Jun 2022 23:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654496372; cv=none; d=google.com; s=arc-20160816; b=fYGpBVLHWSP/QuBKrsC801Yu2f/FvZ4WykuJSAB/S7UhoZbZcv/sUzVDUjepIuvDyd /EoTJji0o5txU2zcXQXgtClQMPctJEidhkllklpLHgEb/DaF11h+HbUvF1hv13oE0EXX PDR2i+HvdrzdW5NqzPaLMQQUGUNAcMU76dN4rYxE7YRAXWc1A3D1z14bfnFJVHTQ4EeC Ggdi24FOjTJVZ9lcZvyphaOnmNFv75oHgZpJqpAAjyy701KwxiljwowVZApO7qANVciE q/4YPfHJ7CcU3WzkOYgaQlFNm4a6aWFiNsAqBhlM7Aceh99tPhhA1nRUuyXHduloUcjG zGww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=ppIQviKeXAjnBTE67zRSl+mz1Fz5fT88/u4zDaATcDY=; b=ebTCzoWzzdOzP/hLNFWROJuGGhIyd4/3ZLvlOcZe2rzBEyPROt5oQmbuAsSp4/NEAU 565O3cqZzHwtrwfL6cOa8Aj/YxFbk1OKB1u1yeyn7wTB4qOlOBvLboJyz45EKqBXQtrK N26Ur7guQrtCZFes9SkwqpQEx/r9zTDsJtinZyCCFcLFQwnpsKaLrcXNNK9TOgwf281U HQeeZ99cjRgQT7PzZdEpmb2efqBUQn47uSTohX6TC0KXUBWTd3xDPzmwpsqJYlhSrGT5 yPJB9x09xfij2/MY/RcsVCSD8qNkvjKbQyr1IJkBJ+oi9RMRDEytvYU6duzzEbGLVafN SxzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZYMZuefq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u24-20020a631418000000b003c14249f5a1si19916922pgl.410.2022.06.05.23.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:19:32 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZYMZuefq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D4669128C2F; Sun, 5 Jun 2022 21:58:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241636AbiFCBAj (ORCPT + 99 others); Thu, 2 Jun 2022 21:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241248AbiFCAub (ORCPT ); Thu, 2 Jun 2022 20:50:31 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15EB933A23 for ; Thu, 2 Jun 2022 17:47:45 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id z5-20020aa79f85000000b0051baa4e9fb8so3504871pfr.7 for ; Thu, 02 Jun 2022 17:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=ppIQviKeXAjnBTE67zRSl+mz1Fz5fT88/u4zDaATcDY=; b=ZYMZuefqQ7VqgcGkwgIuck5ytWZ1wxhU1qBur6BmelEMmu4oOWPTH8gQG6jodbj3mx pc8G/so2nlpShG46ZXNBYya/WdqDMwNyrZfj/RDEVJNFt4OOlVXLho2uY/1HB3NB7cRc jTVFK1C5qpgL3nW+baPppZCthxus7Y7QL0t1TtWlcS59RXQwu8E6ROiJROGaFAwo8YkV kkqe+1kQhzfpn6GsNbwQPsS4KPeMI9F2cBS7CjLL2EnLOceph988mumRcU3z3QtepnOr BtfWI5ufX3VO5dnPGY9jfn2G87tCEj79dlXEPaIm8V+MDIurNCVgfxkzJLl0jH1AM6tG +Wpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=ppIQviKeXAjnBTE67zRSl+mz1Fz5fT88/u4zDaATcDY=; b=IaektHLRM5NMZoQvdSkvSkGQresIOV/CdBvBOp53TtLIbhFrdQS72VYaAr2wIlfK4C YArGKJNP/WMRlEHBBRPMskzuQSL8p2W4vS6fImYuTusTv2BpE/evVp0XIN9Lhfhl7F1a e+DlroY43otc4oe3kGy8kK601cDUuBCCsmfqmVxrSA57DZ9P3f7JIREmsFjQjSsVRQGs L4Lp+X62DBLh9VEo5kOwqocHDEektjQIpuXlQJbnLKDkK6dbKJRUj00jWP8XdtNEyhs4 S/rbLCIA/Sv5X6YdzoEJ6PP6l/uJHYPUIdWFuhwJZre3WD3Vnax7MWB92a7ewUkqNo+w K4Iw== X-Gm-Message-State: AOAM530dp4TyYSra2jl+IB6g5jQiH/6j/sdsk9Ov6bgZdfM05oK/uctk TLLHPZhS9vq+Jdig9v5dKtliWWwWsmI= X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a17:902:e752:b0:165:1282:8d56 with SMTP id p18-20020a170902e75200b0016512828d56mr7738854plf.48.1654217263943; Thu, 02 Jun 2022 17:47:43 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 3 Jun 2022 00:43:24 +0000 In-Reply-To: <20220603004331.1523888-1-seanjc@google.com> Message-Id: <20220603004331.1523888-138-seanjc@google.com> Mime-Version: 1.0 References: <20220603004331.1523888-1-seanjc@google.com> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog Subject: [PATCH v2 137/144] KVM: selftests: Drop @num_percpu_pages from __vm_create_with_vcpus() From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, Vitaly Kuznetsov , Andrew Jones , David Matlack , Ben Gardon , Oliver Upton , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drop @num_percpu_pages from __vm_create_with_vcpus(), all callers pass '0' and there's unlikely to be a test that allocates just enough memory that it needs a per-CPU allocation, but not so much that it won't just do its own memory management. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/include/kvm_util_base.h | 4 ++-- tools/testing/selftests/kvm/kvm_page_table_test.c | 2 +- tools/testing/selftests/kvm/lib/kvm_util.c | 7 +++---- tools/testing/selftests/kvm/lib/perf_test_util.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index f84e01612c52..6143d45a02a7 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -562,14 +562,14 @@ static inline struct kvm_vm *vm_create(uint64_t nr_pages) } struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, - uint64_t extra_mem_pages, uint32_t num_percpu_pages, + uint64_t extra_mem_pages, void *guest_code, struct kvm_vcpu *vcpus[]); static inline struct kvm_vm *vm_create_with_vcpus(uint32_t nr_vcpus, void *guest_code, struct kvm_vcpu *vcpus[]) { - return __vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, 0, 0, + return __vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, 0, guest_code, vcpus); } diff --git a/tools/testing/selftests/kvm/kvm_page_table_test.c b/tools/testing/selftests/kvm/kvm_page_table_test.c index a68c57572ab4..f42c6ac6d71d 100644 --- a/tools/testing/selftests/kvm/kvm_page_table_test.c +++ b/tools/testing/selftests/kvm/kvm_page_table_test.c @@ -254,7 +254,7 @@ static struct kvm_vm *pre_init_before_test(enum vm_guest_mode mode, void *arg) /* Create a VM with enough guest pages */ guest_num_pages = test_mem_size / guest_page_size; - vm = __vm_create_with_vcpus(mode, nr_vcpus, guest_num_pages, 0, + vm = __vm_create_with_vcpus(mode, nr_vcpus, guest_num_pages, guest_code, test_args.vcpus); /* Align down GPA of the testing memslot */ diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index f68234a2ee83..508a5eafe15b 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -281,7 +281,6 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint64_t nr_pages) * mode - VM Mode (e.g. VM_MODE_P52V48_4K) * nr_vcpus - VCPU count * extra_mem_pages - Non-slot0 physical memory total size - * num_percpu_pages - Per-cpu physical memory pages * guest_code - Guest entry point * vcpuids - VCPU IDs * @@ -295,7 +294,7 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint64_t nr_pages) * no real memory allocation for non-slot0 memory in this function. */ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, - uint64_t extra_mem_pages, uint32_t num_percpu_pages, + uint64_t extra_mem_pages, void *guest_code, struct kvm_vcpu *vcpus[]) { uint64_t vcpu_pages, extra_pg_pages, pages; @@ -310,7 +309,7 @@ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus * N pages) will be: N/x+N/x^2+N/x^3+... which is definitely smaller * than N/x*2. */ - vcpu_pages = (DEFAULT_STACK_PGS + num_percpu_pages) * nr_vcpus; + vcpu_pages = nr_vcpus * DEFAULT_STACK_PGS; extra_pg_pages = (DEFAULT_GUEST_PHY_PAGES + extra_mem_pages + vcpu_pages) / PTES_PER_MIN_PAGE * 2; pages = DEFAULT_GUEST_PHY_PAGES + vcpu_pages + extra_pg_pages; @@ -333,7 +332,7 @@ struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu **vcpu, struct kvm_vcpu *vcpus[1]; struct kvm_vm *vm; - vm = __vm_create_with_vcpus(VM_MODE_DEFAULT, 1, extra_mem_pages, 0, + vm = __vm_create_with_vcpus(VM_MODE_DEFAULT, 1, extra_mem_pages, guest_code, vcpus); *vcpu = vcpus[0]; diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c index 656f309584aa..1f25ed69ca98 100644 --- a/tools/testing/selftests/kvm/lib/perf_test_util.c +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c @@ -144,7 +144,7 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int nr_vcpus, * The memory is also added to memslot 0, but that's a benign side * effect as KVM allows aliasing HVAs in meslots. */ - vm = __vm_create_with_vcpus(mode, nr_vcpus, guest_num_pages, 0, + vm = __vm_create_with_vcpus(mode, nr_vcpus, guest_num_pages, guest_code, vcpus); pta->vm = vm; -- 2.36.1.255.ge46751e96f-goog