Skip to contentSkip to conversation

KVM: PPC: BookE: Use vcpu_err() instead of printk() in kvmppc_dump_vcpu()

PATCH Applied Gaurav Yadav 3 participants 7 messages Aug 7 – Nov 23

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

PATCH 1/1 KVM: PPC: BookE: Use vcpu_err() instead of printk() in kvmppc_dump_vcpu()

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

---
 arch/powerpc/kvm/booke.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
arch/powerpc/kvm/booke.c +12 -13
index f3ddb24ece74..23159eb5f5af 100644
@@ -86,26 +86,25 @@ const struct kvm_stats_header kvm_vcpu_stats_header = {
 		       sizeof(kvm_vcpu_stats_desc),
 };
 
-/* TODO: use vcpu_printf() */
 void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
 {
 	int i;
 
-	printk("pc:   %08lx msr:  %08llx\n", vcpu->arch.regs.nip,
-			vcpu->arch.shared->msr);
-	printk("lr:   %08lx ctr:  %08lx\n", vcpu->arch.regs.link,
-			vcpu->arch.regs.ctr);
-	printk("srr0: %08llx srr1: %08llx\n", vcpu->arch.shared->srr0,
-					    vcpu->arch.shared->srr1);
+	vcpu_err(vcpu, "pc:   %08lx msr:  %08llx\n", vcpu->arch.regs.nip,
+		 vcpu->arch.shared->msr);
+	vcpu_err(vcpu, "lr:   %08lx ctr:  %08lx\n", vcpu->arch.regs.link,
+		 vcpu->arch.regs.ctr);
+	vcpu_err(vcpu, "srr0: %08llx srr1: %08llx\n", vcpu->arch.shared->srr0,
+		 vcpu->arch.shared->srr1);
 
-	printk("exceptions: %08lx\n", vcpu->arch.pending_exceptions);
+	vcpu_err(vcpu, "exceptions: %08lx\n", vcpu->arch.pending_exceptions);
 
 	for (i = 0; i < 32; i += 4) {
-		printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i,
-		       kvmppc_get_gpr(vcpu, i),
-		       kvmppc_get_gpr(vcpu, i+1),
-		       kvmppc_get_gpr(vcpu, i+2),
-		       kvmppc_get_gpr(vcpu, i+3));
+		vcpu_err(vcpu, "gpr%02d: %08lx %08lx %08lx %08lx\n", i,
+			 kvmppc_get_gpr(vcpu, i),
+			 kvmppc_get_gpr(vcpu, i+1),
+			 kvmppc_get_gpr(vcpu, i+2),
+			 kvmppc_get_gpr(vcpu, i+3));
 	}
 }
 
Signature · 1 line
2.54.0
#1 lore raw

A gentle reminder: please take a look.

Quoted 60 lines · Gaurav Yadav

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

---
 arch/powerpc/kvm/booke.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
arch/powerpc/kvm/booke.c +12 -13
index f3ddb24ece74..23159eb5f5af 100644
@@ -86,26 +86,25 @@ const struct kvm_stats_header kvm_vcpu_stats_header = {
                       sizeof(kvm_vcpu_stats_desc),
 };
 
-/* TODO: use vcpu_printf() */
 void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
 {
        int i;
 
-       printk("pc:   %08lx msr:  %08llx\n", vcpu->arch.regs.nip,
-                       vcpu->arch.shared->msr);
-       printk("lr:   %08lx ctr:  %08lx\n", vcpu->arch.regs.link,
-                       vcpu->arch.regs.ctr);
-       printk("srr0: %08llx srr1: %08llx\n", vcpu->arch.shared->srr0,
-                                           vcpu->arch.shared->srr1);
+       vcpu_err(vcpu, "pc:   %08lx msr:  %08llx\n", vcpu->arch.regs.nip,
+                vcpu->arch.shared->msr);
+       vcpu_err(vcpu, "lr:   %08lx ctr:  %08lx\n", vcpu->arch.regs.link,
+                vcpu->arch.regs.ctr);
+       vcpu_err(vcpu, "srr0: %08llx srr1: %08llx\n",
 vcpu->arch.shared->srr0,
+                vcpu->arch.shared->srr1);
 
-       printk("exceptions: %08lx\n", vcpu->arch.pending_exceptions);
+       vcpu_err(vcpu, "exceptions: %08lx\n",
 vcpu->arch.pending_exceptions);
 
        for (i = 0; i < 32; i += 4) {
-               printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i,
-                      kvmppc_get_gpr(vcpu, i),
-                      kvmppc_get_gpr(vcpu, i+1),
-                      kvmppc_get_gpr(vcpu, i+2),
-                      kvmppc_get_gpr(vcpu, i+3));
+               vcpu_err(vcpu, "gpr%02d: %08lx %08lx %08lx %08lx\n", i,
+                        kvmppc_get_gpr(vcpu, i),
+                        kvmppc_get_gpr(vcpu, i+1),
+                        kvmppc_get_gpr(vcpu, i+2),
+                        kvmppc_get_gpr(vcpu, i+3));
        }

}

--
2.54.0

Signature · 3 lines
With Regards
Gaurav Yadav
+919310150558
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Gaurav Yadav
Quoted 10 lines · Gaurav Yadav

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

---
 arch/powerpc/kvm/booke.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

Fair enough, this will print vcpu_id as an additional info here. Looks good to me. Please feel free to add:

#3 lore raw

Thanks, Ritesh.

Adding the tag and sending a v2 shortly.

Quoted 19 lines · Ritesh Harjani
Quoted 10 lines · Gaurav Yadav

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

---
 arch/powerpc/kvm/booke.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

Fair enough, this will print vcpu_id as an additional info here. Looks good to me. Please feel free to add:

Signature · 3 lines
With Regards
Gaurav Yadav
+919310150558
#4 lore raw
Quoted 4 lines · Gaurav Yadav

Thanks, Ritesh.

Adding the tag and sending a v2 shortly.

No need. b4 picks up the RB tag on it's own

-ritesh

maintainer Applied
#5 lore raw
In reply to Gaurav Yadav
Quoted 8 lines · Gaurav Yadav

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

[...]

Applied to powerpc/fixes.

[1/1] KVM: PPC: BookE: Use vcpu_err() instead of printk() in kvmppc_dump_vcpu()

      https://git.kernel.org/powerpc/c/54efc2e1e9af9e3a14264db5686330e4fd477286

cheers

#6 lore raw

Thanks a lot.

Quoted 19 lines · Madhavan Srinivasan
Quoted 8 lines · Gaurav Yadav

Replace generic printk() calls in kvmppc_dump_vcpu() with vcpu_err() and remove the corresponding TODO comment.

Using vcpu_err() provides vCPU-aware logging context, making it easier to associate register dumps with specific vCPU instances in logs.

[...]

Applied to powerpc/fixes.

[1/1] KVM: PPC: BookE: Use vcpu_err() instead of printk() in kvmppc_dump_vcpu()

https://git.kernel.org/powerpc/c/54efc2e1e9af9e3a14264db5686330e4fd477286

cheers

Signature · 3 lines
With Regards
Gaurav Yadav
+919310150558