Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1500986rwr; Wed, 3 May 2023 16:42:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ElP7UINq6cn8+geUOrLWRjzFRC44T2pD7ro/jPt5kdviGABZmORGZaLmb0eOzE1JoPyyo X-Received: by 2002:a05:6a20:3ca5:b0:db:22dc:23d with SMTP id b37-20020a056a203ca500b000db22dc023dmr540522pzj.5.1683157366591; Wed, 03 May 2023 16:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683157366; cv=none; d=google.com; s=arc-20160816; b=tf6Nvtv6apYCiSDWBOwfd41mzZ2KbOTzP1sQYH6334nyW5FU9rAfpQY5f5Dmzx/wGj tLwRLtf7XBTz5gckoD7YH8wy1kM7pTFd+ieZJw6HlvBT8tEJWajC1Tc0wGeLN067K8+s tXB92wUZpS3r6Hc3aFCQc5M1eyoorVwlrM0e+z48rhufUB12HgOFgR78+AbC0KJDWf/J ceCFVVI1pHrt075226aFcZvINqlmzZHXzCqEm4uBJ1+CRG78TlEER382XyM8RpZWWGBw GLDyx+DpP1cLwQl3oBWuEbW7zAvS7onbccMmy0eKkipJFPFGqwWTqG5XzwjLcDFsYLns jqCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+hnDTiFptpp0wY89WivAhn6oJplw+7n7FAUqnfvNKTk=; b=R6VeTZgJV8f3nT2mSjDIMOgh60AQ+NxvL7kbtAikDoETzypsKQoaNKzcT+ykJ3GvME N4EwV1DLTFmjBcy7BoJQ5A4hH75mLWVTQ079cM6Yr4IBXsL/4bWlU1bOeLxPAq70ZjIc uzChmcanqMj2QixizLYjydoVd2IZ63fuhadRm7/byumedB9piBjSwTZg7+1rygsK0/5d Lm/kuUE+93fgzSSxfF2eMLdR9PsdFnVfH37lPNvHSHTnbgpnw8UDAx1sUAaF95sHEtcV sS0n+j4Afmv4RDRiIl3/Eot3JfwTq7ztrAgmhE+CQNaAspzbupfT/jiiFUX6FB+BX8Du mWlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Oo2gODbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a63e04c000000b00502f0d858e9si34876602pgj.174.2023.05.03.16.42.33; Wed, 03 May 2023 16:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Oo2gODbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbjECXjM (ORCPT + 99 others); Wed, 3 May 2023 19:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbjECXjK (ORCPT ); Wed, 3 May 2023 19:39:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015C1902E for ; Wed, 3 May 2023 16:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683157098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+hnDTiFptpp0wY89WivAhn6oJplw+7n7FAUqnfvNKTk=; b=Oo2gODbWz781Rah1g0x4UHjuTs+X0kbTYEe2Dx6DrxPH+61LR60Hbk+x70JxCSN5maMFUm GyeBMsYP3P5LDVMcAyn8M0uGnFeiPUdixxGdpuIIkqXEVCpin/Y2OnTnCuNAMTfRWCE3WQ e3PnZ+JTU5TDU7VQngDNfvV98hObD8A= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-tYZudwhfMLCf1ivWulXdIg-1; Wed, 03 May 2023 19:38:16 -0400 X-MC-Unique: tYZudwhfMLCf1ivWulXdIg-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-5ea572ef499so4363326d6.1 for ; Wed, 03 May 2023 16:38:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683157095; x=1685749095; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+hnDTiFptpp0wY89WivAhn6oJplw+7n7FAUqnfvNKTk=; b=ejrgBceThRisTbhlQKNR3uf5hMOh2QCseDQ/5J/kut4apdQXnt8thmbsNRn/K14Fv0 lAmpxwvkrY9t9w5iSYwR6CFMHeW7eOfpR8mneN6OukorCsvSWnHnbs7iJow1tWFnIo3R PyITIFJ4p4+orx56F/6cID57eZZUBgZOTf3SjCkLiKknJPQirVwf0vRRihLrObaARAIg cMuiCjm6c15DH1kFHJFLoEJH2T9fOjJkvg6Lqd+SNKBmX2FedomPeXQTC1C8j0RoMIbi nWyoQ7+LY+NHVuGJGxUCwi7co31SC/jr+8I16454DJ3rdiwh/OLKTe9Cjhgk/hb8O2eA QbtQ== X-Gm-Message-State: AC+VfDy07SQ8vKvgxJlRNFDog6r6KeyW4XMI6rYi38k/hy6KvpM1kHOB Mnyvg9Wfa0iwtMKuT0raHxr6/sx6xu+9ECNI/dkmwLfhqJq22G40MNZ59fKrFf7nOPl9XiPgdWL irHijdABc4eOcQZzUFuCvwzNCnUQQyOIQrHs3qGl1LpHeL9yjhNHTUE+vHjDn8fxLiM4mWOWJED BCKK4rrQ== X-Received: by 2002:a05:6214:5199:b0:616:870c:96b8 with SMTP id kl25-20020a056214519900b00616870c96b8mr29070335qvb.3.1683157095109; Wed, 03 May 2023 16:38:15 -0700 (PDT) X-Received: by 2002:a05:6214:5199:b0:616:870c:96b8 with SMTP id kl25-20020a056214519900b00616870c96b8mr29070315qvb.3.1683157094789; Wed, 03 May 2023 16:38:14 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id u18-20020a0cdd12000000b005e1235e6f2esm10911718qvk.12.2023.05.03.16.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 May 2023 16:38:14 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: peterx@redhat.com, Paolo Bonzini , Sean Christopherson , James Houghton , Anish Moorthy Subject: [PATCH] selftests/kvm: Allow specify physical cpu list in demand paging test Date: Wed, 3 May 2023 19:38:12 -0400 Message-Id: <20230503233812.2743269-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Mimic dirty log test to allow specify physical cpu pinning for vcpu threads. Signed-off-by: Peter Xu --- tools/testing/selftests/kvm/demand_paging_test.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c index bdb8e0748154..d709b65fda2f 100644 --- a/tools/testing/selftests/kvm/demand_paging_test.c +++ b/tools/testing/selftests/kvm/demand_paging_test.c @@ -220,12 +220,13 @@ static void run_test(enum vm_guest_mode mode, void *arg) static void help(char *name) { puts(""); - printf("usage: %s [-h] [-m vm_mode] [-u uffd_mode] [-a]\n" + printf("usage: %s [-h] [-m vm_mode] [-u uffd_mode] [-a] [-c cpu_list]\n" " [-d uffd_delay_usec] [-r readers_per_uffd] [-b memory]\n" " [-s type] [-v vcpus] [-o]\n", name); guest_modes_help(); printf(" -u: use userfaultfd to handle vCPU page faults. Mode is a\n" " UFFD registration mode: 'MISSING' or 'MINOR'.\n"); + printf(" -c: physical cores to pin vcpu threads (e.g. 1,2,3,...)\n"); printf(" -a: Use a single userfaultfd for all of guest memory, instead of\n" " creating one for each region paged by a unique vCPU\n" " Set implicitly with -o, and no effect without -u.\n"); @@ -247,6 +248,7 @@ static void help(char *name) int main(int argc, char *argv[]) { int max_vcpus = kvm_check_cap(KVM_CAP_MAX_VCPUS); + const char *cpulist = NULL; struct test_params p = { .src_type = DEFAULT_VM_MEM_SRC, .partition_vcpu_memory_access = true, @@ -257,7 +259,7 @@ int main(int argc, char *argv[]) guest_modes_append_default(); - while ((opt = getopt(argc, argv, "ahom:u:d:b:s:v:r:")) != -1) { + while ((opt = getopt(argc, argv, "ac:hom:u:d:b:s:v:r:")) != -1) { switch (opt) { case 'm': guest_modes_cmdline(optarg); @@ -272,6 +274,9 @@ int main(int argc, char *argv[]) case 'a': p.single_uffd = true; break; + case 'c': + cpulist = optarg; + break; case 'd': p.uffd_delay = strtoul(optarg, NULL, 0); TEST_ASSERT(p.uffd_delay >= 0, "A negative UFFD delay is not supported."); @@ -309,6 +314,12 @@ int main(int argc, char *argv[]) TEST_FAIL("userfaultfd MINOR mode requires shared memory; pick a different -s"); } + if (cpulist) { + kvm_parse_vcpu_pinning(cpulist, memstress_args.vcpu_to_pcpu, + nr_vcpus); + memstress_args.pin_vcpus = true; + } + for_each_guest_mode(run_test, &p); return 0; -- 2.39.1