Skip to contentSkip to conversation

arm64: kvm: Replace ternary flags with str_on_off() helper

PATCH Applied Seongsu Park 4 participants 6 messages Apr 15, 2025 – May 6, 2025 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20250415012410epcas1p42b48977934c21b5db0b19f4185f7a63c@epcas1p4.samsung.com

#1 lore raw

PATCH 1/1 arm64: kvm: Replace ternary flags with str_on_off() helper

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

---
 arch/arm64/kvm/trace_arm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kvm/trace_arm.h +3 -3
index c18c1a95831e..9c60f6465c78 100644
@@ -176,7 +176,7 @@ TRACE_EVENT(kvm_set_way_flush,
 	    ),
 
 	    TP_printk("S/W flush at 0x%016lx (cache %s)",
-		      __entry->vcpu_pc, __entry->cache ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->cache))
 );
 
 TRACE_EVENT(kvm_toggle_cache,
@@ -196,8 +196,8 @@ TRACE_EVENT(kvm_toggle_cache,
 	    ),
 
 	    TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
-		      __entry->vcpu_pc, __entry->was ? "on" : "off",
-		      __entry->now ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->was),
+		      str_on_off(__entry->now))
 );
 
 /*
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 23 lines · Seongsu Park

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

---
 arch/arm64/kvm/trace_arm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kvm/trace_arm.h +1 -1
index c18c1a95831e..9c60f6465c78 100644
@@ -176,7 +176,7 @@ TRACE_EVENT(kvm_set_way_flush,
 	    ),
 
 	    TP_printk("S/W flush at 0x%016lx (cache %s)",
-		      __entry->vcpu_pc, __entry->cache ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->cache))
 );
 
 TRACE_EVENT(kvm_toggle_cache,

arch/arm64/kvm/trace_arm.h TRACE_EVENT(kvm_toggle_cache, · line 203

Quoted 10 lines
arch/arm64/kvm/trace_arm.h +2 -2
@@ -196,8 +196,8 @@ TRACE_EVENT(kvm_toggle_cache,
 	    ),
 
 	    TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
-		      __entry->vcpu_pc, __entry->was ? "on" : "off",
-		      __entry->now ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->was),
+		      str_on_off(__entry->now))
 );
 
 /*
#3 lore raw
Quoted 35 lines · Seongsu Park
Quoted 32 lines

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

---
 arch/arm64/kvm/trace_arm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kvm/trace_arm.h +3 -3
index c18c1a95831e..9c60f6465c78 100644
@@ -176,7 +176,7 @@ TRACE_EVENT(kvm_set_way_flush,
 	    ),
 
 	    TP_printk("S/W flush at 0x%016lx (cache %s)",
-		      __entry->vcpu_pc, __entry->cache ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->cache))
 );
 
 TRACE_EVENT(kvm_toggle_cache,
@@ -196,8 +196,8 @@ TRACE_EVENT(kvm_toggle_cache,
 	    ),
 
 	    TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
-		      __entry->vcpu_pc, __entry->was ? "on" : "off",
-		      __entry->now ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->was),
+		      str_on_off(__entry->now))
 );
 
Quoted 3 lines

arch/arm64/kvm/trace_arm.h TRACE_EVENT(kvm_toggle_cache, · line 203

Quoted 1 line
arch/arm64/kvm/trace_arm.h +0 -0
 /*

Dear Anshuman,

Do you have any feedback?
If you have, please let me know.
I think this patch is appropriate.

Thanks.
Seongsu Park.

maintainer
#4 lore raw
Quoted 37 lines · Seongsu Park
Quoted 33 lines · Seongsu Park
Quoted 32 lines

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

---
 arch/arm64/kvm/trace_arm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kvm/trace_arm.h +3 -3
index c18c1a95831e..9c60f6465c78 100644
@@ -176,7 +176,7 @@ TRACE_EVENT(kvm_set_way_flush,
 	    ),
 
 	    TP_printk("S/W flush at 0x%016lx (cache %s)",
-		      __entry->vcpu_pc, __entry->cache ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->cache))
 );
 
 TRACE_EVENT(kvm_toggle_cache,
@@ -196,8 +196,8 @@ TRACE_EVENT(kvm_toggle_cache,
 	    ),
 
 	    TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
-		      __entry->vcpu_pc, __entry->was ? "on" : "off",
-		      __entry->now ? "on" : "off")
+		      __entry->vcpu_pc, str_on_off(__entry->was),
+		      str_on_off(__entry->now))
 );
 
Quoted 3 lines

arch/arm64/kvm/trace_arm.h TRACE_EVENT(kvm_toggle_cache, · line 203

Quoted 1 line
arch/arm64/kvm/trace_arm.h +0 -0
 /*
Quoted 5 lines

Dear Anshuman,

Do you have any feedback?
If you have, please let me know.
I think this patch is appropriate.

There isn't much to add. This patch looks reasonable, but it also doesn't warrant being merged immediately (it is purely cosmetic).

Once I start queuing patches for 6.16, I'll probably add it to the mix.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
reviewer Reviewed-by on v1 1/1
#5 lore raw
In reply to Seongsu Park

It'd better to write the subject as "KVM: arm64: Replace ..."

Quoted 8 lines · Seongsu Park

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

---
 arch/arm64/kvm/trace_arm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Thanks,
Zenghui

maintainer Applied
#6 lore raw
In reply to Seongsu Park
Quoted 5 lines · Seongsu Park

Replace repetitive ternary expressions with the str_on_off() helper function. This change improves code readability and ensures consistency in tracepoint string formatting

Applied to kvm-arm64/misc-6.16, thanks!

[1/1] arm64: kvm: Replace ternary flags with str_on_off() helper

      commit: d2f14174f9e839e1128664ab339bbe17c333208b

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.