All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: Aditya Bodkhe <adityab1@linux.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kevin Tian <kevin.tian@intel.com>,
	Dapeng Mi <dapeng1.mi@intel.com>
Subject: Re: [PATCH 5/5] perf tools kvm: Use "cycles" to sample guest for "kvm top" on Intel
Date: Wed, 6 Aug 2025 08:31:51 +0800	[thread overview]
Message-ID: <58f01b41-5acb-47d1-a68e-d496d45bb298@linux.intel.com> (raw)
In-Reply-To: <5b4882dc-c90d-409b-8355-45d8b96df93f@linux.ibm.com>


On 8/5/2025 7:32 PM, Aditya Bodkhe wrote:
> On 05/08/25 6:27 am, Mi, Dapeng wrote:
>> On 8/5/2025 8:46 AM, Dapeng Mi wrote:
>>> As same reason with previous patch, use "cyles" instead of "cycles:P"
>>> event by default to sample guest for "perf kvm top" command on Intel
>>> platforms.
>>>
>>> Reported-by: Kevin Tian <kevin.tian@intel.com>
>>> Fixes: 634d36f82517 ("perf record: Just use "cycles:P" as the default event")
>>> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
>>> ---
>>>   tools/perf/builtin-kvm.c | 30 +++++++++++++++++++++++++++++-
>>>   1 file changed, 29 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
>>> index 7e48d2437710..d72b40f3df12 100644
>>> --- a/tools/perf/builtin-kvm.c
>>> +++ b/tools/perf/builtin-kvm.c
>>> @@ -2075,6 +2075,34 @@ __cmd_buildid_list(const char *file_name, int argc, const char **argv)
>>>   	return ret;
>>>   }
>>>   
>>> +static int __cmd_top(int argc, const char **argv)
>>> +{
>>> +	int i = 0, ret;
>>> +	const char **rec_argv;
>>> +
>>> +	/*
>>> +	 * kvm_add_default_arch_event() may add 2 extra options, so
>>> +	 * allocate 2 more pointers in adavance.
>>> +	 */
>>> +	rec_argv = calloc(argc + 2 + 1, sizeof(char *));
>>> +	if (!rec_argv)
>>> +		return -ENOMEM;
>>> +
>>> +	for (i = 0; i < argc; i++)
>>> +		rec_argv[i] = argv[i];
>>> +
>>> +	BUG_ON(i != argc);
>>> +
>>> +	ret = kvm_add_default_arch_event(&i, rec_argv);
>>> +	if (ret)
>>> +		return -EINVAL;
>>> +
>>> +	ret = cmd_top(i, rec_argv);
>>> +	free(rec_argv);
>>> +
>>> +	return ret;
>>> +}
>>> +
>>>   int cmd_kvm(int argc, const char **argv)
>>>   {
>>>   	const char *file_name = NULL;
>>> @@ -2135,7 +2163,7 @@ int cmd_kvm(int argc, const char **argv)
>>>   	else if (strlen(argv[0]) > 2 && strstarts("diff", argv[0]))
>>>   		return cmd_diff(argc, argv);
>>>   	else if (!strcmp(argv[0], "top"))
>>> -		return cmd_top(argc, argv);
>>> +		return __cmd_top(argc, argv);
>>>   	else if (strlen(argv[0]) > 2 && strstarts("buildid-list", argv[0]))
>>>   		return __cmd_buildid_list(file_name, argc, argv);
>>>   #if defined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
>> This patch would impact powerpc platform as well. Base on the comments
>> before kvm_add_default_arch_event() in
>> tools/perf/arch/powerpc/util/kvm-stat.c, I suppose powerpc also needs this
>> change, otherwise "perf kvm top" command can't sample guest records. But I
>> have no any powerpc on my hand, so it's not tested on powerpc platform. Any
>> test on powerpc is appreciated. Thanks.
> I have powerpc systems . I will test can share the results .

Thanks.


>>

      reply	other threads:[~2025-08-06  0:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  0:46 [PATCH 0/5] Perf kvm commands bug fix Dapeng Mi
2025-08-05  0:46 ` [PATCH 1/5] perf tools kvm: Add missed memory allocation check and free Dapeng Mi
2025-08-06 23:40   ` Namhyung Kim
2025-08-07  2:51     ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 2/5] perf tools kvm: Fix the potential out of range memory access issue Dapeng Mi
2025-08-06 23:53   ` Namhyung Kim
2025-08-07  2:52     ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 3/5] perf tools: Add helper x86__is_intel_cpu() Dapeng Mi
2025-08-05  0:46 ` [PATCH 4/5] perf tools kvm: Use "cycles" to sample guest for "kvm record" on Intel Dapeng Mi
2025-08-07  0:08   ` Namhyung Kim
2025-08-07  3:08     ` Mi, Dapeng
2025-08-08 22:10       ` Namhyung Kim
2025-08-11  5:35         ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 5/5] perf tools kvm: Use "cycles" to sample guest for "kvm top" " Dapeng Mi
2025-08-05  0:57   ` Mi, Dapeng
2025-08-05 11:32     ` Aditya Bodkhe
2025-08-06  0:31       ` Mi, Dapeng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58f01b41-5acb-47d1-a68e-d496d45bb298@linux.intel.com \
    --to=dapeng1.mi@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adityab1@linux.ibm.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dapeng1.mi@intel.com \
    --cc=irogers@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.