]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - arch/x86/events/probe.c
perf/x86/rapl: Add msr mask support
[mirror_ubuntu-kernels.git] / arch / x86 / events / probe.c
index 136a1e847254eab25b3236c42b633e038431a6d7..600bf8d15c0c9cf423ae22f340359f606d97f758 100644 (file)
@@ -28,6 +28,7 @@ perf_msr_probe(struct perf_msr *msr, int cnt, bool zero, void *data)
        for (bit = 0; bit < cnt; bit++) {
                if (!msr[bit].no_check) {
                        struct attribute_group *grp = msr[bit].grp;
+                       u64 mask;
 
                        /* skip entry with no group */
                        if (!grp)
@@ -44,8 +45,12 @@ perf_msr_probe(struct perf_msr *msr, int cnt, bool zero, void *data)
                        /* Virt sucks; you cannot tell if a R/O MSR is present :/ */
                        if (rdmsrl_safe(msr[bit].msr, &val))
                                continue;
+
+                       mask = msr[bit].mask;
+                       if (!mask)
+                               mask = ~0ULL;
                        /* Disable zero counters if requested. */
-                       if (!zero && !val)
+                       if (!zero && !(val & mask))
                                continue;
 
                        grp->is_visible = NULL;