Skip to content

Commit

Permalink
sparc64: Implement a real set_perf_counter_pending().
Browse files Browse the repository at this point in the history
When the perf counter subsystem needs to reschedule work out
from an NMI, it invokes set_perf_counter_pending().

This triggers a non-NMI irq which should invoke
perf_counter_do_pending().

Currently this won't trigger because sparc64 won't trigger
the perf counter subsystem from NMIs, but when the HW counter
support is added it will.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 10, 2009
1 parent 2d0740c commit 5686f9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/perf_counter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __ASM_SPARC_PERF_COUNTER_H
#define __ASM_SPARC_PERF_COUNTER_H

static inline void set_perf_counter_pending(void) { }
extern void set_perf_counter_pending(void);

#define PERF_COUNTER_INDEX_OFFSET 0

Expand Down
14 changes: 13 additions & 1 deletion arch/sparc/kernel/pcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <linux/init.h>
#include <linux/irq.h>

#include <linux/perf_counter.h>

#include <asm/pil.h>
#include <asm/pcr.h>
#include <asm/nmi.h>
Expand Down Expand Up @@ -34,10 +36,20 @@ unsigned int picl_shift;
*/
void deferred_pcr_work_irq(int irq, struct pt_regs *regs)
{
struct pt_regs *old_regs;

clear_softint(1 << PIL_DEFERRED_PCR_WORK);

old_regs = set_irq_regs(regs);
irq_enter();
#ifdef CONFIG_PERF_COUNTERS
perf_counter_do_pending();
#endif
irq_exit();
set_irq_regs(old_regs);
}

void schedule_deferred_pcr_work(void)
void set_perf_counter_pending(void)
{
set_softint(1 << PIL_DEFERRED_PCR_WORK);
}
Expand Down

0 comments on commit 5686f9c

Please sign in to comment.