Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp761259lqp; Wed, 22 May 2024 21:24:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKbEhjbnOA9M9liysqhcyG5/5ewW6Kupk6mFuzk1M1YBiJv6y8sNdkVP/+E2Tc6Iu91bqDwuzpyKCVJ0Az0eFjAHGaz8kQXWiLZgmzyg== X-Google-Smtp-Source: AGHT+IHHBtYnnPzFQmbJXm6NwAEV+ibccHDqUa0wckIeeJNm42i5UJCBW6+h4p4r4wMAMjp7Vark X-Received: by 2002:a17:902:dac7:b0:1f3:61c:30a2 with SMTP id d9443c01a7336-1f31c96530bmr46869775ad.2.1716438241217; Wed, 22 May 2024 21:24:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716438241; cv=pass; d=google.com; s=arc-20160816; b=LrRES0nI2v4gxohVCWqlczpBKH4PBliA3wG49Q2Qfm/PLokx2gesqmSV+J5n1O04iM RITh4IrVKgXqPckKoyCaxLYCFu5g1V8Nbpkycb68pmVe/hPvYbqZH6QIePMn3zJHOsZt EmiwVX2BzI9GOrzrbVDGJyKGUS0afP4bMttDs7N4ocz9ekKa4CbyVzDNpVfP21SYXlYi vA9C8JV1Lj2a/Gtc8J7PaIJ/64uhBhhiFPsUAzuxYLSFGe9s74WOnrInRJ90zhvc8Lm5 SIYcuHg+cajALkBA1/Dxu5JvhYkbtbF4VvZHx9kZ91ZyyOskwX4qtPK44HFvw0i0RIMn UhMA== 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; bh=2nbTyY0YiKMIFTBvGT1E/XGxZ2k7LnuzSV4xdZ3Jw7c=; fh=Gz8yIdazYFk/KZKtPMZ9srAP6iucmIylPsbz1jWkFg4=; b=jKmmUIjyS95a1YbrN5BsFw93k4XWlRFB+vx98BD8iYZ58UeiFM2zsoWUgAKV0y46/A Rcmpz3TPCSHy8/cQrmTH5fowlTp9hjyAOBh9ZcZQOj7ki+Qu8l7foHlwB9EPqRhl0L7c GPbsJz0RbCZzmpQbQetf7IG6KdSYCTgWCOMG+6Z2e7r7nW1v5435IJSVZGb4ZUhZiG5N f40tfOuJPskkwprgSbIImb9HeUrNVyKuSShpBFzGMAIsY9uAPh9oIppMVrQJ7vYGBGgP AKE31j3FoXkRoBhUZMOAwDPtLaIOXHqwcVm23reyx9vVB+MCt2IIfUnDWVSvjkxjmjTn Xsgw==; 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-186971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f308de8ba7si44810755ad.616.2024.05.22.21.24.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 21:24:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6D4E128369B for ; Thu, 23 May 2024 04:23:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FD9E13AA37; Thu, 23 May 2024 04:23:44 +0000 (UTC) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 A678A8249A; Thu, 23 May 2024 04:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716438224; cv=none; b=qru4aL7FhkkE3JSFqJF8CwjFBGgXPlwE5XaEQgy9CxDKdLQUQK5lSrJKl5KG7tiBPXXBF1gZpyZgRRnJ74pQbrMrJmixDU9qgx5js8PEu5mcDdFGwJcro5K1PLxuUllLR0n3eTqrTSnb9uSsU0S3RNGPueAbXAn8EjOkf2DCcaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716438224; c=relaxed/simple; bh=G+Qbunxj/8AnnJWdmaF3UXDeltlfHoJSxjwp7hvWXp4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TmoDJFJaU7j+q0vK1cthcSRK86giLBBWpJRsvnioXx+XiSsibdkTxyRI5xcDv86Xk+okgx8+vRZ6Q66LRm/CkfEu+l/tqvIyL0he6kxkRuwIga70NpsTgRrB41/b40t9mi7sOXegE6fiaky2FFcmT97oAhzd48rYkS09KN8hwUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6f467fb2e66so3133829b3a.1; Wed, 22 May 2024 21:23:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716438222; x=1717043022; 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=2nbTyY0YiKMIFTBvGT1E/XGxZ2k7LnuzSV4xdZ3Jw7c=; b=tUZWfJfHZQfGJCOxbtr955et9E/F64wOEOow4joWTjC678tzT0xF9LR1tuhT6kQD2e qG+IzwNHEYw/nNb0EUXvLjwLMKXFS04RscEe+MUiR0GWPGt2nlHemP/oND73Xg1IWgGb 41qCMUWkQFFi+0QCeZf1QMhfP1X6otyjGPGPB+ZV3P9DgncqPCNFiMd1ZoVDy57P6wbD boLQxfco0nfDTLEVfrS62q+Kap0KLEgZVX4OwxLzxQiJ0WKPm0+8VxNPA3Vs/SWFxPp2 ekcRKpDYoNbDvnC0WRlo+OgkzGoPJVF7S9igvwyhZrHvxK5VGLHqhKdDLY32zr/k1FZA 674g== X-Forwarded-Encrypted: i=1; AJvYcCUVuRZ+U7dxNlYsjf90FJgI8ms99cQZAOJJieiPcaiXiuC/O7T9OjgFaTVlEqVImb6S9bOvxCSUGW5iJZu6mUp0poOkYjGRWdhNrMT17Y57vPKmWXL8uLSXW72pzvnuc+r4Bp2kKfP5AQ0X9Sq5UA== X-Gm-Message-State: AOJu0YyCMZ1dbQ/iOirGr6dlQN3hSJXTHVprda7cN0ZFGv5nS1+lUx0q ugXcdTPWJp83Dw3opyGBuRyrD44mTT40xMYBnmiqjqcBW2WY21pw1B75ljb67aOO0MATTsSdT9h CVUnSQglbs8rmJsiJt+tpVQdzqRQ= X-Received: by 2002:a05:6a20:2586:b0:1b0:1bae:6a8c with SMTP id adf61e73a8af0-1b1f87923admr4529877637.21.1716438221948; Wed, 22 May 2024 21:23:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240515195252.75909-1-yskelg@gmail.com> In-Reply-To: <20240515195252.75909-1-yskelg@gmail.com> From: Namhyung Kim Date: Wed, 22 May 2024 21:23:30 -0700 Message-ID: Subject: Re: [PATCH] buitin-kvm: Update cmd_kvm() to check perf_host value To: yskelg@gmail.com Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Austin Kim , shjy180909@gmail.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, On Wed, May 15, 2024 at 12:54=E2=80=AFPM wrote: > > From: Yunseong Kim > > According to perf-kvm.txt, the default operation is --guest, meaning > perf_host should be set to false and perf_guest to true. Currently, > the incorrect usage of --no-host and --no-guest still results in > the default --guest operation. Hmm, right.. This is not good. > > This patch updates the usage messages to include the --no-guest option > for those who only want host data, as well as the --no-host and > --no-guest case. I'm not sure if it's worth mentioning the host-only use case which is not expected for this command. I think it's enough to warn the no-host and no-guest use cases. > > Signed-off-by: Yunseong Kim > --- > tools/perf/builtin-kvm.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c > index 71165036e4ca..654a07658cdd 100644 > --- a/tools/perf/builtin-kvm.c > +++ b/tools/perf/builtin-kvm.c > @@ -2129,7 +2129,7 @@ int cmd_kvm(int argc, const char **argv) > OPT_BOOLEAN(0, "guest", &perf_guest, > "Collect guest os data"), > OPT_BOOLEAN(0, "host", &perf_host, > - "Collect host os data"), > + "Collect host os data. Host only with --host -= -no-guest"), > OPT_STRING(0, "guestmount", &symbol_conf.guestmount, "dir= ectory", > "guest mount directory under which every guest= os" > " instance has a subdir"), > @@ -2150,16 +2150,23 @@ int cmd_kvm(int argc, const char **argv) > "buildid-list", "stat", N= ULL }; > const char *kvm_usage[] =3D { NULL, NULL }; > > - perf_host =3D 0; > - perf_guest =3D 1; > + /* > + * tools/perf/Documentation/perf-kvm.txt > + * > + * Default('') -> perf.data.guest > + * --host -> perf.data.kvm > + * --guest -> perf.data.guest > + * --host --guest -> perf.data.kvm > + * --host --no-guest -> perf.data.host > + */ > + perf_host =3D false; > + perf_guest =3D true; Probably not needed. > > argc =3D parse_options_subcommand(argc, argv, kvm_options, kvm_su= bcommands, kvm_usage, > PARSE_OPT_STOP_AT_NON_OPTION); > - if (!argc) > + if (!argc || (!perf_host && !perf_guest)) > usage_with_options(kvm_usage, kvm_options); > > - if (!perf_host) > - perf_guest =3D 1; Instead of showing the whole usage, I think it's better to print a specific message for this case. Oh, I've realized that we have 'h' modifier for hypervisors (on ARM64?) Then maybe no-host + no-guest is a valid combination. Probably we need to add --hypervisor option then. Thanks, Namhyung > > if (!file_name) { > file_name =3D get_filename_for_perf_kvm(); > -- > 2.34.1 >