From: Peter Zijlstra on
On Sat, 2010-03-20 at 15:07 +0100, Rafael J. Wysocki wrote:
> Hi Peter,
>
> Your commit 3f6da3905398826d85731247e7fbcf53400c18bd
> (perf: Rework and fix the arch CPU-hotplug hooks) unfortunately broke suspend
> to RAM (probably hibernation too, but I haven't checked) on my HP nx6325.
> I also expect more (if not all) AMD-based boxes to be broken by it.
>
> The machine simply hangs solid while trying to disable CPU1 during suspend.
>
> The patch below fixes it, although I'm not exactly sure why calling
> amd_pmu_cpu_offline() during suspend causes the hang to happen. If there's a
> better way to fix this, please let me know.

Hrmm, I'll have a poke at my AMD once I'm back home again, but does
something like the below cure things for you?

---
arch/x86/kernel/cpu/perf_event_amd.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 358a8e3..0189af4 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -345,6 +345,8 @@ static void amd_pmu_cpu_offline(int cpu)
return;

cpuhw = &per_cpu(cpu_hw_events, cpu);
+ if (!cpuhw)
+ return;

raw_spin_lock(&amd_nb_lock);



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Sat, 2010-03-20 at 21:48 +0100, Rafael J. Wysocki wrote:
> On Saturday 20 March 2010, Linus Torvalds wrote:
> >
> > On Sat, 20 Mar 2010, Peter Zijlstra wrote:
> > >
> > > cpuhw = &per_cpu(cpu_hw_events, cpu);
> > > + if (!cpuhw)
> > > + return;
> >
> > How can an address-of expression be NULL?
> >
> > Yes, 'per_cpu()' is magic, but it shouldn't be possible to be _that_
> > magic. It's rather against the whole C model.
>
> Yeah.
>
> A field in the object pointed to by it can be NULL, though.

That's what I was aiming for,. might have missed it by a mile though :/

> The appended patch fixes the breakage for me too.

ok, works for me, thanks

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/