i386/cpu: Expand MAX_FIXED_COUNTERS from 3 to 4 to for Icelake
PATCH 1/1 i386/cpu: Expand MAX_FIXED_COUNTERS from 3 to 4 to for Icelake
In the Intel SDM, "Table 18-2. Association of Fixed-Function Performance Counters with Architectural Performance Events", we may have a new fixed counter 'TOPDOWN.SLOTS' (since Icelake), which counts the number of available slots for an unhalted logical processor. Check commit 6017608936 in the kernel tree.
--- target/i386/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.h +1 -1
@@ -1185,7 +1185,7 @@ typedef struct {#define CPU_NB_REGS CPU_NB_REGS32#endif -#define MAX_FIXED_COUNTERS 3 +#define MAX_FIXED_COUNTERS 4#define MAX_GP_COUNTERS (MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0)#define TARGET_INSN_START_EXTRA_WORDS 1
Signature · 1 line
2.21.1
Anyone to help review this change?
Thanks,
Like Xu
Quoted 25 lines · Like Xu
In the Intel SDM, "Table 18-2. Association of Fixed-Function Performance Counters with Architectural Performance Events", we may have a new fixed counter 'TOPDOWN.SLOTS' (since Icelake), which counts the number of available slots for an unhalted logical processor. Check commit 6017608936 in the kernel tree.
Signed-off-by Like Xu <[email protected]>--- target/i386/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.h +1
-1@@ -1185,7 +1185,7 @@ typedef struct {#define CPU_NB_REGS CPU_NB_REGS32#endif -#define MAX_FIXED_COUNTERS 3 +#define MAX_FIXED_COUNTERS 4#define MAX_GP_COUNTERS (MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0)#define TARGET_INSN_START_EXTRA_WORDS 1
Quoted 17 lines · Like Xu
In the Intel SDM, "Table 18-2. Association of Fixed-Function Performance Counters with Architectural Performance Events", we may have a new fixed counter 'TOPDOWN.SLOTS' (since Icelake), which counts the number of available slots for an unhalted logical processor. Check commit 6017608936 in the kernel tree.
Signed-off-by Like Xu <[email protected]>--- target/i386/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.h +0
-0
target/i386/cpu.h typedef struct { · line 1191
Quoted 8 lines
target/i386/cpu.h +1
-1@@ -1185,7 +1185,7 @@ typedef struct {#define CPU_NB_REGS CPU_NB_REGS32#endif -#define MAX_FIXED_COUNTERS 3 +#define MAX_FIXED_COUNTERS 4#define MAX_GP_COUNTERS (MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0)#define TARGET_INSN_START_EXTRA_WORDS 1
Hi Like, the problem with this patch is that it breaks live migration; the vmstate_msr_architectural_pmu record hardcodes MAX_FIXED_COUNTERS as the number of registers.
So it's more complicated, you need to add a new subsection (following vmstate_msr_architectural_pmu) and transmit it only if the 4th counter is nonzero (instead of the more complicated check in pmu_enable_needed).
Just to be safe, I'd make the new subsection hold 16 counters and bumpMAX_FIXED_COUNTERS to 16.
Thanks,
Paolo
Quoted 31 lines · Paolo Bonzini
Quoted 17 lines · Like Xu
In the Intel SDM, "Table 18-2. Association of Fixed-Function Performance Counters with Architectural Performance Events", we may have a new fixed counter 'TOPDOWN.SLOTS' (since Icelake), which counts the number of available slots for an unhalted logical processor. Check commit 6017608936 in the kernel tree.
Signed-off-by Like Xu <[email protected]>--- target/i386/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.h +0
-0target/i386/cpu.h typedef struct { · line 1191
Quoted 8 lines
target/i386/cpu.h +1
-1@@ -1185,7 +1185,7 @@ typedef struct {#define CPU_NB_REGS CPU_NB_REGS32#endif -#define MAX_FIXED_COUNTERS 3 +#define MAX_FIXED_COUNTERS 4#define MAX_GP_COUNTERS (MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0)#define TARGET_INSN_START_EXTRA_WORDS 1Hi Like, the problem with this patch is that it breaks live migration; the
vmstate_msr_architectural_pmurecord hardcodesMAX_FIXED_COUNTERSas the number of registers.
Quoted 5 lines
So it's more complicated, you need to add a new subsection (following
vmstate_msr_architectural_pmu) and transmit it only if the 4th counter is nonzero (instead of the more complicated check inpmu_enable_needed).
Just to be safe, I'd make the new subsection hold 16 counters and bumpMAX_FIXED_COUNTERSto 16.
The new MAX_FIXED_COUNTERS looks good to me and
and let me follow up this live migration issue.
Thanks,
Like Xu
Quoted 6 lines
Thanks,
Paolo