From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 567B5C433EF for ; Fri, 19 Nov 2021 00:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30E3F61A81 for ; Fri, 19 Nov 2021 00:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233662AbhKSAga (ORCPT ); Thu, 18 Nov 2021 19:36:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbhKSAg3 (ORCPT ); Thu, 18 Nov 2021 19:36:29 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325C6C061574 for ; Thu, 18 Nov 2021 16:33:29 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id np6-20020a17090b4c4600b001a90b011e06so7318028pjb.5 for ; Thu, 18 Nov 2021 16:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UkcM1rTecmJ25KsUoXFTZKIn9eyzcYLgTJdNQlzShK8=; b=nNONCxvj70orXmFEPPlUSDO3mt6Wtl927JrNDbPxGbq3nLI7dP4aUomf4ikpaAWno1 E5tZ/1qd+TfTbpG3LKaqN3/Q005utHPSi5xYtFL481zC+BGznNHJIpSCAxcReahqhnBX tFfQGDSsOCTvTJzQl80RCaDg+QR/KouVZUOeNuIg3nccU7JjgzDrTQl0U/n93pd4wC6E XxzpObxnLdf9bS/XDIelOHQBYzAx3azq/h3nJh7vThyhUxl3MelJlTwXx+EMRGwpO58E rGWhe2M3G001XQnWRJJksjXDSpugEK1Sh26xTl+BRMz9DQbU6lo6LNZyYUXrfqgk+4MQ y+Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkcM1rTecmJ25KsUoXFTZKIn9eyzcYLgTJdNQlzShK8=; b=DrteGaXE2RPVEHavkQknblEMve8oP264k83uRzswjolFEF5Z7N86W8HNCdmWraJiJW KXeThoZsyAZV9Dms8ZgwHzTvC/3AAiwKBjQDalM8W+oqqyjpOkUgj3Nm1OlVjGUVC4or vHiirXaMbIf1XRkLGk8aAFAw+7kcUxh5xH14c9vxOMPCqMJL3aFfcQrpxP5zXA6XZt7a 5OoZnmmPc2Wt18d7kU0qLphpiBVaPij6WQuRZb2Szh66AFSA5cLWbD96SMemJ+c+FBXl 5UpZ5At3JEhgEK5fyLBXEKix/XB/GaTbULr7ICqSgr6tk2KcZOyUlTmXiP+RN8cUDvIy RIRA== X-Gm-Message-State: AOAM530lHuqxCu6GkP55vkmTwdJ8awporqwADDF1omPbiwKhlBuYnxAw KQcsAGIcTkANdw4uTnUlkYC+BrPZxEaBI7XdzLf0Nw== X-Google-Smtp-Source: ABdhPJx7HLZK7jaTa73RkUrjpdUhNrR+ZBGuDJ1erNCEFL+MslOqX3V7V8oW+JO6oH3Lu4UeiweKvA== X-Received: by 2002:a17:90b:4a01:: with SMTP id kk1mr15807790pjb.7.1637282008706; Thu, 18 Nov 2021 16:33:28 -0800 (PST) Received: from leoy-ThinkPad-X240s ([66.23.193.242]) by smtp.gmail.com with ESMTPSA id k8sm574903pgj.94.2021.11.18.16.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 16:33:28 -0800 (PST) Date: Fri, 19 Nov 2021 08:33:17 +0800 From: Leo Yan To: Mathieu Poirier Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Message-ID: <20211119003317.GD69886@leoy-ThinkPad-X240s> References: <20211113143540.53957-1-leo.yan@linaro.org> <20211118171412.GB2530497@p14s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211118171412.GB2530497@p14s> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, On Thu, Nov 18, 2021 at 10:14:12AM -0700, Mathieu Poirier wrote: > Good morning Leo, > > On Sat, Nov 13, 2021 at 10:35:40PM +0800, Leo Yan wrote: > > Currently, cs-etm passes the tid value for both tid and pid parameters > > when calling machine__set_current_tid(), this can lead to confusion for > > thread handling. E.g. we arbitrarily pass the same value for pid and > > tid, perf tool will be misled to consider it is a main thread (see > > thread__main_thread()). > > > > On the other hand, Perf tool only can retrieve tid from Arm CoreSight > > context packet, and we have no chance to know pid (it maps to kernel's > > task_struct::tgid) from hardware tracing data. For this reason, this > > patch passes -1 as pid for function machine__set_current_tid(). > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/cs-etm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > > index f323adb1af85..eed1a5930072 100644 > > --- a/tools/perf/util/cs-etm.c > > +++ b/tools/perf/util/cs-etm.c > > @@ -1118,7 +1118,7 @@ int cs_etm__etmq_set_tid(struct cs_etm_queue *etmq, > > if (cs_etm__get_cpu(trace_chan_id, &cpu) < 0) > > return err; > > > > - err = machine__set_current_tid(etm->machine, cpu, tid, tid); > > + err = machine__set_current_tid(etm->machine, cpu, -1, tid); > > I remember wondering about what to do with the pid parameter when I wrote this > patch... > > Do you have a before-and-after snapshot you can add to the changelog? I tried to capture log but I didn't observe the difference introduced by this patch, this might because I didn't per-process mode for multi-threading case. I will try more case for this. > I also think it will require a "Fixes" tag. In your next revision please CC James > since you guys are working in that area nowadays. Will do. And will Cc James and German in next spin. Thanks for review and suggestion. Leo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD481C433F5 for ; Fri, 19 Nov 2021 00:34:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FC9061407 for ; Fri, 19 Nov 2021 00:34:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9FC9061407 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YKO3vDJil+HHayHdWlIyU5YPlie0pjzOGCIyokSQxOY=; b=kbzelp4YdDuikH sTgZF5gBSZQMaZSkGwf9Gpjj/XOyi/0h2KlTZXZBz6/0Jk7crLKERgxo93Nr+RjftbKu0rE030WIK UVItHwYJue8oQ2Cvl3A1wqYRKKIKWYHTUoF1K5QfLUnlSjPkQkF/3lLILCieDWWyT+o8ZxXXAhJM9 NTfGzeihkVw813OuSHJWtTAtafzXSRzqM/NdwjIz/DoiT6QKo1QnzjCHn6VvlbDNn5sBah7QQh757 Crb3JIJfY3AaXAgC420+Aru+ELcKQeoENKW/DTW4+zsPqFqAOLPoOfRUsdIkLaHPJe3PnNBAATVzJ Buh30BnrkqfotlPyhpJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnrqP-0095Mj-OQ; Fri, 19 Nov 2021 00:33:33 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnrqM-0095MG-5r for linux-arm-kernel@lists.infradead.org; Fri, 19 Nov 2021 00:33:31 +0000 Received: by mail-pl1-x62a.google.com with SMTP id u17so6766784plg.9 for ; Thu, 18 Nov 2021 16:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UkcM1rTecmJ25KsUoXFTZKIn9eyzcYLgTJdNQlzShK8=; b=nNONCxvj70orXmFEPPlUSDO3mt6Wtl927JrNDbPxGbq3nLI7dP4aUomf4ikpaAWno1 E5tZ/1qd+TfTbpG3LKaqN3/Q005utHPSi5xYtFL481zC+BGznNHJIpSCAxcReahqhnBX tFfQGDSsOCTvTJzQl80RCaDg+QR/KouVZUOeNuIg3nccU7JjgzDrTQl0U/n93pd4wC6E XxzpObxnLdf9bS/XDIelOHQBYzAx3azq/h3nJh7vThyhUxl3MelJlTwXx+EMRGwpO58E rGWhe2M3G001XQnWRJJksjXDSpugEK1Sh26xTl+BRMz9DQbU6lo6LNZyYUXrfqgk+4MQ y+Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkcM1rTecmJ25KsUoXFTZKIn9eyzcYLgTJdNQlzShK8=; b=UE3fCSSZQuoDfA4xr5fAE1VBSxf/1iJvMhLwoUJLIS/CRWFVIrE+5ZpcjvSvaCHdAE UEcwS4EURKiH8MZQuvEJSp60oYQix8CGUEQyGgDaYX52vnozVBbhTk43z/ceNNmO9Uim 1Tuq2iGb/79jcIKeHfUaFd/GUU5tq9/b2CDh9CzTQPRV+BbTcHdqNrJeGnveVm7N7w+m eL4Y3pzIl64Xgj86nZjCVFfN9ZcOCZyyX3BpK1IaOZwysh8YeDuYbE6H+YU4MNe3l+je /z3pwm2GpYK5BH658OuV1BWYc5ix5TuwRHy+Tyuf8HEbc4fgBcZ8ATghPH8cTAJATovE lPPQ== X-Gm-Message-State: AOAM533HedzQVZJfUtw8WrWMcgvZVX9BD+OcXv8G7Yd73iG06/qFtrH+ J8UOeMXFD2g5kkJyiI10uAL7CQ== X-Google-Smtp-Source: ABdhPJx7HLZK7jaTa73RkUrjpdUhNrR+ZBGuDJ1erNCEFL+MslOqX3V7V8oW+JO6oH3Lu4UeiweKvA== X-Received: by 2002:a17:90b:4a01:: with SMTP id kk1mr15807790pjb.7.1637282008706; Thu, 18 Nov 2021 16:33:28 -0800 (PST) Received: from leoy-ThinkPad-X240s ([66.23.193.242]) by smtp.gmail.com with ESMTPSA id k8sm574903pgj.94.2021.11.18.16.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 16:33:28 -0800 (PST) Date: Fri, 19 Nov 2021 08:33:17 +0800 From: Leo Yan To: Mathieu Poirier Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Message-ID: <20211119003317.GD69886@leoy-ThinkPad-X240s> References: <20211113143540.53957-1-leo.yan@linaro.org> <20211118171412.GB2530497@p14s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211118171412.GB2530497@p14s> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211118_163330_296007_C5344906 X-CRM114-Status: GOOD ( 27.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Mathieu, On Thu, Nov 18, 2021 at 10:14:12AM -0700, Mathieu Poirier wrote: > Good morning Leo, > > On Sat, Nov 13, 2021 at 10:35:40PM +0800, Leo Yan wrote: > > Currently, cs-etm passes the tid value for both tid and pid parameters > > when calling machine__set_current_tid(), this can lead to confusion for > > thread handling. E.g. we arbitrarily pass the same value for pid and > > tid, perf tool will be misled to consider it is a main thread (see > > thread__main_thread()). > > > > On the other hand, Perf tool only can retrieve tid from Arm CoreSight > > context packet, and we have no chance to know pid (it maps to kernel's > > task_struct::tgid) from hardware tracing data. For this reason, this > > patch passes -1 as pid for function machine__set_current_tid(). > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/cs-etm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > > index f323adb1af85..eed1a5930072 100644 > > --- a/tools/perf/util/cs-etm.c > > +++ b/tools/perf/util/cs-etm.c > > @@ -1118,7 +1118,7 @@ int cs_etm__etmq_set_tid(struct cs_etm_queue *etmq, > > if (cs_etm__get_cpu(trace_chan_id, &cpu) < 0) > > return err; > > > > - err = machine__set_current_tid(etm->machine, cpu, tid, tid); > > + err = machine__set_current_tid(etm->machine, cpu, -1, tid); > > I remember wondering about what to do with the pid parameter when I wrote this > patch... > > Do you have a before-and-after snapshot you can add to the changelog? I tried to capture log but I didn't observe the difference introduced by this patch, this might because I didn't per-process mode for multi-threading case. I will try more case for this. > I also think it will require a "Fixes" tag. In your next revision please CC James > since you guys are working in that area nowadays. Will do. And will Cc James and German in next spin. Thanks for review and suggestion. Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel