From patchwork Thu Apr 29 15:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12231443 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.0 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 47B06C433B4 for ; Thu, 29 Apr 2021 15:03:14 +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 A294A613F1 for ; Thu, 29 Apr 2021 15:03:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A294A613F1 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=0uGWlEPNYI54Aet9dh/nirAg3uN1IMK1h4bw1XOPdUs=; b=dykMel6bOdaZ2EtZeoYtInMDY zf4VmDzu6szIY1NOf633CocltxJh6WwJQaSHLp0mqk5etr7J6gT7HSnBzqYvDZyYWZ+UgyTI8ZBCI TKqa0HwasZIuXMdQ4ZHuf6GQ5MbhdzIxa4BKEmJGtKSO4Gg0+n9mcNu6foiLghNpYHG8xrgm069YJ QfHqrmC1uZbBZ5I14P5SgT7taDLi9zzqXmHmZBcmu7sqABp6YAuG8kzHRcZdJ5PgTKOmUV6IbtFSa 0Tt9kv3Xh7wijU9uVr70rNRobNuWkloxyR1PkgS2DHbGgc+yY0UE2tM8A6k5SeDryQwGnkEnOudI7 Bjhp90Umw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc8AQ-005sXG-6p; Thu, 29 Apr 2021 15:01:26 +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 1lc8AG-005sWC-7q for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 15:01:16 +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=SE2j4G0rnU+RbiAnIU0X9z105Hwk3a+nEYNJ2sTp6CU=; b=1XpH1MYQwuZhmvz2izgR5iXK8Q aGCL1hMa0540AtX1N82oyJCa/x1xGO3KdWPkbPyrRf3DTdg3TXfeADrqqzV3kX4xau+Jdp44yBMbF Etytb006qFYvhbuvm15HyFRkY3dKS7jGXiSz82zFoAHpD3PJ7ph9reI7eOMo2y/SGQV0gFLMuvKTk iWBRYaRzcnmQMkBES6HDUnsAey7rcEJQMLsTGXFDWuMh+DmX0aZPBVbYt3FyKe2/+KUz0isa/oSep brHm2kp4WQWbO8t9fCv8LcqM35vaVj3cEuWFIXiEybQVY8lzKbSr4ErnIpOOZdzqNhsA4CwxOC/qJ c5UD7qKQ==; 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 1lc8AD-000i2i-J5 for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 15:01:15 +0000 Received: by mail-pj1-x1035.google.com with SMTP id gj14so2876425pjb.5 for ; Thu, 29 Apr 2021 08:01:12 -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=SE2j4G0rnU+RbiAnIU0X9z105Hwk3a+nEYNJ2sTp6CU=; b=o2ddHO/AJTn4nUM9kptqP2uMHAMJ+tXCezYjcHsPtHtR80o3MLq8ZcI0kgffb1PEfg YzVpScqWNeHsXdYbKZD/1Dn1dqBQQCHG+AuDXc5TXsUlYKmJ/IXGBqvUJhmE9e5Bp0rG AXSAhRsjkIjhCW3rnSIFonB08/nLdXVP+rlcb4QdcnUTmEtQWSHLQCJQqLCROz4BeUDG nzCk76wnyt2npPUsVmwQeHWlhBOMmqJkBnsECFgxrlTEaHPlrceAgHkwo82nBbvKsrOr Gm6kmwW/TlN3MRUppOT0xr7TuVUxXUseXw8agsFhll17BSzCcN5uIae2xBoycb3vMscr tA1g== 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=SE2j4G0rnU+RbiAnIU0X9z105Hwk3a+nEYNJ2sTp6CU=; b=mbzZue8BvJQ1S3z1sEaaK1HSlRgQyZx14zbmmjKf9VQnAs6KtBgD0MJSJbvXaCnzfQ ycWH6MpEKh0iQZ007YI20q1AQxEkPpu1Q2RPI1q/951ORy9k40/TbcyvDbQIF5/alfmb Q0DPdHdvL1ui+He9j7QTdkVA0mlpxu9NYybN/5ZxiicSl25zWWakgta8+qYBCVS1TDPl GcIWYZboJVcixOwtC2WvD89k1bSHpTboT2e2Z9aEQReCSvwF4bPK+DxlLfmt+Xo0c8Vn KZd6uOiHw8lDgGt2JXeUa+It+W/ebEx2UX36cErIBrAXydEw4Dl75hDfmMQx/xU+aNfh 1phw== X-Gm-Message-State: AOAM531w9/qKo+aA7ot/F5TMM32IJQEE99xwsME1NElHZPczWvQm79KQ Tm8TKpUyYF+DpgtJpcZYcmbHJA== X-Google-Smtp-Source: ABdhPJwf7g1oC6ruN3H77OZGGIRAb6C00AkhUyagpmFnha9GKdP+iU7Pm4OP9a7ydWBuovm7owxq/A== X-Received: by 2002:a17:902:778f:b029:ec:d04d:4556 with SMTP id o15-20020a170902778fb02900ecd04d4556mr152564pll.43.1619708472144; Thu, 29 Apr 2021 08:01:12 -0700 (PDT) Received: from localhost ([204.124.180.30]) by smtp.gmail.com with ESMTPSA id e2sm2627677pjk.31.2021.04.29.08.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 08:01:11 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , James Clark , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Al Grant Cc: Leo Yan Subject: [PATCH v1 1/3] perf arm-spe: Correct sample flags for SPE event Date: Thu, 29 Apr 2021 23:00:58 +0800 Message-Id: <20210429150100.282180-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210429150100.282180-1-leo.yan@linaro.org> References: <20210429150100.282180-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-20210429_080113_647748_8FD99ECC X-CRM114-Status: GOOD ( 17.38 ) 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 --- 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 Thu Apr 29 15:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12231445 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.0 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 4C5EFC43460 for ; Thu, 29 Apr 2021 15:03:15 +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 A744961441 for ; Thu, 29 Apr 2021 15:03:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A744961441 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=Yvdgqg4mzz86Red6Yl86BX6rRpltdfCjZGhQ4oh9uQ8=; b=cia17rV/lKgYruzaJ7HGV9VFt Xu7r01HHsejisbtnclLRThsC8JAcGg9GHwv2sGahpea7eMOcKLNhd7nUHwFDQqMMkguB188dhnCGT MhYyUIb7qd1e4uywPt+u4WqmsFZEXwyIRJCaLAErw6aUwaxaN8iGVlRnVuacwIjOEVOns6EbgC56a adbdCW0Y612t616z76kpWl5M2Bk1UlJgWGvVItRhT3VMVO+hk7A6RpFHgTEJAxHsFibIL9ZlnHDT4 6kQ59s7R0Dwx/X/7V45jh9ZWhoQWuXGgU1phdxjEBDAj0Iil8IJzWQd8nzji0Q96jHkjucUiFsW/Q oLslllqcg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc8Ad-005sYa-2e; Thu, 29 Apr 2021 15:01:39 +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 1lc8AK-005sWV-0U for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 15:01:20 +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=kKALg3mdCIPQXLNAB5VYdkufEFOWrU4WkUMpgl9QzUE=; b=mawdLVnmgQbFD/PQB6d2vYFAJg wI433pPGyQrEGVuh5zD1frWRGVMnnWyZ/O+ci5VzrlSUxQUrWoxieDLD4c7QB43Dc/Pw5ehV+X7ti 9x9CxC/w2OsFQAs/GSVIY1GYUyuuh5VfVvpsN1YEkcgoBuJb+Ha6sD40Pq6+AVlGNM7TNxFs1bRU7 n0PR30uMcE61b1sY2TJADH/EQ0cFuoL/Uw0/Y9aIW1qdCnOEYG3CTOYSJCHWExfrhLlNxoPQ4M9Fx 852MXZSrSIyofFGAErAL6A+QPc697er/S/F/313sD8iGPKTZhn37ZTt5NijD1Xc3uj9Hw0VxsV3p3 aIaIsXCA==; Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc8AH-000i3R-Ef for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 15:01:18 +0000 Received: by mail-pf1-x431.google.com with SMTP id d124so3500703pfa.13 for ; Thu, 29 Apr 2021 08:01:16 -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=kKALg3mdCIPQXLNAB5VYdkufEFOWrU4WkUMpgl9QzUE=; b=Iz9sOTAaVV/ExNsgTbz8EJRpo7emfPqpNUJOUagetQg1r5WM58iT155wkgu3nZLaXU /on+JnGNm6L0urdVJY30uVWupmNFeOXJ1tGMsEayPSQkDUe7V6QpOJdrB14AomSEZc6Q p9Mus2luS1g2ZJOpFA+Qtuw1LJAgoODKQi5BlABbmAWRSE1FxHOm44VdnFRvC7tIPY2e if3WtfID6mzd6309I/ShyyJAYSwIK6w2u3Rgpa494ulJOci78eQU27cpm7H8lRBq3fkM ckhJh095HbhLJZGnlHxBsn1evO+IV5CzfO0q5+YpFJ+2sIFu1ieeGwx92JRQC0ipTUtR 2fDw== 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=kKALg3mdCIPQXLNAB5VYdkufEFOWrU4WkUMpgl9QzUE=; b=aejJYxowTSiZ4RYfRb+ri0uoZ6wxvGNUcmdBE8Ra45kMfdAdvAL4OATDg/I8Ld00n3 TK1XqVDR7uxbGlOvhf7UbsWGDvoFVFKjIBX21colCF4NA83UBQFpEmHAuEJRr1eze+Iy QhoZhpC6p6i+puxaWYdStwTjz+/NRkhqGj5U+2It/nEAG/XYvYpQEp6lDXZQHgy6cx43 97v7C+mbYcha+OwlGiNcRors+BLgRTWlz1EVVL2sE2wbYT3AluIT+e/W7e8fjpQ90ciL diJzkxbfiUGu43/Dc0OO7x7w/NAYFvqalm3bU2h74Fb3iOhpnvyWvFfFmJJEib8GYWS2 hUWQ== X-Gm-Message-State: AOAM5326LdzPOPlpKLLTZNpc4Ogd4ktMDKQo2w/CxGMEWamgnv/cxxCB /bXSDud8tPx1IUmgH/yUyHlStw== X-Google-Smtp-Source: ABdhPJwul8+2yIAI7+lC44DnHk4W6dca44WS0deVPwTk2JwaNCFtRQMzn1H07FIdZa/rX1sk6E9DsA== X-Received: by 2002:aa7:84d0:0:b029:27d:fff:40c9 with SMTP id x16-20020aa784d00000b029027d0fff40c9mr110903pfn.7.1619708476222; Thu, 29 Apr 2021 08:01:16 -0700 (PDT) Received: from localhost ([204.124.180.30]) by smtp.gmail.com with ESMTPSA id q5sm2747191pfu.5.2021.04.29.08.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 08:01:15 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , James Clark , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Al Grant Cc: Leo Yan Subject: [PATCH v1 2/3] perf arm-spe: Correct sample flags for dummy event Date: Thu, 29 Apr 2021 23:00:59 +0800 Message-Id: <20210429150100.282180-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210429150100.282180-1-leo.yan@linaro.org> References: <20210429150100.282180-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-20210429_080117_497146_71E4FFBE X-CRM114-Status: GOOD ( 17.70 ) 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. This patch enables TIME sample for per-cpu mmap and doesn't enable CPU sample. For later extension (e.g. support multiple AUX events), it sets the dummy event when the condition "opts->full_auxtrace" is true. Signed-off-by: Leo Yan Reviewed-by: James Clark Tested-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 902e73a64184..f6eec0900604 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -70,7 +70,6 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, 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; sper->evlist = evlist; @@ -126,18 +125,23 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, evsel__set_sample_bit(arm_spe_evsel, CPU); /* Add dummy event to keep tracking */ - err = parse_events(evlist, "dummy:u", NULL); - if (err) - return err; - - tracking_evsel = evlist__last(evlist); - evlist__set_tracking_event(evlist, tracking_evsel); - - 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); + if (opts->full_auxtrace) { + struct evsel *tracking_evsel; + + err = parse_events(evlist, "dummy:u", NULL); + if (err) + return err; + + tracking_evsel = evlist__last(evlist); + evlist__set_tracking_event(evlist, tracking_evsel); + + tracking_evsel->core.attr.freq = 0; + tracking_evsel->core.attr.sample_period = 1; + + /* 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 Thu Apr 29 15:01:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12231447 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.0 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 079F4C433B4 for ; Thu, 29 Apr 2021 15:03:17 +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 67F846143B for ; Thu, 29 Apr 2021 15:03:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67F846143B 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=BqQSyPG2K40O5cbP2M4XRvbmNmUMM2bMZwJWEoE+Hew=; b=IDLuBjPipDAcOCJoXMUjO5D8X BauBuHDxbQULhrxdJeoA+Bdh3RoPdP7zOMHnZsKmQE/05sP5kWiIaugcjafgayA1I68LouASkS3W8 Et2AiUCfepGuqp0GEKtuT/twz4dHvFbxigp6kaue36hMgbBUyRInslXVyyPrfniSfjrgSJZWWFkuN ExKu3N/ozPqqbmL7Y8sDy32pjnnCtybg95TZWIy7b6szIvbjCoXu7K+U1bE5etX0Fp0BLnMjOndXG f1Ile4nD6wkt3TRrt3LoqXEXeG49i1rYFvZUIyBJLiWvqTt9k/8uN9x+R5dtLvYKF6pUNlywrvyVn ejZDhgCgg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc8Am-005sar-SO; Thu, 29 Apr 2021 15:01:49 +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 1lc8AO-005sWl-2H for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 15:01:24 +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=XKzTGaXq5BgNlLNQghWJCOtAajFRMnz38uWkb37Btq0=; b=cr4FTtnpTBg71p0uY7+m4i2k0o Du4p+dvUtIc+PVF5oHvmRnRwaQS+fouUY8K+6824i3g3F/3eB7OABwUSA0wE7CmiNCUA2g5+i9jmJ jw9rCPbA1/M5VroMNJKr3joVVrQ9LHEiWBBamebkrh2Z2DCPDLz9/fX7tj/048gBKLYegBUQIVIKk uguQk7kwhUwPblmu/C1DURUR2NeFCia8NqAPC5/fEoImgXMEbWDG1tTaICyRu7fjsUv1vbwbC8nPF Lf2SnVrLjufnFO6iWyRTVdFHGl67kvGHkgALTXTUQZB1CjTnSx/V+D4s+rufGCozOKnGR1B0QdxaU VUBnYwOg==; Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc8AL-000i47-Gp for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 15:01:22 +0000 Received: by mail-pf1-x42c.google.com with SMTP id a12so3960125pfc.7 for ; Thu, 29 Apr 2021 08:01:20 -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=XKzTGaXq5BgNlLNQghWJCOtAajFRMnz38uWkb37Btq0=; b=vdjfp6T9ELO/U/TE5+KkR/ljxb5dDEpn3eDZXxEznvnTdj+ZlDuigDbJwQjcvfNe2f 1RcVpsKvKgb/ZD7swSBbi63tgsGSduD86CHVXwlIuLk/ujREs7DH0bElJskIzdbDFvhW mYUOe3rnGk8q9s477H8WBr/1YeX2hfIOawdSqcwQEfKVhmj+kC8adnIDT4lYJoknNNhP QCLIRTG94fjMOCZF4jRqd5AmS+SKMXDwY83iJp7jm8KQAH0WGSnot94JmMopYJA428aS gut3YCjn5qIm5pyTaXBrEXnhZ4QOx10MH/XmrW3l9W2XmLalk+ihm3ZQxs7DauIo53e9 4QUQ== 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=XKzTGaXq5BgNlLNQghWJCOtAajFRMnz38uWkb37Btq0=; b=B3Ft0lfurNMwQecR6p+7LnszSHWDDr/c6iMOLeKNdTsS3/7VVZnZ2zGuUL5gFgUnEq UowqG4UbnYA0e4gSX2+XsyxY0MvedX8NniDgnhoM6AclOagpW0aJkMH2JyFG0x23UBfo VrKz/HeJiHYlaEtjYyaVyNR1Cl84qphedmWsLfbLloTjvtAOL2gQ2LhWGGtjvc9S7RXH Sn80BulHgFmnqL4L+5Od/k2k9Y6uOQpomjZVyu1UFPSayBYVP9MM7SQE1oOPKkjN8b1x JwEK7d9U/Lmo+qkJGame2d6z170uXTAbhTTaNgfzsfPU620TvL3dfyL7U4HhTjT0HyXc Z+EQ== X-Gm-Message-State: AOAM532Xt/SsKT3uRFEwieBecZUJ4yFxlGaDId2OPAVHymTCn61MBLsj aj2H4R59FUKLOLI13v02TJGNgg== X-Google-Smtp-Source: ABdhPJxlUPcxM98q94BIRDqtl6qiB6XI4IIX8WgyoEZUYoolY68FW0vRSchkJ6LPoCXuhU9Ncw4q7Q== X-Received: by 2002:a62:55c6:0:b029:21c:4dfc:d6e2 with SMTP id j189-20020a6255c60000b029021c4dfcd6e2mr127505pfb.60.1619708479686; Thu, 29 Apr 2021 08:01:19 -0700 (PDT) Received: from localhost ([204.124.180.30]) by smtp.gmail.com with ESMTPSA id f135sm2726924pfa.102.2021.04.29.08.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 08:01:19 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , James Clark , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Al Grant Cc: Leo Yan Subject: [PATCH v1 3/3] perf arm-spe: Enable timestamp for per-cpu mode Date: Thu, 29 Apr 2021 23:01:00 +0800 Message-Id: <20210429150100.282180-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210429150100.282180-1-leo.yan@linaro.org> References: <20210429150100.282180-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-20210429_080121_564903_3C178FB7 X-CRM114-Status: GOOD ( 18.08 ) 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 --- 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 f6eec0900604..dae115dd458e 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) @@ -120,9 +144,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 */ if (opts->full_auxtrace) {