KVM: s390: add stat counter for shadow gmap events
authorNico Boehr <nrb@linux.ibm.com>
Mon, 9 Oct 2023 09:32:52 +0000 (11:32 +0200)
committerJanosch Frank <frankja@linux.ibm.com>
Mon, 16 Oct 2023 12:54:29 +0000 (14:54 +0200)
commitc3235e2dd6956448a562d6b1112205eeebc8ab43
tree7d5f5939b799541371b8096ad52e4540222fa0b9
parentce9ecca0238b140b88f43859b211c9fdfd8e5b70
KVM: s390: add stat counter for shadow gmap events

The shadow gmap tracks memory of nested guests (guest-3). In certain
scenarios, the shadow gmap needs to be rebuilt, which is a costly operation
since it involves a SIE exit into guest-1 for every entry in the respective
shadow level.

Add kvm stat counters when new shadow structures are created at various
levels. Also add a counter gmap_shadow_create when a completely fresh
shadow gmap is created as well as a counter gmap_shadow_reuse when an
existing gmap is being reused.

Note that when several levels are shadowed at once, counters on all
affected levels will be increased.

Also note that not all page table levels need to be present and a ASCE
can directly point to e.g. a segment table. In this case, a new segment
table will always be equivalent to a new shadow gmap and hence will be
counted as gmap_shadow_create and not as gmap_shadow_segment.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20231009093304.2555344-2-nrb@linux.ibm.com
Message-Id: <20231009093304.2555344-2-nrb@linux.ibm.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/gaccess.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/vsie.c