Skip to contentSkip to conversation

KVM: trace events: update list of exit reasons

PATCH Applied Ladi Prosek 4 participants 7 messages Sep 14, 2017 – Sep 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: trace events: update list of exit reasons

Adding entries for exit reasons 23 - 27:

KVM_EXIT_EPR
KVM_EXIT_SYSTEM_EVENT
KVM_EXIT_S390_STSI
KVM_EXIT_IOAPIC_EOI
KVM_EXIT_HYPERV

---
 include/trace/events/kvm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/kvm.h +3 -1
index 8ade3eb..dcffedf 100644
@@ -14,7 +14,9 @@
 	ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),	\
 	ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
 	ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),	\
-	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
+	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH), ERSN(EPR),\
+	ERSN(SYSTEM_EVENT), ERSN(S390_STSI), ERSN(IOAPIC_EOI),          \
+	ERSN(HYPERV)
 
 TRACE_EVENT(kvm_userspace_exit,
 	    TP_PROTO(__u32 reason, int errno),
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · On Thu, 14 Sep 2017 11:50:07 +0200 Ladi Prosek <[email protected]> wrote:

Adding entries for exit reasons 23 - 27:

KVM_EXIT_EPR
KVM_EXIT_SYSTEM_EVENT
KVM_EXIT_S390_STSI
KVM_EXIT_IOAPIC_EOI
KVM_EXIT_HYPERV

---
 include/trace/events/kvm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/kvm.h +0 -0
index 8ade3eb..dcffedf 100644

include/trace/events/kvm.h line 22

Quoted 10 lines
include/trace/events/kvm.h +3 -1
@@ -14,7 +14,9 @@
 	ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),	\
 	ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
 	ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),	\
-	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
+	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH), ERSN(EPR),\
+	ERSN(SYSTEM_EVENT), ERSN(S390_STSI), ERSN(IOAPIC_EOI),          \
+	ERSN(HYPERV)
 
 TRACE_EVENT(kvm_userspace_exit,
 	    TP_PROTO(__u32 reason, int errno),

/me wonders whether there is a way to avoid them running out of sync... but otoh, not so many exit reasons are being added anyway.

#2 lore raw

2017-09-14 12:06+0200, Cornelia Huck:

Quoted 29 lines
Quoted 26 lines · On Thu, 14 Sep 2017 11:50:07 +0200 Ladi Prosek <[email protected]> wrote:

Adding entries for exit reasons 23 - 27:

KVM_EXIT_EPR
KVM_EXIT_SYSTEM_EVENT
KVM_EXIT_S390_STSI
KVM_EXIT_IOAPIC_EOI
KVM_EXIT_HYPERV

---
 include/trace/events/kvm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/kvm.h +3 -1
index 8ade3eb..dcffedf 100644
@@ -14,7 +14,9 @@
 	ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),	\
 	ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
 	ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),	\
-	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
+	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH), ERSN(EPR),\
+	ERSN(SYSTEM_EVENT), ERSN(S390_STSI), ERSN(IOAPIC_EOI),          \
+	ERSN(HYPERV)
 
Quoted 2 lines

include/trace/events/kvm.h line 22

Quoted 2 lines
include/trace/events/kvm.h +0 -0
 TRACE_EVENT(kvm_userspace_exit,
 	    TP_PROTO(__u32 reason, int errno),

Applied, thanks.

Quoted 3 lines

/me wonders whether there is a way to avoid them running out of sync...

If we do not want to generate it with an external script, I think the simplest is to have a separate file that looks like

  #define kvm_exit_reasons \
    KVM_EXIT(UNKNOWN, 0), \
    KVM_EXIT(EXCEPTION, 1), \
    ...
    KVM_EXIT(HYPERV, 27) \

and include it from both places. The current exit definitions would be

  #define KVM_EXIT(reason, code)
  	KVM_EXIT_ ## reason = code

  #include <the/magic/file>
  
  enum {
  	kvm_exit_reasons
  };

#undef kvm_exit_reasons

and the trace

  #define KVM_EXIT(reason, code)
  	{ code, "KVM_EXIT_" # reason }
  #include <the/magic/file>

...

__print_symbolic(__entry->reason, kvm_exit_reasons),

...

#undef kvm_exit_reasons

(Would also work with just "KVM_EXIT(UNKNOWN), ..." and small tweaks.)

Quoted 1 line

but otoh, not so many exit reasons are being added anyway.

Yes. :)

#3 lore raw
Quoted 38 lines · On Thu, 14 Sep 2017 20:07:37 +0200 Radim Krčmář <[email protected]> wrote:

2017-09-14 12:06+0200, Cornelia Huck:

Quoted 1 line

/me wonders whether there is a way to avoid them running out of sync...

If we do not want to generate it with an external script, I think the simplest is to have a separate file that looks like

  #define kvm_exit_reasons \
    KVM_EXIT(UNKNOWN, 0), \
    KVM_EXIT(EXCEPTION, 1), \
    ...
    KVM_EXIT(HYPERV, 27) \

and include it from both places. The current exit definitions would be

  #define KVM_EXIT(reason, code)
  	KVM_EXIT_ ## reason = code

  #include <the/magic/file>
  
  enum {
  	kvm_exit_reasons
  };

#undef kvm_exit_reasons

and the trace

  #define KVM_EXIT(reason, code)
  	{ code, "KVM_EXIT_" # reason }
  #include <the/magic/file>

...

__print_symbolic(__entry->reason, kvm_exit_reasons),

...

Quoted 7 lines

#undef kvm_exit_reasons

(Would also work with just "KVM_EXIT(UNKNOWN), ..." and small tweaks.)

Quoted 1 line

but otoh, not so many exit reasons are being added anyway.

Yes. :)

Yeah, your approach would work, but it's unlikely to be worth it :)

maintainer
#4 lore raw
Quoted 43 lines · Cornelia Huck
Quoted 40 lines · On Thu, 14 Sep 2017 20:07:37 +0200 Radim Krčmář <[email protected]> wrote:

2017-09-14 12:06+0200, Cornelia Huck:

Quoted 1 line

/me wonders whether there is a way to avoid them running out of sync...

If we do not want to generate it with an external script, I think the simplest is to have a separate file that looks like

  #define kvm_exit_reasons \
    KVM_EXIT(UNKNOWN, 0), \
    KVM_EXIT(EXCEPTION, 1), \
    ...
    KVM_EXIT(HYPERV, 27) \

and include it from both places. The current exit definitions would be

  #define KVM_EXIT(reason, code)
  	KVM_EXIT_ ## reason = code

  #include <the/magic/file>
  
  enum {
  	kvm_exit_reasons
  };

#undef kvm_exit_reasons

and the trace

  #define KVM_EXIT(reason, code)
  	{ code, "KVM_EXIT_" # reason }
  #include <the/magic/file>

...

__print_symbolic(__entry->reason, kvm_exit_reasons),

...

#undef kvm_exit_reasons

Quoted 7 lines
Quoted 5 lines

(Would also work with just "KVM_EXIT(UNKNOWN), ..." and small tweaks.)

Quoted 1 line

but otoh, not so many exit reasons are being added anyway.

Yes. :)

Yeah, your approach would work, but it's unlikely to be worth it :)

The next one who adds an exit reason will do it then. :)

Paolo

#5 lore raw
In reply to Radim Krčmář
Quoted 30 lines · Radim Krčmář

If we do not want to generate it with an external script, I think the simplest is to have a separate file that looks like

  #define kvm_exit_reasons \
    KVM_EXIT(UNKNOWN, 0), \
    KVM_EXIT(EXCEPTION, 1), \
    ...
    KVM_EXIT(HYPERV, 27) \

and include it from both places. The current exit definitions would be

  #define KVM_EXIT(reason, code)
        KVM_EXIT_ ## reason = code

  #include <the/magic/file>

  enum {
        kvm_exit_reasons
  };

#undef kvm_exit_reasons

and the trace

  #define KVM_EXIT(reason, code)
        { code, "KVM_EXIT_" # reason }
  #include <the/magic/file>

...

Quoted 7 lines
        __print_symbolic(__entry->reason, kvm_exit_reasons),

...

#undef kvm_exit_reasons

(Would also work with just "KVM_EXIT(UNKNOWN), ..." and small tweaks.)

It can be done without a separate file:

#define kvm_exit_reasons \
       KVM_EXIT(UNKNOWN, 0), \
       KVM_EXIT(EXCEPTION, 1), \
       ...
       KVM_EXIT(HYPERV, 27)

#define KVM_EXIT(reason, code) \
KVM_EXIT_ ## reason = code
enum {
kvm_exit_reasons
};
#undef KVM_EXIT

^^^ goes in the general header

#define KVM_EXIT(reason, code) \
        { code, "KVM_EXIT_" # reason }

... _reasons[] = {
kvm_exit_reasons
};
#undef KVM_EXIT

^^^ goes in the trace header

I.e. this is symbol manipulation, no need to have KVM_EXIT defined when it's "used".

maintainer Applied
#6 lore raw
In reply to Ladi Prosek
Quoted 19 lines · Ladi Prosek

Adding entries for exit reasons 23 - 27:

KVM_EXIT_EPR
KVM_EXIT_SYSTEM_EVENT
KVM_EXIT_S390_STSI
KVM_EXIT_IOAPIC_EOI
KVM_EXIT_HYPERV

---
 include/trace/events/kvm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/kvm.h +0 -0
index 8ade3eb..dcffedf 100644

include/trace/events/kvm.h line 22

Quoted 10 lines
include/trace/events/kvm.h +3 -1
@@ -14,7 +14,9 @@
 	ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),	\
 	ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
 	ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),	\
-	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
+	ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH), ERSN(EPR),\
+	ERSN(SYSTEM_EVENT), ERSN(S390_STSI), ERSN(IOAPIC_EOI),          \
+	ERSN(HYPERV)
 
 TRACE_EVENT(kvm_userspace_exit,
 	    TP_PROTO(__u32 reason, int errno),

Applied, thanks.

Paolo