Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8494554rwp; Wed, 19 Jul 2023 10:33:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlFphYluwK+YAf6ngxzgwLQk5mGl7CzBO0n6Lw8Bhgn2MKU6BRvE8K2EYubFoidCJvoPL70p X-Received: by 2002:a05:6a20:9147:b0:134:1b21:b2e4 with SMTP id x7-20020a056a20914700b001341b21b2e4mr12152937pzc.56.1689787984081; Wed, 19 Jul 2023 10:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689787984; cv=none; d=google.com; s=arc-20160816; b=JP3qsO9+96h1Tq20V/61RKfW9PUFfMpuC0zikscyyb+zM2ticuckaJl7VaShaG0Uq1 julqTzxZqGC6lS82sl385lA6mcZHbm0Bhb3dWqmvdf3kwAv5VnKna7kFiCr7tRRXgYDC 72YqKw96bTqXaF0W/FP/LWaVRWThexoNv8PZvoQLECCnZWuKLxByz3dL1rrGhjqlURTq z1UTaZAXz4WH9d8bzyF4j5we6Y87qyTnL8E2TeDexhmmf5kAJ7/6MTZBEFqoO7FTBG6b Ynzhd8+/5dFI1YI9MK1JUNPgTzEVsjBMmh4AntyhBchL6EgqbayuRv8SD9HMOCQsiSxZ DMrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Sj3T/c8YmvgYfTPVsluIq5bnwE6iaG+nhT4u1XN3xLo=; fh=m24Jqoq1NLQ3nw8nM7ym43zTCYLmzC0IblJmvoRAFak=; b=dXfI1KLLz5lXoaFBQqewsythxpxKDKh1oyBPEL0KTW55IFs6t8igivwk4+Az5v6Ymx L3TGwW/xjwP1GZtXOSR0El2kgzVal9TBBQW5UwsfyMYwp8XeKkuqzob4FSvSUm2dazQW OIrl4NUdhJQXPFrhkLQfI/X6raOH/19DlbX2ms6fFDi496RlO9jEQM2HaivGsnOjokfa bY2DAq/J7tsmXQQh1meB+67vM4T+WEgHFXOBs0UzH+OCsaSmSbLtCXrtIDIQ2tFzbn5y l6xAJOptHp3WoAsC3N6liQnY5Niy7uiqca2tJJ1tJ9n1ZDRGBuJaSQhx4DAx1X5rMu9P xxyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=AGauPzP+; 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 c11-20020a056a00248b00b0067f750aa3f7si3937970pfv.257.2023.07.19.10.32.51; Wed, 19 Jul 2023 10:33:04 -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=20221208 header.b=AGauPzP+; 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 S229920AbjGSQzy (ORCPT + 99 others); Wed, 19 Jul 2023 12:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjGSQzx (ORCPT ); Wed, 19 Jul 2023 12:55:53 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A785010CB for ; Wed, 19 Jul 2023 09:55:51 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-401d1d967beso8161cf.0 for ; Wed, 19 Jul 2023 09:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689785751; x=1692377751; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Sj3T/c8YmvgYfTPVsluIq5bnwE6iaG+nhT4u1XN3xLo=; b=AGauPzP+8A9C+sl48+22NswYUFYkLmocOlzOPRtRzGNodahOvDljveR86sZfrkPW3K US8iRew1BEtZbAN6hhw0SpfSi8U9+bkjubJXW2G2IC7yVaotwcPSaW0YHtREMyTLs4BI KqHsQyyUkVmdqDcwMfjtUQyAmlgkHfu7Pk5s4EdLPxKicFU2T7sTUfShrDVnJzPawepi unuF4nvUQhVxecmP8wiKzkcTwrXQVugAnbr/IASM1PWYJIsChQYV4X0cMh1lzmjnDti+ ES30zALn0mmVGx16mAF/lvdlIo3yX+4luTfgbnMx8TlNWVcAA0znb6RmnaTMG7WHhmRb Wc/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689785751; x=1692377751; h=content-transfer-encoding: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=Sj3T/c8YmvgYfTPVsluIq5bnwE6iaG+nhT4u1XN3xLo=; b=OEEptoP52JJZkGVO3IRQlrrnq89wzFhFADbzohiIcTx5dgD3WzYeCAWjk/0P0/LAfm KJe7m8wcxyNg81ZNnfJARxu5Y+j0kC3FjTcjgqIvVKIcoVrUD7KZx2i8Bc5k9KACcNIz ctcd2POCh4c1LkpYzNviXp5tBv9/TQWtzAoc/OsjBgcWYMGZQ9tED4nnPIpu4mwUhJQh Xz4k9GqkkLZ1NM97AORRhXNFOfc6vu7Fuf34qszfjyVflPGrf3Qvc4RLTcaFokMffw1G pwjJYwaOBjkwaMdUE+jYk+0RrsMV89ID+AcYUVr57CDtJ/mzB7N4tChi/sM+eFPEYpVc 26XA== X-Gm-Message-State: ABy/qLav4ueabAc4CVry6iHgQ3FofJCyO7WaXjmLEktf++V1ky3ht+UX eHuV1V6uYqQkBNglUX+5X0bgbO9JMZPvnwXbd7LjAg== X-Received: by 2002:ac8:5714:0:b0:403:a43d:bd7d with SMTP id 20-20020ac85714000000b00403a43dbd7dmr625699qtw.4.1689785750750; Wed, 19 Jul 2023 09:55:50 -0700 (PDT) MIME-Version: 1.0 References: <20230713085831.395112-1-changbin.du@huawei.com> <20230714071914.3jro4kfcvhun2ptd@M910t> In-Reply-To: <20230714071914.3jro4kfcvhun2ptd@M910t> From: Ian Rogers Date: Wed, 19 Jul 2023 09:55:39 -0700 Message-ID: Subject: Re: [PATCH] perf: add new option '--workload-attr' to set workload sched_policy/priority/mask To: Changbin Du Cc: Adrian Hunter , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,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, Jul 14, 2023 at 12:19=E2=80=AFAM Changbin Du wrote: > > On Fri, Jul 14, 2023 at 10:06:31AM +0300, Adrian Hunter wrote: > > On 13/07/23 11:58, Changbin Du wrote: > > > To get consistent benchmarking results, sometimes we need to set the > > > sched_policy/priority/mask of the workload to reduce system noise. > > > > > > For example, CPU binding is required on big.little system. > > > > > > $ perf stat -r 10 -- taskset -c 0 ls > > > > > > Nevertheless, the 'taskset' is also counted here. > > > > > > To get away of the middleman, this adds a new option '--workload-attr= ' to > > > do the same jobs for stat and record commands. > > > > > > $ sudo perf stat --workload-attr fifo,40,0x1 -- ls > > > > > > Above will make 'ls' run on CPU #0 with fifo scheduler and realtime > > > priority is 40. > > > > Aren't there ways to set up a process then start perf using -p > > then let the process continue. > > > By that you need a mechanism to pause the new spawnned process and wait p= erf to > attach. Or setup the sched properties by the app itself. But sometimes we= just > simply want to run the app through and measure some events. With > --workload-attr, we do not need extra setup works. To my naive eyes this looks to be a broadly useful addition. Some thoughts: - "cpu-mask" as the command line argument name, this is "-C" and "--cpu" elsewhere, so perhaps just "cpu" as the mask is perhaps confusing. - could we get a test? Perhaps add a case to tools/perf/tests/shell/stat.s= h: https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tr= ee/tools/perf/tests/shell/stat.sh?h=3Dperf-tools-next Thanks, Ian > -- > Cheers, > Changbin Du