Skip to content

Commit 28a27cb

Browse files
committed
Merge tag 'perf-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf events updates from Ingo Molnar: - Platform PMU driver updates: - x86 Intel uncore driver updates for Skylake (SNR) and Icelake (ICX) servers - Fix RDPMC support - Fix [extended-]PEBS-via-PT support - Fix Sapphire Rapids event constraints - Fix :ppp support on Sapphire Rapids - Fix fixed counter sanity check on Alder Lake & X86_FEATURE_HYBRID_CPU - Other heterogenous-PMU fixes - Kprobes: - Remove the unused and misguided kprobe::fault_handler callbacks. - Warn about kprobes taking a page fault. - Fix the 'nmissed' stat counter. - Misc cleanups and fixes. * tag 'perf-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Fix task context PMU for Hetero perf/x86/intel: Fix instructions:ppp support in Sapphire Rapids perf/x86/intel: Add more events requires FRONTEND MSR on Sapphire Rapids perf/x86/intel: Fix fixed counter check warning for some Alder Lake perf/x86/intel: Fix PEBS-via-PT reload base value for Extended PEBS perf/x86: Reset the dirty counter to prevent the leak for an RDPMC task kprobes: Do not increment probe miss count in the fault handler x86,kprobes: WARN if kprobes tries to handle a fault kprobes: Remove kprobe::fault_handler uprobes: Update uprobe_write_opcode() kernel-doc comment perf/hw_breakpoint: Fix DocBook warnings in perf hw_breakpoint perf/core: Fix DocBook warnings perf/core: Make local function perf_pmu_snapshot_aux() static perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on ICX perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on SNR perf/x86/intel/uncore: Generalize I/O stacks to PMON mapping procedure perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of()
2 parents a15286c + 012669c commit 28a27cb

29 files changed

Lines changed: 257 additions & 285 deletions

File tree

Documentation/trace/kprobes.rst

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,11 @@ register_kprobe
362362
#include <linux/kprobes.h>
363363
int register_kprobe(struct kprobe *kp);
364364

365-
Sets a breakpoint at the address kp->addr. When the breakpoint is
366-
hit, Kprobes calls kp->pre_handler. After the probed instruction
367-
is single-stepped, Kprobe calls kp->post_handler. If a fault
368-
occurs during execution of kp->pre_handler or kp->post_handler,
369-
or during single-stepping of the probed instruction, Kprobes calls
370-
kp->fault_handler. Any or all handlers can be NULL. If kp->flags
371-
is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled,
372-
so, its handlers aren't hit until calling enable_kprobe(kp).
365+
Sets a breakpoint at the address kp->addr. When the breakpoint is hit, Kprobes
366+
calls kp->pre_handler. After the probed instruction is single-stepped, Kprobe
367+
calls kp->post_handler. Any or all handlers can be NULL. If kp->flags is set
368+
KPROBE_FLAG_DISABLED, that kp will be registered but disabled, so, its handlers
369+
aren't hit until calling enable_kprobe(kp).
373370

374371
.. note::
375372

@@ -415,17 +412,6 @@ User's post-handler (kp->post_handler)::
415412
p and regs are as described for the pre_handler. flags always seems
416413
to be zero.
417414

418-
User's fault-handler (kp->fault_handler)::
419-
420-
#include <linux/kprobes.h>
421-
#include <linux/ptrace.h>
422-
int fault_handler(struct kprobe *p, struct pt_regs *regs, int trapnr);
423-
424-
p and regs are as described for the pre_handler. trapnr is the
425-
architecture-specific trap number associated with the fault (e.g.,
426-
on i386, 13 for a general protection fault or 14 for a page fault).
427-
Returns 1 if it successfully handled the exception.
428-
429415
register_kretprobe
430416
------------------
431417

arch/arc/kernel/kprobes.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -317,22 +317,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned long trapnr)
317317
* caused the fault.
318318
*/
319319

320-
/* We increment the nmissed count for accounting,
321-
* we can also use npre/npostfault count for accounting
322-
* these specific fault cases.
323-
*/
324-
kprobes_inc_nmissed_count(cur);
325-
326-
/*
327-
* We come here because instructions in the pre/post
328-
* handler caused the page_fault, this could happen
329-
* if handler tries to access user space by
330-
* copy_from_user(), get_user() etc. Let the
331-
* user-specified handler try to fix it first.
332-
*/
333-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
334-
return 1;
335-
336320
/*
337321
* In case the user-specified fault handler returned zero,
338322
* try to fix up.

arch/arm/probes/kprobes/core.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -348,29 +348,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
348348
reset_current_kprobe();
349349
}
350350
break;
351-
352-
case KPROBE_HIT_ACTIVE:
353-
case KPROBE_HIT_SSDONE:
354-
/*
355-
* We increment the nmissed count for accounting,
356-
* we can also use npre/npostfault count for accounting
357-
* these specific fault cases.
358-
*/
359-
kprobes_inc_nmissed_count(cur);
360-
361-
/*
362-
* We come here because instructions in the pre/post
363-
* handler caused the page_fault, this could happen
364-
* if handler tries to access user space by
365-
* copy_from_user(), get_user() etc. Let the
366-
* user-specified handler try to fix it.
367-
*/
368-
if (cur->fault_handler && cur->fault_handler(cur, regs, fsr))
369-
return 1;
370-
break;
371-
372-
default:
373-
break;
374351
}
375352

376353
return 0;

arch/arm64/kernel/probes/kprobes.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,23 +276,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
276276
break;
277277
case KPROBE_HIT_ACTIVE:
278278
case KPROBE_HIT_SSDONE:
279-
/*
280-
* We increment the nmissed count for accounting,
281-
* we can also use npre/npostfault count for accounting
282-
* these specific fault cases.
283-
*/
284-
kprobes_inc_nmissed_count(cur);
285-
286-
/*
287-
* We come here because instructions in the pre/post
288-
* handler caused the page_fault, this could happen
289-
* if handler tries to access user space by
290-
* copy_from_user(), get_user() etc. Let the
291-
* user-specified handler try to fix it first.
292-
*/
293-
if (cur->fault_handler && cur->fault_handler(cur, regs, fsr))
294-
return 1;
295-
296279
/*
297280
* In case the user-specified fault handler returned
298281
* zero, try to fix up.

arch/csky/kernel/probes/kprobes.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -294,23 +294,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr)
294294
break;
295295
case KPROBE_HIT_ACTIVE:
296296
case KPROBE_HIT_SSDONE:
297-
/*
298-
* We increment the nmissed count for accounting,
299-
* we can also use npre/npostfault count for accounting
300-
* these specific fault cases.
301-
*/
302-
kprobes_inc_nmissed_count(cur);
303-
304-
/*
305-
* We come here because instructions in the pre/post
306-
* handler caused the page_fault, this could happen
307-
* if handler tries to access user space by
308-
* copy_from_user(), get_user() etc. Let the
309-
* user-specified handler try to fix it first.
310-
*/
311-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
312-
return 1;
313-
314297
/*
315298
* In case the user-specified fault handler returned
316299
* zero, try to fix up.

arch/ia64/kernel/kprobes.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -843,22 +843,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
843843
break;
844844
case KPROBE_HIT_ACTIVE:
845845
case KPROBE_HIT_SSDONE:
846-
/*
847-
* We increment the nmissed count for accounting,
848-
* we can also use npre/npostfault count for accounting
849-
* these specific fault cases.
850-
*/
851-
kprobes_inc_nmissed_count(cur);
852-
853-
/*
854-
* We come here because instructions in the pre/post
855-
* handler caused the page_fault, this could happen
856-
* if handler tries to access user space by
857-
* copy_from_user(), get_user() etc. Let the
858-
* user-specified handler try to fix it first.
859-
*/
860-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
861-
return 1;
862846
/*
863847
* In case the user-specified fault handler returned
864848
* zero, try to fix up.

arch/mips/kernel/kprobes.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
403403
struct kprobe *cur = kprobe_running();
404404
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
405405

406-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
407-
return 1;
408-
409406
if (kcb->kprobe_status & KPROBE_HIT_SS) {
410407
resume_execution(cur, regs, kcb);
411408
regs->cp0_status |= kcb->kprobe_old_SR;

arch/powerpc/kernel/kprobes.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -501,23 +501,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
501501
break;
502502
case KPROBE_HIT_ACTIVE:
503503
case KPROBE_HIT_SSDONE:
504-
/*
505-
* We increment the nmissed count for accounting,
506-
* we can also use npre/npostfault count for accounting
507-
* these specific fault cases.
508-
*/
509-
kprobes_inc_nmissed_count(cur);
510-
511-
/*
512-
* We come here because instructions in the pre/post
513-
* handler caused the page_fault, this could happen
514-
* if handler tries to access user space by
515-
* copy_from_user(), get_user() etc. Let the
516-
* user-specified handler try to fix it first.
517-
*/
518-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
519-
return 1;
520-
521504
/*
522505
* In case the user-specified fault handler returned
523506
* zero, try to fix up.

arch/riscv/kernel/probes/kprobes.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,23 +278,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr)
278278
break;
279279
case KPROBE_HIT_ACTIVE:
280280
case KPROBE_HIT_SSDONE:
281-
/*
282-
* We increment the nmissed count for accounting,
283-
* we can also use npre/npostfault count for accounting
284-
* these specific fault cases.
285-
*/
286-
kprobes_inc_nmissed_count(cur);
287-
288-
/*
289-
* We come here because instructions in the pre/post
290-
* handler caused the page_fault, this could happen
291-
* if handler tries to access user space by
292-
* copy_from_user(), get_user() etc. Let the
293-
* user-specified handler try to fix it first.
294-
*/
295-
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
296-
return 1;
297-
298281
/*
299282
* In case the user-specified fault handler returned
300283
* zero, try to fix up.

arch/s390/kernel/kprobes.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -445,23 +445,6 @@ static int kprobe_trap_handler(struct pt_regs *regs, int trapnr)
445445
break;
446446
case KPROBE_HIT_ACTIVE:
447447
case KPROBE_HIT_SSDONE:
448-
/*
449-
* We increment the nmissed count for accounting,
450-
* we can also use npre/npostfault count for accounting
451-
* these specific fault cases.
452-
*/
453-
kprobes_inc_nmissed_count(p);
454-
455-
/*
456-
* We come here because instructions in the pre/post
457-
* handler caused the page_fault, this could happen
458-
* if handler tries to access user space by
459-
* copy_from_user(), get_user() etc. Let the
460-
* user-specified handler try to fix it first.
461-
*/
462-
if (p->fault_handler && p->fault_handler(p, regs, trapnr))
463-
return 1;
464-
465448
/*
466449
* In case the user-specified fault handler returned
467450
* zero, try to fix up.

0 commit comments

Comments
 (0)