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

Pull perf fixes from Thomas Gleixner:
"A couple of fixes for performance counters and kprobes:

- a series of small patches which make the uncore performance
counters on Skylake server systems work correctly

- add a missing instruction slot release to the failure path of
kprobes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
kprobes/x86: Release insn_slot in failure path
perf/x86/intel/uncore: Fix missing marker for skx_uncore_cha_extra_regs
perf/x86/intel/uncore: Fix SKX CHA event extra regs
perf/x86/intel/uncore: Remove invalid Skylake server CHA filter field
perf/x86/intel/uncore: Fix Skylake server CHA LLC_LOOKUP event umask
perf/x86/intel/uncore: Fix Skylake server PCU PMU event format
perf/x86/intel/uncore: Fix Skylake UPI PMU event masks

Changed files
+50 -11
arch
x86
events
kernel
kprobes
+41 -10
arch/x86/events/intel/uncore_snbep.c
··· 316 316 #define SKX_UPI_PCI_PMON_CTL0 0x350 317 317 #define SKX_UPI_PCI_PMON_CTR0 0x318 318 318 #define SKX_UPI_PCI_PMON_BOX_CTL 0x378 319 - #define SKX_PMON_CTL_UMASK_EXT 0xff 319 + #define SKX_UPI_CTL_UMASK_EXT 0xffefff 320 320 321 321 /* SKX M2M */ 322 322 #define SKX_M2M_PCI_PMON_CTL0 0x228 ··· 328 328 DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); 329 329 DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7"); 330 330 DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15"); 331 - DEFINE_UNCORE_FORMAT_ATTR(umask_ext, umask, "config:8-15,32-39"); 331 + DEFINE_UNCORE_FORMAT_ATTR(umask_ext, umask, "config:8-15,32-43,45-55"); 332 332 DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16"); 333 333 DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18"); 334 334 DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19"); ··· 351 351 DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8"); 352 352 DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8"); 353 353 DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12"); 354 - DEFINE_UNCORE_FORMAT_ATTR(filter_link4, filter_link, "config1:9-12"); 355 354 DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17"); 356 355 DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47"); 357 356 DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22"); ··· 3301 3302 &format_attr_inv.attr, 3302 3303 &format_attr_thresh8.attr, 3303 3304 &format_attr_filter_tid4.attr, 3304 - &format_attr_filter_link4.attr, 3305 3305 &format_attr_filter_state5.attr, 3306 3306 &format_attr_filter_rem.attr, 3307 3307 &format_attr_filter_loc.attr, ··· 3310 3312 &format_attr_filter_opc_0.attr, 3311 3313 &format_attr_filter_opc_1.attr, 3312 3314 &format_attr_filter_nc.attr, 3313 - &format_attr_filter_c6.attr, 3314 3315 &format_attr_filter_isoc.attr, 3315 3316 NULL, 3316 3317 }; ··· 3330 3333 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), 3331 3334 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), 3332 3335 SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), 3333 - SNBEP_CBO_EVENT_EXTRA_REG(0x2134, 0xffff, 0x4), 3334 - SNBEP_CBO_EVENT_EXTRA_REG(0x8134, 0xffff, 0x4), 3336 + SNBEP_CBO_EVENT_EXTRA_REG(0x3134, 0xffff, 0x4), 3337 + SNBEP_CBO_EVENT_EXTRA_REG(0x9134, 0xffff, 0x4), 3338 + SNBEP_CBO_EVENT_EXTRA_REG(0x35, 0xff, 0x8), 3339 + SNBEP_CBO_EVENT_EXTRA_REG(0x36, 0xff, 0x8), 3340 + EVENT_EXTRA_END 3335 3341 }; 3336 3342 3337 3343 static u64 skx_cha_filter_mask(int fields) ··· 3347 3347 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LINK; 3348 3348 if (fields & 0x4) 3349 3349 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_STATE; 3350 + if (fields & 0x8) { 3351 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_REM; 3352 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LOC; 3353 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_ALL_OPC; 3354 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NM; 3355 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NOT_NM; 3356 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_OPC0; 3357 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_OPC1; 3358 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NC; 3359 + mask |= SKX_CHA_MSR_PMON_BOX_FILTER_ISOC; 3360 + } 3350 3361 return mask; 3351 3362 } 3352 3363 ··· 3503 3492 .format_group = &skx_uncore_format_group, 3504 3493 }; 3505 3494 3495 + static struct attribute *skx_uncore_pcu_formats_attr[] = { 3496 + &format_attr_event.attr, 3497 + &format_attr_umask.attr, 3498 + &format_attr_edge.attr, 3499 + &format_attr_inv.attr, 3500 + &format_attr_thresh8.attr, 3501 + &format_attr_occ_invert.attr, 3502 + &format_attr_occ_edge_det.attr, 3503 + &format_attr_filter_band0.attr, 3504 + &format_attr_filter_band1.attr, 3505 + &format_attr_filter_band2.attr, 3506 + &format_attr_filter_band3.attr, 3507 + NULL, 3508 + }; 3509 + 3510 + static struct attribute_group skx_uncore_pcu_format_group = { 3511 + .name = "format", 3512 + .attrs = skx_uncore_pcu_formats_attr, 3513 + }; 3514 + 3506 3515 static struct intel_uncore_ops skx_uncore_pcu_ops = { 3507 3516 IVBEP_UNCORE_MSR_OPS_COMMON_INIT(), 3508 3517 .hw_config = hswep_pcu_hw_config, ··· 3541 3510 .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL, 3542 3511 .num_shared_regs = 1, 3543 3512 .ops = &skx_uncore_pcu_ops, 3544 - .format_group = &snbep_uncore_pcu_format_group, 3513 + .format_group = &skx_uncore_pcu_format_group, 3545 3514 }; 3546 3515 3547 3516 static struct intel_uncore_type *skx_msr_uncores[] = { ··· 3634 3603 .perf_ctr_bits = 48, 3635 3604 .perf_ctr = SKX_UPI_PCI_PMON_CTR0, 3636 3605 .event_ctl = SKX_UPI_PCI_PMON_CTL0, 3637 - .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK, 3638 - .event_mask_ext = SKX_PMON_CTL_UMASK_EXT, 3606 + .event_mask = SNBEP_PMON_RAW_EVENT_MASK, 3607 + .event_mask_ext = SKX_UPI_CTL_UMASK_EXT, 3639 3608 .box_ctl = SKX_UPI_PCI_PMON_BOX_CTL, 3640 3609 .ops = &skx_upi_uncore_pci_ops, 3641 3610 .format_group = &skx_upi_uncore_format_group,
+9 -1
arch/x86/kernel/kprobes/core.c
··· 457 457 458 458 int arch_prepare_kprobe(struct kprobe *p) 459 459 { 460 + int ret; 461 + 460 462 if (alternatives_text_reserved(p->addr, p->addr)) 461 463 return -EINVAL; 462 464 ··· 469 467 if (!p->ainsn.insn) 470 468 return -ENOMEM; 471 469 472 - return arch_copy_kprobe(p); 470 + ret = arch_copy_kprobe(p); 471 + if (ret) { 472 + free_insn_slot(p->ainsn.insn, 0); 473 + p->ainsn.insn = NULL; 474 + } 475 + 476 + return ret; 473 477 } 474 478 475 479 void arch_arm_kprobe(struct kprobe *p)