Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp935578rwi; Fri, 14 Oct 2022 10:26:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jlEPSjlTpjNUsSmU6r+gE+/7M4lA7iRpZR6KGkBitO1FqWC9iVOyC9gvTHp4uxvfQcVd9 X-Received: by 2002:a17:902:6b81:b0:182:df88:e6ce with SMTP id p1-20020a1709026b8100b00182df88e6cemr6089151plk.173.1665768411956; Fri, 14 Oct 2022 10:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665768411; cv=none; d=google.com; s=arc-20160816; b=aEPCT/t/qFh+mbFxHgTcdh68sjMXPcgwYVZRwMJSSfgXQkdndD7A5pAmkQrmZOMROx 1d/gFIhx4HSABvkL5lZo3ON+YLyj4nvuU9tqNpEWyKHkpkUWvJEZGVtLZx9mt851vVCG TVdoYdfDc6qjkpw5OR1drNDyIUZv464KxwECL588XHauhQSdezZpd2myrQyM8Dz0Yzhv JrQ/n7vwWZN5jvdAboJF8Rj/3MGjjGDcy5JiV2lE20C+zj7cGuutF8wX+DWnP0bGHG8z P7CXQdUScuc0bDBBvs1a1hqWuz9byNfaNtbUDTiXpmhgwMkQAxLqE8792XqnCChTu2iQ MWUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=621BLDO+wewUpZczBZfn8RJnMCft7GwJ94oh2KaIzRg=; b=MuvNdW+6NgnJ+a0oyQdiHxzm6fOOekiiMzweW9ETj+bO7r5Lb6/ghnlwJCOezijCc4 UhDDooagLDToYfj+6hF0dR1AzRoLw2JhUs+HOFAX0f1D9OrLCaf1VnCISz1gUhrpBCzU SZdg4PuR6eJkpDZsxYFrd9MqCNK6qindebwE7qybWZtLdphzjQC1OtUxA/MYNdjnqtvU xlqao7cwEo4pyxy+qYIGHqMjWr6N0m1xtr05hpL7e9W6osOkY7klDpPgOsENwyMyBiW6 amCJ7wvoBk3Vc9/C6IWMyJ0zbut+bOobqyFhIpoakNHrF6BfykVkRVYZWyAiQ7pApAuY Lgdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IHN8W0HK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a63d00b000000b0046afcba3088si3207622pgf.735.2022.10.14.10.26.39; Fri, 14 Oct 2022 10:26:51 -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=@google.com header.s=20210112 header.b=IHN8W0HK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbiJNQ4E (ORCPT + 99 others); Fri, 14 Oct 2022 12:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbiJNQz5 (ORCPT ); Fri, 14 Oct 2022 12:55:57 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 071EA191D44 for ; Fri, 14 Oct 2022 09:55:54 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-354c7abf786so52107847b3.0 for ; Fri, 14 Oct 2022 09:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=621BLDO+wewUpZczBZfn8RJnMCft7GwJ94oh2KaIzRg=; b=IHN8W0HKAbuSfaHJWrQYdabbCio4EQjxKxBZ44SyZ/jgJhNUKCkLm4heZAaly2FvIU OzuiTIyOSK0aHTI4s3PrlaTwBmG7Ew3l0+Jg6+f6VmLOCYp6CnxyNBvZcjWIEuAJC44W 0aDjQvSyRupLaPDcLnMDGI74NdNlXR9fUMR/DksP63rh9HdVqLZdx1IPQDk7Wz3T3v06 l1P/6wJa8kwdq6K5bfhTPijRS6tFRSY4W9Kct3bPc3tscDqYMzzztx7kH8XCQ2zDL6QF IZjvJtKu3rMOpvsRsR5KyM6A+PFQE5O+hJ5MxAqapBFCVmGs7+FYZvk8bfYWDsEIJ6AF lhwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=621BLDO+wewUpZczBZfn8RJnMCft7GwJ94oh2KaIzRg=; b=SNcmNHuPWhbnJKfi70owTTtGpgcasCAE1fNwvFyVQJE6ky7T8FalVU8PsCCN7bWL3m musFH0Tl0ozacFXNk1aLF1fLEQsL+ytthFY+4G4+yMg4fLm0OMD7rYYUrTOAZZK1OyiH TUSooTjFJ08QHxPnllIECuNUvD5mbVwwOCdpD5E7gj9kPE0cJA5nM99y+bikoZib9md0 Sa63Y1eFC/1OhAC/qwZQMjYZA/pb/J7z0BsagKOm/bnR85twqjPbYzZnw+aMGOSmZXit 1u8R8acwFlwf8GiuKw1ToCG9IfJlEEWVwQWDXedx6l41MiNlSJusoFiFDkdYtfXP6zoX CYog== X-Gm-Message-State: ACrzQf08/PeXDuLhrFzH+9YkVlcTT/qP99s05qb9ChuOdV71vZgyJ1tv ac0K3SYyKcwuaNsQvrpi5NPU0g9A8g2m2dqn8XY6Yw== X-Received: by 2002:a0d:f545:0:b0:350:8a38:7edf with SMTP id e66-20020a0df545000000b003508a387edfmr5389860ywf.209.1665766553213; Fri, 14 Oct 2022 09:55:53 -0700 (PDT) MIME-Version: 1.0 References: <20221010220538.1154054-1-vipinsh@google.com> In-Reply-To: From: David Matlack Date: Fri, 14 Oct 2022 09:55:27 -0700 Message-ID: Subject: Re: [PATCH v5 0/5] dirty_log_perf_test vCPU pinning To: Sean Christopherson Cc: "Wang, Wei W" , Vipin Sharma , "pbonzini@redhat.com" , "andrew.jones@linux.dev" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Fri, Oct 14, 2022 at 9:34 AM Sean Christopherson wrote: > > On Fri, Oct 14, 2022, Wang, Wei W wrote: > > On Tuesday, October 11, 2022 6:06 AM, Vipin Sharma wrote: > > > Pin vCPUs to a host physical CPUs (pCPUs) in dirty_log_perf_test and optionally > > > pin the main application thread to a physical cpu if provided. All tests based on > > > perf_test_util framework can take advantage of it if needed. > > > > > > While at it, I changed atoi() to atoi_paranoid(), atoi_positive, > > > atoi_non_negative() in other tests, sorted command line options alphabetically > > > in dirty_log_perf_test, and added break between -e and -g which was missed in > > > original commit when -e was introduced. > > > > Just curious why not re-using the existing tools (e.g. taskset) to do the pinning? > > IIUC, you're suggesting the test give tasks meaningful names so that the user can > do taskset on the appropriate tasks? The goal is to ensure vCPUs are pinned before > they do any meaningful work. I don't see how that can be accomplished with taskset > without some form of hook in the test to effectively pause the test until the user > (or some run script) is ready to continue. A taskset approach would also be more difficult to incorporate into automated runs of dirty_log_perf_test. > > Pinning aside, naming the threads is a great idea! That would definitely help > debug, e.g. if one vCPU gets stuck or is lagging behind. +1 > > > > > For example, with below changes: > > diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/se lftests/kvm/lib/perf_test_util.c > > index 9618b37c66f7..aac58d1acb3c 100644 > > --- a/tools/testing/selftests/kvm/lib/perf_test_util.c > > +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c > > @@ -264,6 +264,7 @@ void perf_test_start_vcpu_threads(int nr_vcpus, > > void (*vcpu_fn)(struct perf_test_vcpu_args *)) > > { > > int i; > > + char vcpu_name[5]; > > > > vcpu_thread_fn = vcpu_fn; > > WRITE_ONCE(all_vcpu_threads_running, false); > > @@ -275,6 +276,8 @@ void perf_test_start_vcpu_threads(int nr_vcpus, > > WRITE_ONCE(vcpu->running, false); > > > > pthread_create(&vcpu->thread, NULL, vcpu_thread_main, vcpu); > > + sprintf(vcpu_name, "%s%d", "vcpu", i); > > + pthread_setname_np(vcpu->thread, vcpu_name); > > } > > > > and with top we can get > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > > 4464 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.97 dirty_log_perf_ > > 4467 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.93 vcpu0 > > 4469 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.93 vcpu2 > > 4470 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.94 vcpu3 > > 4468 root 20 0 4248684 4.0g 1628 R 99.7 26.2 0:50.93 vcpu1