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 F2348C433F5 for ; Sat, 13 Nov 2021 14:35:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D095161211 for ; Sat, 13 Nov 2021 14:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235890AbhKMOir (ORCPT ); Sat, 13 Nov 2021 09:38:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbhKMOiq (ORCPT ); Sat, 13 Nov 2021 09:38:46 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C805AC061766 for ; Sat, 13 Nov 2021 06:35:53 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id g28so10522451pgg.3 for ; Sat, 13 Nov 2021 06:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dfwe9FP6qPb0M5pi6USL1mjcAtZ1A1CIUzpfR6+xGK8=; b=xLFfAmjtEzl6v6gQWLtpJKt32K3RMaVlILb9fvzfg+9AZwM2v111b792wNp6vewQE5 J7tcKJAgPwM5GNJqFH3eVG54mztQoi3RjLyhmnuiQIzPPUfFOYJ0RUyG912UfcMlixgA 2xmU2mDzHtSstZCbQ8wLGv8RwwsWFqWS8pVzq9OyFpCtc5RPC/LgPbhFIO6jvprxcdJg wVEAu3XO8eVyLU07vIs0lrsFPBw1H0yFGtZz67v4WcyAu6GJXSZifM5z5uAC1T/3iwzi fK9daFBxW1h3mJ3H0FoNotIH6Aq0fKEp7eIjrE/FI8sPgMuQrVXfyRe7y/k0Y+uI1FqQ 83Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dfwe9FP6qPb0M5pi6USL1mjcAtZ1A1CIUzpfR6+xGK8=; b=FXOPaEJJf6u4OrXmhHiDt4cASzFWfv0ZSerpdE5ENRm9TS0QKs12GvXIJjyOX4b3gs WOD73DH4igjCPaX37Ztijg/9BqbIzWJYBXPJiZxifqEs1ujzR9We3b3s0qE47qi7oDjH AhCUOh+TeOpYPOQLWhwD3B4xJlIMT5F6y8kaPIab6bvNvx2RMXFAVNlAlJSiOOzHZtqp fUR+RVzqzygns75q5bZmNVy09JbaY07941HoqAYZlsQ4JwnFeM+1cCaTn7sU8d2Dr456 UF4lHcM1Woq04ZaKuCORZgexLfvLLZfn+V+anEN967r3g7GEbNNAbg49jRJ3dKDyzG0e xvdQ== X-Gm-Message-State: AOAM5304rfxReYo/5J3upA7ybUw5X0fwIYGFoKcs4mDpg+F9blBMTz83 ucZsbiTTMdF49rOjOWQxG+WooQ== X-Google-Smtp-Source: ABdhPJxKTIgm4qdaxKTOeNe4FZmbm6HFTBywwZZIFYTMbCqAZubpvgBPgn4uvNfqTO3A0XUB9QVQ8w== X-Received: by 2002:a63:1617:: with SMTP id w23mr15293671pgl.380.1636814153051; Sat, 13 Nov 2021 06:35:53 -0800 (PST) Received: from localhost ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id a29sm9511576pfh.29.2021.11.13.06.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Nov 2021 06:35:52 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mathieu Poirier , 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 Cc: Leo Yan Subject: [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Date: Sat, 13 Nov 2021 22:35:40 +0800 Message-Id: <20211113143540.53957-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); if (err) return err; -- 2.25.1 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 E83F5C433F5 for ; Sat, 13 Nov 2021 14:37:02 +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 A8E2A6120E for ; Sat, 13 Nov 2021 14:37:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A8E2A6120E 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=q8fcwTadei52rIJhUwhnQhydPdfbAEPRP1//iC5z0yQ=; b=qNU9ekK6wCU90d dHxxjEBpLWt+4ySHjYI+BmV5OYDJmKFRT9sRe/vR3vmrskJEkMaUXqam/04OEFRDGHSgQ5IJkXjYF /3f0sfQ2QcrNHyXK89dwnwA8g4CvdBN3Ym2JEnisW0Cxe0k5WtcjggC09iFzJth5XCXYQfLX6O2FV LBqFZ+Bt83/BSSSNfJAzOcwijtvFTAwlc6khOczpuTs96RR7tAGIqI3bXZkUMPd4UZ27pMmKv7Rsx rcMImCCZp9HbEnXe1+g9fbfyYKBeYLPqWfCSQ0hfppCT5bq77e6cjBnDzbkv98aikgux3I1hx+LaX +3qnoVRsZtfuS/YU8KiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlu8M-00CllL-3F; Sat, 13 Nov 2021 14:35:58 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlu8I-00Clks-HB for linux-arm-kernel@lists.infradead.org; Sat, 13 Nov 2021 14:35:55 +0000 Received: by mail-pg1-x529.google.com with SMTP id s138so2519050pgs.4 for ; Sat, 13 Nov 2021 06:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dfwe9FP6qPb0M5pi6USL1mjcAtZ1A1CIUzpfR6+xGK8=; b=xLFfAmjtEzl6v6gQWLtpJKt32K3RMaVlILb9fvzfg+9AZwM2v111b792wNp6vewQE5 J7tcKJAgPwM5GNJqFH3eVG54mztQoi3RjLyhmnuiQIzPPUfFOYJ0RUyG912UfcMlixgA 2xmU2mDzHtSstZCbQ8wLGv8RwwsWFqWS8pVzq9OyFpCtc5RPC/LgPbhFIO6jvprxcdJg wVEAu3XO8eVyLU07vIs0lrsFPBw1H0yFGtZz67v4WcyAu6GJXSZifM5z5uAC1T/3iwzi fK9daFBxW1h3mJ3H0FoNotIH6Aq0fKEp7eIjrE/FI8sPgMuQrVXfyRe7y/k0Y+uI1FqQ 83Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dfwe9FP6qPb0M5pi6USL1mjcAtZ1A1CIUzpfR6+xGK8=; b=NEc/bgcUk2Rw9zDoSAhOAjfe1N8WJWfuB8w02aIpI63hVpuUCRlAcwv5F2FrbgirOV IkkV9tYhu6ShFuCD4EBYTfLdrh8WoJgSw2XA9NerMQEnZRB5tImin/tLWJ5fEequ8A5J /xY/LAtuZy+rusTThu++OzXExbcXx5ekU7x/2AOxjT61/I10MhBpqZDSCjIHTkDAe5Iv ZcGvcQNry+/hldvKvfjgL7kBrgC0aT+XGZyDYNcxKg62Pq8mVRjJSvZVp3EmCxSQpYhG BetLdaZhkTTYa4TBhyxHnjgc/MJX4lyL5szl1y6CYwtjUDtYICc47cpRbqLyVf4/wT4z 0/fQ== X-Gm-Message-State: AOAM5309Si8DcXA7b507fwYz4BOVY0MhGYSrSMACoVefXEnJWu6+O5E2 +PJrBszzSOhhzrRxiY6PCaqMBg== X-Google-Smtp-Source: ABdhPJxKTIgm4qdaxKTOeNe4FZmbm6HFTBywwZZIFYTMbCqAZubpvgBPgn4uvNfqTO3A0XUB9QVQ8w== X-Received: by 2002:a63:1617:: with SMTP id w23mr15293671pgl.380.1636814153051; Sat, 13 Nov 2021 06:35:53 -0800 (PST) Received: from localhost ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id a29sm9511576pfh.29.2021.11.13.06.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Nov 2021 06:35:52 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mathieu Poirier , 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 Cc: Leo Yan Subject: [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Date: Sat, 13 Nov 2021 22:35:40 +0800 Message-Id: <20211113143540.53957-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211113_063554_630502_544ED8FF X-CRM114-Status: GOOD ( 13.34 ) 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 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); if (err) return err; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel