From patchwork Wed Jan 22 09:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233590 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 189B1C2D0DB for ; Wed, 22 Jan 2020 09:38:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFB8924683 for ; Wed, 22 Jan 2020 09:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579685897; bh=m8ipr9+0MDwOb4v+qrzFhrfPIvmXiJ/RP17Uky4V/LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fsSWSu3xdEULOJJypN5FaLg/78cwxIGTvpCWPjERx4p1UvfDjQgk1q3cVfqj0/ogq xlG9ddxor7vCEiJmCQNVGE/uuwJkjGck6k+IbNZM42znCoq1lf+vO+BWrS8496PHTP 6/IPFTaESCWbpF9tR2e15HfLYrbd89kF0uWChjS8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732899AbgAVJiQ (ORCPT ); Wed, 22 Jan 2020 04:38:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:54850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732891AbgAVJiP (ORCPT ); Wed, 22 Jan 2020 04:38:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3D5E124686; Wed, 22 Jan 2020 09:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579685894; bh=m8ipr9+0MDwOb4v+qrzFhrfPIvmXiJ/RP17Uky4V/LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pMCLzQbEHOwzSdH6eMBPViYeqQdrLzz9QA0fzj00rchtdxbq2Hobidql/q8fPoqh7 ndhsyjPzgPWGlNn+qG0EUkQ//Gc5F1N4M2OA1LXMFL1TraS/eAh/3ywHIpxX24t7xd mHrnEBmzAIpbh4wi9hEbAn0V8PfJ5gzdAUXiTuuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jin Yao , Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , Andi Kleen , Feng Tang , Jin Yao , Kan Liang , Peter Zijlstra Subject: [PATCH 4.14 25/65] perf report: Fix incorrectly added dimensions as switch perf data file Date: Wed, 22 Jan 2020 10:29:10 +0100 Message-Id: <20200122092754.455714615@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092750.976732974@linuxfoundation.org> References: <20200122092750.976732974@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jin Yao commit 0feba17bd7ee3b7e03d141f119049dcc23efa94e upstream. We observed an issue that was some extra columns displayed after switching perf data file in browser. The steps to reproduce: 1. perf record -a -e cycles,instructions -- sleep 3 2. perf report --group 3. In browser, we use hotkey 's' to switch to another perf.data 4. Now in browser, the extra columns 'Self' and 'Children' are displayed. The issue is setup_sorting() executed again after repeat path, so dimensions are added again. This patch checks the last key returned from __cmd_report(). If it's K_SWITCH_INPUT_DATA, skips the setup_sorting(). Fixes: ad0de0971b7f ("perf report: Enable the runtime switching of perf data file") Signed-off-by: Jin Yao Tested-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Feng Tang Cc: Jin Yao Cc: Kan Liang Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20191220013722.20592-1-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/builtin-report.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -742,6 +742,7 @@ int cmd_report(int argc, const char **ar struct stat st; bool has_br_stack = false; int branch_mode = -1; + int last_key = 0; bool branch_call_mode = false; char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT; const char * const report_usage[] = { @@ -1048,7 +1049,8 @@ repeat: else use_browser = 0; - if (setup_sorting(session->evlist) < 0) { + if ((last_key != K_SWITCH_INPUT_DATA) && + (setup_sorting(session->evlist) < 0)) { if (sort_order) parse_options_usage(report_usage, options, "s", 1); if (field_order) @@ -1108,6 +1110,7 @@ repeat: ret = __cmd_report(&report); if (ret == K_SWITCH_INPUT_DATA) { perf_session__delete(session); + last_key = K_SWITCH_INPUT_DATA; goto repeat; } else ret = 0;