From patchwork Wed Jul 25 17:59:37 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: 10544555 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 70B2A112E for ; Wed, 25 Jul 2018 18:11:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604362A9C5 for ; Wed, 25 Jul 2018 18:11:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E12F2AA8B; Wed, 25 Jul 2018 18:11:50 +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 D8D382A9C5 for ; Wed, 25 Jul 2018 18:11:49 +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=kmK+u9WgY4UNxpB14paciNbfSMREMSlOJQPWLpfXtNQ=; b=tIp2tJ08etDP4y/ZgwHa3q5qwH k8SLFxhQ5M2BNE6KjW0lF8P0C1WogQ4eDKu5tbFvjst/PbNWs9P8Pco58fJ0zN9j7W2niCl5hwKxY Fo0UpV7txofZH6T6Bt3eyjYZX9GsiK+J9yen6GAwPPDxBEym0Qdglw8AJLgmLKrGZCKCKFvFpmgGH FQOGSKOG1coXY18bzTBw+2m9BxtzAKuGklVulyMb6odO79u8+qyqx9/U0Gb6N1pjJ3F3T7Q0qjBsg 9R5d2BXRpctslBwiFWB4BXOUJzFh7YiA2mwsGgisLTSUXnbuuvJXZQEGT9fUyzSubW9sDrtYj0oPA 4gv6tHew==; 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 1fiOGI-0001UT-LM; Wed, 25 Jul 2018 18:11:46 +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 1fiO5j-0001mA-D2 for linux-arm-kernel@lists.infradead.org; Wed, 25 Jul 2018 18:00:53 +0000 Received: from jouet.infradead.org (189-94-96-116.3g.claro.net.br [189.94.96.116]) (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 8289620893; Wed, 25 Jul 2018 18:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532541641; bh=Iyyav/WoMgogm7wNtNs8LGT6od91lV623UDLoKn4qEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=McK2t8M9uZRxRHb/GokCqVmwAlTJVLY3wYjHCC3CiocJrZ1d9spMEZw/hJJkxCPAS 39TJTVPPik94mHz/zskgP4LEzS1t+4W37Kz7H4YKrk/XXo1oZzeZdtXcJ+oHFpT3G9 Lc9Bm039mT28OocVY/NPoruH6UY6cM4Yupx1pypE= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 03/27] perf cs-etm: Introduce invalid address macro Date: Wed, 25 Jul 2018 14:59:37 -0300 Message-Id: <20180725180001.15108-4-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180725180001.15108-1-acme@kernel.org> References: <20180725180001.15108-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180725_110051_549719_228D280D X-CRM114-Status: GOOD ( 11.25 ) 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 This patch introduces invalid address macro and uses it to replace dummy value '0xdeadbeefdeadbeefUL'. 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/1529298599-3876-2-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index 4d5fc374e730..938def6d0bb9 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -31,6 +31,8 @@ #endif #endif +#define CS_ETM_INVAL_ADDR 0xdeadbeefdeadbeefUL + struct cs_etm_decoder { void *data; void (*packet_printer)(const char *msg); @@ -261,8 +263,8 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder) decoder->tail = 0; decoder->packet_count = 0; for (i = 0; i < MAX_BUFFER; i++) { - decoder->packet_buffer[i].start_addr = 0xdeadbeefdeadbeefUL; - decoder->packet_buffer[i].end_addr = 0xdeadbeefdeadbeefUL; + decoder->packet_buffer[i].start_addr = CS_ETM_INVAL_ADDR; + decoder->packet_buffer[i].end_addr = CS_ETM_INVAL_ADDR; decoder->packet_buffer[i].last_instr_taken_branch = false; decoder->packet_buffer[i].exc = false; decoder->packet_buffer[i].exc_ret = false; @@ -295,8 +297,8 @@ cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder, decoder->packet_buffer[et].exc = false; decoder->packet_buffer[et].exc_ret = false; decoder->packet_buffer[et].cpu = *((int *)inode->priv); - decoder->packet_buffer[et].start_addr = 0xdeadbeefdeadbeefUL; - decoder->packet_buffer[et].end_addr = 0xdeadbeefdeadbeefUL; + decoder->packet_buffer[et].start_addr = CS_ETM_INVAL_ADDR; + decoder->packet_buffer[et].end_addr = CS_ETM_INVAL_ADDR; if (decoder->packet_count == MAX_BUFFER - 1) return OCSD_RESP_WAIT; From patchwork Wed Jul 25 17:59:38 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: 10544547 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 1C6E7112E for ; Wed, 25 Jul 2018 18:01:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 075D92A9DE for ; Wed, 25 Jul 2018 18:01:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFE052A9E6; Wed, 25 Jul 2018 18:01:03 +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 9B5C62A9CB for ; Wed, 25 Jul 2018 18:01:03 +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=BDNdkpEESDU9jIlZ3v1JQjIECzzzOAT9OGiH6gFOSaQ=; b=b1GwwG7cGnxl/gotucYVNkNBqN GkFCBEXAYfCp/E53XVLEWXfiKBAZvSj7g51kJgDxiaHO3N4rIzfohro7WYpG9Uhxy/MYd9j2JKgSl nUSAFmEmLugOpj9Gm9xZmk72yH0anXImwsK61oj8Kwanjt/p6Qg5FU3DEEqnHxH8chR+fDZCn9fFV 8t+QNHk9OdjiciNQEnohwDELFhTyKOFSAwGqwcMute0oksL6vVlzD5MgzDd/beqiXSYFywu5ayiJF Cp15pLNSMlYRDJEKStkn2YTPgoNIvSqXLLYKpmOLe4SclkkSb5YIClrMUeKJwYkWdjDEhs1Vfrk6a QrwV9N0A==; 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 1fiO5o-00022X-02; Wed, 25 Jul 2018 18:00: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 1fiO5j-0001uc-D3 for linux-arm-kernel@lists.infradead.org; Wed, 25 Jul 2018 18:00:53 +0000 Received: from jouet.infradead.org (189-94-96-116.3g.claro.net.br [189.94.96.116]) (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 EC06C20833; Wed, 25 Jul 2018 18:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532541647; bh=ppmIxlNOnW1PVQKGK3DbtHWZMJUw0wXV/Jl4Rr/6cfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov1zL8Z41hEJDCixcQMTM3hvsr4Smpc6OKD/jc1HjGLbmv8dIL7AFUfO+2PDYKSKM 3Zbc2ZxnCU1so1EIgAfkXZKRx2fhL+Z02kXJy0bemdKVw5JbvWtOwlId/Nuzy2jiPA hemGTJ6Fkx9jIW2GjLoXNvt4mQ1W+KCi0QsSg/tw= From: Arnaldo Carvalho de Melo To: Ingo Molnar Subject: [PATCH 04/27] perf cs-etm: Bail out immediately for instruction sample failure Date: Wed, 25 Jul 2018 14:59:38 -0300 Message-Id: <20180725180001.15108-5-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180725180001.15108-1-acme@kernel.org> References: <20180725180001.15108-1-acme@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180725_110051_553536_DEBA19AA X-CRM114-Status: GOOD ( 10.07 ) 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 the instruction sample failure has happened, it isn't necessary to execute to the end of the function cs_etm__flush(). This commit is to bail out immediately and return the error code. 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/1529298599-3876-3-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 822ba915d144..8b2c099e750a 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -939,6 +939,9 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) err = cs_etm__synth_instruction_sample( etmq, addr, etmq->period_instructions); + if (err) + return err; + etmq->period_instructions = 0; /*