Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2297567lqo; Mon, 13 May 2024 13:59:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVys6zKejnkh1rCmjXBrlGHHZ8j6IheL0XTOh7xRXrX80T9ZOJEcxrp3uVE/RDBlXMyDAcA008HoW5C5aNne0zE3Gsj5VBtK5wmHCyoaQ== X-Google-Smtp-Source: AGHT+IEWXki5lzmcOSAYuH1dDb+pGB9qhlV8l/rGZLLaS6fHU6F45sM1NEnDsEHs5wdhAUkOf9ez X-Received: by 2002:a05:6214:5908:b0:6a0:d581:921f with SMTP id 6a1803df08f44-6a168210be5mr133836726d6.42.1715633992786; Mon, 13 May 2024 13:59:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715633992; cv=pass; d=google.com; s=arc-20160816; b=RpEDl05+guXPSMKIvsKUY8uPU7EUlyzPf9GgFs2Rb91G9DOsr6d79khmqHYqzbq5H5 2RBeCIViGgBRc2rH8+Nqfgf5YB3DXU7D02rKojMNNfnP7KvawiG1Jnh79LWLj0BaxbxA vuP3pq5mwbRfACkUj2iucBZ0/8Yyew+O02FaoOtCkHw2VvcFp4tlUHELLfa54AavNF+/ NvodbtCwvmcMX+W5pwwIH1p+vjhhXCPVcxZPj24MDbUJrK0l98bXrfqqWfJdKrkBbmlW Foe340e1Va+zSCnVnirRCDqCJ3msOPOfDsgN63NmA0JW0762V+zpTmq7UvFAjfN6i3ov FJ8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=9fxgwVwfcFfwC3FeF4jyUDShyy0fu5SAPtgvle3ae2Y=; fh=llwdMnD2hbswDXUHWdihTsfBulURhu/u3ZZblYgO0jw=; b=CUAFZJO0nEfca+n9G6dJusDMtfTJY+M7q3Rd6PU5sWMWim92Xp0VT8qRxt/Zfnuhe3 Bxgyxdwg+sItBGVXCYkqkNKJI4r+IZ7cVwytZOn1FDRNq5vdgxh+n96q01dtrYFTw7Im ECvoD3pvWeQ/xTggZq3n2vxlkUXHbEYCo7qGtulCf4VKPZnbJklYd92FUBAmxvOHV3Lt TmHNPzIVx5qgf+D0dC2EGaa3iwBFh7d64ahQOWu7hyUY9uBFHMRNDVLahaDkp6HAVYH/ Jq30ULRP+1JFkyXLcpyIA4ZLHRUIFtYxHTFqcAjVzraVHG+autj0H3lLqMubk9k1Hg18 n+7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Qde6JNI5; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a8fasi105271946d6.278.2024.05.13.13.59.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 13:59:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Qde6JNI5; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 774351C20EC6 for ; Mon, 13 May 2024 20:59:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C09B81AD2; Mon, 13 May 2024 20:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Qde6JNI5" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 E1B6980BE3 for ; Mon, 13 May 2024 20:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633984; cv=none; b=Lq/Di+3pWFArdMhAftPblxUNjdFWhu+rap0sJqTOWFw7sez6Nx4b9lv6wG7u/7djYq+tF2tk0Nf2oehUq9lCiDUZVKBkLI+EYR0XE4v8OYrgTi3e5zy+rPGBUrEU6kVaSyMNqU6vd/ecIQQJU55fk7DlfuvCKBCSntveG3S5/Lc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633984; c=relaxed/simple; bh=4wo2azftFf1AIjEsDAwA4hFFTnEjmQzUBAW7KDvwLWo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=IuRnzThS9XABvjbLX2qzLce5KyALpKuJwKzjn1I7M7ck8G/OrmZh2QPix3WkBXC34WqTgp5Ha/wuX1D03FdrqqhwgjKMC1x0v/ML0BPTAyuOM47Vqwp5IbCsmBGi3smseait1ITL/MMpWKRya+FwBV4L8hp94Dw8CHQhyQ1G+nc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Qde6JNI5; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1eed90a926fso357145ad.0 for ; Mon, 13 May 2024 13:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715633982; x=1716238782; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9fxgwVwfcFfwC3FeF4jyUDShyy0fu5SAPtgvle3ae2Y=; b=Qde6JNI5l75mLlMq0h4/tKtqSsacECJW7j6biT0K4JsxzRZBjg45dv+9dIHvbdrePW 5WUMfHBCj0j00LN7qTPn5BDsf500uP0DdJh1ETC8CmNRalyVRHRkb9q6MrhH5RbO6VXb kOzXYz6ZN3/J7nhlBqwiqtQsgLDSnLOcdSayw70mna7e/wJs2kSJ2eOvC8U8n3em6hjr ducaUsVwX2M3W0vG+x/0Sy9OgXglvz5cekIBePumy6y9BmXZiGUFZyrmSo/W3cbKdHy9 917GCy10/jiPe/mKv4zXlw3XXoAJfGL3DlQJy0U+rK7qmH2f7WKCA+ONiEOVUgyHD9Wg l/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715633982; x=1716238782; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9fxgwVwfcFfwC3FeF4jyUDShyy0fu5SAPtgvle3ae2Y=; b=U57RNcthapyjs/yq43DopSV5r4Bm/Oy2H2qB5GdRRKhw1UJvzqXr54H2r+LtFzKLtr uzKXULBk1w4zMQ+tfr7v/0okKHsGqx0q1mONdv4Y6BKWlYx4Oxm0igyp/PrQxrnbzy2y Egjy9dvfKKfdqVbu3uztWlqj25DR+gCTnG6yTmRJ9IEqKPIwi2wMHveP77lUtYfxrtze 4j5USY+GT2M5vdGd/aEvFFPIhS+uB9n52hNTGGlA4Ntfd0pR26oDmlbVSU82CQJTW4Jp ggIwcCPmQzKeU2WyV4P1MF/OOtm4P5JYCnvSzdh0lmRPnWrB2JS0dpGXKyPFS45VXEyE XG7A== X-Forwarded-Encrypted: i=1; AJvYcCVVndkVtB5Vl+qV85dkJzdGqG6RXHLiLu4hVK4T71npV5BDnxWkfusWvSZoFy63FPnv7qWmECyjRjJolsXMBM1yBfOI5n8T7HcQb/F8 X-Gm-Message-State: AOJu0YxGcbDbYxNC4g92nbMH+dQrurgddxxKmiHrrjrtI0FI5xEtRGN1 zmKGb+sg/nUtKp6ZqHV8nkM980q7RSk3ovkoHCdmDmz7h2WTElLnHlYtN5/orSLUstDWa6pr5oe IweZuIxMMTs0oTTC3+vCbkXZTCnDqqdddErcF X-Received: by 2002:a17:902:d4c6:b0:1e8:88b2:17cd with SMTP id d9443c01a7336-1f05f651484mr4698595ad.12.1715633981812; Mon, 13 May 2024 13:59:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240508133518.3204221-1-leitao@debian.org> In-Reply-To: From: Ian Rogers Date: Mon, 13 May 2024 13:59:30 -0700 Message-ID: Subject: Re: [PATCH] perf list: Fix the --no-desc option To: Breno Leitao 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 13, 2024 at 1:45=E2=80=AFPM Breno Leitao wr= ote: > > On Mon, May 13, 2024 at 10:13:01AM -0700, Ian Rogers wrote: > > On Mon, May 13, 2024 at 10:08=E2=80=AFAM Breno Leitao wrote: > > > On Sat, May 11, 2024 at 02:25:53PM -0300, Arnaldo Carvalho de Melo wr= ote: > > > > 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: Looks good, could you send as a v2 and I can test. Thanks, Ian > 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 th= e > 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_option= s() > 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 =3D NULL; > int desc_len =3D -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 =3D 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 =3D 0; > struct print_state default_ps =3D { > .fp =3D stdout, > + .desc =3D true, > }; > struct print_state json_ps =3D { > .fp =3D stdout, > @@ -556,7 +555,6 @@ int cmd_list(int argc, const char **argv) > }; > ps =3D &json_ps; > } else { > - default_ps.desc =3D !default_ps.long_desc; > default_ps.last_topic =3D strdup(""); > assert(default_ps.last_topic); > default_ps.visited_metrics =3D strlist__new(NULL, NULL);