Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3516464pxf; Mon, 15 Mar 2021 11:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY21VjXxDZ5+WhtkdWcayf7aWF3OLqQuKbG3dOijbiY6qE/FmcDtnsYpKVqjpwSWINsDn/ X-Received: by 2002:a17:906:4015:: with SMTP id v21mr26104606ejj.433.1615832203984; Mon, 15 Mar 2021 11:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832203; cv=none; d=google.com; s=arc-20160816; b=U98WjxrB6KMdU4gdcGP/TQyccT09n9S73NZluC0NgXB2w0fMGUAWIm7i7t8gcuuZay kI4MJ9K5Y+R7UBpxxH8GAEmWARyW/V03Rt8o1NiKK3hrZyv/cY+TJThKxFTPPWUfnX5e Vi7ANn26GawVYifigzrY9ux3uJPgUc/B5o7CuWAT1pyMannMZDLJKrsbfm0FrBlM+RzJ NoZuPmWylXeSf66tDuvEtnaafW3ddjuRoRpjzA3+RGtPhQTWJk7qiVv/wu7SKbuujTkk dr8MbazCdAFsjkZ9mRG5LvYFCSObQoY+5IcHF6J384I7BIUa8Ul0b7V4diVdNpZLw8VZ 5FbQ== 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=tdftpqjSLyWfpENBO0OxEUoZK99I0UmAA1iGEdqvLMA=; b=s6a6Oq8xjA96Vz3I1ODRBogDOuqsky514/cA1GrBs5f2Njkq9XA6nzM5m8mFrRn5na B1qRh2PCDyKcuTUW46Zsy0pWo4ain5DXrnAaXLbTjFoD5LTyADsL80pHr/1fkutrPvCZ eV5jWc26KlpTvWCs4By/35Lh03Tfj/Wp7ARvHwvxnY7vLfq1cRZZSkeiXpYl0ZCz8PG2 MDkjLAfNBxozSlxGEa7XG8JZ0ciB62Iyl3L5LJ6jdp08Ta16dO3qF/HuqRmJe9CAWCv1 lyRj/ihnpUcIAyHcTN7qbmNBwoeXn/18LyJalHY9/I8OSC1+86aqrVwFw81c0SevpstH xgYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Z1858jc/"; 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 ho7si10963988ejc.686.2021.03.15.11.16.21; Mon, 15 Mar 2021 11:16:43 -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="Z1858jc/"; 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 S236838AbhCOOPs (ORCPT + 99 others); Mon, 15 Mar 2021 10:15:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232482AbhCON66 (ORCPT ); Mon, 15 Mar 2021 09:58:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF81564F44; Mon, 15 Mar 2021 13:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816720; bh=RAhO4+QJnKn5fUdmktY/OvMRVJhUWkG2JgXMSuntQGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z1858jc/DH6hWrccp9CIdWETrilC/ziNzajqoVgs51KXlng28GlZVTQV4qkjk0tNg 8TnDvl9pTQdlpuuUG1qmrCTz1y0swiobxbbjy2WI7bS3JL2cazD5mO1xYCLFBuL/Ub VZlNWju51yWG9+Cb8nw0flbSNuWA3us4ZLLeUozA= 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.10 074/290] perf report: Fix -F for branch & mem modes Date: Mon, 15 Mar 2021 14:52:47 +0100 Message-Id: <20210315135544.414893543@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -3003,7 +3003,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); @@ -3015,7 +3015,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);