Skip to contentSkip to conversation

struct sys_timer .suspend/.resume ignored for ARCH_SA1100/ARCH_PXA?

DISCUSSION Stephen Warren 2 participants 3 messages Nov 7, 2012 – Nov 8, 2012

lore
Share & tools
lore
#0 lore raw

Russell, Kevin,

In commit 9e4559d "[ARM] 4258/2: Support for dynticks in idle loop" in 2007, Kevin applied the following change:

arch/arm/kernel/time.c

Quoted 5 lines
arch/arm/kernel/time.c +1 -1
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS)
 static int timer_suspend(struct sys_device *dev, pm_message_t state)

This means that for any architecture that enables GENERIC_CLOCKEVENTS, the .suspend/.resume fields of struct sys_timer will be ignored, since timer_suspend()/timer_resume() won't be filled into arch/arm/kernel/time.c's struct syscore_ops timer_syscore_ops.

Later, in commit 3e238be "[ARM] sa1100: add clock event support" in 2008, Russell modified ARCH_SA1100 to select GENERIC_CLOCKEVENTS. I believe this means that sa1100_timer_suspend()/resume() haven't been used since.

A similar issue exists for ARCH_PXA.

Should sa1100_timer_suspend(), sa1100_timer_resume(), pxa_timer_suspend(), pxa_timer_suspend() simply be deleted since they are dead code, or should they be revived somehow; is the ifdef from Kevin's change incorrect?

As background, I'm working on a patch series that will remove all fields from struct sys_timer except for .init, and will then replace the ARM machine descriptor's .timer struct pointer with a .init_timer function pointer. This will allow machines, on an opt-in basis, to call into a central function in drivers/clocksource to initialize the required timer, as determined by searching device tree for a known device type, in much the same way as has been proposed to use a single implementation for for the machine descriptor's .init_irq. As part of this, I've been looking at moving any use of struct sys_timer .suspend/.resume into e.g. struct clock_event_device .suspend/.resume, and found this issue.

Thanks for any hints.

#1 lore raw
Quoted 7 lines · Stephen Warren

Russell, Kevin,

In commit 9e4559d "[ARM] 4258/2: Support for dynticks in idle loop" in 2007, Kevin applied the following change:

Quoted 1 line
arch/arm/kernel/time.c +0 -0
Quoted 8 lines

arch/arm/kernel/time.c

Quoted 3 lines
arch/arm/kernel/time.c +1 -1
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS)
 static int timer_suspend(struct sys_device *dev, pm_message_t state)

This means that for any architecture that enables GENERIC_CLOCKEVENTS, the .suspend/.resume fields of struct sys_timer will be ignored, since timer_suspend()/timer_resume() won't be filled into arch/arm/kernel/time.c's struct syscore_ops timer_syscore_ops.

Correct.

Quoted 4 lines

Later, in commit 3e238be "[ARM] sa1100: add clock event support" in 2008, Russell modified ARCH_SA1100 to select GENERIC_CLOCKEVENTS. I believe this means that sa1100_timer_suspend()/resume() haven't been used since.

Also correct.

Quoted 6 lines

A similar issue exists for ARCH_PXA.

Should sa1100_timer_suspend(), sa1100_timer_resume(), pxa_timer_suspend(), pxa_timer_suspend() simply be deleted since they are dead code, or should they be revived somehow; is the ifdef from Kevin's change incorrect?

Hmm, that's probably not good for either of those two platforms; it means that the OSCR and match registers get lost over a suspend/resume. That's not a real big problem for the clocksource code, but if its being used for something else (eg, rtc) then it probably means we have a failure there.

Quoted 10 lines

As background, I'm working on a patch series that will remove all fields from struct sys_timer except for .init, and will then replace the ARM machine descriptor's .timer struct pointer with a .init_timer function pointer. This will allow machines, on an opt-in basis, to call into a central function in drivers/clocksource to initialize the required timer, as determined by searching device tree for a known device type, in much the same way as has been proposed to use a single implementation for for the machine descriptor's .init_irq. As part of this, I've been looking at moving any use of struct sys_timer .suspend/.resume into e.g. struct clock_event_device .suspend/.resume, and found this issue.

Don't forget we still have a number of platforms not converted to the generic event/clocksource stuff (because they lack the necessary counters/timers for this 'new' infrastructure.)

#2 lore raw
Quoted 33 lines · Russell King - ARM Linux
Quoted 7 lines · Stephen Warren

Russell, Kevin,

In commit 9e4559d "[ARM] 4258/2: Support for dynticks in idle loop" in 2007, Kevin applied the following change:

Quoted 1 line
arch/arm/kernel/time.c +0 -0
Quoted 8 lines

arch/arm/kernel/time.c

Quoted 3 lines
arch/arm/kernel/time.c +1 -1
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS)
 static int timer_suspend(struct sys_device *dev, pm_message_t state)

This means that for any architecture that enables GENERIC_CLOCKEVENTS, the .suspend/.resume fields of struct sys_timer will be ignored, since timer_suspend()/timer_resume() won't be filled into arch/arm/kernel/time.c's struct syscore_ops timer_syscore_ops.

Correct.

Quoted 4 lines

Later, in commit 3e238be "[ARM] sa1100: add clock event support" in 2008, Russell modified ARCH_SA1100 to select GENERIC_CLOCKEVENTS. I believe this means that sa1100_timer_suspend()/resume() haven't been used since.

Also correct.

Quoted 6 lines

A similar issue exists for ARCH_PXA.

Should sa1100_timer_suspend(), sa1100_timer_resume(), pxa_timer_suspend(), pxa_timer_suspend() simply be deleted since they are dead code, or should they be revived somehow; is the ifdef from Kevin's change incorrect?

Quoted 5 lines

Hmm, that's probably not good for either of those two platforms; it means that the OSCR and match registers get lost over a suspend/resume. That's not a real big problem for the clocksource code, but if its being used for something else (eg, rtc) then it probably means we have a failure there.

OK, so it sounds like the correct approach here is to re-enable those functions. The local patches I have right now do this, and hook them into e.g. ckevt_sa1100_osmr0's suspend/resume rather than sys_timer's. I assume that will work fine?

Quoted 11 lines
Quoted 10 lines

As background, I'm working on a patch series that will remove all fields from struct sys_timer except for .init, and will then replace the ARM machine descriptor's .timer struct pointer with a .init_timer function pointer. This will allow machines, on an opt-in basis, to call into a central function in drivers/clocksource to initialize the required timer, as determined by searching device tree for a known device type, in much the same way as has been proposed to use a single implementation for for the machine descriptor's .init_irq. As part of this, I've been looking at moving any use of struct sys_timer .suspend/.resume into e.g. struct clock_event_device .suspend/.resume, and found this issue.

Quoted 3 lines

Don't forget we still have a number of platforms not converted to the generic event/clocksource stuff (because they lack the necessary counters/timers for this 'new' infrastructure.)

I believe the only user of struct sys_timer .suspend/.resume that does use struct clock_event_device is s3c2410. I'd missed that before since I'd only searched for .suspend and not .resume alone. Perhaps this one should just register its own syscore_ops instead of having the ARM core do that on its behalf.