Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp123884rwb; Fri, 19 Aug 2022 18:29:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR7bZg4gHn97eo2ZqtCKyi9hgykjbR5v8Gt6AkQm0jS4p7Li2CFGfCafaERW60BOeleX+2ks X-Received: by 2002:aa7:8e91:0:b0:52d:8ebf:29a4 with SMTP id a17-20020aa78e91000000b0052d8ebf29a4mr10520099pfr.1.1660958964541; Fri, 19 Aug 2022 18:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660958964; cv=none; d=google.com; s=arc-20160816; b=n2rRkBZ14KCgNjLGmh7rW2BHzVIzEjZYWOLgl0/pggYcIYHFxrUPiOhTDH3hHfL3cS SGy4Zd8z9HLLPGZCaIHs/EX8nfI8tmZ8O8l3xPjMMClDJGAeaVqn9nBto7diUf+O94zj ZPhAtFX26jVLoio/X1vQsLBX8FnkyZFtS0Kp+5M6Pf9I1ou7UIFe2TaBEx2ePf1iOGJ3 z5A/DysfnssP3bzIozzw01dbL8evpAA1/1+IEtxPOtDYMJJKLG2Mxqjbc1TmVKYTMfoU ny5bGrug8/bEkCvdZTiNvzbfKVL3NU8HHtZDgWdtOMWqseRYZAsp8uox0q1m/2lhhaTD DQYw== 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=CNep9ry1VvhvpUTMySVEmMbXzxdlarH1IuCZVDew7EY=; b=Y8FZ3Koo57oh9YGZNSPh+DMNYJ8UUUcKzP2Uut/jBe2Qh0N+pCtLG+xlD9sXQBs8/e fycSafIc+HXwBHsIydJ+MdxSUAAsVd5beO4DgfIY7gFlIGqZRA4LA6Iqy8Eidptzizw/ tfEhV7f8Jmj9fbNeY6ZHddycjiYgWfqDPF84yVWQa/4LMXX1rBUpB+9R4aYgPjcBEH+a 00Uls/C1LvEb7pTCSSBFvHltoO46id9ayBKKiQ0wCu9bCXEr/R9o+f8G7JEaalQkvE3E D1mCol2TjszFa2tNFdhIn5aVZcxLTr0LvnIgeP0iNRCG1UMkXwDszdeG6KRhmN1jLMyI 87aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=STdhnd7F; 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 d2-20020a056a00244200b0052d90409c2csi5541465pfj.226.2022.08.19.18.29.14; Fri, 19 Aug 2022 18:29:24 -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=STdhnd7F; 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 S245052AbiHTASD (ORCPT + 99 others); Fri, 19 Aug 2022 20:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237749AbiHTASB (ORCPT ); Fri, 19 Aug 2022 20:18:01 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B039113DC7 for ; Fri, 19 Aug 2022 17:17:59 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id x25so5856042ljm.5 for ; Fri, 19 Aug 2022 17:17:59 -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; bh=CNep9ry1VvhvpUTMySVEmMbXzxdlarH1IuCZVDew7EY=; b=STdhnd7FenS1b/9kx+ca0KEU2L2sOkn+b8mag93WCl0qPu+9sR9XYsxscrOUHLFIXW GKJ5YreWlZJNDH/GvF0kNzSLpKrGAgDGa3yeNCHlgddsdT12mr4MTuWH4aMH0LNKyvyo T8YLdvUt+8pTVs4RzpUBpPNCbiulxOuR/0E7pZ1WWnIqfwHNVtEh2OsQNHQb7/xVLf9V g4LmhTHvSXx9LTNeXZZYNYJnHdZLZqfkkQqePE29BoKzdNONUG62mQRE/fO53EwXs06V /VoRUErLHTspzFL6Ilp0d76nDYnZwMshMeztaiSPzoKN2oujvwDqeAKwg7LdE+Mh755G +DPw== 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; bh=CNep9ry1VvhvpUTMySVEmMbXzxdlarH1IuCZVDew7EY=; b=JRMdw3R3R2zwB25ssiV4ICiTexo64wcwytijagI/zl10BffpN1BTPBDGRAyqMxWveO A52+ZPWBYLXKEj9wZjpmEZXwLfP1en7MUVytOJd2FvIdCwnw4CAp2z2b/goCeGWrZCW0 1xuzL27x1T/FzEwACmngnD8m7gOlzqPiLJ5Mb8xAqQHe7Gi/Kwv5wBI1wl99sFKUEb84 WGXGjG5xf7ugZrvZvjZZNalGOXjOEcGKMKQXnjqL73VKKsfhKgpB/T+7OPvk5Td5OQ6u HPYHrYXO1chjfDEITWrbr9Ws4I6DtCD2khHtu3NAsaXdW51HCI7aEVHje4rZPyWtwC40 yGHw== X-Gm-Message-State: ACgBeo3AvA7zWUOHFQZ1D3QkBj8U/KBLODiJHEXpcjtM3wfsyE/ME2Q5 CA76XxWuthPEgC4Ix3uExNA5ASF38AmsXIApDbNcFA== X-Received: by 2002:a2e:84ca:0:b0:25d:77e0:2566 with SMTP id q10-20020a2e84ca000000b0025d77e02566mr2983018ljh.78.1660954677321; Fri, 19 Aug 2022 17:17:57 -0700 (PDT) MIME-Version: 1.0 References: <20220819210737.763135-1-vipinsh@google.com> In-Reply-To: From: Vipin Sharma Date: Fri, 19 Aug 2022 17:17:20 -0700 Message-ID: Subject: Re: [PATCH v2] KVM: selftests: Run dirty_log_perf_test on specific cpus To: Sean Christopherson Cc: David Matlack , pbonzini@redhat.com, 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, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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, Aug 19, 2022 at 3:59 PM Sean Christopherson wrote: > > On Fri, Aug 19, 2022, David Matlack wrote: > > On Fri, Aug 19, 2022 at 03:20:06PM -0700, Vipin Sharma wrote: > > > On Fri, Aug 19, 2022 at 2:38 PM David Matlack wrote: > > > > I think we should move all the logic to pin threads to perf_test_util.c. > > > > The only thing dirty_log_perf_test.c should do is pass optarg into > > > > perf_test_util.c. This will make it trivial for any other test based on > > > > pef_test_util.c to also use pinning. > > > > > > > > e.g. All a test needs to do to use pinning is add a flag to the optlist > > > > and add a case statement like: > > > > > > > > case 'c': > > > > perf_test_setup_pinning(optarg); > > > > break; > > > > > > > > perf_test_setup_pinning() would: > > > > - Parse the list and populate perf_test_vcpu_args with each vCPU's > > > > assigned pCPU. > > > > - Pin the current thread to it's assigned pCPU if one is provided. > > > > > > > > > > This will assume all tests have the same pinning requirement and > > > format. What if some tests have more than one worker threads after the > > > vcpus? > > > > Even if a test has other worker threads, this proposal would still be > > logically consistent. The flag is defined to only control the vCPU > > threads and the main threads. If some test has some other threads > > besides that, this flag will not affect them (which is exactly how it's > > defined to behave). If such a test wants to pin those other threads, it > > would make sense to have a test-specific flag for that pinning (and we > > can figure out the right way to do that if/when we encounter that > > situation). > > ... > > > Yeah and I also realized perf_test_setup_pinning() will need to know how > > many vCPUs there are so it can determine which element is the main > > thread's pCPU assignment. > > The "how many workers you got?" conundrum can be solved in the same way, e.g. just > have the caller pass in the number of workers it will create. > > perf_test_setup_pinning(pin_string, nr_vcpus, NR_WORKERS); > > The only question is what semantics we should support for workers, e.g. do we > want to force an all-or-none approach or can the user pin a subset. All-or-none > seems like it'd be the simplest to maintain and understand. I.e. if -c is used, > then all vCPUs must be pinned, and either all workers or no workers are pinned. Combining both of your suggestions to make sure everyone is on the same page: perf_test_setup_pinning(pin_string, nr_vcpus) API expects (nr_vcpus + 1) entries in "pin_string", where it will use first nr_vcpus entries for vcpus and the one after that for caller thread cpu. In future if there is a need for common workers, then after nr_vcpus+1 entries there will be entries for workers, having a predefined order as workers get added to the code. "pin_string" must always have AT LEAST (nr_vcpus + 1) entries. After that if there are more entries, then those will be used to assign cpus to common worker threads based on predefined order. perf_test_util should have a way to know how many common workers there are. There can be more workers than entries, this is fine, those extra workers will not be pinned. If this is not desirable, let us hold on discussion when we actually get common workers, meanwhile, just keep nr_vcpus + 1 entries and work accordingly.