Skip to contentSkip to conversation

perf kvm stat: Update the exit reason mappings

PATCH In review Gautam Menghani 4 participants 6 messages May 12 – May 18 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf kvm stat: Update the exit reason mappings

Sync the exit reason mappings with the mappings in trace_book3s.h

---
 tools/perf/util/kvm-stat-arch/book3s_hv_exits.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/kvm-stat-arch/book3s_hv_exits.h +3 -1
index 2011376c7ab5..2688ca7d0399 100644
@@ -26,8 +26,10 @@
 	{0xe00, "H_DATA_STORAGE"}, \
 	{0xe20, "H_INST_STORAGE"}, \
 	{0xe40, "H_EMUL_ASSIST"}, \
+	{0xea0, "H_VIRT"}, \
 	{0xf00, "PERFMON"}, \
 	{0xf20, "ALTIVEC"}, \
-	{0xf40, "VSX"}
+	{0xf40, "VSX"}, \
+	{0xf80, "H_FAC_UNAVAIL"}
 
 #endif
Signature · 1 line
2.53.0
reviewer
#1 lore raw
Quoted 2 lines · Gautam Menghani

Sync the exit reason mappings with the mappings in trace_book3s.h

I see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kvm/trace_book3s.h
Would it make sense to have a copy in perf and use the check headers code to keep them in sync?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/check-headers.sh

Could you add the commits that add the H_VIRT and H_FAC_UNAVAIL definitions? I don't see them in Linus' tree yet.

Thanks,
Ian

Quoted 24 lines
---
 tools/perf/util/kvm-stat-arch/book3s_hv_exits.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/kvm-stat-arch/book3s_hv_exits.h +3 -2
index 2011376c7ab5..2688ca7d0399 100644
@@ -26,8 +26,10 @@
        {0xe00, "H_DATA_STORAGE"}, \
        {0xe20, "H_INST_STORAGE"}, \
        {0xe40, "H_EMUL_ASSIST"}, \
+       {0xea0, "H_VIRT"}, \
        {0xf00, "PERFMON"}, \
        {0xf20, "ALTIVEC"}, \
-       {0xf40, "VSX"}
+       {0xf40, "VSX"}, \
+       {0xf80, "H_FAC_UNAVAIL"}
 
 #endif
--

2.53.0

#2 lore raw
Quoted 9 lines · Ian Rogers
Quoted 2 lines · Gautam Menghani

Sync the exit reason mappings with the mappings in trace_book3s.h

I see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kvm/trace_book3s.h
Would it make sense to have a copy in perf and use the check headers code to keep them in sync?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/check-headers.sh

I'll take a look at this, thanks

Quoted 3 lines

Could you add the commits that add the H_VIRT and H_FAC_UNAVAIL definitions? I don't see them in Linus' tree yet.

I posted that patch earlier today - https://lore.kernel.org/linuxppc-dev/[email protected]/
should've pasted the link in the patch

Thanks,
Gautam

#3 lore raw

++ linuxppc-dev

Quoted 11 lines · Gautam Menghani
Quoted 9 lines · Ian Rogers
Quoted 2 lines · Gautam Menghani

Sync the exit reason mappings with the mappings in trace_book3s.h

I see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kvm/trace_book3s.h
Would it make sense to have a copy in perf and use the check headers code to keep them in sync?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/check-headers.sh

Quoted 9 lines

I'll take a look at this, thanks

Quoted 3 lines

Could you add the commits that add the H_VIRT and H_FAC_UNAVAIL definitions? I don't see them in Linus' tree yet.

I posted that patch earlier today - https://lore.kernel.org/linuxppc-dev/[email protected]/
should've pasted the link in the patch

For patches not yet merged and having such a dependency, this could cause confusion. What I generally tend to do in such case is, group this patch (changes in tools/perf/util/kvm-stat-arch/book3s_hv_exits.h) into the same series which adds H_FAC_UNAVAIL to trace_book3s.h [1]. This way it is easier for everyone to keep track of the dependencies.

[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/

Note, that we should still cc the relevant mailing lists, reviewers and maintainers to get an Acked-by. Since the changes in this patch are largely powerpc specific, so IMO, it should be ok even if it goes via powerpc tree via a common series, as long as everyone agrees.

-ritesh

#4 lore raw
Quoted 26 lines · Ritesh Harjani

++ linuxppc-dev

Quoted 11 lines · Gautam Menghani
Quoted 9 lines · Ian Rogers
Quoted 2 lines · Gautam Menghani

Sync the exit reason mappings with the mappings in trace_book3s.h

I see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kvm/trace_book3s.h
Would it make sense to have a copy in perf and use the check headers code to keep them in sync?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/check-headers.sh

Quoted 9 lines

I'll take a look at this, thanks

Quoted 3 lines

Could you add the commits that add the H_VIRT and H_FAC_UNAVAIL definitions? I don't see them in Linus' tree yet.

I posted that patch earlier today - https://lore.kernel.org/linuxppc-dev/[email protected]/
should've pasted the link in the patch

Quoted 7 lines

For patches not yet merged and having such a dependency, this could cause confusion. What I generally tend to do in such case is, group this patch (changes in tools/perf/util/kvm-stat-arch/book3s_hv_exits.h) into the same series which adds H_FAC_UNAVAIL to trace_book3s.h [1]. This way it is easier for everyone to keep track of the dependencies.

[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/

My patch description is incorrect, there actually isn't a dependency - both patches can go in independently. I'll send a v2 to make this clear.

Quoted 5 lines

Note, that we should still cc the relevant mailing lists, reviewers and maintainers to get an Acked-by. Since the changes in this patch are largely powerpc specific, so IMO, it should be ok even if it goes via powerpc tree via a common series, as long as everyone agrees.

Yes noted, thanks.

- Gautam

#5 lore raw
In reply to Gautam Menghani
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The patch adds `H_FAC_UNAVAIL` to the exit reason mappings, but this mapping is missing from…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch adds H_FAC_UNAVAIL to the exit reason mappings, but this mapping is missing from trace_book3s.h, contradicting the commit message. --

commit ece070bf3559f07c600d918f34f26871f45c741d
Author: Gautam Menghani <[email protected]>

perf kvm stat: Update the exit reason mappings

This commit updates the exit reason mappings in perf to sync them with the definitions in trace_book3s.h.

Quoted 5 lines
tools/perf/util/kvm-stat-arch/book3s_hv_exits.h +0 -0
index 2011376c7ab58..2688ca7d03990 100644

tools/perf/util/kvm-stat-arch/book3s_hv_exits.h line 33

Quoted 9 lines
tools/perf/util/kvm-stat-arch/book3s_hv_exits.h +3 -1
@@ -26,8 +26,10 @@
 	{0xe00, "H_DATA_STORAGE"}, \
 	{0xe20, "H_INST_STORAGE"}, \
 	{0xe40, "H_EMUL_ASSIST"}, \
+	{0xea0, "H_VIRT"}, \
 	{0xf00, "PERFMON"}, \
 	{0xf20, "ALTIVEC"}, \
-	{0xf40, "VSX"}
+	{0xf40, "VSX"}, \
+	{0xf80, "H_FAC_UNAVAIL"}

The commit message states "Sync the exit reason mappings with the mappings in trace_book3s.h".

Is this description accurate? Looking at arch/powerpc/kvm/trace_book3s.h, it does not contain the mapping for H_FAC_UNAVAIL (0xf80):

arch/powerpc/kvm/trace_book3s.h:
#define kvm_trace_symbol_exit \
...

	{0xea0, "H_VIRT"}, \
	{0xf00, "PERFMON"}, \
	{0xf20, "ALTIVEC"}, \
	{0xf40, "VSX"}

Because trace_book3s.h lacks H_FAC_UNAVAIL, the ftrace kvm_guest_exit tracepoint and perf kvm stat remain out of sync, as ftrace will display the raw vector while perf will decode it.

Should trace_book3s.h also be updated to ensure they are truly synchronized?

Additionally, several other common KVM exits defined in kvm_asm.h, such as HMI (0xe60) and H_DOORBELL (0xe80), appear to be missing from both headers.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1