aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2016-11-08 03:53:34 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-12-12 06:12:18 -0500
commitc19805f870c1fa87c69819eb1e18d9c5fc398f58 (patch)
tree9315f283cb443bea2890f9d714c874f169d73a83
parentb4623d4e5b2370fcf1200cbf832aaa53f6e96ef3 (diff)
s390/cpumf: Use configuration level indication for sampling data
Newer hardware provides the level of virtualization that a particular sample belongs to. Use that information and fall back to the old heuristics if the sample does not contain that information. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/cpu_mf.h3
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c27
2 files changed, 22 insertions, 8 deletions
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h
index 03516476127b..b69d8bc231a5 100644
--- a/arch/s390/include/asm/cpu_mf.h
+++ b/arch/s390/include/asm/cpu_mf.h
@@ -104,7 +104,8 @@ struct hws_basic_entry {
104 unsigned int P:1; /* 28 PSW Problem state */ 104 unsigned int P:1; /* 28 PSW Problem state */
105 unsigned int AS:2; /* 29-30 PSW address-space control */ 105 unsigned int AS:2; /* 29-30 PSW address-space control */
106 unsigned int I:1; /* 31 entry valid or invalid */ 106 unsigned int I:1; /* 31 entry valid or invalid */
107 unsigned int:16; 107 unsigned int CL:2; /* 32-33 Configuration Level */
108 unsigned int:14;
108 unsigned int prim_asn:16; /* primary ASN */ 109 unsigned int prim_asn:16; /* primary ASN */
109 unsigned long long ia; /* Instruction Address */ 110 unsigned long long ia; /* Instruction Address */
110 unsigned long long gpp; /* Guest Program Parameter */ 111 unsigned long long gpp; /* Guest Program Parameter */
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 4e7ee8647b8b..763dec18edcd 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -1002,16 +1002,29 @@ static int perf_push_sample(struct perf_event *event, struct sf_raw_sample *sfr)
1002 psw_bits(regs.psw).as = sfr->basic.AS; 1002 psw_bits(regs.psw).as = sfr->basic.AS;
1003 1003
1004 /* 1004 /*
1005 * A non-zero guest program parameter indicates a guest 1005 * Use the hardware provided configuration level to decide if the
1006 * sample. 1006 * sample belongs to a guest or host. If that is not available,
1007 * Note that some early samples or samples from guests without 1007 * fall back to the following heuristics:
1008 * A non-zero guest program parameter always indicates a guest
1009 * sample. Some early samples or samples from guests without
1008 * lpp usage would be misaccounted to the host. We use the asn 1010 * lpp usage would be misaccounted to the host. We use the asn
1009 * value as a heuristic to detect most of these guest samples. 1011 * value as an addon heuristic to detect most of these guest samples.
1010 * If the value differs from the host hpp value, we assume 1012 * If the value differs from the host hpp value, we assume to be a
1011 * it to be a KVM guest. 1013 * KVM guest.
1012 */ 1014 */
1013 if (sfr->basic.gpp || sfr->basic.prim_asn != (u16) sfr->basic.hpp) 1015 switch (sfr->basic.CL) {
1016 case 1: /* logical partition */
1017 sde_regs->in_guest = 0;
1018 break;
1019 case 2: /* virtual machine */
1014 sde_regs->in_guest = 1; 1020 sde_regs->in_guest = 1;
1021 break;
1022 default: /* old machine, use heuristics */
1023 if (sfr->basic.gpp ||
1024 sfr->basic.prim_asn != (u16)sfr->basic.hpp)
1025 sde_regs->in_guest = 1;
1026 break;
1027 }
1015 1028
1016 overflow = 0; 1029 overflow = 0;
1017 if (perf_exclude_event(event, &regs, sde_regs)) 1030 if (perf_exclude_event(event, &regs, sde_regs))