Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp369890lqo; Wed, 8 May 2024 02:15:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXaW3NgMvgwnIUY7hC78+qhMJd9js+mxlehICVojL0y9pmVgN+2lCb+m73gG/feTJiS2Hzg2wi+lPSDcZ1CfWXR2eCNvLI6cB4e/c6U/A== X-Google-Smtp-Source: AGHT+IERkljQaQNgoKkqYU23S1ATJol5fnh0sg89Jc9vO69Fmmf0wEdMzI4wuNwX9kKQbSJok5lN X-Received: by 2002:a05:6808:b2f:b0:3c8:49e3:c0f1 with SMTP id 5614622812f47-3c9852944fcmr2022757b6e.5.1715159739881; Wed, 08 May 2024 02:15:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715159739; cv=pass; d=google.com; s=arc-20160816; b=GznKs65t8FJXNcL0Rjv+ZpY71IEfuWEHhuIpz7bum89bojZXZJB7aZiktzkZvAuqnC AZRSywyM5GV4PgUpok/CPlpo1evBVf6TjmsfrVSfhfr+zzDNSJcyvs1RLopzONvGhdUU rYQWhImqRFraiczu99Ag/CKfIoqFcV6+4nopx81TOP0lmzlbw3xBRNMTxWrIIbNJ3ApN +HxryrPQ/ysv//RRh0h0UNIOd3Buyusl1Z4vt1g0t2RaroMtgNskOVN0Yyp4egPysXaW WySSbjhPft9KGB+4h4ChEN+SWgdKHk0U43l7RWLrDilaOI/nWZHtYb6YfFGHbGwM8fyU zcWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:content-language :references:cc:to:subject:from:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=vk48eu0Xo/UBKu+9Xz0cZZUY4zbOrqjxHfp3u11IDM4=; fh=EG+XtYGbjymptjd85g4FnDwBMGC2xCrqkPwy4brnQYA=; b=Ho3X0EqXChGJInbY7+PWU8LDOiUH9otUHGSC5xksYStbMdhoUGHuSnzcjxdSxoefgP oweoz8ud4FzrMRZQu/jtJkkWmMUGeO4ZarMLf+R+FuoP7dosJYCaOPwILZ4AlwPZBFAu EBWdpjNoN55webyVavk41j9cSGtYs4oyEw3Dk5gDDIU4sxhRBN0oJEpkXUlaTNIvLvB2 FQXgplqsFuWRkZIJyTXkWdeSQfnKabkgXA1Ibot2wK1hNUkwl/prMlBigR1FWG6VxH6c vDjwTr2lqtQW7B1vuEVGv4ZXlLTdT5fzvrOMDD0RmRduC0PIw5e1ghl3MnT8XkX6kDzT gISg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-172965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u28-20020a05620a085c00b00792ad92f825si2332197qku.96.2024.05.08.02.15.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 02:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172965-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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-172965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 964561C211A2 for ; Wed, 8 May 2024 09:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55D6574419; Wed, 8 May 2024 09:15:33 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 858CE7442E; Wed, 8 May 2024 09:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715159732; cv=none; b=aPrVYfbOynnD1CXMo04BkcirwIB3n40+oaofBe620pUHu9OmUDsm4Lvt+2saeGJcxDN5YnvKSyYqGyoIZeIHvLRYUb6tXpNvPh9pUnlgGpBOrWEU0k5Ycp2s1A7n5Lyc/NEqGXgSONTaZJR5w/5Fi/1S62tKwc5Fsz7Etm9Hx10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715159732; c=relaxed/simple; bh=2U+lQYBT9fkEJIVjOh9dsby6cdeI9wj4uLu2lvfSCAU=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=i0OlHxrbP8ixXX0qoWvfrYD4pP0ODtkx5veB7trwkq6+GX0HAnUjAcJQR73O7zO/iM6FmeC2uN7g9232Pnp6nyJSbbLCPwz/YwMN4WkiH2oSca6O5PbCOhqUkv1NlMb0dc4hQrpiKq2cwQI0nqAlEN5ib0NCYYqBpvPJgUlkHW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A568A1063; Wed, 8 May 2024 02:15:54 -0700 (PDT) Received: from [10.57.34.44] (unknown [10.57.34.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 648CC3F6A8; Wed, 8 May 2024 02:15:27 -0700 (PDT) Message-ID: Date: Wed, 8 May 2024 10:15:24 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Nick Forrington Subject: Re: [PATCH v2 1/1] perf lock info: Display both map and thread by default To: Namhyung Kim Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" References: <20240502091446.3037-1-nick.forrington@arm.com> <20240502091446.3037-2-nick.forrington@arm.com> Content-Language: en-US Organization: Arm In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 02/05/2024 19:32, Namhyung Kim wrote: > Hello, > > On Thu, May 2, 2024 at 2:15 AM Nick Forrington wrote: >> Change "perf lock info" argument handling to: >> >> Display both map and thread info (rather than an error) when neither are >> specified. >> >> Display both map and thread info (rather than just thread info) when >> both are requested. >> >> Signed-off-by: Nick Forrington >> --- >> tools/perf/Documentation/perf-lock.txt | 4 ++-- >> tools/perf/builtin-lock.c | 22 +++++++++++++++++----- >> 2 files changed, 19 insertions(+), 7 deletions(-) >> >> diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt >> index f5938d616d75..57a940399de0 100644 >> --- a/tools/perf/Documentation/perf-lock.txt >> +++ b/tools/perf/Documentation/perf-lock.txt >> @@ -111,11 +111,11 @@ INFO OPTIONS >> >> -t:: >> --threads:: >> - dump thread list in perf.data >> + dump only the thread list in perf.data >> >> -m:: >> --map:: >> - dump map of lock instances (address:name table) >> + dump only the map of lock instances (address:name table) > But your change allows both thread and map info to be printed, right? Yes >> CONTENTION OPTIONS >> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c >> index 230461280e45..86c68c39aac0 100644 >> --- a/tools/perf/builtin-lock.c >> +++ b/tools/perf/builtin-lock.c >> @@ -1483,11 +1483,16 @@ static int dump_info(void) >> >> if (info_threads) >> dump_threads(); >> - else if (info_map) >> + >> + if (info_map) { >> + if (info_threads) >> + fputc('\n', lock_output); >> dump_map(); >> - else { >> + } >> + >> + if (!info_threads && !info_map) { >> rc = -1; >> - pr_err("Unknown type of information\n"); >> + pr_err("No lock info specified\n"); >> } > I guess you made this condition impossible. Yes. (I kept/updated the error handling for potential future errors) >> return rc; >> @@ -2578,9 +2583,9 @@ int cmd_lock(int argc, const char **argv) >> >> const struct option info_options[] = { >> OPT_BOOLEAN('t', "threads", &info_threads, >> - "dump thread list in perf.data"), >> + "dump only the thread list in perf.data"), >> OPT_BOOLEAN('m', "map", &info_map, >> - "map of lock instances (address:name table)"), >> + "dump only the map of lock instances (address:name table)"), > Ditto, I think we can drop the 'only' part. Ok, I'll submit a new version with this removed > Thanks, > Namhyung > > >> OPT_PARENT(lock_options) >> }; >> >> @@ -2694,6 +2699,13 @@ int cmd_lock(int argc, const char **argv) >> if (argc) >> usage_with_options(info_usage, info_options); >> } >> + >> + /* If neither threads nor map requested, display both */ >> + if (!info_threads && !info_map) { >> + info_threads = true; >> + info_map = true; >> + } >> + >> /* recycling report_lock_ops */ >> trace_handler = &report_lock_ops; >> rc = __cmd_report(true); >> -- >> 2.44.0 >> >>