From patchwork Wed Aug 1 21:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10553055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D95D313BB for ; Wed, 1 Aug 2018 21:38:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5B052B6FC for ; Wed, 1 Aug 2018 21:38:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86EF2B715; Wed, 1 Aug 2018 21:38:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5364B2B6FC for ; Wed, 1 Aug 2018 21:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BAPov+sFsenUDUjKy6pyHsfsZMW+w8ZIsF1JJzodDtE=; b=ARo4Mhkp6Q9aVUPlheNSn3zdVg IsSWQVzsC8mRgD31hk6uLnZ3D5qT7PvYiPt62kx7nt6nQHPfv4JHoiJHXzFEoxfvCqsc2gk4l1N9u VoZsh3sfObZwZXOv/6hEDI0bW1gawmaPNGu2LzTHMJp/z0KAeYxaTJiR0hocRx8sZH3H2Z/iPfRqN k9NbekVubnCdr9Pzpdfkgmv/uWYTG1Uj9TncEv/Bbl80pvaff2UQj/8TsJ8zViMJRzy8WIlmRI2Ac X5k/cALKQLj/FiqS8TyRYBMq7PFQ6JydC63vdEgjMm1XLe+v5d4FoeA+aeQxSkZOcAI6EzrH4TILx Kms6IrXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyon-0007JT-K0; Wed, 01 Aug 2018 21:38:05 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyoY-00074u-BE for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:37:55 +0000 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAC2020844; Wed, 1 Aug 2018 21:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159460; bh=cBJxGGiRQ8OhCHI0jL0TIWRSIpaffOEAEiNllGfDtW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJFp1zSK8K9NBuJ+YJ68XgzsGfth4YCaccLSXPC2AzXu0rkrtHS5Dbo0P/31RFvcr aEadS8tbsW4Z0rH8HlSlDw6C1VULxe2nsyhn+x/jyvY0uzpTmeAgpQzTlnfdOhymuI xxRYRnwxkgxqqG/nFfZ5MiX2f2+5RB5zctiXptYs= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 12/21] perf cs-etm: Fix start tracing packet handling Date: Wed, 1 Aug 2018 18:36:39 -0300 Message-Id: <20180801213648.4814-13-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_143750_516259_C2732B4B X-CRM114-Status: GOOD ( 15.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Kim Phillips , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Leo Yan , Namhyung Kim , Robert Walker , Jiri Olsa , linux-arm-kernel@lists.infradead.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leo Yan Usually the start tracing packet is a CS_ETM_TRACE_ON packet, this packet is passed to cs_etm__flush(); cs_etm__flush() will check the condition 'prev_packet->sample_type == CS_ETM_RANGE' but 'prev_packet' is allocated by zalloc() so 'prev_packet->sample_type' is zero in initialization and this condition is false. So cs_etm__flush() will directly bail out without handling the start tracing packet. This patch is to introduce a new sample type CS_ETM_EMPTY, which is used to indicate the packet is an empty packet. cs_etm__flush() will swap packets when it finds the previous packet is empty, so this can record the start tracing packet into 'etmq->prev_packet'. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-4-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 1 + tools/perf/util/cs-etm.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index 743f5f444304..612b5755f742 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -23,6 +23,7 @@ struct cs_etm_buffer { }; enum cs_etm_sample_type { + CS_ETM_EMPTY = 0, CS_ETM_RANGE = 1 << 0, CS_ETM_TRACE_ON = 1 << 1, }; diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 8b2c099e750a..ae7c9c880cb2 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -924,8 +924,14 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) int err = 0; struct cs_etm_packet *tmp; + if (!etmq->prev_packet) + return 0; + + /* Handle start tracing packet */ + if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) + goto swap_packet; + if (etmq->etm->synth_opts.last_branch && - etmq->prev_packet && etmq->prev_packet->sample_type == CS_ETM_RANGE) { /* * Generate a last branch event for the branches left in the @@ -944,6 +950,10 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) etmq->period_instructions = 0; + } + +swap_packet: + if (etmq->etm->synth_opts.last_branch) { /* * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for * the next incoming packet. @@ -1023,6 +1033,13 @@ static int cs_etm__run_decoder(struct cs_etm_queue *etmq) */ cs_etm__flush(etmq); break; + case CS_ETM_EMPTY: + /* + * Should not receive empty packet, + * report error. + */ + pr_err("CS ETM Trace: empty packet\n"); + return -EINVAL; default: break; } From patchwork Wed Aug 1 21:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10553053 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F30613BF for ; Wed, 1 Aug 2018 21:38:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BECC2B6FC for ; Wed, 1 Aug 2018 21:38:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 204562B715; Wed, 1 Aug 2018 21:38:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C4302B6FC for ; Wed, 1 Aug 2018 21:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4sBRW54lvxC1Z+byQVStZhxe2onqY45PaLv7H6Gjbho=; b=XQQaofF/ZjhAjOq0rPqSAJzHYW 2GvwW5N7/NxCSDP7gk6hSKfk88/GScKwrtYDzLg/Ebs5iZayBlZNTsJsRfJRpKKPNzSPZSNwtp4vt ml8YdQ9u3gO8NzHeUJyoycWni/O+WP/YNwLE1A7yqw9CydFfcaFMb7/w5O/l9HdLfAP1NOZxVS/j9 Pcnnqte+SqSPtUno84f6VWJ9IUrorpbLO7VEgqXIqCWzSQaCD/gA6vdQwSuPTEt+/3UMtKyByFmQF PnreRyRlifEqgOGl3O+iQasCv66lxY6LPmyLvWGSUXYs7W2wshc9moob4b14QY0uOGX2zVD8p2BmD OA85J4bw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyoe-00079M-Fz; Wed, 01 Aug 2018 21:37:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyoY-00075w-BG for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:37:54 +0000 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 833EB208AF; Wed, 1 Aug 2018 21:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159463; bh=P3EbxfSbhAlP0lDHU95I527JUVWMv16Ylkjp3mX0IUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3Gy9xfTjEeeWZSwDOXS3rbu8BDNrT3FQpXuDa+dcTzYeLn0sJmfpobUDBxnDkNMH bKdfAOu1jWZO/kTmEG4l2vE/629KXYDncu5ldQnj9sUQJ4LyVgtwv5mFzjxwfli/kQ Q4mgVDG8BUhfyy2G2/szg6AuPYKdb6aoAAXtsLcw= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 13/21] perf cs-etm: Support dummy address value for CS_ETM_TRACE_ON packet Date: Wed, 1 Aug 2018 18:36:40 -0300 Message-Id: <20180801213648.4814-14-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_143750_513414_D7B9399B X-CRM114-Status: GOOD ( 15.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Kim Phillips , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Leo Yan , Namhyung Kim , Robert Walker , Jiri Olsa , linux-arm-kernel@lists.infradead.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leo Yan For CS_ETM_TRACE_ON packet, its fields 'packet->start_addr' and 'packet->end_addr' equal to 0xdeadbeefdeadbeefUL which are emitted in the decoder layer as dummy value, but the dummy value is pointless for branch sample when we use 'perf script' command to check program flow. This patch is a preparation to support CS_ETM_TRACE_ON packet for branch sample, it converts the dummy address value to zero for more readable; this is accomplished by cs_etm__last_executed_instr() and cs_etm__first_executed_instr(). The later one is a new function introduced by this patch. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-5-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index ae7c9c880cb2..976db8483478 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -494,6 +494,10 @@ static inline void cs_etm__reset_last_branch_rb(struct cs_etm_queue *etmq) static inline u64 cs_etm__last_executed_instr(struct cs_etm_packet *packet) { + /* Returns 0 for the CS_ETM_TRACE_ON packet */ + if (packet->sample_type == CS_ETM_TRACE_ON) + return 0; + /* * The packet records the execution range with an exclusive end address * @@ -505,6 +509,15 @@ static inline u64 cs_etm__last_executed_instr(struct cs_etm_packet *packet) return packet->end_addr - A64_INSTR_SIZE; } +static inline u64 cs_etm__first_executed_instr(struct cs_etm_packet *packet) +{ + /* Returns 0 for the CS_ETM_TRACE_ON packet */ + if (packet->sample_type == CS_ETM_TRACE_ON) + return 0; + + return packet->start_addr; +} + static inline u64 cs_etm__instr_count(const struct cs_etm_packet *packet) { /* @@ -546,7 +559,7 @@ static void cs_etm__update_last_branch_rb(struct cs_etm_queue *etmq) be = &bs->entries[etmq->last_branch_pos]; be->from = cs_etm__last_executed_instr(etmq->prev_packet); - be->to = etmq->packet->start_addr; + be->to = cs_etm__first_executed_instr(etmq->packet); /* No support for mispredict */ be->flags.mispred = 0; be->flags.predicted = 1; @@ -701,7 +714,7 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq) sample.ip = cs_etm__last_executed_instr(etmq->prev_packet); sample.pid = etmq->pid; sample.tid = etmq->tid; - sample.addr = etmq->packet->start_addr; + sample.addr = cs_etm__first_executed_instr(etmq->packet); sample.id = etmq->etm->branches_id; sample.stream_id = etmq->etm->branches_id; sample.period = 1; From patchwork Wed Aug 1 21:36:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10553103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD7E81708 for ; Wed, 1 Aug 2018 21:54:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC22628825 for ; Wed, 1 Aug 2018 21:54:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FF6F29492; Wed, 1 Aug 2018 21:54:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CEF328825 for ; Wed, 1 Aug 2018 21:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Wjj/ChTpiaQ7J1d+14hXrWeXnbuzDtpvr4rdAo1iFgU=; b=jEqBCavFb8gbkSJl6EcPK7z9TC ErSLJuIzx5EIMMzbHl/rR4xn+OgDSEt+Q3VB18wDRCi8S6plrLhX4hgE/INTU3UoGF6BPO0ZH1mqh VxicN9baKNlW30MMJjo7HAUuS5LmEIevGcDK9tq00IJ+5WNrC88Sszp2h2JqlFpgYu/ay8JTQuQD7 G2fghExylz1hEIrwZqIKykwGD/3vUGxvlWsN7kneNU1jdbRkcIOxaTZr02YUv68TCmFZhgxoPZCf5 5leBEdMetpgCzYTk6PcCvNVIzL5aoXz5lgk38SPdk3lCwXdnWL811Kx24OjYxEVMtYP5ptjblP8qh 6AGBuk5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkz4q-0006Wh-PY; Wed, 01 Aug 2018 21:54:40 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkz4o-0006PL-S5 for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Aug 2018 21:54:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+ho/dAztRl0NBinJdfduzic0XwDrf5rMeHeWU22OpIA=; b=GgZ/3RS6viQYAuC2r3G8Acrek kndvVgV8x6sSfODWBOS+lgVDePWIfhTdIQhjjrwTbQSYTjBCAbgF+uC35q9+qkaS90bh2i6owXPji /LOLnFTD27PfzykYm4HhKoeWYW6AyK2+TtoViTEu9EsPHmKKzHfqm+PFyd8nFgAq+BZRnEr/qwWoU vus1rirVTVrXzGJX6cqGYLv6J1tCWnGA82nlshqLzmzfpWr1lpd293BjCd+cNnTFC/UKq+vVrfzNf VWcQF6O/oppl6aygBNUXAieJMtRNLiZRAOzak/1OV6Wq9DehGPRbq3UqPSOq4nCvU2wWI3XUSwqfs M4WSWwq9A==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyog-0002Me-Up for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:38:00 +0000 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4971A208A5; Wed, 1 Aug 2018 21:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159467; bh=7PKxdmB4FcUBYEjNnAhtmm43wZS9a9WB6nlc3RVbQfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+rOsewFPObmsjQuhqrD48RJQj+qPrbMyJFjiHZeyAUifvKRX4n1SY4pQYdNqMpIQ /HGkFMHU2WDrZLcsRz9Ko/oQe6+UvMy040vzHGCVx3TC4+OV+jk5lEeqqLzMYJ2bTF pqt7RNZKQXjOeOw0Sl7S8EMRr08mVuVCUe2EAL0g= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 14/21] perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet Date: Wed, 1 Aug 2018 18:36:41 -0300 Message-Id: <20180801213648.4814-15-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_223759_136263_2DBB146D X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Kim Phillips , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Leo Yan , Namhyung Kim , Robert Walker , Jiri Olsa , linux-arm-kernel@lists.infradead.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leo Yan If one CS_ETM_TRACE_ON packet is inserted, we miss to generate branch sample for the previous CS_ETM_RANGE packet. This patch is to generate branch sample when receiving a CS_ETM_TRACE_ON packet, so this can save complete info for the previous CS_ETM_RANGE packet just before CS_ETM_TRACE_ON packet. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-6-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 976db8483478..d3b794286bca 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -935,6 +935,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) static int cs_etm__flush(struct cs_etm_queue *etmq) { int err = 0; + struct cs_etm_auxtrace *etm = etmq->etm; struct cs_etm_packet *tmp; if (!etmq->prev_packet) @@ -965,6 +966,13 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) } + if (etm->sample_branches && + etmq->prev_packet->sample_type == CS_ETM_RANGE) { + err = cs_etm__synth_branch_sample(etmq); + if (err) + return err; + } + swap_packet: if (etmq->etm->synth_opts.last_branch) { /* From patchwork Wed Aug 1 21:36:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10553063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DD1F15E2 for ; Wed, 1 Aug 2018 21:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A8342B13B for ; Wed, 1 Aug 2018 21:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2FEA2B71F; Wed, 1 Aug 2018 21:50:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D5E32B13B for ; Wed, 1 Aug 2018 21:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nrYujnGvvCv744IYqUg3B70jp5Y6Fn93WN95OrmDr90=; b=WVVs4OMOCZ//qliu6ZX5yGp9ul iWIrAY6NfCRIZBiE8WkV050NdLFzuRid9IOU6Fuk+iSgfAZs/rBjTvFShcagjpPDS1lf/53FXgC+e dLy/O301kPbonALgugDxta87DK2acnpnBXS4htWTjscFmlwuwnq47wQvA8UzHz0Re/Tr7Vhy9BeT8 QC7wgH2TMvDPcWgmeFXJi0vZZ6DfcKdBdQxIYxj3XNqc7Gz4J0oAiq/D3BYWHhMSPnd0tFY+FKwzc F7Yw80JYyMOU6znkxZ/LiRm5tQQ/SLCcN35RDJxMFs5awdtVmYlDj21KsujDpKwSQoblZrZ9+6ao2 Kv1Su4TQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkz0n-0004lX-IU; Wed, 01 Aug 2018 21:50:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyok-00078T-4d for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:38:19 +0000 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22FF8208A6; Wed, 1 Aug 2018 21:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159471; bh=NqiGDYhS9DKP0U4/znGIEYTBKhiCrrjfAp/8MIJXKfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvFwQ9Y8p5E89BIkO9YmOL9r5t6MC8DddMXKgZ54bzyo5PuRizDW0Cy2LM8VLFlfS 8sjG1VV3eIeATNMSQwbh9J8vW3PaiCptGFgTr8dyG9nVU7N+3bS9D0AnJL4SS+UFGB CLURbYRzaoznbAfN+I4R/2ToRD9MGYGcLZu2b9H8= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 15/21] perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet Date: Wed, 1 Aug 2018 18:36:42 -0300 Message-Id: <20180801213648.4814-16-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_143802_697859_3B61FE38 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Kim Phillips , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Leo Yan , Namhyung Kim , Robert Walker , Jiri Olsa , linux-arm-kernel@lists.infradead.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leo Yan CS_ETM_TRACE_ON packet itself can give the info that there have a discontinuity in the trace, this patch is to add branch sample for CS_ETM_TRACE_ON packet if it is inserted in the middle of CS_ETM_RANGE packets; as result we can have hint for the trace discontinuity. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-7-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index d3b794286bca..2ae640257fdb 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -910,13 +910,23 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) etmq->period_instructions = instrs_over; } - if (etm->sample_branches && - etmq->prev_packet && - etmq->prev_packet->sample_type == CS_ETM_RANGE && - etmq->prev_packet->last_instr_taken_branch) { - ret = cs_etm__synth_branch_sample(etmq); - if (ret) - return ret; + if (etm->sample_branches && etmq->prev_packet) { + bool generate_sample = false; + + /* Generate sample for tracing on packet */ + if (etmq->prev_packet->sample_type == CS_ETM_TRACE_ON) + generate_sample = true; + + /* Generate sample for branch taken packet */ + if (etmq->prev_packet->sample_type == CS_ETM_RANGE && + etmq->prev_packet->last_instr_taken_branch) + generate_sample = true; + + if (generate_sample) { + ret = cs_etm__synth_branch_sample(etmq); + if (ret) + return ret; + } } if (etm->sample_branches || etm->synth_opts.last_branch) { From patchwork Wed Aug 1 21:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10553061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 297F715E2 for ; Wed, 1 Aug 2018 21:50:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15FB32B13B for ; Wed, 1 Aug 2018 21:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 089FE2B71F; Wed, 1 Aug 2018 21:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 72FF42B13B for ; Wed, 1 Aug 2018 21:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4lrMIuKsAggKHqdc0W819YhmvlmSsGjqRodrHlkFoeg=; b=g6FeBnAAu6jqZGxVEFChMgoRxo IjgPYMMCI6a/5fKRrm8livZvEOnBXoVzEzFhq+zM8K4rWmuVb6LWsuVt6Zd95Sk0fXY6LMI5PiJeS OKtS0kVQRu8+4if/GnLy5OEr90yV5QkR+5q7nYU+1zdtGSdIDBHBmX992OB83R5Xcowh/9eq2hd6C viwN1PoGskaOFh2tpTtSx9LXlUd1bbrGVJ5T2L5lJPvEFCMFG9k6k65mVon/70JJujdyprYVto50D 1+oWNwV/O+jt9kYWTT9eHtt+zqSqnMKl/8KJwWPyfqrpTgHlDMQlgLPsbkndNxT+xwFFeZdrXEr0g MC6PQKdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkz0h-0004dx-UM; Wed, 01 Aug 2018 21:50:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkyok-00079a-4c for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:38:14 +0000 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 50E36208A4; Wed, 1 Aug 2018 21:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159476; bh=CeK0mUT+vGVvWWvO/1bakgoy0dVdzh/jf+2pLGvFxBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogqK00UOBLXxOkpE7UWRo5XGJ/ZtqbRP4NcMwtAu8HtkYf2mvDhdGAtFeuaSA72l2 lFpjhPFIGWyph05xgEYukWcgiCyJ6cSYZFxzaogNVZS3Q+uqbh0q5MIt5DUmOsE7LM oU3E3u3u2X6cAxLZwpXdg9zDjZre0WWud46c39Xk= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 16/21] perf vendor events arm64: Update ThunderX2 implementation defined pmu core events Date: Wed, 1 Aug 2018 18:36:43 -0300 Message-Id: <20180801213648.4814-17-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_143802_582277_5DA3FA08 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Arnaldo Carvalho de Melo , Peter Zijlstra , Jan Glauber , Clark Williams , Will Deacon , linux-kernel@vger.kernel.org, Robert Richter , linux-perf-users@vger.kernel.org, Alexander Shishkin , Ganapatrao Kulkarni , Vadim Lomovtsev , Jayachandran C , Ganapatrao Kulkarni , Namhyung Kim , Jiri Olsa , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ganapatrao Kulkarni Signed-off-by: Ganapatrao Kulkarni Cc: Alexander Shishkin Cc: Ganapatrao Kulkarni Cc: Jan Glauber Cc: Jayachandran C Cc: Jiri Olsa Cc: linux-arm-kernel@lists.infradead.org Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Richter Cc: Vadim Lomovtsev Cc: Will Deacon Link: http://lkml.kernel.org/r/20180731100251.23575-1-ganapatrao.kulkarni@cavium.com Signed-off-by: Arnaldo Carvalho de Melo --- .../arch/arm64/cavium/thunderx2/core-imp-def.json | 87 +++++++++++++++++++++- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json b/tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json index bc03c06c3918..752e47eb6977 100644 --- a/tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json +++ b/tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json @@ -11,6 +11,21 @@ { "ArchStdEvent": "L1D_CACHE_REFILL_WR", }, + { + "ArchStdEvent": "L1D_CACHE_REFILL_INNER", + }, + { + "ArchStdEvent": "L1D_CACHE_REFILL_OUTER", + }, + { + "ArchStdEvent": "L1D_CACHE_WB_VICTIM", + }, + { + "ArchStdEvent": "L1D_CACHE_WB_CLEAN", + }, + { + "ArchStdEvent": "L1D_CACHE_INVAL", + }, { "ArchStdEvent": "L1D_TLB_REFILL_RD", }, @@ -23,10 +38,76 @@ { "ArchStdEvent": "L1D_TLB_WR", }, + { + "ArchStdEvent": "L2D_TLB_REFILL_RD", + }, + { + "ArchStdEvent": "L2D_TLB_REFILL_WR", + }, + { + "ArchStdEvent": "L2D_TLB_RD", + }, + { + "ArchStdEvent": "L2D_TLB_WR", + }, { "ArchStdEvent": "BUS_ACCESS_RD", - }, - { + }, + { "ArchStdEvent": "BUS_ACCESS_WR", - } + }, + { + "ArchStdEvent": "MEM_ACCESS_RD", + }, + { + "ArchStdEvent": "MEM_ACCESS_WR", + }, + { + "ArchStdEvent": "UNALIGNED_LD_SPEC", + }, + { + "ArchStdEvent": "UNALIGNED_ST_SPEC", + }, + { + "ArchStdEvent": "UNALIGNED_LDST_SPEC", + }, + { + "ArchStdEvent": "EXC_UNDEF", + }, + { + "ArchStdEvent": "EXC_SVC", + }, + { + "ArchStdEvent": "EXC_PABORT", + }, + { + "ArchStdEvent": "EXC_DABORT", + }, + { + "ArchStdEvent": "EXC_IRQ", + }, + { + "ArchStdEvent": "EXC_FIQ", + }, + { + "ArchStdEvent": "EXC_SMC", + }, + { + "ArchStdEvent": "EXC_HVC", + }, + { + "ArchStdEvent": "EXC_TRAP_PABORT", + }, + { + "ArchStdEvent": "EXC_TRAP_DABORT", + }, + { + "ArchStdEvent": "EXC_TRAP_OTHER", + }, + { + "ArchStdEvent": "EXC_TRAP_IRQ", + }, + { + "ArchStdEvent": "EXC_TRAP_FIQ", + } ]