Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
"Misc fixlets from all around the place"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86/uncore: Fix IVT/SNB-EP uncore CBOX NID filter table
perf/x86: Correctly use FEATURE_PDCM
perf, nmi: Fix unknown NMI warning
perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches
perf trace: Add fallback definition of EFD_SEMAPHORE
perf list: Fix checking for supported events on older kernels
perf tools: Handle PERF_RECORD_HEADER_EVENT_TYPE properly
perf probe: Do not add offset twice to uprobe address
perf/x86: Fix Userspace RDPMC switch
perf/x86/intel/p6: Add userspace RDPMC quirk for PPro

+98 -31
+6 -2
arch/x86/kernel/cpu/perf_event.c
··· 1521 1521 1522 1522 pr_cont("%s PMU driver.\n", x86_pmu.name); 1523 1523 1524 + x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */ 1525 + 1524 1526 for (quirk = x86_pmu.quirks; quirk; quirk = quirk->next) 1525 1527 quirk->func(); 1526 1528 ··· 1536 1534 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1, 1537 1535 0, x86_pmu.num_counters, 0, 0); 1538 1536 1539 - x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */ 1540 1537 x86_pmu_format_group.attrs = x86_pmu.format_attrs; 1541 1538 1542 1539 if (x86_pmu.event_attrs) ··· 1821 1820 if (ret) 1822 1821 return ret; 1823 1822 1823 + if (x86_pmu.attr_rdpmc_broken) 1824 + return -ENOTSUPP; 1825 + 1824 1826 if (!!val != !!x86_pmu.attr_rdpmc) { 1825 1827 x86_pmu.attr_rdpmc = !!val; 1826 - smp_call_function(change_rdpmc, (void *)val, 1); 1828 + on_each_cpu(change_rdpmc, (void *)val, 1); 1827 1829 } 1828 1830 1829 1831 return count;
+1
arch/x86/kernel/cpu/perf_event.h
··· 409 409 /* 410 410 * sysfs attrs 411 411 */ 412 + int attr_rdpmc_broken; 412 413 int attr_rdpmc; 413 414 struct attribute **format_attrs; 414 415 struct attribute **event_attrs;
+3 -8
arch/x86/kernel/cpu/perf_event_intel.c
··· 1361 1361 intel_pmu_disable_all(); 1362 1362 handled = intel_pmu_drain_bts_buffer(); 1363 1363 status = intel_pmu_get_status(); 1364 - if (!status) { 1365 - intel_pmu_enable_all(0); 1366 - return handled; 1367 - } 1364 + if (!status) 1365 + goto done; 1368 1366 1369 1367 loops = 0; 1370 1368 again: ··· 2308 2310 if (version > 1) 2309 2311 x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3); 2310 2312 2311 - /* 2312 - * v2 and above have a perf capabilities MSR 2313 - */ 2314 - if (version > 1) { 2313 + if (boot_cpu_has(X86_FEATURE_PDCM)) { 2315 2314 u64 capabilities; 2316 2315 2317 2316 rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
+11 -3
arch/x86/kernel/cpu/perf_event_intel_uncore.c
··· 501 501 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN, 502 502 SNBEP_CBO_PMON_CTL_TID_EN, 0x1), 503 503 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4), 504 + SNBEP_CBO_EVENT_EXTRA_REG(0x4334, 0xffff, 0x6), 504 505 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), 506 + SNBEP_CBO_EVENT_EXTRA_REG(0x4534, 0xffff, 0x6), 505 507 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), 508 + SNBEP_CBO_EVENT_EXTRA_REG(0x4934, 0xffff, 0x6), 506 509 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x6), 507 510 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x8), 508 511 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x8), ··· 1181 1178 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN, 1182 1179 SNBEP_CBO_PMON_CTL_TID_EN, 0x1), 1183 1180 SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2), 1184 - SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4), 1185 - SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), 1186 - SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), 1181 + SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), 1187 1182 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0xc), 1183 + SNBEP_CBO_EVENT_EXTRA_REG(0x5134, 0xffff, 0xc), 1184 + SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4), 1185 + SNBEP_CBO_EVENT_EXTRA_REG(0x4334, 0xffff, 0xc), 1186 + SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), 1187 + SNBEP_CBO_EVENT_EXTRA_REG(0x4534, 0xffff, 0xc), 1188 + SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), 1189 + SNBEP_CBO_EVENT_EXTRA_REG(0x4934, 0xffff, 0xc), 1188 1190 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x10), 1189 1191 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x10), 1190 1192 SNBEP_CBO_EVENT_EXTRA_REG(0x2135, 0xffff, 0x10),
+33 -15
arch/x86/kernel/cpu/perf_event_p6.c
··· 231 231 232 232 }; 233 233 234 + static __init void p6_pmu_rdpmc_quirk(void) 235 + { 236 + if (boot_cpu_data.x86_mask < 9) { 237 + /* 238 + * PPro erratum 26; fixed in stepping 9 and above. 239 + */ 240 + pr_warn("Userspace RDPMC support disabled due to a CPU erratum\n"); 241 + x86_pmu.attr_rdpmc_broken = 1; 242 + x86_pmu.attr_rdpmc = 0; 243 + } 244 + } 245 + 234 246 __init int p6_pmu_init(void) 235 247 { 248 + x86_pmu = p6_pmu; 249 + 236 250 switch (boot_cpu_data.x86_model) { 237 - case 1: 238 - case 3: /* Pentium Pro */ 239 - case 5: 240 - case 6: /* Pentium II */ 241 - case 7: 242 - case 8: 243 - case 11: /* Pentium III */ 244 - case 9: 245 - case 13: 246 - /* Pentium M */ 251 + case 1: /* Pentium Pro */ 252 + x86_add_quirk(p6_pmu_rdpmc_quirk); 247 253 break; 254 + 255 + case 3: /* Pentium II - Klamath */ 256 + case 5: /* Pentium II - Deschutes */ 257 + case 6: /* Pentium II - Mendocino */ 258 + break; 259 + 260 + case 7: /* Pentium III - Katmai */ 261 + case 8: /* Pentium III - Coppermine */ 262 + case 10: /* Pentium III Xeon */ 263 + case 11: /* Pentium III - Tualatin */ 264 + break; 265 + 266 + case 9: /* Pentium M - Banias */ 267 + case 13: /* Pentium M - Dothan */ 268 + break; 269 + 248 270 default: 249 - pr_cont("unsupported p6 CPU model %d ", 250 - boot_cpu_data.x86_model); 271 + pr_cont("unsupported p6 CPU model %d ", boot_cpu_data.x86_model); 251 272 return -ENODEV; 252 273 } 253 274 254 - x86_pmu = p6_pmu; 255 - 256 275 memcpy(hw_cache_event_ids, p6_hw_cache_event_ids, 257 276 sizeof(hw_cache_event_ids)); 258 - 259 277 260 278 return 0; 261 279 }
+22
tools/perf/builtin-trace.c
··· 37 37 # define MADV_UNMERGEABLE 13 38 38 #endif 39 39 40 + #ifndef EFD_SEMAPHORE 41 + # define EFD_SEMAPHORE 1 42 + #endif 43 + 40 44 struct tp_field { 41 45 int offset; 42 46 union { ··· 283 279 284 280 #define SCA_STRARRAY syscall_arg__scnprintf_strarray 285 281 282 + #if defined(__i386__) || defined(__x86_64__) 283 + /* 284 + * FIXME: Make this available to all arches as soon as the ioctl beautifier 285 + * gets rewritten to support all arches. 286 + */ 286 287 static size_t syscall_arg__scnprintf_strhexarray(char *bf, size_t size, 287 288 struct syscall_arg *arg) 288 289 { ··· 295 286 } 296 287 297 288 #define SCA_STRHEXARRAY syscall_arg__scnprintf_strhexarray 289 + #endif /* defined(__i386__) || defined(__x86_64__) */ 298 290 299 291 static size_t syscall_arg__scnprintf_fd(char *bf, size_t size, 300 292 struct syscall_arg *arg); ··· 849 839 850 840 #define SCA_SIGNUM syscall_arg__scnprintf_signum 851 841 842 + #if defined(__i386__) || defined(__x86_64__) 843 + /* 844 + * FIXME: Make this available to all arches. 845 + */ 852 846 #define TCGETS 0x5401 853 847 854 848 static const char *tioctls[] = { ··· 874 860 }; 875 861 876 862 static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401); 863 + #endif /* defined(__i386__) || defined(__x86_64__) */ 877 864 878 865 #define STRARRAY(arg, name, array) \ 879 866 .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ ··· 956 941 { .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), }, 957 942 { .name = "ioctl", .errmsg = true, 958 943 .arg_scnprintf = { [0] = SCA_FD, /* fd */ 944 + #if defined(__i386__) || defined(__x86_64__) 945 + /* 946 + * FIXME: Make this available to all arches. 947 + */ 959 948 [1] = SCA_STRHEXARRAY, /* cmd */ 960 949 [2] = SCA_HEX, /* arg */ }, 961 950 .arg_parm = { [1] = &strarray__tioctls, /* cmd */ }, }, 951 + #else 952 + [2] = SCA_HEX, /* arg */ }, }, 953 + #endif 962 954 { .name = "kill", .errmsg = true, 963 955 .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, }, 964 956 { .name = "linkat", .errmsg = true,
+15 -2
tools/perf/util/parse-events.c
··· 1091 1091 static bool is_event_supported(u8 type, unsigned config) 1092 1092 { 1093 1093 bool ret = true; 1094 + int open_return; 1094 1095 struct perf_evsel *evsel; 1095 1096 struct perf_event_attr attr = { 1096 1097 .type = type, 1097 1098 .config = config, 1098 1099 .disabled = 1, 1099 - .exclude_kernel = 1, 1100 1100 }; 1101 1101 struct { 1102 1102 struct thread_map map; ··· 1108 1108 1109 1109 evsel = perf_evsel__new(&attr); 1110 1110 if (evsel) { 1111 - ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0; 1111 + open_return = perf_evsel__open(evsel, NULL, &tmap.map); 1112 + ret = open_return >= 0; 1113 + 1114 + if (open_return == -EACCES) { 1115 + /* 1116 + * This happens if the paranoid value 1117 + * /proc/sys/kernel/perf_event_paranoid is set to 2 1118 + * Re-run with exclude_kernel set; we don't do that 1119 + * by default as some ARM machines do not support it. 1120 + * 1121 + */ 1122 + evsel->attr.exclude_kernel = 1; 1123 + ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0; 1124 + } 1112 1125 perf_evsel__delete(evsel); 1113 1126 } 1114 1127
+1 -1
tools/perf/util/probe-event.c
··· 336 336 return ret; 337 337 338 338 for (i = 0; i < ntevs && ret >= 0; i++) { 339 + /* point.address is the addres of point.symbol + point.offset */ 339 340 offset = tevs[i].point.address - stext; 340 - offset += tevs[i].point.offset; 341 341 tevs[i].point.offset = 0; 342 342 zfree(&tevs[i].point.symbol); 343 343 ret = e_snprintf(buf, 32, "0x%lx", offset);
+6
tools/perf/util/session.c
··· 1008 1008 if (err == 0) 1009 1009 perf_session__set_id_hdr_size(session); 1010 1010 return err; 1011 + case PERF_RECORD_HEADER_EVENT_TYPE: 1012 + /* 1013 + * Depreceated, but we need to handle it for sake 1014 + * of old data files create in pipe mode. 1015 + */ 1016 + return 0; 1011 1017 case PERF_RECORD_HEADER_TRACING_DATA: 1012 1018 /* setup for reading amidst mmap */ 1013 1019 lseek(fd, file_offset, SEEK_SET);