Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3517017pxf; Mon, 15 Mar 2021 11:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybKvj3S0iUtUhGMDZIMdc5Ha3++pGh3xdHkT5x6mGMxYJ7AQIrJV6XsV4lQ3ozTvDkcWf1 X-Received: by 2002:a17:906:5ad2:: with SMTP id x18mr19320845ejs.117.1615832254223; Mon, 15 Mar 2021 11:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832254; cv=none; d=google.com; s=arc-20160816; b=oE9+dnoT1R/3vUKwdf3dVCmvgtdCzbl6O8MRrtNR0Kfvl2HFuBp8Mu9QbXFwtq5Q5p lt1+iIOSkvZ7B+5Whc1L8tbGll6bknxGV909+uHY0OnDNF15De/W0WZrDKh+02toUgiY urg0jmV0LvFtgUuXOSrzEwyg9c38sOUxh3KnZlijyfqpyW7VLRgApQsoqmwGfj9FyoyP eoINdowyKLJNKR7ZjR+9XDuk577mjjrwo6Ll2z5K7zixCnCL2y/gOr4pprUEc1SDWRLv kfMvYkkv8XEkotApCj5Ws8+zLZFcBs/AlT29t/UU0H5wjgDBgn4jKTyUjBczpzbXETbC TwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4LmYtlZ7oCCaBxjYgPN7THqUH1HaV93fXoYokSITMc4=; b=ncWt5bWRz+X51IeMDtwABxChPSFzRbHMbAtq4aHwhl9o++4q+w8CHMShPkbxz5oNBq Db9iSgVwnoFQ17KvZ1b8bHFcLZ9ZL/jf8XklfG9xY/vC81dJmwCIdvNAjHC0l+Mo7cte du1e2eJZLhcsTdDQKtYjAk6tIxkxkQNqJPdT4S5dVIQ7RwQAgFa9i28Z59hWsH/7k3dU DbI09dmF1egyWFrA0/1B//pGyE62KEBnVkB+moT+jWS71Z1stBiQm2YHXczXLplUUzVE Ll+QsnRZV4ROROG+qm7uEbARzjKK+cBSvJIOEOZII6TC1KniSPLyFibiDk3+FuR16qar LRpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EhQYJzcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si11645803ejx.635.2021.03.15.11.17.11; Mon, 15 Mar 2021 11:17:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EhQYJzcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236712AbhCOOPG (ORCPT + 99 others); Mon, 15 Mar 2021 10:15:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbhCON7L (ORCPT ); Mon, 15 Mar 2021 09:59:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77A6764F07; Mon, 15 Mar 2021 13:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816728; bh=tx6MkaTFAnma3YohoT3W1AmIMh/V8kDFYF/eP1fmFSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhQYJzcOr8HbqfMp5X5bQHFQbxNzQ3UOPE9IlCYxqr/dehWQ+fp1lK3bDKL1NCu3o r/EUh8npL+i5sdynYEwqoRlC/L/QLWZlfM/kXUZ3lAFk98RfapbXPLiTsp43KnWkKh WGsbquDdCQmCKa+wj5+FkTVCB0TlPLs31NOVRL6E= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Jajeev , Ravi Bangoria , Arnaldo Carvalho de Melo , Jiri Olsa , Kan Liang , Namhyung Kim Subject: [PATCH 5.11 088/306] perf report: Fix -F for branch & mem modes Date: Mon, 15 Mar 2021 14:52:31 +0100 Message-Id: <20210315135510.620909725@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Ravi Bangoria commit 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf upstream. perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it. Before patch: $ perf record -b $ perf report -b -F +srcline_from --stdio Error: Invalid --fields key: `srcline_from' After patch: $ perf report -b -F +srcline_from --stdio # Samples: 8K of event 'cycles' # Event count (approx.): 8784 ... Committer notes: There was an inversion: when looking at branch stack dimensions (keys) it was checking if the sort mode was 'mem', not 'branch'. Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s") Reported-by: Athira Jajeev Signed-off-by: Ravi Bangoria Reviewed-by: Athira Jajeev Tested-by: Arnaldo Carvalho de Melo Tested-by: Athira Jajeev Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/20210304062958.85465-1-ravi.bangoria@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/sort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -3033,7 +3033,7 @@ int output_field_add(struct perf_hpp_lis if (strncasecmp(tok, sd->name, strlen(tok))) continue; - if (sort__mode != SORT_MODE__MEMORY) + if (sort__mode != SORT_MODE__BRANCH) return -EINVAL; return __sort_dimension__add_output(list, sd); @@ -3045,7 +3045,7 @@ int output_field_add(struct perf_hpp_lis if (strncasecmp(tok, sd->name, strlen(tok))) continue; - if (sort__mode != SORT_MODE__BRANCH) + if (sort__mode != SORT_MODE__MEMORY) return -EINVAL; return __sort_dimension__add_output(list, sd);