[PATCH v5] clocksource:arm_global_timer: Add ARM global timer support.

Stephen Boyd sboyd at codeaurora.org
Tue Jun 25 08:00:18 EST 2013


On 06/24/13 14:08, Srinivas KANDAGATLA wrote:
> On 24/06/13 21:06, Stephen Boyd wrote:
>> On 06/24/13 08:53, Srinivas KANDAGATLA wrote:
>>> +
>>> +static void gt_clockevents_stop(struct clock_event_device *clk)
>>> +{
>>> +	gt_clockevent_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
>>> +	disable_percpu_irq(clk->irq);
>>> +}
>>> +
>>> +static int __cpuinit gt_clockevents_setup(struct clock_event_device *clk)
>>> +{
>>> +	struct clock_event_device *evt = this_cpu_ptr(gt_evt);
>>> +	return evt->name ? 0 : gt_clockevents_init(evt);
>>> +}
>> How does this work? gt_clockevents_stop() is using the
>> clock_event_device struct from the ARM local timer layer whereas
>> gt_clockevents_setup() is using a driver private allocation.
> Thanks for pointing this..
> This should fix it.
>
> static void gt_clockevents_stop(struct clock_event_device *clk)
> {
> 	struct clock_event_device *evt = this_cpu_ptr(gt_evt);
> 	gt_clockevent_set_mode(CLOCK_EVT_MODE_UNUSED, evt);
> 	disable_percpu_irq(evt->irq);
> }

Looks good, but even better would be to not use the local timer API.

>  Please just
>> don't use the local timer API at all and use cpu notifiers instead.
> Last time when I did try using cpu notifiers like arm_arch_timer, the
> broadcast dummy timer did kick off and took over the local timer on the
> secondary cpus. Resulting in lot of broadcast IPI's.
>
> If I use cpu notifiers I will end up two clk events on a each core (one
> dummy from arm/kernel/smp.c and other gt clk_evt). I think I can only
> use cpu notifiers in my case once your patches are in.
> Also I cant disable LOCAL_TIMERS as it y by default.
>
> Am I missing something?
>
> Am happy to move to cpu notifiers if it works, else the driver will be
> broken.

I think the problem is your clockevent has no rating. Please give it a
rating (300?) so that it prevents the dummy from taking over. You don't
need to worry about disabling the local timer API, it will register a
harmless clockevent with a low rating (100) that should be ignored.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation



More information about the devicetree-discuss mailing list