Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5692440rwd; Mon, 12 Jun 2023 08:25:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ei7ujPFL2Ph55O33SgWLYoDsnMXRnce2urbm4QTXw3KbvUvIaGj+05reqQW69qoYrU3y4 X-Received: by 2002:a17:903:1247:b0:1ac:83d1:9269 with SMTP id u7-20020a170903124700b001ac83d19269mr7721672plh.16.1686583550062; Mon, 12 Jun 2023 08:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686583550; cv=none; d=google.com; s=arc-20160816; b=no/xKv+kyVF8glfa7G56EOruQw4+AYy7bE25ZWHeFsmIqKXVHCV+KdY53x1asRvS5b d8XUt1HJA/ZoSKcZ1vgyor0p9gFzfjLABxUJZ7cysHAMIiokmLfnHSrnjaZez0R1I9bo 5RlAgzexECCBTE4Q79pv1V1Lwx3iR/nVjSRgrxB0MZ//qmd2wX5F6xQREsU2bjeAe+rb 54OFw0M/Awb5E9lz28EunNv7W7a7g4B4RZGcGWl5QEW2AvN4Ncegl0s1PO7qjGOjuufs Q6LVYMzavnzlCWHyAdoleMKbWLJcw8VcXVGjo6OmiRMt/xVk+ODFZv02Pr0O6Chq6C90 vTxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xvwUNkAXVQ8qGm2MvMHvQ7D7SsRckSCIQl+LZ/aTdsc=; b=VmukSax+o9wsriABWUrX5ruUbZWeiWCcDLQPwsWClhquEdWMm3WXg6/dXw/psXkXYw nfQtFVwt9FN9+dV8j5tHZ4rvXLc8EMq9DIv/cp7MFVgq/mihjbFH3R+cLtu4LoUAYybR jHW9FgO9HdyVI0U5vCdOR+TbyLUeuZUtHLKSSffPJDZjV3QjWev7P9/wtpbgpWm/k1Ri j+ufMAhVhTdp+G5/LoOjFL1w9/SnQBIHIkqH4hNh2SBXcFbGhDQ2tqfpSrZDgf+x4YcA 5+oLXzE+BUW7nFk+bHdUhKPy+mhgjtsazqTKhtmJysdZvkqxMrEjACvxQCMAxF4Bud3J wkqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UbFAttbC; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a170902b28300b001b3d3575ea0si1347975plr.368.2023.06.12.08.25.37; Mon, 12 Jun 2023 08:25:50 -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=@kernel.org header.s=k20201202 header.b=UbFAttbC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238996AbjFLO1N (ORCPT + 99 others); Mon, 12 Jun 2023 10:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237829AbjFLO0u (ORCPT ); Mon, 12 Jun 2023 10:26:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CB71982; Mon, 12 Jun 2023 07:24:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 901BA6152C; Mon, 12 Jun 2023 14:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC0B2C433D2; Mon, 12 Jun 2023 14:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686579869; bh=8sAZD+hAvXQWVLROaSM5UrvaEx3cSXS0jloJ1FKhXDg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UbFAttbCT8XewMJnnbiDzVJvX5bcVvUfZK6SKm4RNZjwsX8j53ejjOM9jVluUtQ33 le43aa7pI99xCGft+eRu54DKT3UeNaeABuUEsQs2zSfUikoxLrm6ROr8Ru+D14BVoB S56sAEvCIJpxsRa+GA5j5kN3eA1d2lE2+O1EdkQ1FxFhLod4C9fbUvJ+WNtWCcVIwE h0Mtbd3IIpacz30Esx9LwYuWereyudzBpBxDKlALt9CSTpUxNttZs2YSy3tcPdY6wy LZmWtIkr8JTet4EZIBKXIO0glQTBds1dmaQfejQbzAAY9X5eV8vP3hl+FhjGNVFz7X H8XY5BcoBFJAg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 4ACEA40692; Mon, 12 Jun 2023 11:24:26 -0300 (-03) Date: Mon, 12 Jun 2023 11:24:26 -0300 From: Arnaldo Carvalho de Melo To: Yang Jihong Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users , linux-kernel Subject: Re: [RFC] Adding support for setting the affinity of the recording process Message-ID: References: <159de73b-fdd6-6df8-4f77-73c628fe641f@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159de73b-fdd6-6df8-4f77-73c628fe641f@huawei.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Em Mon, Jun 12, 2023 at 06:26:10PM +0800, Yang Jihong escreveu: > Hello everyone, > > Currently, perf-record supports profiling an existing process, thread, or a > specified command. > > Sometimes we may need to set CPU affinity of the target process before > recording: > > # taskset -pc > # perf record -p -- sleep 10 > > or: > > # perf record -- `taskset -c COMMAND` > > I'm thinking about getting perf to support setting the affinity of the > recording process, for example: not of the 'recording process' but the 'observed process', right? > 1. set the CPU affinity of the process to , process to > , and record: > > # perf record -p /:/ -- sleep 10 but what would be the semantic for what is being observed? Would this result in it recording events on that CPU or just for that process (that now runs just on that CPU)? Without affinity setting that could mean: observe just that process when it runs on that CPU. But could you please spell out the use case, why do you need this, is this so common (for you) that you repeatedly need to first taskset, then perf, etc? > and > > 2. set CPU affinity of the COMMAND and record: > > # perf record --taskset-command COMMAND > > In doing so, perf, as an observer, actually changes some of the properties > of the target process, which may be contrary to the purpose of perf tool. Up for discussion, but I don't think this is that much a problem if it streamlines common observability sessions/experimentations. > Will we consider accepting this approach? - Arnaldo