diff options
| -rw-r--r-- | arch/x86/events/intel/uncore_snbep.c | 51 | ||||
| -rw-r--r-- | arch/x86/kernel/kprobes/core.c | 10 |
2 files changed, 50 insertions, 11 deletions
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index dae2fedc1601..4f9127644b80 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c | |||
| @@ -316,7 +316,7 @@ | |||
| 316 | #define SKX_UPI_PCI_PMON_CTL0 0x350 | 316 | #define SKX_UPI_PCI_PMON_CTL0 0x350 |
| 317 | #define SKX_UPI_PCI_PMON_CTR0 0x318 | 317 | #define SKX_UPI_PCI_PMON_CTR0 0x318 |
| 318 | #define SKX_UPI_PCI_PMON_BOX_CTL 0x378 | 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 | /* SKX M2M */ | 321 | /* SKX M2M */ |
| 322 | #define SKX_M2M_PCI_PMON_CTL0 0x228 | 322 | #define SKX_M2M_PCI_PMON_CTL0 0x228 |
| @@ -328,7 +328,7 @@ DEFINE_UNCORE_FORMAT_ATTR(event2, event, "config:0-6"); | |||
| 328 | DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); | 328 | DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); |
| 329 | DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7"); | 329 | DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7"); |
| 330 | DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15"); | 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 | DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16"); | 332 | DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16"); |
| 333 | DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18"); | 333 | DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18"); |
| 334 | DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19"); | 334 | DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19"); |
| @@ -351,7 +351,6 @@ DEFINE_UNCORE_FORMAT_ATTR(filter_cid, filter_cid, "config1:5"); | |||
| 351 | DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8"); | 351 | DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8"); |
| 352 | DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8"); | 352 | DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8"); |
| 353 | DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12"); | 353 | DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12"); |
| 354 | DEFINE_UNCORE_FORMAT_ATTR(filter_link4, filter_link, "config1:9-12"); | ||
| 355 | DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17"); | 354 | DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17"); |
| 356 | DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47"); | 355 | DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47"); |
| 357 | DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22"); | 356 | DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22"); |
| @@ -3302,7 +3301,6 @@ static struct attribute *skx_uncore_cha_formats_attr[] = { | |||
| 3302 | &format_attr_inv.attr, | 3301 | &format_attr_inv.attr, |
| 3303 | &format_attr_thresh8.attr, | 3302 | &format_attr_thresh8.attr, |
| 3304 | &format_attr_filter_tid4.attr, | 3303 | &format_attr_filter_tid4.attr, |
| 3305 | &format_attr_filter_link4.attr, | ||
| 3306 | &format_attr_filter_state5.attr, | 3304 | &format_attr_filter_state5.attr, |
| 3307 | &format_attr_filter_rem.attr, | 3305 | &format_attr_filter_rem.attr, |
| 3308 | &format_attr_filter_loc.attr, | 3306 | &format_attr_filter_loc.attr, |
| @@ -3312,7 +3310,6 @@ static struct attribute *skx_uncore_cha_formats_attr[] = { | |||
| 3312 | &format_attr_filter_opc_0.attr, | 3310 | &format_attr_filter_opc_0.attr, |
| 3313 | &format_attr_filter_opc_1.attr, | 3311 | &format_attr_filter_opc_1.attr, |
| 3314 | &format_attr_filter_nc.attr, | 3312 | &format_attr_filter_nc.attr, |
| 3315 | &format_attr_filter_c6.attr, | ||
| 3316 | &format_attr_filter_isoc.attr, | 3313 | &format_attr_filter_isoc.attr, |
| 3317 | NULL, | 3314 | NULL, |
| 3318 | }; | 3315 | }; |
| @@ -3333,8 +3330,11 @@ static struct extra_reg skx_uncore_cha_extra_regs[] = { | |||
| 3333 | SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), | 3330 | SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), |
| 3334 | SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), | 3331 | SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), |
| 3335 | SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), | 3332 | SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), |
| 3336 | SNBEP_CBO_EVENT_EXTRA_REG(0x2134, 0xffff, 0x4), | 3333 | SNBEP_CBO_EVENT_EXTRA_REG(0x3134, 0xffff, 0x4), |
| 3337 | SNBEP_CBO_EVENT_EXTRA_REG(0x8134, 0xffff, 0x4), | 3334 | SNBEP_CBO_EVENT_EXTRA_REG(0x9134, 0xffff, 0x4), |
| 3335 | SNBEP_CBO_EVENT_EXTRA_REG(0x35, 0xff, 0x8), | ||
| 3336 | SNBEP_CBO_EVENT_EXTRA_REG(0x36, 0xff, 0x8), | ||
| 3337 | EVENT_EXTRA_END | ||
| 3338 | }; | 3338 | }; |
| 3339 | 3339 | ||
| 3340 | static u64 skx_cha_filter_mask(int fields) | 3340 | static u64 skx_cha_filter_mask(int fields) |
| @@ -3347,6 +3347,17 @@ static u64 skx_cha_filter_mask(int fields) | |||
| 3347 | mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LINK; | 3347 | mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LINK; |
| 3348 | if (fields & 0x4) | 3348 | if (fields & 0x4) |
| 3349 | mask |= SKX_CHA_MSR_PMON_BOX_FILTER_STATE; | 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 | return mask; | 3361 | return mask; |
| 3351 | } | 3362 | } |
| 3352 | 3363 | ||
| @@ -3492,6 +3503,26 @@ static struct intel_uncore_type skx_uncore_irp = { | |||
| 3492 | .format_group = &skx_uncore_format_group, | 3503 | .format_group = &skx_uncore_format_group, |
| 3493 | }; | 3504 | }; |
| 3494 | 3505 | ||
| 3506 | static struct attribute *skx_uncore_pcu_formats_attr[] = { | ||
| 3507 | &format_attr_event.attr, | ||
| 3508 | &format_attr_umask.attr, | ||
| 3509 | &format_attr_edge.attr, | ||
| 3510 | &format_attr_inv.attr, | ||
| 3511 | &format_attr_thresh8.attr, | ||
| 3512 | &format_attr_occ_invert.attr, | ||
| 3513 | &format_attr_occ_edge_det.attr, | ||
| 3514 | &format_attr_filter_band0.attr, | ||
| 3515 | &format_attr_filter_band1.attr, | ||
| 3516 | &format_attr_filter_band2.attr, | ||
| 3517 | &format_attr_filter_band3.attr, | ||
| 3518 | NULL, | ||
| 3519 | }; | ||
| 3520 | |||
| 3521 | static struct attribute_group skx_uncore_pcu_format_group = { | ||
| 3522 | .name = "format", | ||
| 3523 | .attrs = skx_uncore_pcu_formats_attr, | ||
| 3524 | }; | ||
| 3525 | |||
| 3495 | static struct intel_uncore_ops skx_uncore_pcu_ops = { | 3526 | static struct intel_uncore_ops skx_uncore_pcu_ops = { |
| 3496 | IVBEP_UNCORE_MSR_OPS_COMMON_INIT(), | 3527 | IVBEP_UNCORE_MSR_OPS_COMMON_INIT(), |
| 3497 | .hw_config = hswep_pcu_hw_config, | 3528 | .hw_config = hswep_pcu_hw_config, |
| @@ -3510,7 +3541,7 @@ static struct intel_uncore_type skx_uncore_pcu = { | |||
| 3510 | .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL, | 3541 | .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL, |
| 3511 | .num_shared_regs = 1, | 3542 | .num_shared_regs = 1, |
| 3512 | .ops = &skx_uncore_pcu_ops, | 3543 | .ops = &skx_uncore_pcu_ops, |
| 3513 | .format_group = &snbep_uncore_pcu_format_group, | 3544 | .format_group = &skx_uncore_pcu_format_group, |
| 3514 | }; | 3545 | }; |
| 3515 | 3546 | ||
| 3516 | static struct intel_uncore_type *skx_msr_uncores[] = { | 3547 | static struct intel_uncore_type *skx_msr_uncores[] = { |
| @@ -3603,8 +3634,8 @@ static struct intel_uncore_type skx_uncore_upi = { | |||
| 3603 | .perf_ctr_bits = 48, | 3634 | .perf_ctr_bits = 48, |
| 3604 | .perf_ctr = SKX_UPI_PCI_PMON_CTR0, | 3635 | .perf_ctr = SKX_UPI_PCI_PMON_CTR0, |
| 3605 | .event_ctl = SKX_UPI_PCI_PMON_CTL0, | 3636 | .event_ctl = SKX_UPI_PCI_PMON_CTL0, |
| 3606 | .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK, | 3637 | .event_mask = SNBEP_PMON_RAW_EVENT_MASK, |
| 3607 | .event_mask_ext = SKX_PMON_CTL_UMASK_EXT, | 3638 | .event_mask_ext = SKX_UPI_CTL_UMASK_EXT, |
| 3608 | .box_ctl = SKX_UPI_PCI_PMON_BOX_CTL, | 3639 | .box_ctl = SKX_UPI_PCI_PMON_BOX_CTL, |
| 3609 | .ops = &skx_upi_uncore_pci_ops, | 3640 | .ops = &skx_upi_uncore_pci_ops, |
| 3610 | .format_group = &skx_upi_uncore_format_group, | 3641 | .format_group = &skx_upi_uncore_format_group, |
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 6b877807598b..f0153714ddac 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
| @@ -457,6 +457,8 @@ static int arch_copy_kprobe(struct kprobe *p) | |||
| 457 | 457 | ||
| 458 | int arch_prepare_kprobe(struct kprobe *p) | 458 | int arch_prepare_kprobe(struct kprobe *p) |
| 459 | { | 459 | { |
| 460 | int ret; | ||
| 461 | |||
| 460 | if (alternatives_text_reserved(p->addr, p->addr)) | 462 | if (alternatives_text_reserved(p->addr, p->addr)) |
| 461 | return -EINVAL; | 463 | return -EINVAL; |
| 462 | 464 | ||
| @@ -467,7 +469,13 @@ int arch_prepare_kprobe(struct kprobe *p) | |||
| 467 | if (!p->ainsn.insn) | 469 | if (!p->ainsn.insn) |
| 468 | return -ENOMEM; | 470 | return -ENOMEM; |
| 469 | 471 | ||
| 470 | return arch_copy_kprobe(p); | 472 | ret = arch_copy_kprobe(p); |
| 473 | if (ret) { | ||
| 474 | free_insn_slot(p->ainsn.insn, 0); | ||
| 475 | p->ainsn.insn = NULL; | ||
| 476 | } | ||
| 477 | |||
| 478 | return ret; | ||
| 471 | } | 479 | } |
| 472 | 480 | ||
| 473 | void arch_arm_kprobe(struct kprobe *p) | 481 | void arch_arm_kprobe(struct kprobe *p) |
