On Fri, Oct 30, 2020 at 10:00:37AM +0100, Peter Zijlstra wrote:
> > static void __intel_pmu_pebs_event(struct perf_event *event,
> >                                struct pt_regs *iregs,
> >                                void *base, void *top,
> >                                int bit, int count,
> >                                void (*setup_sample)(struct perf_event *,
> >                                             struct pt_regs *,
> >                                             void *,
> >                                             struct perf_sample_data *,
> >                                             struct pt_regs *))
> > {
> >     struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> >     struct hw_perf_event *hwc = &event->hw;
> >     struct perf_sample_data data;
> >     struct x86_perf_regs perf_regs;
> >     struct pt_regs *regs = &perf_regs.regs;
> >     void *at = get_next_pebs_record_by_bit(base, top, bit);
> >     struct pt_regs dummy_iregs;
> 
> The only thing I can come up with in a hurry is that that dummy_iregs
> thing really should be static. That's 168 bytes of stack out the window
> right there.

---
Subject: perf/x86: Make dummy_iregs static
From: Peter Zijlstra <pet...@infradead.org>
Date: Fri Oct 30 12:15:06 CET 2020

Having pt_regs on-stack is unfortunate, it's 168 bytes. Since it isn't
actually used, make it a static variable. This both gets if off the
stack and ensures it gets 0 initialized, just in case someone does
look at it.

Reported-by: Steven Rostedt <rost...@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
---
 arch/x86/events/intel/ds.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1735,7 +1735,7 @@ static void __intel_pmu_pebs_event(struc
        struct x86_perf_regs perf_regs;
        struct pt_regs *regs = &perf_regs.regs;
        void *at = get_next_pebs_record_by_bit(base, top, bit);
-       struct pt_regs dummy_iregs;
+       static struct pt_regs dummy_iregs;
 
        if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD) {
                /*

Reply via email to