Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4821413ybl; Wed, 22 Jan 2020 05:23:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyZFMa5Vl/FY8KFCdO2SWKv7bZC4I/6UCfO1qt9tKTJIkTcW+wlLq/7J9Kz7SRf2BWG6/bF X-Received: by 2002:aca:2419:: with SMTP id n25mr6796599oic.13.1579699426335; Wed, 22 Jan 2020 05:23:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699426; cv=none; d=google.com; s=arc-20160816; b=SL8WdiXE0YV3upd83/WrXnm6HRgD5lwa7OkQk4N5tMq9KXv3EYSmhFfiLJU84npEfS j68qoarO3bs4Ti9KYqatwMTI6Lrk6/nU656X+nM5RlWEM75TnOM0oe09Rh2N1IMHNIPf C41OOdB0kvrJVKVGIPfJtR5zNMhFlVXRacv88pqAjZjt299ZUikKkKTGSpnDI4N90cG1 zzgsOZ3i5e/w4VmnW7v6ov5IzEh4MDGyOWpCdKfZj+cXkGK4kYr5bBc6ziexKQKlPl4G dABPXwoibjgXs0Uz4NGcTMfo+zKCfO73fAcPfjrF1n1lwFpHJU+gmvudFfvKgKh314uO 7zEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F2bEDDEYcd+wJVNQqXRS31RBOTJO7QLBdrf1SkCeR4I=; b=Fgs7M4dEEagoJ4PHXXCXIFgzAbA4Iz+BMHVIN7slVD0ZTDnIBCaoFRLaTKFEnpsMwG gxKDfrQnyeY5ztFN2CFbs4yPQajvqM2DhqoqTvy78kq76rPEcpM2OHdtEq8dlpF03RSz QPel7MgulVfoccFg1z8XShCaOIwllM9oikQNgZu9PBnBRnuoRuNh1cuG4Hzc5YXx4CiZ Vpg5OoFbMCh7/uOteDmt+7CDrnRSOfNkgOqSIhWHrtvADdbNnn3I6f0rQliJbwLNS1z+ vcZ2hDMCAZHnaaZaJKnfdnZ1FQj6C/Z8k0Npbnov2g/7xu/R5FXaPVXzGqSlnEz2FtO5 xOFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EQsgqBOm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si20653673oic.116.2020.01.22.05.23.34; Wed, 22 Jan 2020 05:23:46 -0800 (PST) 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=@kernel.org header.s=default header.b=EQsgqBOm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730503AbgAVNWU (ORCPT + 99 others); Wed, 22 Jan 2020 08:22:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:39778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730487AbgAVNWQ (ORCPT ); Wed, 22 Jan 2020 08:22:16 -0500 Received: from localhost (unknown [84.241.205.26]) (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 2A6632467B; Wed, 22 Jan 2020 13:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699335; bh=e9ZQfFjwOKU/ObdvaAfQZMdNRTkN7X/aHdOhJLXe0AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQsgqBOmQD9jrX4B4sDwYOnqPcxEL91DkbbxYcPb0k5SZUCOBrc/a6PF5aCTgDgHU kRY4EzI6KTMMVVp3VHPEVAdF1VXTzw/K+C62mMbJusHmzjtuwxfahwO1O7jiwM9Nlt yLhZWVtpzneDRa/LLCwJvlAQeADc170x53wf74CI= 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 5.4 077/222] perf report: Fix incorrectly added dimensions as switch perf data file Date: Wed, 22 Jan 2020 10:27:43 +0100 Message-Id: <20200122092839.228537744@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -1031,6 +1031,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; #define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent" static const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n" @@ -1396,7 +1397,8 @@ repeat: sort_order = sort_tmp; } - 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) @@ -1475,6 +1477,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;