From patchwork Wed May 19 04:15:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12266193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16847C433ED for ; Wed, 19 May 2021 04:18:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9BED76112F for ; Wed, 19 May 2021 04:18:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BED76112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=odlrK0MQTbsraBmOX9ZtTt5mXi6D2az3jBeds6Q1P8c=; b=c6HHP12fVoFGYIF8PSUUrvZXv dz2HyaV5Wp0SDGNuoIwrWH8CY/cQ4sldmecqOiDaMmDrmgOVojJy0HX6HVJ/mwc2IBiDlnu5Bk2WE X6318kcHVwTBAIKLO207f6I/XTZEHT8AttGfejxVzmi5Cf4sRyaV2Lo8ecLIYoxqX/N1/2qnmKcmY 36m/XlFfL2pwlpmhBj5ZwIrcN8xzjIkF/Gq+dK3MeFkwGFUZ89wVFoRT/J8ceU/F/KBTSfTMkv/tX yQB0MwWVq4vES3kJ4ddppgOBpbZSXhezGDrjZH4r0uC+tOEtALlSPC+fB8TVAB9cy+6zAgFrIyJyI t6W7pJfSg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcv-002hbz-Qi; Wed, 19 May 2021 04:16:10 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcl-002haw-Vc for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 04:16:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=dSvPMJ6ajKYTaE4dMLmv0bU7XqFPvynhF+nhCSjEXqk=; b=iRlwUx/YJkiLTaxwZwbI+PD8CE wiRfSJEcTa16cV8CaR/tKuL7tdWldKNOrkOBMesetGrglFHWWR3rETeU1u/iiZYQIQx31E6A3c8gC oJuQUpYnhcUHeTnAy2BG3/kV4dHiAnHFrZFUBnrYosRP98ai3j0gG+KEhCkIRBnF1kY9tsNMAjuHn a2qqaB2Z9V+xPOPKiPPbxExUK2vTSQotTJLUO1r9DD0+33Jlsd0EqaptF1A42DLfMhjGxUArSyFFx 0V6SKTfbcOS+9n4xsZpF8Py+pxP1ihF3/BWOV1l4J0MB+BlLvh1IPLbXq1oEFXGrW6Vnz1bee7EIF rV55NN3A==; Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcj-00F77N-FC for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 04:15:58 +0000 Received: by mail-pf1-x42e.google.com with SMTP id 10so9004329pfl.1 for ; Tue, 18 May 2021 21:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dSvPMJ6ajKYTaE4dMLmv0bU7XqFPvynhF+nhCSjEXqk=; b=aaCOTZsa/3yjYLdqdA/OfbMLWzu9RyJRXuZPYfr+wm3AI9457kCSoFMDCrIsLQrGLt ByoCDOENXrICY1ExhAww4HbaQCkuMYnaHUi2moXVW/S5cevx0U9KeGKRAg+EdufUBA+V 1ZxFBOdj8svbSNooNQOceeTijJZm1lZDYEkpSXhTi+1d8Lr1q4cCdCLsaO/eKDLf19ez 2YkqD0JJR1s5x88/GXM+P0fpjAOd+F+NR7xfHvvKO4rjabQ2boL8aHUt8jn1GFkgTkj3 8xlRFRQ1K2K41Dhesb7oEyVgmMTj+CsIX46gFK77ODinRCHexWx2mKDAQQu7iBu65BYz ZwjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dSvPMJ6ajKYTaE4dMLmv0bU7XqFPvynhF+nhCSjEXqk=; b=bVfBCevov1Vs8GuLq12PAaxOL4QuNTO31wvrvzcZ8WuDK6huBnlbaJB8LJFG/RIJi+ diAt5cnzzoPUC1cuhLxWpJoJgtenmV/r2qdaBygKx5M3mv8hY697Uk4tzdfW39N5pNlw tjtMVQpU0/g+PBkOUFoIohCXR2xRc+L+jZaVtpP7OQwbtIxcKXNIlQKPC43J9xQoC4xe 73KCz5pM9T219bu4M8zaAxIJw9cOfX6KwRAX7Wsa0Xs2GT3rPnrlEjoB8CwtAY+PwO2o 5g+jnO2yJJM48Gc4Uu67MP+iLXd1MRcudmx7wqsBTORu8nIpqCXrVsCSpzjQRHO6CnI0 NjPw== X-Gm-Message-State: AOAM532SZMkoZozYsqvsFTz3LeB638uaajjRyICBCVhstLGmBRZOW4KE Pawwq84esnXL2YPtkGaaP/oZfg== X-Google-Smtp-Source: ABdhPJypI2NKauTPCzBLknKllWhLQ9Zb5c+DwOn8mkNjD/GPp1xQGsoaRdyiZLKLGIK9pw/p+X+/Tg== X-Received: by 2002:a65:5248:: with SMTP id q8mr8763715pgp.176.1621397756718; Tue, 18 May 2021 21:15:56 -0700 (PDT) Received: from localhost ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id d3sm13588742pfn.141.2021.05.18.21.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 21:15:56 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Clark , Al Grant , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 1/4] perf arm-spe: Correct sample flags for SPE event Date: Wed, 19 May 2021 12:15:43 +0800 Message-Id: <20210519041546.1574961-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519041546.1574961-1-leo.yan@linaro.org> References: <20210519041546.1574961-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_211557_527555_75D19D0A X-CRM114-Status: GOOD ( 18.52 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now it's hard code to set sample flags for CPU, TIME and TID for SPE event, which is pointless. The CPU is useful for sampling only for per-mmap case, it is used to indicate the AUX trace is associated to which CPU. The TIME sample is not needed for AUX event, since the time for AUX event is not really used and this time is a different thing from the timestamp in Arm SPE trace, the timestamp tracing which is controlled by Arm SPE's config bit. The TID sample is not useful for AUX event. This patch corrects the sample flags for SPE event, it only set CPU sample bit for per-cpu mmap case. Signed-off-by: Leo Yan Reviewed-by: James Clark Tested-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 414c8a5584b1..902e73a64184 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -68,6 +68,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, container_of(itr, struct arm_spe_recording, itr); struct perf_pmu *arm_spe_pmu = sper->arm_spe_pmu; struct evsel *evsel, *arm_spe_evsel = NULL; + struct perf_cpu_map *cpus = evlist->core.cpus; bool privileged = perf_event_paranoid_check(-1); struct evsel *tracking_evsel; int err; @@ -120,9 +121,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, */ evlist__to_front(evlist, arm_spe_evsel); - evsel__set_sample_bit(arm_spe_evsel, CPU); - evsel__set_sample_bit(arm_spe_evsel, TIME); - evsel__set_sample_bit(arm_spe_evsel, TID); + /* In the case of per-cpu mmaps, sample CPU for AUX event. */ + if (!perf_cpu_map__empty(cpus)) + evsel__set_sample_bit(arm_spe_evsel, CPU); /* Add dummy event to keep tracking */ err = parse_events(evlist, "dummy:u", NULL); From patchwork Wed May 19 04:15:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12266195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE016C433B4 for ; Wed, 19 May 2021 04:18:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 775D16112F for ; Wed, 19 May 2021 04:18:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 775D16112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=J3lI7ZA0j/2QWZaToOByxYFVa1o1x1kLrrENrYHWjSY=; b=WhCu6dd0xOLYKBjRAR74UNmOn rssQcLI4pBYlhn5Y4dNLPh/wm4s9AJnk6+ivKU6CBC4boUL5v9a2PQ5chjb7+whpxXWhn3iKB+KsJ pK+uN2JfXHF7RgMQP2/xSuUpmyiM3BLoiFtbfX2OrogpUp69CIEa4VQboF+mLqWtbfnP3LZRyFZtt FX828MOCwoKpIzw/StXXxZtxZ55MdXoegoeCJWhesm00j3v5kuppvaAIsD8YS+ZHyUudUKgncIx2E TyPP+zhIkkWGrNs3SpWgMcY4SnUAf/Dk9nmEHNwHu/dZI2XmzK+dPljldGF52nKDK+gKr/FNtgDWg BgbHjQFVg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljDd9-002hda-5Z; Wed, 19 May 2021 04:16:23 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcp-002hbV-PW for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 04:16:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=9hP472i8tu0x2oWr2ZZdW3TiExRRKywLv6WAxBp0eH4=; b=2nTEpY0yLTd9rBE4Ytd58CJggq HuzZSHfcivJu53b5Q1dT7P1RGJBjdiuU6z5o7kuNEZVbVgqdMEQWsLbX+tKCVJtgYde3s2YiIOMNo PE3L/dR0Yqgnwh7OK6mZ96jXoVz5CioFjaiDt0G2Jkds49BPj/2KGC1EMGdVyJ4h/p0jOQ08hnvTS p5aKGX0LW4KFwQMfrOSHA/xXhi95ZOybzUy638icyO54eQZKp98amD7MQt8M9zCqfRBQ8uZgM4pNk kCM3XZyrmcIvG1FhswgxhHsxxPfXEmL9GWsueL0h4EJJi15Mn0zSD6BJwOnc584Aod9o7pQozZzuy UWdxJPPw==; Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcn-00F77y-BD for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 04:16:02 +0000 Received: by mail-pl1-x631.google.com with SMTP id s20so6271603plr.13 for ; Tue, 18 May 2021 21:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9hP472i8tu0x2oWr2ZZdW3TiExRRKywLv6WAxBp0eH4=; b=ZqWbS934HXeMusilkVQHGpZ3Q7vGiO7M0MUhqBwrcrwXi+yiv+LfI1IFFgG55aPJ3F AqPEzAT7IbucWE+hJY1kLI3IgxoGc26uDeR8hTERW6r4mUhqr/wj25zAXWpckxqMyJaQ e9wa8PoKnLRs6YM2oykFuACMjKlfifKrW/fRG8dH5auH3N++J40GsQb/mOGRSbp7AVtt 63ew5qNPYMksJ374gKdWGU3yxvOlLUj5a2GWDAzzBIOolZT8BYehXPx47F5zXJe1ZxIp oS0+kaCHvPBfeER/gIuQpIjD4BQ2cJJOugivvlmBYPxNN3J+NmK1UfzRCeFHqoyRV6gW IqWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9hP472i8tu0x2oWr2ZZdW3TiExRRKywLv6WAxBp0eH4=; b=OXqbfScnOCTr6uUZradHNPmGvAWuyG/gpwfcsbuGKwfhr2WY9KYfb70EFuctJ9Meea Gzs5eljxsAqBCaRdTEOB4qVnMsRRdzy/tiYfsN+WS46goVD4uDQ4UdRSFCvkZktyV+GI yOHm72UEuShEhx+uesY99y+lhSMT7gc0kZ4X9W7DcrH/y3DxZBYLM19v6MnhvYUepKZo hwH4U+QmYI8Je43Z7LLhtVrF6v/KHvqrgnbN9k4TWX1LsGQLbLSjHlMg2i6oFts0UAGc oeGS5qf2G4Eny9G7F5iWHFFrWiaef8xMZPoOUnBRk0YuRrar3jwG2rBAIM0m0Xj14h7J kwXQ== X-Gm-Message-State: AOAM532aUjnOjnIqjGA/77BIr5ZWSQih7EVP6B0og8i00QB8Ja+DNEW7 ZtcShoOwyAArWnkoQVTUtl8e/g== X-Google-Smtp-Source: ABdhPJyGVQQN0GIEUbL3koaYY2sK4NeUkK5gEA8vO0yJRRxu3bib5xdQI2HlfpWuxUUBFFDAnKf5BA== X-Received: by 2002:a17:90a:1a43:: with SMTP id 3mr9090485pjl.154.1621397760560; Tue, 18 May 2021 21:16:00 -0700 (PDT) Received: from localhost ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id kk7sm2993954pjb.16.2021.05.18.21.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 21:16:00 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Clark , Al Grant , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 2/4] perf arm-spe: Correct sample flags for dummy event Date: Wed, 19 May 2021 12:15:44 +0800 Message-Id: <20210519041546.1574961-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519041546.1574961-1-leo.yan@linaro.org> References: <20210519041546.1574961-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_211601_400311_51A63E9D X-CRM114-Status: GOOD ( 17.12 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The dummy event is mainly used for mmap, the TIME sample is only needed for per-cpu case so that the perf tool can rely on the correct timing for parsing symbols. And the CPU sample is useless for mmap. The BRANCH_STACK sample bit will be always reset for the dummy event in the function evsel__config(), so don't need to repeatedly reset it for Arm SPE specific. So this patch only enables TIME sample for per-cpu mmap. Signed-off-by: Leo Yan Reviewed-by: James Clark Tested-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 902e73a64184..4c916626c203 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -135,9 +135,10 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, tracking_evsel->core.attr.freq = 0; tracking_evsel->core.attr.sample_period = 1; - evsel__set_sample_bit(tracking_evsel, TIME); - evsel__set_sample_bit(tracking_evsel, CPU); - evsel__reset_sample_bit(tracking_evsel, BRANCH_STACK); + + /* In per-cpu case, always need the time of mmap events etc */ + if (!perf_cpu_map__empty(cpus)) + evsel__set_sample_bit(tracking_evsel, TIME); return 0; } From patchwork Wed May 19 04:15:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12266199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0729C433ED for ; Wed, 19 May 2021 04:18:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7C96D6112F for ; Wed, 19 May 2021 04:18:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C96D6112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=WjEH5LUy7YjPrWKETN+8TJeKh1vCxdPKPEtvVyDSO7E=; b=LobT3KjpQsTLWEG2J1O135rPU /r+8iVZATFlXtjbsok/jtZ1NG0rGZMlky++jVbxaX2wjX0dYxi2/jWWxaZsxoNucK/6vfpJwmPbSc ypkM3xeylFac4cjm/r63QH+PFT6fkUekttoCub1cP96xKGgU1OBR6p1ka5vWj9ewQY+9jPECOilyN Na27om5ap79WU3dl2AsiHupP9/k/Ru6Fr+wfdiNmsICrK3INvwsGgN6vV+1pICwVgX0q8LGXjYx/1 CcMRAp3PX9xdQNwz0ZiJWPR7mPxxYfNSDK98k37WJ0JJAokXeRmpvAe0ZOfV9S1FoRpdo4t/Mf1yb EylKSaoTg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljDdJ-002hfj-4C; Wed, 19 May 2021 04:16:33 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDct-002hbk-8n for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 04:16:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=mnv8F8uuj2iGeObVVsabQBsjZH5xCx4JzTz8peGn5X8=; b=EAc2/PusQ/e9C6G/JdRRBLKp3y J37rDmyDYIieaKHs0PZs999bZ4U7d/2IQl8QI5+tLQhIFsXBTNnPR8X0976Bi5qAggkS/GO2n9xCY NJKllKXuKs8IHnHvzb2AcSV02sVJd8ItIaU8eOmGkerBh8S/v/DxEz865HqQlmkXnVYXnCS+vgPpI bnudXFBqzgQfzv1s6WYgmGjWGtgX7hbhWpHkp/I+CFSJi8vJkhUETW/TnJWSOs0254QWdAK1Z6pwI 4eMORx3eszCfsKCA2yZC+MGnY3FrCNwaPH2sPaakIT8LT0TCk3WELfIoOKsgu1/08+fMbW3SL9+xf w4jFcsGQ==; Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcq-00F78g-Oh for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 04:16:06 +0000 Received: by mail-pj1-x1035.google.com with SMTP id b15-20020a17090a550fb029015dad75163dso2753207pji.0 for ; Tue, 18 May 2021 21:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mnv8F8uuj2iGeObVVsabQBsjZH5xCx4JzTz8peGn5X8=; b=Y+RMOePPmr4kW5SydrzVYc81VRZiT9Pdaw7+lMi1c/3VQAJnwsVKJZ+Owg4oqkoImN VQ/xQHlYqld5wGmU3OvkCbAK6+LLB12H9EfoDb8qfgMLqCfFItZMQjUX1NhPRHHb0zg4 u3ALxImkgMy4kfxfidk4xgaKDK/53HBYifOz5BQMJZL75y1MJ+cFXmGu+VgTSMkvT274 64uQuhmXUWh9sb5p7LndkI/DAoEuUOfLL2At1xAMn88XQ/8H+jssdSXFofc3ef1vzkdb /tmX5nIfzFoAcKgfrMlZz2GElZHwA6QkrsYvzmUwL19070gJ+1AYJ+pfQbYkzz8Ped4B 98ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mnv8F8uuj2iGeObVVsabQBsjZH5xCx4JzTz8peGn5X8=; b=TePmfyTyEEPifXY8Viowh73lMkQAvikEnYG77v4KPwEQ0MCM87G4i4k/7dm650EIrR 7iBFsrPlaIpdy0aYZM7CYPlA4BwcpAuskwsWTVeiRf2BzSXjbVEcv1HEto+bJq5IWrZB AXkzjTUrucJovL0INaZjY7VAmAD5f1txlq38UOxbYS/Ubmt/ImGv0PqstNZFUNM4rOZQ rDae0jD10riDIZ2+1r3Rre02YqMdBScerKYDPyc/qkmk/reWgQzSPumhsf63x3YzgZAL eJw+iWDYJ1teS33nky0UYCt61NZQNA3PAhwnX3qyOIkI+V1scmTn06pHNqNTOx54HeeX XO0g== X-Gm-Message-State: AOAM5325tyE3EtiMOJkuuEhmszkQup/4cGdtlRfNldqdz5BxJJeu8SJM Ma5PGemX5utUVgFXWAOe+GhMOw== X-Google-Smtp-Source: ABdhPJxqPnecAC2BAEyYAoyFzR9V9h/+elZ/KCxFqPwDX2Iiya4EEcsqoiloKy2Ce3eTob3HDqmniQ== X-Received: by 2002:a17:902:a58b:b029:ee:d13a:2642 with SMTP id az11-20020a170902a58bb02900eed13a2642mr8544241plb.35.1621397764039; Tue, 18 May 2021 21:16:04 -0700 (PDT) Received: from localhost ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id n23sm811091pff.93.2021.05.18.21.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 21:16:03 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Clark , Al Grant , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 3/4] perf arm-spe: Enable timestamp for per-cpu mode Date: Wed, 19 May 2021 12:15:45 +0800 Message-Id: <20210519041546.1574961-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519041546.1574961-1-leo.yan@linaro.org> References: <20210519041546.1574961-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_211604_823762_FF556FE9 X-CRM114-Status: GOOD ( 19.27 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For per-cpu mmap, it should enable timestamp tracing for Arm SPE; this is helpful for samples correlation. To automatically enable the timestamp, a helper arm_spe_set_timestamp() is introduced for setting "ts_enable" format bit. Signed-off-by: Leo Yan Reviewed-by: James Clark Tested-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 4c916626c203..bacdf366040d 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -14,6 +14,7 @@ #include "../../../util/cpumap.h" #include "../../../util/event.h" #include "../../../util/evsel.h" +#include "../../../util/evsel_config.h" #include "../../../util/evlist.h" #include "../../../util/session.h" #include // page_size @@ -32,6 +33,29 @@ struct arm_spe_recording { struct evlist *evlist; }; +static void arm_spe_set_timestamp(struct auxtrace_record *itr, + struct evsel *evsel) +{ + struct arm_spe_recording *ptr; + struct perf_pmu *arm_spe_pmu; + struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG); + u64 user_bits = 0, bit; + + ptr = container_of(itr, struct arm_spe_recording, itr); + arm_spe_pmu = ptr->arm_spe_pmu; + + if (term) + user_bits = term->val.cfg_chg; + + bit = perf_pmu__format_bits(&arm_spe_pmu->format, "ts_enable"); + + /* Skip if user has set it */ + if (bit & user_bits) + return; + + evsel->core.attr.config |= bit; +} + static size_t arm_spe_info_priv_size(struct auxtrace_record *itr __maybe_unused, struct evlist *evlist __maybe_unused) @@ -121,9 +145,14 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, */ evlist__to_front(evlist, arm_spe_evsel); - /* In the case of per-cpu mmaps, sample CPU for AUX event. */ - if (!perf_cpu_map__empty(cpus)) + /* + * In the case of per-cpu mmaps, sample CPU for AUX event; + * also enable the timestamp tracing for samples correlation. + */ + if (!perf_cpu_map__empty(cpus)) { evsel__set_sample_bit(arm_spe_evsel, CPU); + arm_spe_set_timestamp(itr, arm_spe_evsel); + } /* Add dummy event to keep tracking */ err = parse_events(evlist, "dummy:u", NULL); From patchwork Wed May 19 04:15:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12266197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13687C433B4 for ; Wed, 19 May 2021 04:18:26 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9548061042 for ; Wed, 19 May 2021 04:18:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9548061042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=6QjevqOFx8k3rUwwHp5gx71fAKpoARHWIw9cN7ijdZQ=; b=p02yRkPbDUdFFL/ByBtFpT9Y/ YM1QvOgKqGN2yrFY4ERsm2tAYynjJsrnKwBriDPjpHJ92crWkvgOho+7DvmrnVRqVfq6KR7FGMBOh ezNNuoSyFZKhE6TXFUfOa59anQYySJRjLSv6joVpNPf7ZqZGn7Hvs7JzotYDQ4P7DjZjDlxMF7Xje l6W4yILBk4g8aucNb/TOv+br1KGnZhVurQevnvebj8CYbC0bV1sFjVwBChCenc1vcewjipchChp5Y tKJKhTtTilVNar+g1q3BlS50E5fvaBPlkSGvxC20Ua+CBy+KxHNUDVfCfyBDKnBBEqT+bgt5KgV3G b6V4jCPWg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljDdT-002hi7-JI; Wed, 19 May 2021 04:16:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcx-002hcK-L6 for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 04:16:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=D1RKoRUPuNTpnbjdR5aGjDE7LDjBJaTYkeLxTxjV2B0=; b=MsTw/fDvhIT0Cxs9vQrxD7kkMg 68324NCbMpqOV1EoMisAZY+stzrzSuGjsYP03cGzjn95PuOXDbyFXuIj/XXLiXhudAj8bfdA9aA/m DlRsw0s2DSBoO0V88756qm80gpD5aoj9cy+nZwBUbJYXqynCYWCYRcbwxFXM+JMoyTjqGQqDtqR7i 2BT3DFlod9TniCSHs16DU6o+uEt1TPsAC+NGbCn5dyHB/crVk1v2CyH8r2VcjXoahztuCKAfeeHOV Udff/VYhap9FrJSNw5+yhWlRhZY+avWrfy4CCmIWbxjmu92ZAYiUdMJYv0/Pha1XJSn7lJiECgANR yEcfiWsA==; Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljDcu-00F79F-CX for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 04:16:10 +0000 Received: by mail-pj1-x102c.google.com with SMTP id t11so6683996pjm.0 for ; Tue, 18 May 2021 21:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D1RKoRUPuNTpnbjdR5aGjDE7LDjBJaTYkeLxTxjV2B0=; b=XdLYknR3fS24BTVvcLO3iqnPV+utzH9WZmcaLVtD0da3CEd5nRSGOsYgETlrU0h0be XTFcdN16VnEGZSiAQWx8Jvxu/bc14GkHzaqJE4Bu8qqEv0DIneoy8ewj7eTQndwMZPSc gMc5biLXt5doir7/csUoUlJz92NHQKPnwJRvauj5n/4ZF0VmfmQ8D3xND0+36/esjZZ6 QxTtkq8kQ+bqIEwOhilUnMl49r1x2PXqe2KXNzy5JYhS/yzDGtCky1lMghgG9DNIt0Ow 28n2CzKD7dRk6sQKo+KjWubnmO+eTbzcjJoPmVHTmanbu2q1OWqbL0wgMeBB9WVpOnBJ +lgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D1RKoRUPuNTpnbjdR5aGjDE7LDjBJaTYkeLxTxjV2B0=; b=t0PF6L+kd1Olcv7rasUjh2PA+qkX2ORRVm4BmrWvSh19Smxxrv3VXuMIPcYqmrAuqa xSHLLd0GVM+cnAR16+TANuXtbRHp+Qb48FIlOEBDAxKXqRCO43eNfqeyxIq/P/jp2Une 6pk8s3BSvmYWxI5QTI+pFIYc8g6Ptge0MUqSuY73QB7+KmCrTcN3KTj5+o9Z7bhugPy2 BcfJJLrd6qTLevMSU2pbiinD0LT/LJdMCl5vF2lb00/iayxlfdq0dg5ZVnD6ypsZGqUM s30NnMYXxEcPsJXn93zGnnd0bsI2CMDapp+hSiTxlDVHK9KBTSqpgvB2KOE8DH3SGj94 HiiQ== X-Gm-Message-State: AOAM533i4xMAzNLujyEM90qLP0OtJUFFIsV8L/S/ZLEcg7XuygUS41bN oC2FmwhK2S056ZP+flVMx1E5ag== X-Google-Smtp-Source: ABdhPJyh6+EMoF+CHQhlbWP3oQvoiUYhgaYPgM56CYEO/3syDO+eek0q9XYJLvBDwxuc46LHh4nY5A== X-Received: by 2002:a17:902:f784:b029:ef:8e2f:430e with SMTP id q4-20020a170902f784b02900ef8e2f430emr8615252pln.28.1621397767625; Tue, 18 May 2021 21:16:07 -0700 (PDT) Received: from localhost ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id np1sm3007388pjb.13.2021.05.18.21.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 21:16:07 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Clark , Al Grant , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 4/4] perf arm-spe: Remove redundant checking for "full_auxtrace" Date: Wed, 19 May 2021 12:15:46 +0800 Message-Id: <20210519041546.1574961-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519041546.1574961-1-leo.yan@linaro.org> References: <20210519041546.1574961-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_211608_436307_5478CDD0 X-CRM114-Status: GOOD ( 16.81 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The option "opts->full_auxtrace" is checked at the earlier place, if it is false the function will directly bail out. So remove the redundant checking for "opts->full_auxtrace". Suggested-by: James Clark Signed-off-by: Leo Yan Reviewed-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index bacdf366040d..a4420d4df503 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -116,7 +116,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, return 0; /* We are in full trace mode but '-m,xyz' wasn't specified */ - if (opts->full_auxtrace && !opts->auxtrace_mmap_pages) { + if (!opts->auxtrace_mmap_pages) { if (privileged) { opts->auxtrace_mmap_pages = MiB(4) / page_size; } else {