Re: [Qemu-devel] [PATCH 2/2] target/ppc/kvm: Convert DPRINTF to traces
On Fri, Apr 05, 2019 at 10:05:24AM +0200, Greg Kurz wrote: > Signed-off-by: Greg Kurz Applied to ppc-for-4.1, thanks. I did have to fix up a small conflict because I've now merged my style fixups for target/ppc into ppc-for-4.1. > --- > target/ppc/kvm.c| 68 > +++ > target/ppc/trace-events | 25 + > 2 files changed, 52 insertions(+), 41 deletions(-) > > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > index 2427c8ee13ae..3a11d2e1060c 100644 > --- a/target/ppc/kvm.c > +++ b/target/ppc/kvm.c > @@ -49,16 +49,6 @@ > #include "elf.h" > #include "sysemu/kvm_int.h" > > -//#define DEBUG_KVM > - > -#ifdef DEBUG_KVM > -#define DPRINTF(fmt, ...) \ > -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) > -#else > -#define DPRINTF(fmt, ...) \ > -do { } while (0) > -#endif > - > #define PROC_DEVTREE_CPU "/proc/device-tree/cpus/" > > const KVMCapabilityInfo kvm_arch_required_capabilities[] = { > @@ -626,7 +616,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)&fpscr; > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set FPSCR to KVM: %s\n", strerror(errno)); > +trace_kvm_failed_fpscr_set(strerror(errno)); > return ret; > } > > @@ -647,8 +637,8 @@ static int kvm_put_fp(CPUState *cs) > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set %s%d to KVM: %s\n", vsx ? "VSR" : > "FPR", > -i, strerror(errno)); > +trace_kvm_failed_fp_set(vsx ? "VSR" : "FPR", i, > +strerror(errno)); > return ret; > } > } > @@ -659,7 +649,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)&env->vscr; > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set VSCR to KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vscr_set(strerror(errno)); > return ret; > } > > @@ -668,7 +658,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set VR%d to KVM: %s\n", i, > strerror(errno)); > +trace_kvm_failed_vr_set(i, strerror(errno)); > return ret; > } > } > @@ -693,7 +683,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)&fpscr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get FPSCR from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_fpscr_get(strerror(errno)); > return ret; > } else { > env->fpscr = fpscr; > @@ -709,8 +699,8 @@ static int kvm_get_fp(CPUState *cs) > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get %s%d from KVM: %s\n", > -vsx ? "VSR" : "FPR", i, strerror(errno)); > +trace_kvm_failed_fp_get(vsx ? "VSR" : "FPR", i, > +strerror(errno)); > return ret; > } else { > #ifdef HOST_WORDS_BIGENDIAN > @@ -733,7 +723,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)&env->vscr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VSCR from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vscr_get(strerror(errno)); > return ret; > } > > @@ -742,8 +732,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VR%d from KVM: %s\n", > -i, strerror(errno)); > +trace_kvm_failed_vr_get(i, strerror(errno)); > return ret; > } > } > @@ -764,7 +753,7 @@ static int kvm_get_vpa(CPUState *cs) > reg.addr = (uintptr_t)&spapr_cpu->vpa_addr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VPA address from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vpa_addr_get(strerror(errno)); > return ret; > } > > @@ -774,8 +763,7 @@ static int kvm_get_vpa(CPUState *cs) > reg.addr = (uintptr_t)&spapr_cpu->slb_shadow_addr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get SLB shadow state from KVM: %s\n", > -strerror(errno)); > +
Re: [Qemu-devel] [PATCH 2/2] target/ppc/kvm: Convert DPRINTF to traces
On Fri, 05 Apr 2019 10:12:42 -0300 "Murilo Opsfelder Araújo" wrote: > Hi, Greg. > Hi Murilo, > Greg Kurz writes: > > > Signed-off-by: Greg Kurz > > --- > > target/ppc/kvm.c| 68 > > +++ > > target/ppc/trace-events | 25 + > > 2 files changed, 52 insertions(+), 41 deletions(-) > > > > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > > index 2427c8ee13ae..3a11d2e1060c 100644 > > --- a/target/ppc/kvm.c > > +++ b/target/ppc/kvm.c > > @@ -49,16 +49,6 @@ > > #include "elf.h" > > #include "sysemu/kvm_int.h" > > > > -//#define DEBUG_KVM > > - > > -#ifdef DEBUG_KVM > > -#define DPRINTF(fmt, ...) \ > > -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) > > -#else > > -#define DPRINTF(fmt, ...) \ > > -do { } while (0) > > -#endif > > - > > #define PROC_DEVTREE_CPU "/proc/device-tree/cpus/" > > > > const KVMCapabilityInfo kvm_arch_required_capabilities[] = { > > @@ -626,7 +616,7 @@ static int kvm_put_fp(CPUState *cs) > > reg.addr = (uintptr_t)&fpscr; > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to set FPSCR to KVM: %s\n", strerror(errno)); > > +trace_kvm_failed_fpscr_set(strerror(errno)); > > return ret; > > } > > > > @@ -647,8 +637,8 @@ static int kvm_put_fp(CPUState *cs) > > > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to set %s%d to KVM: %s\n", vsx ? "VSR" : > > "FPR", > > -i, strerror(errno)); > > +trace_kvm_failed_fp_set(vsx ? "VSR" : "FPR", i, > > +strerror(errno)); > > return ret; > > } > > } > > @@ -659,7 +649,7 @@ static int kvm_put_fp(CPUState *cs) > > reg.addr = (uintptr_t)&env->vscr; > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to set VSCR to KVM: %s\n", strerror(errno)); > > +trace_kvm_failed_vscr_set(strerror(errno)); > > return ret; > > } > > > > @@ -668,7 +658,7 @@ static int kvm_put_fp(CPUState *cs) > > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to set VR%d to KVM: %s\n", i, > > strerror(errno)); > > +trace_kvm_failed_vr_set(i, strerror(errno)); > > return ret; > > } > > } > > @@ -693,7 +683,7 @@ static int kvm_get_fp(CPUState *cs) > > reg.addr = (uintptr_t)&fpscr; > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to get FPSCR from KVM: %s\n", strerror(errno)); > > +trace_kvm_failed_fpscr_get(strerror(errno)); > > return ret; > > } else { > > env->fpscr = fpscr; > > @@ -709,8 +699,8 @@ static int kvm_get_fp(CPUState *cs) > > > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to get %s%d from KVM: %s\n", > > -vsx ? "VSR" : "FPR", i, strerror(errno)); > > +trace_kvm_failed_fp_get(vsx ? "VSR" : "FPR", i, > > +strerror(errno)); > > return ret; > > } else { > > #ifdef HOST_WORDS_BIGENDIAN > > @@ -733,7 +723,7 @@ static int kvm_get_fp(CPUState *cs) > > reg.addr = (uintptr_t)&env->vscr; > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to get VSCR from KVM: %s\n", strerror(errno)); > > +trace_kvm_failed_vscr_get(strerror(errno)); > > return ret; > > } > > > > @@ -742,8 +732,7 @@ static int kvm_get_fp(CPUState *cs) > > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to get VR%d from KVM: %s\n", > > -i, strerror(errno)); > > +trace_kvm_failed_vr_get(i, strerror(errno)); > > return ret; > > } > > } > > @@ -764,7 +753,7 @@ static int kvm_get_vpa(CPUState *cs) > > reg.addr = (uintptr_t)&spapr_cpu->vpa_addr; > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > > if (ret < 0) { > > -DPRINTF("Unable to get VPA address from KVM: %s\n", > > strerror(errno)); > > +trace_kvm_failed_vpa_addr_get(strerror(errno)); > > return ret; > > } > > > > @@ -774,8 +763,7 @@ static int kvm_get_vpa(CPUState *cs) > > reg.addr = (uintptr_t)&spapr_cpu->slb_shadow_addr; > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_R
Re: [Qemu-devel] [PATCH 2/2] target/ppc/kvm: Convert DPRINTF to traces
Hi, Greg. Greg Kurz writes: > Signed-off-by: Greg Kurz > --- > target/ppc/kvm.c| 68 > +++ > target/ppc/trace-events | 25 + > 2 files changed, 52 insertions(+), 41 deletions(-) > > diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c > index 2427c8ee13ae..3a11d2e1060c 100644 > --- a/target/ppc/kvm.c > +++ b/target/ppc/kvm.c > @@ -49,16 +49,6 @@ > #include "elf.h" > #include "sysemu/kvm_int.h" > > -//#define DEBUG_KVM > - > -#ifdef DEBUG_KVM > -#define DPRINTF(fmt, ...) \ > -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) > -#else > -#define DPRINTF(fmt, ...) \ > -do { } while (0) > -#endif > - > #define PROC_DEVTREE_CPU "/proc/device-tree/cpus/" > > const KVMCapabilityInfo kvm_arch_required_capabilities[] = { > @@ -626,7 +616,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)&fpscr; > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set FPSCR to KVM: %s\n", strerror(errno)); > +trace_kvm_failed_fpscr_set(strerror(errno)); > return ret; > } > > @@ -647,8 +637,8 @@ static int kvm_put_fp(CPUState *cs) > > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set %s%d to KVM: %s\n", vsx ? "VSR" : > "FPR", > -i, strerror(errno)); > +trace_kvm_failed_fp_set(vsx ? "VSR" : "FPR", i, > +strerror(errno)); > return ret; > } > } > @@ -659,7 +649,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)&env->vscr; > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set VSCR to KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vscr_set(strerror(errno)); > return ret; > } > > @@ -668,7 +658,7 @@ static int kvm_put_fp(CPUState *cs) > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to set VR%d to KVM: %s\n", i, > strerror(errno)); > +trace_kvm_failed_vr_set(i, strerror(errno)); > return ret; > } > } > @@ -693,7 +683,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)&fpscr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get FPSCR from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_fpscr_get(strerror(errno)); > return ret; > } else { > env->fpscr = fpscr; > @@ -709,8 +699,8 @@ static int kvm_get_fp(CPUState *cs) > > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get %s%d from KVM: %s\n", > -vsx ? "VSR" : "FPR", i, strerror(errno)); > +trace_kvm_failed_fp_get(vsx ? "VSR" : "FPR", i, > +strerror(errno)); > return ret; > } else { > #ifdef HOST_WORDS_BIGENDIAN > @@ -733,7 +723,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)&env->vscr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VSCR from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vscr_get(strerror(errno)); > return ret; > } > > @@ -742,8 +732,7 @@ static int kvm_get_fp(CPUState *cs) > reg.addr = (uintptr_t)cpu_avr_ptr(env, i); > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VR%d from KVM: %s\n", > -i, strerror(errno)); > +trace_kvm_failed_vr_get(i, strerror(errno)); > return ret; > } > } > @@ -764,7 +753,7 @@ static int kvm_get_vpa(CPUState *cs) > reg.addr = (uintptr_t)&spapr_cpu->vpa_addr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get VPA address from KVM: %s\n", strerror(errno)); > +trace_kvm_failed_vpa_addr_get(strerror(errno)); > return ret; > } > > @@ -774,8 +763,7 @@ static int kvm_get_vpa(CPUState *cs) > reg.addr = (uintptr_t)&spapr_cpu->slb_shadow_addr; > ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); > if (ret < 0) { > -DPRINTF("Unable to get SLB shadow state from KVM: %s\n", > -strerror(errno)); > +trace_kvm_failed_slb_get(strerror(errno)); > return ret; > } > > @@ -785,8 +773,7 @@ static int kvm_get_vpa(CPUState *cs) > reg.addr = (uintptr_t)&spapr_cpu->dtl_addr; >
[Qemu-devel] [PATCH 2/2] target/ppc/kvm: Convert DPRINTF to traces
Signed-off-by: Greg Kurz --- target/ppc/kvm.c| 68 +++ target/ppc/trace-events | 25 + 2 files changed, 52 insertions(+), 41 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2427c8ee13ae..3a11d2e1060c 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -49,16 +49,6 @@ #include "elf.h" #include "sysemu/kvm_int.h" -//#define DEBUG_KVM - -#ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ -do { } while (0) -#endif - #define PROC_DEVTREE_CPU "/proc/device-tree/cpus/" const KVMCapabilityInfo kvm_arch_required_capabilities[] = { @@ -626,7 +616,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr = (uintptr_t)&fpscr; ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to set FPSCR to KVM: %s\n", strerror(errno)); +trace_kvm_failed_fpscr_set(strerror(errno)); return ret; } @@ -647,8 +637,8 @@ static int kvm_put_fp(CPUState *cs) ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to set %s%d to KVM: %s\n", vsx ? "VSR" : "FPR", -i, strerror(errno)); +trace_kvm_failed_fp_set(vsx ? "VSR" : "FPR", i, +strerror(errno)); return ret; } } @@ -659,7 +649,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr = (uintptr_t)&env->vscr; ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to set VSCR to KVM: %s\n", strerror(errno)); +trace_kvm_failed_vscr_set(strerror(errno)); return ret; } @@ -668,7 +658,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr = (uintptr_t)cpu_avr_ptr(env, i); ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to set VR%d to KVM: %s\n", i, strerror(errno)); +trace_kvm_failed_vr_set(i, strerror(errno)); return ret; } } @@ -693,7 +683,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr = (uintptr_t)&fpscr; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get FPSCR from KVM: %s\n", strerror(errno)); +trace_kvm_failed_fpscr_get(strerror(errno)); return ret; } else { env->fpscr = fpscr; @@ -709,8 +699,8 @@ static int kvm_get_fp(CPUState *cs) ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get %s%d from KVM: %s\n", -vsx ? "VSR" : "FPR", i, strerror(errno)); +trace_kvm_failed_fp_get(vsx ? "VSR" : "FPR", i, +strerror(errno)); return ret; } else { #ifdef HOST_WORDS_BIGENDIAN @@ -733,7 +723,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr = (uintptr_t)&env->vscr; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get VSCR from KVM: %s\n", strerror(errno)); +trace_kvm_failed_vscr_get(strerror(errno)); return ret; } @@ -742,8 +732,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr = (uintptr_t)cpu_avr_ptr(env, i); ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get VR%d from KVM: %s\n", -i, strerror(errno)); +trace_kvm_failed_vr_get(i, strerror(errno)); return ret; } } @@ -764,7 +753,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr = (uintptr_t)&spapr_cpu->vpa_addr; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get VPA address from KVM: %s\n", strerror(errno)); +trace_kvm_failed_vpa_addr_get(strerror(errno)); return ret; } @@ -774,8 +763,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr = (uintptr_t)&spapr_cpu->slb_shadow_addr; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get SLB shadow state from KVM: %s\n", -strerror(errno)); +trace_kvm_failed_slb_get(strerror(errno)); return ret; } @@ -785,8 +773,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr = (uintptr_t)&spapr_cpu->dtl_addr; ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { -DPRINTF("Unable to get dispatch trace log state from KVM: %s\n", -strerror(errno)); +trace_kvm_failed_dtl_get(strerror(errno)); return ret; } @@ -812,7