<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/arch/arm/kernel, branch PD13.2.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>timer: fix the too many reries on the per-cpu event device</title>
<updated>2013-03-01T09:30:05+00:00</updated>
<author>
<name>Jason Liu</name>
<email>r64343@freescale.com</email>
</author>
<published>2013-02-25T11:55:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=33ddde4e10a08294274d018a758cd9288f646f21'/>
<id>33ddde4e10a08294274d018a758cd9288f646f21</id>
<content type='text'>
There are so many retries happen on the per-cpu event device
when run the command 'cat /proc/timer_list', as following:

root@~$ cat /proc/timer_list
Timer List Version: v0.6
HRTIMER_MAX_CLOCK_BASES: 3
now at 3297691988044 nsecs

Tick Device: mode:     1
Per CPU device: 0
Clock Event Device: local_timer
 max_delta_ns:   8624432320
 min_delta_ns:   1000
 mult:           2138893713
 shift:          32
 mode:           3
 next_event:     3297700000000 nsecs
 set_next_event: twd_set_next_event
 set_mode:       twd_set_mode
 event_handler:  hrtimer_interrupt
 retries:        36383

the reason is that the local timer will stop when enter C3 state,
we need switch the local timer to bc timer when enter the state
and switch back when exit from the that state.The code is like this:

void arch_idle(void)
{
....
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &amp;cpu);
enter_the_wait_mode();

clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &amp;cpu);
}

when the broadcast timer interrupt arrives(this interrupt just wakeup
the ARM, and ARM has no chance to handle it since local irq is disabled.
In fact it's disabled in cpu_idle() of arch/arm/kernel/process.c)

the broadcast timer interrupt will wake up the CPU and run:

clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &amp;cpu);    -&gt;
tick_broadcast_oneshot_control(...);
-&gt;
tick_program_event(dev-&gt;next_event, 1);
-&gt;
tick_dev_program_event(dev, expires, force);
-&gt;
for (i = 0;;) {
                int ret = clockevents_program_event(dev, expires, now);
                if (!ret || !force)
                        return ret;
                dev-&gt;retries++;
                ....
                now = ktime_get();
                expires = ktime_add_ns(now, dev-&gt;min_delta_ns);
}
clockevents_program_event(dev, expires, now);
        delta = ktime_to_ns(ktime_sub(expires, now));

        if (delta &lt;= 0)
                return -ETIME;
when the bc timer interrupt arrives,  which means the last local timer
expires too. so, clockevents_program_event will return -ETIME, which will
cause the dev-&gt;retries++ when retry to program the expired timer.

Even under the worst case, after the re-program the expired timer,
then CPU enter idle quickly before the re-progam timer expired,
it will make system ping-pang forever if no interrupt happen.

We have found the ping-pang issue during the video play-back test.
system will freeze and video not playing for sometime until other interrupt
occured to break the error condition.

The detailed information, please refer to the LKML:https://lkml.org/lkml/2013/2/20/216
which posted by Jason Liu.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Jason Liu &lt;r64343@freescale.com&gt;
Tested-by: Jason Liu &lt;r64343@freescale.com&gt;
Tested-by: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Tested-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are so many retries happen on the per-cpu event device
when run the command 'cat /proc/timer_list', as following:

root@~$ cat /proc/timer_list
Timer List Version: v0.6
HRTIMER_MAX_CLOCK_BASES: 3
now at 3297691988044 nsecs

Tick Device: mode:     1
Per CPU device: 0
Clock Event Device: local_timer
 max_delta_ns:   8624432320
 min_delta_ns:   1000
 mult:           2138893713
 shift:          32
 mode:           3
 next_event:     3297700000000 nsecs
 set_next_event: twd_set_next_event
 set_mode:       twd_set_mode
 event_handler:  hrtimer_interrupt
 retries:        36383

the reason is that the local timer will stop when enter C3 state,
we need switch the local timer to bc timer when enter the state
and switch back when exit from the that state.The code is like this:

void arch_idle(void)
{
....
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &amp;cpu);
enter_the_wait_mode();

clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &amp;cpu);
}

when the broadcast timer interrupt arrives(this interrupt just wakeup
the ARM, and ARM has no chance to handle it since local irq is disabled.
In fact it's disabled in cpu_idle() of arch/arm/kernel/process.c)

the broadcast timer interrupt will wake up the CPU and run:

clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &amp;cpu);    -&gt;
tick_broadcast_oneshot_control(...);
-&gt;
tick_program_event(dev-&gt;next_event, 1);
-&gt;
tick_dev_program_event(dev, expires, force);
-&gt;
for (i = 0;;) {
                int ret = clockevents_program_event(dev, expires, now);
                if (!ret || !force)
                        return ret;
                dev-&gt;retries++;
                ....
                now = ktime_get();
                expires = ktime_add_ns(now, dev-&gt;min_delta_ns);
}
clockevents_program_event(dev, expires, now);
        delta = ktime_to_ns(ktime_sub(expires, now));

        if (delta &lt;= 0)
                return -ETIME;
when the bc timer interrupt arrives,  which means the last local timer
expires too. so, clockevents_program_event will return -ETIME, which will
cause the dev-&gt;retries++ when retry to program the expired timer.

Even under the worst case, after the re-program the expired timer,
then CPU enter idle quickly before the re-progam timer expired,
it will make system ping-pang forever if no interrupt happen.

We have found the ping-pang issue during the video play-back test.
system will freeze and video not playing for sometime until other interrupt
occured to break the error condition.

The detailed information, please refer to the LKML:https://lkml.org/lkml/2013/2/20/216
which posted by Jason Liu.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Jason Liu &lt;r64343@freescale.com&gt;
Tested-by: Jason Liu &lt;r64343@freescale.com&gt;
Tested-by: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Tested-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Add sysfs entry to enable return stack if supported</title>
<updated>2012-09-26T05:26:21+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-04-04T01:01:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1b7aab024e897875100c331786f55902c6de565d'/>
<id>1b7aab024e897875100c331786f55902c6de565d</id>
<content type='text'>
Change-Id: Icb73d60324ad0ddfc3e8a450a28bb3d90c702788
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Icb73d60324ad0ddfc3e8a450a28bb3d90c702788
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Add sysfs entry to disable branch_output flag</title>
<updated>2012-09-26T05:26:11+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-04-03T23:15:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6c0b910c0e3be3015d60a149fe98e3f89c8604f5'/>
<id>6c0b910c0e3be3015d60a149fe98e3f89c8604f5</id>
<content type='text'>
Change-Id: Ib91208a2c33621aa2d7bd9aa72bfbc670d9d5f1d
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Ib91208a2c33621aa2d7bd9aa72bfbc670d9d5f1d
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Add sysfs entry to set context-id-size</title>
<updated>2012-09-26T05:25:55+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-04-03T00:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=829c3284e802cd3100f5a28a59b41c3ed5f57463'/>
<id>829c3284e802cd3100f5a28a59b41c3ed5f57463</id>
<content type='text'>
Change-Id: I520dfb6e593dac131de8b9b1db77f1c734f18c24
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I520dfb6e593dac131de8b9b1db77f1c734f18c24
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Add sysfs entry to enable timestamps if supported</title>
<updated>2012-09-26T05:24:57+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-04-03T00:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=86a7393665c7d6fb5fed84de15f50d394d55c8d8'/>
<id>86a7393665c7d6fb5fed84de15f50d394d55c8d8</id>
<content type='text'>
Change-Id: Iff964ba2f6236ed81863e02ec7b3ec9fbc48044a
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Iff964ba2f6236ed81863e02ec7b3ec9fbc48044a
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Check arch version and disable data tracing for ptm</title>
<updated>2012-09-26T05:24:45+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-04-03T03:18:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8449220d6931f572f20f62a20b745949c65d1a7b'/>
<id>8449220d6931f572f20f62a20b745949c65d1a7b</id>
<content type='text'>
Change-Id: If2cb7928d0711f48348443d882a12416be9c5910
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: If2cb7928d0711f48348443d882a12416be9c5910
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Wait for etm/ptm(s) to stop before requesting PowerDown</title>
<updated>2012-09-26T05:24:30+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2012-03-29T04:03:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ac58d07866bea0dfab35a7520388b46d81e92340'/>
<id>ac58d07866bea0dfab35a7520388b46d81e92340</id>
<content type='text'>
When PowerDown was requested at the same time as ProgBit, the
formatter flush command that follows could get stuck.

Change-Id: Iafb665f61f055819e64ca1dcb60398c656f593e4
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When PowerDown was requested at the same time as ProgBit, the
formatter flush command that follows could get stuck.

Change-Id: Iafb665f61f055819e64ca1dcb60398c656f593e4
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Power down etm(s) when tracing is not enabled</title>
<updated>2012-09-26T05:24:07+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2011-02-24T00:51:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=08aee79345937b04382511abb641f817864e20f5'/>
<id>08aee79345937b04382511abb641f817864e20f5</id>
<content type='text'>
Without this change a saw an 18% increase in idle power consumption
on one deivce when trace support is compiled into the kernel. Now
I see the same increase only when tracing.

Change-Id: I21bb5ecf1b7d29ce3790ceeb5323409cc22d5a3b
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this change a saw an 18% increase in idle power consumption
on one deivce when trace support is compiled into the kernel. Now
I see the same increase only when tracing.

Change-Id: I21bb5ecf1b7d29ce3790ceeb5323409cc22d5a3b
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Support multiple ETMs/PTMs.</title>
<updated>2012-09-26T05:23:55+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2011-02-05T06:38:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4c6379115e1ed59603b22626af744abfd48fc48e'/>
<id>4c6379115e1ed59603b22626af744abfd48fc48e</id>
<content type='text'>
If more than one ETM or PTM are present, configure all of them
and enable the formatter in the ETB. This allows tracing on dual
core systems (e.g. omap4).

Change-Id: I028657d5cf2bee1b23f193d4387b607953b35888
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If more than one ETM or PTM are present, configure all of them
and enable the formatter in the ETB. This allows tracing on dual
core systems (e.g. omap4).

Change-Id: I028657d5cf2bee1b23f193d4387b607953b35888
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ARM: etm: Return the entire trace buffer if it is empty after reset</title>
<updated>2012-09-26T05:23:41+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2011-02-05T06:38:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=019c28e12dc0f6cb196de13489cad65a90edd9b0'/>
<id>019c28e12dc0f6cb196de13489cad65a90edd9b0</id>
<content type='text'>
On some SOCs the read and write pointer are reset when the chip
resets, but the trace buffer content is preserved. If the status
bits indicates that the buffer is empty and we have never started
tracing, assume the buffer is full instead. This can be useful
if the system rebooted from a watchdog reset.

Change-Id: Iaf21c2c329c6059004ee1d38e3dfff66d7d28029
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On some SOCs the read and write pointer are reset when the chip
resets, but the trace buffer content is preserved. If the status
bits indicates that the buffer is empty and we have never started
tracing, assume the buffer is full instead. This can be useful
if the system rebooted from a watchdog reset.

Change-Id: Iaf21c2c329c6059004ee1d38e3dfff66d7d28029
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
