Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2291823lqo; Mon, 13 May 2024 13:45:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqDyTGuKJsBfeULogybylTmetzAkwKv30JzfijZnJljSrhRmIn4oFpQllESt3hv6WFBWP2GKWz6ajZR88XfeGVDMeC4MWm9Tpp58VmMQ== X-Google-Smtp-Source: AGHT+IEHu0IcSMEmMRDQET9ilFWvrYS8I4yMC43O17KtP2UNX8/qegugfstTmfA9ujtPEtND6kq7 X-Received: by 2002:a17:906:7c91:b0:a59:ad47:756f with SMTP id a640c23a62f3a-a5a2d6756e3mr739509266b.74.1715633119038; Mon, 13 May 2024 13:45:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715633119; cv=pass; d=google.com; s=arc-20160816; b=hGQUPYePXAd9rY4oPphf3akAMkx68HN/F7LWfOk+Z0IZPAJ7MXDmmaHN5cEyaA1Qp0 h0Mqk1cWD0Ch/oTDFqDWpW7ojsvxv0bErHB2Fhg64SQ36aTjH4SW88ETEByJAKCcqYh6 9CWy5MJta/fsj7mZUxWe5CILySgaoSVRcP+jsNLaOUX/rjR7KOmbppejE1XLSAWm5UkT CbXSn1Dz/Cp1IPln54qN0Lu/Zb2+hv1ZO89SJ5EOeI7w5AfBC+ajckMYsiG2JuV14GQP uq/35zMNpEKax+S1dIttfCRXiuhRgUcJ/2McWNmwE8OWvbK9Of0il+0KrrHtMKFGMVXc s/yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=ZN5aHmJD+8Qc+VF/qva9+v6a6gaT9BFTUwi3zjLZGzs=; fh=vdCEF5X+N54LsWnWcEjDZHgf8Ft43ibvy8+Ddx+X0wE=; b=LhIh4bebZtuqu/4VYPjHzsLywGYSexrodYdxjfyth2zbnp8oNIDIejlnSCe0D0KCKP WfxdtyiZITN5U8U78TUYLNwJmO+hxji6dGhtGWGF6Lv8nQ+HCbE9Xn1fYqfOHZH2XYBo rqUx11XDT25N0GXlFBe33AmW7R7khmc0nnBtVAYrxrnWB1YvKpkBytSp5/Dg8YRCQVNy H/LiPRaOct1sKMpiHLe6AIrJE70LCGvQpE43hUvfIN0hzvPLJXbGfzTu99KJbQnnD1vH B5Hu5gfeqnBw5pon6c3DD+gTFUoyPtcC3II5KxpJdx2s8ONHndxrAZWLYVSmrxI6WnV7 dDFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178082-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2bcb4si519833166b.920.2024.05.13.13.45.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 13:45:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178082-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 96ED31F221B4 for ; Mon, 13 May 2024 20:45:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 516F381720; Mon, 13 May 2024 20:45:10 +0000 (UTC) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BAF93A1A2; Mon, 13 May 2024 20:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633109; cv=none; b=pkOjSuCn+rHBi3ypo8w82QMh0jdGI987XjKDqIWBcvL4GAFs0oPOHsbFlE9O4JtnistcqvCT79z0zj8Cb3yVszR9knzR08axFFKUI1ZNHtQQRXjzlmPZV/ZXG7SRqutBGepxQMFl3bphLvGH6PFJAa/V1+rP4oCvfDmYkK1BI+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633109; c=relaxed/simple; bh=aF/Pllhk6I653hcEia2iO8Yd+UqBm6WptITdg6zZZkE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=at9uQW4Q1UsyvtSpGPKRR2+obfuv0BkUMup4+VdHoKsONsGkvfjryz00ojxntq1DiuVyz2MCavkdi38SPnYA6rg7kCT21enW67U2K1DdECdWvOYUbe3q0RYCSmTX+lKqLvX+5CBZg0lqYY3GShbMYh+yNq0zJnU+EgVu0jkzZqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-61be599ab77so2161971a12.1; Mon, 13 May 2024 13:45:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715633107; x=1716237907; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZN5aHmJD+8Qc+VF/qva9+v6a6gaT9BFTUwi3zjLZGzs=; b=xIl6IjR7vtRDuVjSJbzHsDPW3v1B6kgS5XzKTzBa0oh7XM2HSojTK+OuNul97aeTSE Lr1klIo64cUSC/rGzyyW0vnBJRoVmru4zaKQ6cR/awjjmv1JxvqRTeJnZTrpC80LYttf At/yrifuMfaTrVEV7MT9hQvHDz+hj0bf/w4YnDqs8w9xEvhrTmbtAwR6WgU7N3t2j5qk PirW7MAqVWOrOXMsRumq2uQ5jXVHLEWs1D09TxlWkzdqJKyTj8paAtCyRfaLX2FibitT kPmuFecKLTPcQWFZ4nRNrHUrkHmprgPBqxIURh6z3VBvhbifgD+MQHBQqAXiugonw+fO m6/A== X-Forwarded-Encrypted: i=1; AJvYcCW22109sZppNdHub9G18sf4tCsM7t2yB2QiuDPycYB7VohZWwQx1BpezRZoAQYZkbBqTveIt41S/AHeh9z9oFn+7RLyLYICVPMRffUx0GbqXHnFjsb6GTsvfLFGxN8Au0qPYVbvov+F30YuNu5XQA== X-Gm-Message-State: AOJu0YygS2uctlZ8ab1JWrvaxPSrS0y9JPtLcJkzRNC+JjbM3wYEFj+y 2WXxnADyWDLxTvd+nLflR1INHhsz9SM3By001Q854/71Oud9ebun X-Received: by 2002:a05:6a20:dd9e:b0:1af:d19b:a78 with SMTP id adf61e73a8af0-1afde0b7245mr9666032637.13.1715633107502; Mon, 13 May 2024 13:45:07 -0700 (PDT) Received: from gmail.com ([50.204.89.32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2b62886b669sm10170490a91.24.2024.05.13.13.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 13:45:07 -0700 (PDT) Date: Mon, 13 May 2024 21:45:05 +0100 From: Breno Leitao To: Ian Rogers Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , leit@meta.com, "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:PERFORMANCE EVENTS SUBSYSTEM" Subject: Re: [PATCH] perf list: Fix the --no-desc option Message-ID: References: <20240508133518.3204221-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, May 13, 2024 at 10:13:01AM -0700, Ian Rogers wrote: > On Mon, May 13, 2024 at 10:08 AM Breno Leitao wrote: > > On Sat, May 11, 2024 at 02:25:53PM -0300, Arnaldo Carvalho de Melo wrote: > > > Thanks for asking the question, I'm dropping the patch, Breno, can you > > > try again? > > > > Sure, let me think about it and send a v2. > > Thanks Breno! My bug, thanks for digging into this. How about something like this: Author: Breno Leitao Date: Wed May 8 06:35:17 2024 -0700 perf list: Fix the --no-desc option Currently, the --no-desc option in perf list isn't functioning as intended. This issue arises from the overwriting of struct option->desc with the opposite value of struct option->long_desc. Consequently, whatever parse_options() returns at struct option->desc gets overridden later, rendering the --desc or --no-desc arguments ineffective. To resolve this, set ->desc as true by default and allow parse_options() to adjust it accordingly. This adjustment will fix the --no-desc option while preserving the functionality of the other parameters. Signed-off-by: Breno Leitao diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index e27a1b1288c2..16186acdd301 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -149,7 +149,11 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi } else fputc('\n', fp); - if (desc && print_state->desc) { + if (long_desc && print_state->long_desc) { + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, long_desc, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); + } else if (desc && print_state->desc) { char *desc_with_unit = NULL; int desc_len = -1; @@ -165,12 +169,6 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi fprintf(fp, "]\n"); free(desc_with_unit); } - long_desc = long_desc ?: desc; - if (long_desc && print_state->long_desc) { - fprintf(fp, "%*s", 8, "["); - wordwrap(fp, long_desc, 8, pager_get_columns(), 0); - fprintf(fp, "]\n"); - } if (print_state->detailed && encoding_desc) { fprintf(fp, "%*s", 8, ""); @@ -484,6 +482,7 @@ int cmd_list(int argc, const char **argv) int i, ret = 0; struct print_state default_ps = { .fp = stdout, + .desc = true, }; struct print_state json_ps = { .fp = stdout, @@ -556,7 +555,6 @@ int cmd_list(int argc, const char **argv) }; ps = &json_ps; } else { - default_ps.desc = !default_ps.long_desc; default_ps.last_topic = strdup(""); assert(default_ps.last_topic); default_ps.visited_metrics = strlist__new(NULL, NULL);