From patchwork Mon Jun 18 05:09:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 138845 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3529764lji; Sun, 17 Jun 2018 22:10:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLguqlAKvwB8x6KKIqEzl+vpici4wPoL4JZFkXNyiG+OiGAZtrj2orzxOWZhAEUCFJJjtXF X-Received: by 2002:a17:902:2927:: with SMTP id g36-v6mr12274460plb.303.1529298652185; Sun, 17 Jun 2018 22:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529298652; cv=none; d=google.com; s=arc-20160816; b=bWB59cvTGozSsuYNfibJyhKr4/Uxpe1D+4akZA19K3XK6bUbRUKFzHwpDDzsZTYe9n UtfuLu+nsxQoOO07B5kNoeDxD65vH6jMrJh3qQ4Px3XzXgggpz3qsCv087lAmcyS3mVj rgZwNRH5WLzG9J3ZQVZZMXvOLeFqoKcPeZipN37xpIQCt8UEEcvru0F+DMhcagO2X93r XyxpcMWCcWZAI2kJtzr7DT3As2hE5KPPDi3vfa+TiiE/Pb/eiDL5undhh5AQKWgU021Z w8E7MX68BNqddEnKXWrYMYDzCB4YLbwJfA44rNh8R40BSrDMWPRZ3FfTyTDZQxk15sfV lDAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=P8F/rdx0Dg+tbAP4xRKVzOUZryhhTxWfkI38tLb+Eck=; b=B6IwuvgqmeAedTgV+Jg+VfjkvVspCe0z+d+XfHn6JljA/6StOAUHR/+E9/DTQHcJSm lWPaD/IrRofWnh8EKFtO5bOCa3M0nv8rLkd36UuJa62D1EmXQ3awmmJPk6RXkSvd2IRZ NfvNAbG9Rf1ZP9GbpxwTtj24FrzpRgtaVoNkGavNPWXUZfp58DDPGkB+agKQxoiIVuTF eRrQ0gRT6x1igHOX/mZK10s6RLozYxsCxnyN6l8vx97IV5DxTsJvDKD5d9uGmHL8eQf2 PktNoe3iwCTIbcjaFXzKjm0BpvKZj2Bkimou7KsyFm5n+w0Bb/XpnIrJ4pTuBBAPwBk0 x9fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AJPw/IX/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5-v6si13831125pfi.360.2018.06.17.22.10.51; Sun, 17 Jun 2018 22:10:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AJPw/IX/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754712AbeFRFKn (ORCPT + 30 others); Mon, 18 Jun 2018 01:10:43 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36587 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754288AbeFRFKk (ORCPT ); Mon, 18 Jun 2018 01:10:40 -0400 Received: by mail-pg0-f66.google.com with SMTP id m5-v6so6966261pgd.3 for ; Sun, 17 Jun 2018 22:10:40 -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; bh=P8F/rdx0Dg+tbAP4xRKVzOUZryhhTxWfkI38tLb+Eck=; b=AJPw/IX/VN0XwcK1Ched1kGfQBYDjuanEYGEs/y4J+hLXkavQTnpY6xZNhinOXqWvP PE1fQ4QPcFombM4wCpzkn2u7sslK0CiLeOW1//tilXlowC3BtVpVJ1LtSLA8qeyaiduA xrgUHPr0fPSe175W02wB8+lHCUmhx1OiZiucM= 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; bh=P8F/rdx0Dg+tbAP4xRKVzOUZryhhTxWfkI38tLb+Eck=; b=CZL5uwNfWexJheLtjbU8t9nTnrCJxx5ZRQswJMeo+kwW+KBZRpaKBNiCLDj70UWN73 93yT1QfK1E0OfpfILsXA2UtEqcbL7PborF7SuqIxFTEBcR6DjC6xgb1uaVqTKQSCR8sq v2wx7cJ/8tDWJuiwTzxwchDqRjIgobHfUL7I275n7nC0erbCr9rE/sZ1RtuBLbGKkGFk +Ho1rCbzWcpg91q1i84A/PSZ55/ImSLgY/R7JXA+syIepOIRNFvrI/daFmPsRTzABNC6 Xdcd6kJoHPFuIh06npD0j953X/IduqxcPR2r5+Ojsn8hmuPm5yIFBPv0yBiMq9XKRcB6 eZsQ== X-Gm-Message-State: APt69E35WcooU7/B2kv7emgM2DqTJVBY+DVGduLqLIHrNslxFr1IFHKb cH61ghzTFC5IzZwyNIHmblLpRQ== X-Received: by 2002:a63:902:: with SMTP id 2-v6mr9540897pgj.3.1529298640259; Sun, 17 Jun 2018 22:10:40 -0700 (PDT) Received: from localhost.localdomain (li1181-92.members.linode.com. [45.79.82.92]) by smtp.gmail.com with ESMTPSA id l15-v6sm29051710pfg.88.2018.06.17.22.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jun 2018 22:10:39 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mike Leach , Robert Walker , Kim Phillips Cc: Leo Yan Subject: [PATCH v1 2/6] perf cs-etm: Bail out immediately for instruction sample failure Date: Mon, 18 Jun 2018 13:09:55 +0800 Message-Id: <1529298599-3876-3-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529298599-3876-1-git-send-email-leo.yan@linaro.org> References: <1529298599-3876-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/perf/util/cs-etm.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 822ba91..8b2c099 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; /*