[PATCH v6] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests
Michael Ellerman
mpe at ellerman.id.au
Wed May 8 22:36:35 AEST 2024
Gautam Menghani <gautam at linux.ibm.com> writes:
> PAPR hypervisor has introduced three new counters in the VPA area of
> LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - 2
> for context switches from host to guest and vice versa, and 1 counter
> for getting the total time spent inside the KVM guest. Add a tracepoint
> that enables reading the counters for use by ftrace/perf. Note that this
> tracepoint is only available for nestedv2 API (i.e, KVM on PowerVM).
...
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 8e86eb577eb8..ed69ad58bd02 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4108,6 +4108,54 @@ static void vcpu_vpa_increment_dispatch(struct kvm_vcpu *vcpu)
> }
> }
>
> +static inline int kvmhv_get_l2_counters_status(void)
> +{
> + return get_lppaca()->l2_counters_enable;
> +}
This is breaking the powernv build:
$ make powernv_defconfig ; make -s -j (nproc)
make[1]: Entering directory '/home/michael/linux/.build'
GEN Makefile
#
# configuration written to .config
#
make[1]: Leaving directory '/home/michael/linux/.build'
../arch/powerpc/kvm/book3s_hv.c: In function ‘kvmhv_get_l2_counters_status’:
../arch/powerpc/kvm/book3s_hv.c:4113:16: error: implicit declaration of function ‘get_lppaca’; did you mean ‘get_paca’? [-Werror=implicit-function-declaration]
4113 | return get_lppaca()->l2_counters_enable;
| ^~~~~~~~~~
| get_paca
../arch/powerpc/kvm/book3s_hv.c:4113:28: error: invalid type argument of ‘->’ (have ‘int’)
4113 | return get_lppaca()->l2_counters_enable;
| ^~
In file included from ../arch/powerpc/include/asm/paravirt.h:9,
from ../arch/powerpc/include/asm/qspinlock.h:7,
from ../arch/powerpc/include/asm/spinlock.h:7,
from ../include/linux/spinlock.h:95,
from ../include/linux/sched.h:2138,
from ../include/linux/hardirq.h:9,
from ../include/linux/kvm_host.h:7,
from ../arch/powerpc/kvm/book3s_hv.c:18:
../arch/powerpc/kvm/book3s_hv.c: In function ‘kvmhv_set_l2_counters_status’:
../arch/powerpc/include/asm/lppaca.h:105:41: error: ‘struct paca_struct’ has no member named ‘lppaca_ptr’
105 | #define lppaca_of(cpu) (*paca_ptrs[cpu]->lppaca_ptr)
| ^~
../arch/powerpc/kvm/book3s_hv.c:4119:17: note: in expansion of macro ‘lppaca_of’
4119 | lppaca_of(cpu).l2_counters_enable = 1;
| ^~~~~~~~~
../arch/powerpc/include/asm/lppaca.h:105:41: error: ‘struct paca_struct’ has no member named ‘lppaca_ptr’
105 | #define lppaca_of(cpu) (*paca_ptrs[cpu]->lppaca_ptr)
| ^~
../arch/powerpc/kvm/book3s_hv.c:4121:17: note: in expansion of macro ‘lppaca_of’
4121 | lppaca_of(cpu).l2_counters_enable = 0;
| ^~~~~~~~~
../arch/powerpc/kvm/book3s_hv.c: In function ‘do_trace_nested_cs_time’:
../arch/powerpc/kvm/book3s_hv.c:4145:29: error: initialization of ‘struct lppaca *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
4145 | struct lppaca *lp = get_lppaca();
| ^~~~~~~~~~
../arch/powerpc/kvm/book3s_hv.c: In function ‘kvmhv_get_l2_counters_status’:
../arch/powerpc/kvm/book3s_hv.c:4114:1: error: control reaches end of non-void function [-Werror=return-type]
4114 | }
| ^
cc1: all warnings being treated as errors
make[5]: *** [../scripts/Makefile.build:244: arch/powerpc/kvm/book3s_hv.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [../scripts/Makefile.build:485: arch/powerpc/kvm] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:485: arch/powerpc] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/home/michael/linux/Makefile:1919: .] Error 2
make[1]: *** [/home/michael/linux/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2
cheers
More information about the Linuxppc-dev
mailing list