Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1716450pxb; Wed, 10 Feb 2021 15:15:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyatvWDMQHAhjHeNVLTK7oMLtw55v4ou/QvtNTId9736X00HAXFtlqAP2zRp0HUlOQ/NEwT X-Received: by 2002:a17:906:af86:: with SMTP id mj6mr5299194ejb.509.1612998930990; Wed, 10 Feb 2021 15:15:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612998930; cv=none; d=google.com; s=arc-20160816; b=hiPII3Lf+V1bTKY0Vo9UnNYOE5m0n9YlnuCNbZ5ePTVUVtXEgcIx8NCVEfrfjpoz5m GURDh0abtTggGjdIFEeE/vrgOB5u6ghMlK+PcGbuVVqoodcOMdUpB6eZXtmbTikph0ha c5hGWB33dr+xagroVusTZEsM7vpV57b2Zio85brNJXnFDZ1xdPRNnttIJ1llv81Et8il r1pzGMp20D/bd9ylAHy2PPmd4iH0+cAO2ZuYikdqzLLYb2Fm6Po56ALGOj+gEFfJqDnZ aX7hvaFFN+WbPdkxMM8RphA6vcxpAAXIAr+45MrBo4vAHzvJrmqGdKbBbnmyyT9V8srp VWqA== 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:sender:dkim-signature; bh=5PnXDF9tiDkGPbh/VAWaDwby96Avt0+QuG4w822UbjY=; b=CeCj38pShmfn1U9Ly8bzTQ0LU4Y90dIf0QSMjbybZoXMRfz0KDeA8vBR7m7UWwGKAC LUXrCdegtD+imzbalHHxi6G9YDs0mLdFU6l4xPhgJBko4AfuT9QhrRAz48WkgZl+ksQ4 cdXmwb5zOkrc/4ZIDqo2UoQMGLmSFXr+dM+GU0PQHsJwppraWRK1PyJSwYvDTNowQQ9h 2pkjiHToD70rVMNssh5d8psi/BcfOeuCrwgttZIvbJ6Leq5IYMmiq5hQjGYUw+84CV95 iMrxKb3xqDussFXVHJ9N63rHbtaragnODhmNiHgQ9cLzUvxw1cvUy1pB50Ip+BI5OGlD ntxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ta/BJY4l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si2184699ejr.383.2021.02.10.15.15.07; Wed, 10 Feb 2021 15:15:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ta/BJY4l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234112AbhBJXMk (ORCPT + 99 others); Wed, 10 Feb 2021 18:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233908AbhBJXJb (ORCPT ); Wed, 10 Feb 2021 18:09:31 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B87C061222 for ; Wed, 10 Feb 2021 15:06:58 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id d8so4270545ybs.11 for ; Wed, 10 Feb 2021 15:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=5PnXDF9tiDkGPbh/VAWaDwby96Avt0+QuG4w822UbjY=; b=Ta/BJY4l1df5MvQ8o8wCs579FL0qBg6e+Ev+44fO/sCFPAmHqrzszh1h1b1aidhjgy sA3TU6A6ir+0rKWWoK8QsIiw9+1u1PqhcDkh7V11tiARPiHCVZuNLrgyOvcxbMLWC2MI O/M5epUclP33pX0tTZNA3hVu91cJZBVI2nt8mqMfBRqdxnCDXu6O5hINNLTg2Qvd05ib UqIYB2q7oHinhOVSdWe4lovNE7wHuWKEgLZgDlfQ9chtRBn1ZFSF8+kFxuXwSDFcedlN NHN2rKgG+xttQynNlbxKZUjWtu0GfJ5iPDC8MqCCGhq8GKT62i4n/eS/iR0NFb2nSyYO cSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=5PnXDF9tiDkGPbh/VAWaDwby96Avt0+QuG4w822UbjY=; b=KlQprg7jjgE80VvN99CIRWJWjqkQB/8lCDJVIpgH1GNE20Bab0y1FVG9Sl2smjieod BMzoOrpkwHhwNs+XkkN6EnAToJM0R8GizD99P1GvFOJ0C2PFRLscedYb4mra9vG+EBnZ MxLwRyx8o1lQbQlRY68VS6T2uIFHc8DYSJcRLGOWqlNNiUqEJL18ybbrGBWEj6EEWUIq ULV11EwzbXsm1w+oEo5ku66veT6YwRhU/Qs5hnU+w1IwpfKQ/77FsiUzdozHgWW5OwcC /6mCc4mdBer/3zYqxfy+ztZBo+avgVQYoic9DrX3E5YonvgfFGo4AZV1+tDhD0GOyHp+ kvPQ== X-Gm-Message-State: AOAM531O4ka4tkrqc6UprSkdvmYQARXBtL3y63DBrJibvniMpQuA9RZe 0IbzuTr7JBaGZdcOmSqJs7419Jzvxew= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a25:67d6:: with SMTP id b205mr1035523ybc.394.1612998417404; Wed, 10 Feb 2021 15:06:57 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 15:06:21 -0800 In-Reply-To: <20210210230625.550939-1-seanjc@google.com> Message-Id: <20210210230625.550939-12-seanjc@google.com> Mime-Version: 1.0 References: <20210210230625.550939-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 11/15] KVM: selftests: Create VM with adjusted number of guest pages for perf tests From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Ben Gardon , Yanan Wang , Andrew Jones , Peter Xu , Aaron Lewis Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the already computed guest_num_pages when creating the so called extra VM pages for a perf test, and add a comment explaining why the pages are allocated as extra pages. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/perf_test_util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c index 982a86c8eeaa..9b0cfdf10772 100644 --- a/tools/testing/selftests/kvm/lib/perf_test_util.c +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c @@ -71,9 +71,12 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus, TEST_ASSERT(vcpu_memory_bytes % pta->guest_page_size == 0, "Guest memory size is not guest page size aligned."); - vm = vm_create_with_vcpus(mode, vcpus, - (vcpus * vcpu_memory_bytes) / pta->guest_page_size, - 0, guest_code, NULL); + /* + * Pass guest_num_pages to populate the page tables for test memory. + * The memory is also added to memslot 0, but that's a benign side + * effect as KVM allows aliasing HVAs in memslots. + */ + vm = vm_create_with_vcpus(mode, vcpus, 0, guest_num_pages, guest_code, NULL); pta->vm = vm; /* -- 2.30.0.478.g8a0d178c01-goog