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:
"Two fixlets"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/hwbp: Simplify the perf-hwbp code, fix documentation
perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs

+24 -31
+17 -8
arch/x86/events/intel/ds.c
··· 1153 1153 if (pebs == NULL) 1154 1154 return; 1155 1155 1156 + regs->flags &= ~PERF_EFLAGS_EXACT; 1156 1157 sample_type = event->attr.sample_type; 1157 1158 dsrc = sample_type & PERF_SAMPLE_DATA_SRC; 1158 1159 ··· 1198 1197 */ 1199 1198 *regs = *iregs; 1200 1199 regs->flags = pebs->flags; 1201 - set_linear_ip(regs, pebs->ip); 1202 1200 1203 1201 if (sample_type & PERF_SAMPLE_REGS_INTR) { 1204 1202 regs->ax = pebs->ax; ··· 1233 1233 #endif 1234 1234 } 1235 1235 1236 - if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { 1237 - regs->ip = pebs->real_ip; 1238 - regs->flags |= PERF_EFLAGS_EXACT; 1239 - } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(regs)) 1240 - regs->flags |= PERF_EFLAGS_EXACT; 1241 - else 1242 - regs->flags &= ~PERF_EFLAGS_EXACT; 1236 + if (event->attr.precise_ip > 1) { 1237 + /* Haswell and later have the eventing IP, so use it: */ 1238 + if (x86_pmu.intel_cap.pebs_format >= 2) { 1239 + set_linear_ip(regs, pebs->real_ip); 1240 + regs->flags |= PERF_EFLAGS_EXACT; 1241 + } else { 1242 + /* Otherwise use PEBS off-by-1 IP: */ 1243 + set_linear_ip(regs, pebs->ip); 1244 + 1245 + /* ... and try to fix it up using the LBR entries: */ 1246 + if (intel_pmu_pebs_fixup_ip(regs)) 1247 + regs->flags |= PERF_EFLAGS_EXACT; 1248 + } 1249 + } else 1250 + set_linear_ip(regs, pebs->ip); 1251 + 1243 1252 1244 1253 if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) && 1245 1254 x86_pmu.intel_cap.pebs_format >= 1)
+7 -23
kernel/events/hw_breakpoint.c
··· 427 427 * modify_user_hw_breakpoint - modify a user-space hardware breakpoint 428 428 * @bp: the breakpoint structure to modify 429 429 * @attr: new breakpoint attributes 430 - * @triggered: callback to trigger when we hit the breakpoint 431 - * @tsk: pointer to 'task_struct' of the process to which the address belongs 432 430 */ 433 431 int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) 434 432 { 435 - u64 old_addr = bp->attr.bp_addr; 436 - u64 old_len = bp->attr.bp_len; 437 - int old_type = bp->attr.bp_type; 438 - int err = 0; 439 - 440 433 /* 441 434 * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it 442 435 * will not be possible to raise IPIs that invoke __perf_event_disable. ··· 444 451 bp->attr.bp_addr = attr->bp_addr; 445 452 bp->attr.bp_type = attr->bp_type; 446 453 bp->attr.bp_len = attr->bp_len; 454 + bp->attr.disabled = 1; 447 455 448 - if (attr->disabled) 449 - goto end; 456 + if (!attr->disabled) { 457 + int err = validate_hw_breakpoint(bp); 450 458 451 - err = validate_hw_breakpoint(bp); 452 - if (!err) 459 + if (err) 460 + return err; 461 + 453 462 perf_event_enable(bp); 454 - 455 - if (err) { 456 - bp->attr.bp_addr = old_addr; 457 - bp->attr.bp_type = old_type; 458 - bp->attr.bp_len = old_len; 459 - if (!bp->attr.disabled) 460 - perf_event_enable(bp); 461 - 462 - return err; 463 + bp->attr.disabled = 0; 463 464 } 464 - 465 - end: 466 - bp->attr.disabled = attr->disabled; 467 465 468 466 return 0; 469 467 }