Hello community,

here is the log from the commit of package cpupower for openSUSE:Leap:15.2 
checked in at 2020-05-23 16:07:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/cpupower (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.cpupower.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cpupower"

Sat May 23 16:07:29 2020 rev:24 rq:808205 version:5.5

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/cpupower/cpupower.changes      2020-03-21 
16:50:26.789776836 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.cpupower.new.2738/cpupower.changes    
2020-05-23 16:07:31.857067324 +0200
@@ -1,0 +2,13 @@
+Tue May 19 09:21:48 UTC 2020 - Thomas Renninger <[email protected]>
+
+- Update to latest:
+  turbostat 20.03.20
+  intel-speed-select 1.3  (bsc#1171810)
+  verions
+- Adjust needed kernel and userspace requirements in:
+  cpupower_export_tarball_from_git.sh
+  and
+  BuildRequires: libcap-devel
+A remove_bits_h.patch
+
+-------------------------------------------------------------------

Old:
----
  intel-speed-select-1.0.tar.bz2
  turbostat-19.08.31.tar.bz2

New:
----
  intel-speed-select-1.3.tar.bz2
  remove_bits_h.patch
  turbostat-20.03.20.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cpupower.spec ++++++
--- /var/tmp/diff_new_pack.F5zkbc/_old  2020-05-23 16:07:34.649073311 +0200
+++ /var/tmp/diff_new_pack.F5zkbc/_new  2020-05-23 16:07:34.653073320 +0200
@@ -20,9 +20,9 @@
 # Use this as version when things are in mainline kernel
 %define version %(rpm -q --qf '%{VERSION}' kernel-source)
 
-%define tsversion      19.08.31
+%define tsversion      20.03.20
 %define pbversion      17.05.11
-%define ssversion      1.0
+%define ssversion      1.3
 
 Name:           cpupower
 # Use this as version when things are in mainline kernel
@@ -48,6 +48,7 @@
 
 #turbostat patches
 Patch22:        turbostat_makefile_fix_asm_header.patch
+Patch23:        remove_bits_h.patch
 
 # x86_energy_perf patches
 # Fixes bsc#1048546:
@@ -57,6 +58,7 @@
 Patch50:        intel-speed-select_remove_DATE_TIME.patch
 
 BuildRequires:  gettext-tools
+BuildRequires:  libcap-devel
 BuildRequires:  pciutils
 BuildRequires:  pciutils-devel
 
@@ -103,6 +105,7 @@
 
 cd ../turbostat-%{tsversion}
 %patch22 -p1
+%patch23 -p1
 
 cd ../x86_energy_perf_policy-%{pbversion}
 %patch30 -p1

++++++ cpupower_export_tarball_from_git.sh ++++++
--- /var/tmp/diff_new_pack.F5zkbc/_old  2020-05-23 16:07:34.737073499 +0200
+++ /var/tmp/diff_new_pack.F5zkbc/_new  2020-05-23 16:07:34.741073508 +0200
@@ -89,11 +89,16 @@
     fi
     TURBOSTAT_VERSION=$(echo "-$TURBOSTAT_VERSION")
     mv tools/power/x86/turbostat turbostat${TURBOSTAT_VERSION}
-    git checkout $GIT_TAG include/linux/bits.h
+    git checkout $GIT_TAG include/uapi/linux/const.h
+    git checkout $GIT_TAG include/vdso/bits.h
+    git checkout $GIT_TAG include/vdso/const.h
     git checkout $GIT_TAG arch/x86/include/asm/msr-index.h
     git checkout $GIT_TAG arch/x86/include/asm/intel-family.h
-    mkdir -p turbostat${TURBOSTAT_VERSION}/include/linux
-    cp include/linux/bits.h turbostat${TURBOSTAT_VERSION}/include/linux/bits.h
+    mkdir -p turbostat${TURBOSTAT_VERSION}/include/uapi/linux
+    mkdir -p turbostat${TURBOSTAT_VERSION}/include/vdso
+    cp include/uapi/linux/const.h 
turbostat${TURBOSTAT_VERSION}/include/uapi/linux/const.h
+    cp include/vdso/bits.h turbostat${TURBOSTAT_VERSION}/include/vdso/bits.h
+    cp include/vdso/const.h turbostat${TURBOSTAT_VERSION}/include/vdso/const.h
     cp arch/x86/include/asm/intel-family.h turbostat${TURBOSTAT_VERSION}
     cp arch/x86/include/asm/msr-index.h turbostat${TURBOSTAT_VERSION}
     tar -cvjf turbostat${TURBOSTAT_VERSION}.tar.bz2 
turbostat${TURBOSTAT_VERSION}

++++++ intel-speed-select-1.0.tar.bz2 -> intel-speed-select-1.3.tar.bz2 ++++++
++++ 3432 lines of diff (skipped)

++++++ remove_bits_h.patch ++++++
---
 msr-index.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/msr-index.h
+++ b/msr-index.h
@@ -2,7 +2,7 @@
 #ifndef _ASM_X86_MSR_INDEX_H
 #define _ASM_X86_MSR_INDEX_H
 
-#include <linux/bits.h>
+#include <vdso/bits.h>
 
 /*
  * CPU model specific register (MSR) numbers.
++++++ turbostat-19.08.31.tar.bz2 -> turbostat-20.03.20.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/.gitignore 
new/turbostat-20.03.20/.gitignore
--- old/turbostat-19.08.31/.gitignore   2019-10-28 21:05:03.000000000 +0100
+++ new/turbostat-20.03.20/.gitignore   2020-05-18 20:29:21.000000000 +0200
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 turbostat
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/Makefile 
new/turbostat-20.03.20/Makefile
--- old/turbostat-19.08.31/Makefile     2019-10-28 21:05:03.000000000 +0100
+++ new/turbostat-20.03.20/Makefile     2020-05-18 20:29:21.000000000 +0200
@@ -16,7 +16,7 @@
 
 %: %.c
        @mkdir -p $(BUILD_OUTPUT)
-       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
+       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) -lcap
 
 .PHONY : clean
 clean :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/include/linux/bits.h 
new/turbostat-20.03.20/include/linux/bits.h
--- old/turbostat-19.08.31/include/linux/bits.h 2019-10-29 16:21:38.630462997 
+0100
+++ new/turbostat-20.03.20/include/linux/bits.h 1970-01-01 01:00:00.000000000 
+0100
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __LINUX_BITS_H
-#define __LINUX_BITS_H
-
-#include <linux/const.h>
-#include <asm/bitsperlong.h>
-
-#define BIT(nr)                        (UL(1) << (nr))
-#define BIT_ULL(nr)            (ULL(1) << (nr))
-#define BIT_MASK(nr)           (UL(1) << ((nr) % BITS_PER_LONG))
-#define BIT_WORD(nr)           ((nr) / BITS_PER_LONG)
-#define BIT_ULL_MASK(nr)       (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
-#define BIT_ULL_WORD(nr)       ((nr) / BITS_PER_LONG_LONG)
-#define BITS_PER_BYTE          8
-
-/*
- * Create a contiguous bitmask starting at bit position @l and ending at
- * position @h. For example
- * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
- */
-#define GENMASK(h, l) \
-       (((~UL(0)) - (UL(1) << (l)) + 1) & \
-        (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
-
-#define GENMASK_ULL(h, l) \
-       (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
-        (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
-
-#endif /* __LINUX_BITS_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/include/uapi/linux/const.h 
new/turbostat-20.03.20/include/uapi/linux/const.h
--- old/turbostat-19.08.31/include/uapi/linux/const.h   1970-01-01 
01:00:00.000000000 +0100
+++ new/turbostat-20.03.20/include/uapi/linux/const.h   2020-05-19 
11:27:20.030375155 +0200
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _UAPI_LINUX_CONST_H
+#define _UAPI_LINUX_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code.  Therefore we cannot annotate them always with
+ * 'UL' and other type specifiers unilaterally.  We
+ * use the following macros to deal with this.
+ *
+ * Similarly, _AT() will cast an expression with a type in C, but
+ * leave it unchanged in asm.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)       X
+#define _AT(T,X)       X
+#else
+#define __AC(X,Y)      (X##Y)
+#define _AC(X,Y)       __AC(X,Y)
+#define _AT(T,X)       ((T)(X))
+#endif
+
+#define _UL(x)         (_AC(x, UL))
+#define _ULL(x)                (_AC(x, ULL))
+
+#define _BITUL(x)      (_UL(1) << (x))
+#define _BITULL(x)     (_ULL(1) << (x))
+
+#endif /* _UAPI_LINUX_CONST_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/include/vdso/bits.h 
new/turbostat-20.03.20/include/vdso/bits.h
--- old/turbostat-19.08.31/include/vdso/bits.h  1970-01-01 01:00:00.000000000 
+0100
+++ new/turbostat-20.03.20/include/vdso/bits.h  2020-05-19 11:27:20.030375155 
+0200
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __VDSO_BITS_H
+#define __VDSO_BITS_H
+
+#include <vdso/const.h>
+
+#define BIT(nr)                        (UL(1) << (nr))
+
+#endif /* __VDSO_BITS_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/include/vdso/const.h 
new/turbostat-20.03.20/include/vdso/const.h
--- old/turbostat-19.08.31/include/vdso/const.h 1970-01-01 01:00:00.000000000 
+0100
+++ new/turbostat-20.03.20/include/vdso/const.h 2020-05-19 11:27:20.034375155 
+0200
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __VDSO_CONST_H
+#define __VDSO_CONST_H
+
+#include <uapi/linux/const.h>
+
+#define UL(x)          (_UL(x))
+#define ULL(x)         (_ULL(x))
+
+#endif /* __VDSO_CONST_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/intel-family.h 
new/turbostat-20.03.20/intel-family.h
--- old/turbostat-19.08.31/intel-family.h       2019-10-29 16:21:38.634462997 
+0100
+++ new/turbostat-20.03.20/intel-family.h       2020-05-19 11:27:20.038375156 
+0200
@@ -35,6 +35,9 @@
  * The #define line may optionally include a comment including platform names.
  */
 
+/* Wildcard match for FAM6 so X86_MATCH_INTEL_FAM6_MODEL(ANY) works */
+#define INTEL_FAM6_ANY                 X86_MODEL_ANY
+
 #define INTEL_FAM6_CORE_YONAH          0x0E
 
 #define INTEL_FAM6_CORE2_MEROM         0x0F
@@ -111,23 +114,14 @@
 
 #define INTEL_FAM6_ATOM_TREMONT_D      0x86 /* Jacobsville */
 #define INTEL_FAM6_ATOM_TREMONT                0x96 /* Elkhart Lake */
+#define INTEL_FAM6_ATOM_TREMONT_L      0x9C /* Jasper Lake */
 
 /* Xeon Phi */
 
 #define INTEL_FAM6_XEON_PHI_KNL                0x57 /* Knights Landing */
 #define INTEL_FAM6_XEON_PHI_KNM                0x85 /* Knights Mill */
 
-/* Useful macros */
-#define INTEL_CPU_FAM_ANY(_family, _model, _driver_data)       \
-{                                                              \
-       .vendor         = X86_VENDOR_INTEL,                     \
-       .family         = _family,                              \
-       .model          = _model,                               \
-       .feature        = X86_FEATURE_ANY,                      \
-       .driver_data    = (kernel_ulong_t)&_driver_data         \
-}
-
-#define INTEL_CPU_FAM6(_model, _driver_data)                   \
-       INTEL_CPU_FAM_ANY(6, INTEL_FAM6_##_model, _driver_data)
+/* Family 5 */
+#define INTEL_FAM5_QUARK_X1000         0x09 /* Quark X1000 SoC */
 
 #endif /* _ASM_X86_INTEL_FAMILY_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/msr-index.h 
new/turbostat-20.03.20/msr-index.h
--- old/turbostat-19.08.31/msr-index.h  2019-10-29 16:21:38.638462997 +0100
+++ new/turbostat-20.03.20/msr-index.h  2020-05-19 11:27:20.038375156 +0200
@@ -41,6 +41,10 @@
 
 /* Intel MSRs. Some also available on other CPUs */
 
+#define MSR_TEST_CTRL                          0x00000033
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT    29
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT                
BIT(MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT)
+
 #define MSR_IA32_SPEC_CTRL             0x00000048 /* Speculation Control */
 #define SPEC_CTRL_IBRS                 BIT(0)     /* Indirect Branch 
Restricted Speculation */
 #define SPEC_CTRL_STIBP_SHIFT          1          /* Single Thread Indirect 
Branch Predictor (STIBP) bit */
@@ -70,6 +74,11 @@
  */
 #define MSR_IA32_UMWAIT_CONTROL_TIME_MASK      (~0x03U)
 
+/* Abbreviated from Intel SDM name IA32_CORE_CAPABILITIES */
+#define MSR_IA32_CORE_CAPS                       0x000000cf
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT  5
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT     
BIT(MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT)
+
 #define MSR_PKG_CST_CONFIG_CONTROL     0x000000e2
 #define NHM_C3_AUTO_DEMOTE             (1UL << 25)
 #define NHM_C1_AUTO_DEMOTE             (1UL << 26)
@@ -93,6 +102,18 @@
                                                  * Microarchitectural Data
                                                  * Sampling (MDS) 
vulnerabilities.
                                                  */
+#define ARCH_CAP_PSCHANGE_MC_NO                BIT(6)   /*
+                                                 * The processor is not 
susceptible to a
+                                                 * machine check error due to 
modifying the
+                                                 * code page size along with 
either the
+                                                 * physical address or cache 
type
+                                                 * without TLB invalidation.
+                                                 */
+#define ARCH_CAP_TSX_CTRL_MSR          BIT(7)  /* MSR for TSX control is 
available. */
+#define ARCH_CAP_TAA_NO                        BIT(8)  /*
+                                                * Not susceptible to
+                                                * TSX Async Abort (TAA) 
vulnerabilities.
+                                                */
 
 #define MSR_IA32_FLUSH_CMD             0x0000010b
 #define L1D_FLUSH                      BIT(0)  /*
@@ -103,6 +124,10 @@
 #define MSR_IA32_BBL_CR_CTL            0x00000119
 #define MSR_IA32_BBL_CR_CTL3           0x0000011e
 
+#define MSR_IA32_TSX_CTRL              0x00000122
+#define TSX_CTRL_RTM_DISABLE           BIT(0)  /* Disable RTM feature */
+#define TSX_CTRL_CPUID_CLEAR           BIT(1)  /* Disable TSX enumeration */
+
 #define MSR_IA32_SYSENTER_CS           0x00000174
 #define MSR_IA32_SYSENTER_ESP          0x00000175
 #define MSR_IA32_SYSENTER_EIP          0x00000176
@@ -393,6 +418,8 @@
 #define MSR_AMD_PSTATE_DEF_BASE                0xc0010064
 #define MSR_AMD64_OSVW_ID_LENGTH       0xc0010140
 #define MSR_AMD64_OSVW_STATUS          0xc0010141
+#define MSR_AMD_PPIN_CTL               0xc00102f0
+#define MSR_AMD_PPIN                   0xc00102f1
 #define MSR_AMD64_LS_CFG               0xc0011020
 #define MSR_AMD64_DC_CFG               0xc0011022
 #define MSR_AMD64_BU_CFG2              0xc001102a
@@ -494,6 +521,8 @@
 #define MSR_K7_HWCR                    0xc0010015
 #define MSR_K7_HWCR_SMMLOCK_BIT                0
 #define MSR_K7_HWCR_SMMLOCK            BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
+#define MSR_K7_HWCR_IRPERF_EN_BIT      30
+#define MSR_K7_HWCR_IRPERF_EN          BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
 #define MSR_K7_FID_VID_CTL             0xc0010041
 #define MSR_K7_FID_VID_STATUS          0xc0010042
 
@@ -540,7 +569,14 @@
 #define MSR_IA32_EBL_CR_POWERON                0x0000002a
 #define MSR_EBC_FREQUENCY_ID           0x0000002c
 #define MSR_SMI_COUNT                  0x00000034
-#define MSR_IA32_FEATURE_CONTROL        0x0000003a
+
+/* Referred to as IA32_FEATURE_CONTROL in Intel's SDM. */
+#define MSR_IA32_FEAT_CTL              0x0000003a
+#define FEAT_CTL_LOCKED                                BIT(0)
+#define FEAT_CTL_VMX_ENABLED_INSIDE_SMX                BIT(1)
+#define FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX       BIT(2)
+#define FEAT_CTL_LMCE_ENABLED                  BIT(20)
+
 #define MSR_IA32_TSC_ADJUST             0x0000003b
 #define MSR_IA32_BNDCFGS               0x00000d90
 
@@ -548,11 +584,6 @@
 
 #define MSR_IA32_XSS                   0x00000da0
 
-#define FEATURE_CONTROL_LOCKED                         (1<<0)
-#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX       (1<<1)
-#define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX      (1<<2)
-#define FEATURE_CONTROL_LMCE                           (1<<20)
-
 #define MSR_IA32_APICBASE              0x0000001b
 #define MSR_IA32_APICBASE_BSP          (1<<8)
 #define MSR_IA32_APICBASE_ENABLE       (1<<11)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-19.08.31/turbostat.c 
new/turbostat-20.03.20/turbostat.c
--- old/turbostat-19.08.31/turbostat.c  2019-10-28 21:05:03.000000000 +0100
+++ new/turbostat-20.03.20/turbostat.c  2020-05-18 20:29:21.000000000 +0200
@@ -30,7 +30,7 @@
 #include <sched.h>
 #include <time.h>
 #include <cpuid.h>
-#include <linux/capability.h>
+#include <sys/capability.h>
 #include <errno.h>
 #include <math.h>
 
@@ -304,6 +304,10 @@
 
 void setup_all_buffers(void);
 
+char *sys_lpi_file;
+char *sys_lpi_file_sysfs = 
"/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us";
+char *sys_lpi_file_debugfs = 
"/sys/kernel/debug/pmc_core/slp_s0_residency_usec";
+
 int cpu_is_not_present(int cpu)
 {
        return !CPU_ISSET_S(cpu, cpu_present_setsize, cpu_present_set);
@@ -2916,8 +2920,6 @@
  *
  * record snapshot of
  * /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
- *
- * return 1 if config change requires a restart, else return 0
  */
 int snapshot_cpu_lpi_us(void)
 {
@@ -2941,17 +2943,14 @@
 /*
  * snapshot_sys_lpi()
  *
- * record snapshot of
- * /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
- *
- * return 1 if config change requires a restart, else return 0
+ * record snapshot of sys_lpi_file
  */
 int snapshot_sys_lpi_us(void)
 {
        FILE *fp;
        int retval;
 
-       fp = 
fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us",
 "r");
+       fp = fopen_or_die(sys_lpi_file, "r");
 
        retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us);
        if (retval != 1) {
@@ -3151,28 +3150,42 @@
                        err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" ");
 }
 
-void check_permissions()
+/*
+ * check for CAP_SYS_RAWIO
+ * return 0 on success
+ * return 1 on fail
+ */
+int check_for_cap_sys_rawio(void)
 {
-       struct __user_cap_header_struct cap_header_data;
-       cap_user_header_t cap_header = &cap_header_data;
-       struct __user_cap_data_struct cap_data_data;
-       cap_user_data_t cap_data = &cap_data_data;
-       extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
-       int do_exit = 0;
-       char pathname[32];
+       cap_t caps;
+       cap_flag_value_t cap_flag_value;
 
-       /* check for CAP_SYS_RAWIO */
-       cap_header->pid = getpid();
-       cap_header->version = _LINUX_CAPABILITY_VERSION;
-       if (capget(cap_header, cap_data) < 0)
-               err(-6, "capget(2) failed");
+       caps = cap_get_proc();
+       if (caps == NULL)
+               err(-6, "cap_get_proc\n");
 
-       if ((cap_data->effective & (1 << CAP_SYS_RAWIO)) == 0) {
-               do_exit++;
+       if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value))
+               err(-6, "cap_get\n");
+
+       if (cap_flag_value != CAP_SET) {
                warnx("capget(CAP_SYS_RAWIO) failed,"
                        " try \"# setcap cap_sys_rawio=ep %s\"", progname);
+               return 1;
        }
 
+       if (cap_free(caps) == -1)
+               err(-6, "cap_free\n");
+
+       return 0;
+}
+void check_permissions(void)
+{
+       int do_exit = 0;
+       char pathname[32];
+
+       /* check for CAP_SYS_RAWIO */
+       do_exit += check_for_cap_sys_rawio();
+
        /* test file permissions */
        sprintf(pathname, "/dev/cpu/%d/msr", base_cpu);
        if (euidaccess(pathname, R_OK)) {
@@ -3265,6 +3278,7 @@
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
        case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
        case INTEL_FAM6_ATOM_GOLDMONT_D:        /* DNV */
+       case INTEL_FAM6_ATOM_TREMONT:   /* EHL */
                pkg_cstate_limits = glm_pkg_cstate_limits;
                break;
        default:
@@ -3336,6 +3350,17 @@
        }
        return 0;
 }
+int is_ehl(unsigned int family, unsigned int model)
+{
+       if (!genuine_intel)
+               return 0;
+
+       switch (model) {
+       case INTEL_FAM6_ATOM_TREMONT:
+               return 1;
+       }
+       return 0;
+}
 
 int has_turbo_ratio_limit(unsigned int family, unsigned int model)
 {
@@ -3478,6 +3503,23 @@
        dump_nhm_cst_cfg();
 }
 
+static void dump_sysfs_file(char *path)
+{
+       FILE *input;
+       char cpuidle_buf[64];
+
+       input = fopen(path, "r");
+       if (input == NULL) {
+               if (debug)
+                       fprintf(outf, "NSFOD %s\n", path);
+               return;
+       }
+       if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input))
+               err(1, "%s: failed to read file", path);
+       fclose(input);
+
+       fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf);
+}
 static void
 dump_sysfs_cstate_config(void)
 {
@@ -3491,6 +3533,15 @@
        if (!DO_BIC(BIC_sysfs))
                return;
 
+       if (access("/sys/devices/system/cpu/cpuidle", R_OK)) {
+               fprintf(outf, "cpuidle not loaded\n");
+               return;
+       }
+
+       dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver");
+       dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor");
+       dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro");
+
        for (state = 0; state < 10; ++state) {
 
                sprintf(path, 
"/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",
@@ -3894,6 +3945,20 @@
                else
                        BIC_PRESENT(BIC_PkgWatt);
                break;
+       case INTEL_FAM6_ATOM_TREMONT:   /* EHL */
+               do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM 
| RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
+               if (rapl_joules) {
+                       BIC_PRESENT(BIC_Pkg_J);
+                       BIC_PRESENT(BIC_Cor_J);
+                       BIC_PRESENT(BIC_RAM_J);
+                       BIC_PRESENT(BIC_GFX_J);
+               } else {
+                       BIC_PRESENT(BIC_PkgWatt);
+                       BIC_PRESENT(BIC_CorWatt);
+                       BIC_PRESENT(BIC_RAMWatt);
+                       BIC_PRESENT(BIC_GFXWatt);
+               }
+               break;
        case INTEL_FAM6_SKYLAKE_L:      /* SKL */
        case INTEL_FAM6_CANNONLAKE_L:   /* CNL */
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM 
| RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
@@ -4295,6 +4360,7 @@
        case INTEL_FAM6_ATOM_GOLDMONT:          /* BXT */
        case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
        case INTEL_FAM6_ATOM_GOLDMONT_D:        /* DNV */
+       case INTEL_FAM6_ATOM_TREMONT:           /* EHL */
                return 1;
        }
        return 0;
@@ -4324,6 +4390,7 @@
        case INTEL_FAM6_CANNONLAKE_L:   /* CNL */
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
        case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
+       case INTEL_FAM6_ATOM_TREMONT:   /* EHL */
                return 1;
        }
        return 0;
@@ -4499,10 +4566,10 @@
 {
        unsigned long long msr;
 
-       if (!get_msr(base_cpu, MSR_IA32_FEATURE_CONTROL, &msr))
+       if (!get_msr(base_cpu, MSR_IA32_FEAT_CTL, &msr))
                fprintf(outf, "cpu%d: MSR_IA32_FEATURE_CONTROL: 0x%08llx 
(%sLocked %s)\n",
                        base_cpu, msr,
-                       msr & FEATURE_CONTROL_LOCKED ? "" : "UN-",
+                       msr & FEAT_CTL_LOCKED ? "" : "UN-",
                        msr & (1 << 18) ? "SGX" : "");
 }
 
@@ -4610,14 +4677,24 @@
        case INTEL_FAM6_SKYLAKE:
        case INTEL_FAM6_KABYLAKE_L:
        case INTEL_FAM6_KABYLAKE:
+       case INTEL_FAM6_COMETLAKE_L:
+       case INTEL_FAM6_COMETLAKE:
                return INTEL_FAM6_SKYLAKE_L;
 
        case INTEL_FAM6_ICELAKE_L:
        case INTEL_FAM6_ICELAKE_NNPI:
+       case INTEL_FAM6_TIGERLAKE_L:
+       case INTEL_FAM6_TIGERLAKE:
                return INTEL_FAM6_CANNONLAKE_L;
 
        case INTEL_FAM6_ATOM_TREMONT_D:
                return INTEL_FAM6_ATOM_GOLDMONT_D;
+
+       case INTEL_FAM6_ATOM_TREMONT_L:
+               return INTEL_FAM6_ATOM_TREMONT;
+
+       case INTEL_FAM6_ICELAKE_X:
+               return INTEL_FAM6_SKYLAKE_X;
        }
        return model;
 }
@@ -4872,7 +4949,8 @@
        do_slm_cstates = is_slm(family, model);
        do_knl_cstates  = is_knl(family, model);
 
-       if (do_slm_cstates || do_knl_cstates || is_cnl(family, model))
+       if (do_slm_cstates || do_knl_cstates || is_cnl(family, model) ||
+           is_ehl(family, model))
                BIC_NOT_PRESENT(BIC_CPU_c3);
 
        if (!quiet)
@@ -4907,10 +4985,16 @@
        else
                BIC_NOT_PRESENT(BIC_CPU_LPI);
 
-       if 
(!access("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", 
R_OK))
+       if (!access(sys_lpi_file_sysfs, R_OK)) {
+               sys_lpi_file = sys_lpi_file_sysfs;
                BIC_PRESENT(BIC_SYS_LPI);
-       else
+       } else if (!access(sys_lpi_file_debugfs, R_OK)) {
+               sys_lpi_file = sys_lpi_file_debugfs;
+               BIC_PRESENT(BIC_SYS_LPI);
+       } else {
+               sys_lpi_file_sysfs = NULL;
                BIC_NOT_PRESENT(BIC_SYS_LPI);
+       }
 
        if (!quiet)
                decode_misc_feature_control();
@@ -5306,7 +5390,7 @@
 }
 
 void print_version() {
-       fprintf(outf, "turbostat version 19.08.31"
+       fprintf(outf, "turbostat version 20.03.20"
                " - Len Brown <[email protected]>\n");
 }
 
@@ -5323,9 +5407,9 @@
        }
 
        msrp->msr_num = msr_num;
-       strncpy(msrp->name, name, NAME_BYTES);
+       strncpy(msrp->name, name, NAME_BYTES - 1);
        if (path)
-               strncpy(msrp->path, path, PATH_BYTES);
+               strncpy(msrp->path, path, PATH_BYTES - 1);
        msrp->width = width;
        msrp->type = type;
        msrp->format = format;


Reply via email to