]> www.infradead.org Git - users/jedix/linux-maple.git/commit
powerpc/kvm-hv-pmu: Implement GSB message-ops for hostwide counters
authorVaibhav Jain <vaibhav@linux.ibm.com>
Wed, 16 Apr 2025 16:27:35 +0000 (21:57 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 16 Apr 2025 16:46:09 +0000 (22:16 +0530)
commitf0c9c49c50678385c406e805e377965e853828fa
tree59cd581142cc3d801338b3a72c4f2974dc93b927
parentff45bf50ccbbd6d799a8e77e4cde890b6f9ef9f5
powerpc/kvm-hv-pmu: Implement GSB message-ops for hostwide counters

Implement and setup necessary structures to send a prepolulated
Guest-State-Buffer(GSB) requesting hostwide counters to L0-PowerVM and have
the returned GSB holding the values of these counters parsed. This is done
via existing GSB implementation and with the newly added support of
Hostwide elements in GSB.

The request to L0-PowerVM to return Hostwide counters is done using a
pre-allocated GSB named 'gsb_l0_stats'. To be able to populate this GSB
with the needed Guest-State-Elements (GSIDs) a instance of 'struct
kvmppc_gs_msg' named 'gsm_l0_stats' is introduced. The 'gsm_l0_stats' is
tied to an instance of 'struct kvmppc_gs_msg_ops' named  'gsb_ops_l0_stats'
which holds various callbacks to be compute the size ( hostwide_get_size()
), populate the GSB ( hostwide_fill_info() ) and
refresh ( hostwide_refresh_info() ) the contents of
'l0_stats' that holds the Hostwide counters returned from L0-PowerVM.

To protect these structures from simultaneous access a spinlock
'lock_l0_stats' has been introduced. The allocation and initialization of
the above structures is done in newly introduced kvmppc_init_hostwide() and
similarly the cleanup is performed in newly introduced
kvmppc_cleanup_hostwide().

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250416162740.93143-6-vaibhav@linux.ibm.com
arch/powerpc/perf/kvm-hv-pmu.c