Hi,
While working on the ONESHOT_STOPPED mode I came across
another confusing scenario..
Normal timers (kernel/timer.c) don't configure clockevent devices
at all but they always rely on PERIODIC tick interrupts to get them
scheduled. i.e. normal timers would be only serviced at next tick
interrupt (in both LOW & HIGH resolution modes)..
Suppose we have entered into NO_HZ_FULL mode (we made
sure that there are no normal timers queued) and a normal
timer was added after that. We will add it to the timer list but
as there is no tick-sched timer, we wouldn't be able to service
the normal timer until next time tick fires again (MAX 1 second
currently)..
And once we remove this MAX 1 second limitation, we might
not service this normal timer for long..
Does this problem statement make sense? Or we don't have
any such problem?
--
viresh
We already have dummy implementation for most of the regulators APIs for
!CONFIG_REGULATOR case and were missing it for regulator_set_voltage_time().
Found this issue while compiling cpufreq-cpu0 driver without regulators support
in kernel.
drivers/cpufreq/cpufreq-cpu0.c: In function ‘cpu0_cpufreq_probe’:
drivers/cpufreq/cpufreq-cpu0.c:186:3: error: implicit declaration of function ‘regulator_set_voltage_time’ [-Werror=implicit-function-declaration]
Fix this by adding dummy definition for regulator_set_voltage_time().
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
Liam/Broonie: Please see if this can go through Rafael as 2nd patch is dependent
on it.
include/linux/regulator/consumer.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1a4a8c1..0cfc286 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -397,6 +397,12 @@ static inline int regulator_set_voltage(struct regulator *regulator,
return 0;
}
+static inline int regulator_set_voltage_time(struct regulator *regulator,
+ int old_uV, int new_uV)
+{
+ return 0;
+}
+
static inline int regulator_get_voltage(struct regulator *regulator)
{
return -EINVAL;
--
2.0.0.rc2
Hi,
Here goes the fourth version and its very much light weight compared to earlier
versions. I hope I haven't missed any review comments here :)
More or less all patches are updated to get rid of all unrelated changes, like
removing unsupported modes OR not disabling events for default cases..
So, please review them again :)
Here goes the mainline version of cover-letter:
A clockevent device should be stopped, or its events should be masked, if next
event is expected at KTIME_MAX, i.e. no events are required for very long time.
This would normally happen with NO_HZ (both NO_HZ_IDLE and NO_HZ_FULL) when
tick-sched timer is removed and we don't have any more timers scheduled for
long.
If we don't STOP clockevent device, we are guaranteed to receive at least one
spurious interrupt, as hrtimer_force_reprogram() isn't reprogramming the event
device (on expires == KTIME_MAX). Depending on particular implementation of
clockevent device, this can be a fake interrupt at tick-rate.. (When driver is
emulating ONESHOT over PERIODIC mode. This was observed on at least one
implementation: arm_arch_timer.c).
A simple (yet hacky) solution to get this fixed could be: update
hrtimer_force_reprogram() to always reprogram clockevent device and update
clockevent drivers to STOP generating events (or delay it to max time), when
'expires' is set to KTIME_MAX. But the drawback here is that every clockevent
driver has to be hacked for this particular case and its very easy for new ones
to miss this.
However, Thomas suggested to add an optional mode: ONESHOT_STOPPED
(lkml.org/lkml/2014/5/9/508) to solve this problem.
With this proposal, introducing a new ONESHOT_STOPPED mode would require the
core to know whether the platform implements this mode so it could be
reprogrammed later.
In order for the core to tell if the mode is implemented, ->set_mode() callback
needs to be able to return success or failure.
To change return type of set_mode(), Thomas suggested to implement another
callback: ->set_dev_mode(), with return type 'int'. We can then convert
clockevent drivers to use this interface instead of existing ->set_mode() and
then finally remove ->set_mode()'s support.
This patchset first adds another callback with return capability,
set_dev_mode(), then it migrates all drivers one by one to it and finally
removes earlier callback set_mode() when it has no more users.
FIXME: There are two issues which *may* be required to fix separately.
1. Few drivers still have 'switch cases' for handling unsupported modes (like:
drivers not supporting ONESHOT have a 'case: ONESHOT' with or without a
WARN/BUG/pr_err/etc). As we now have a WARN() in core, we don't need these in
individual drivers and they can be removed.
2. Few clockevent drivers have disabled clock events as soon as we enter their
->set_dev_mode() callbacks and so they stay disabled for 'default case' as
well. We *may* need to fix these drivers in case we don't want them to
disable events in 'default case'. After this series we will never hit
'default case' as we are handling all cases separately, but it might be
required to fix them before ONESHOT_STOPPED series gets in.
Viresh Kumar (8):
clockevents: add ->set_dev_mode() to struct clock_event_device
clockevents: arm: migrate to ->set_dev_mode()
clockevents: mips: migrate to ->set_dev_mode()
clockevents: sparc: migrate to ->set_dev_mode()
clockevents: x86: migrate to ->set_dev_mode()
clockevents: drivers/: migrate to ->set_dev_mode()
clockevents: misc: migrate to ->set_dev_mode()
clockevents: remove ->set_mode() from struct clock_event_device
arch/alpha/kernel/time.c | 32 ++++++++++++++++++----
arch/arc/kernel/time.c | 11 +++++---
arch/arm/common/timer-sp.c | 9 ++++---
arch/arm/kernel/smp_twd.c | 10 ++++---
arch/arm/mach-at91/at91rm9200_time.c | 7 +++--
arch/arm/mach-at91/at91sam926x_time.c | 8 ++++--
arch/arm/mach-clps711x/common.c | 7 +++--
arch/arm/mach-cns3xxx/core.c | 10 ++++---
arch/arm/mach-davinci/time.c | 7 +++--
arch/arm/mach-footbridge/dc21285-timer.c | 7 +++--
arch/arm/mach-gemini/time.c | 7 ++---
arch/arm/mach-imx/epit.c | 7 +++--
arch/arm/mach-imx/time.c | 7 +++--
arch/arm/mach-integrator/integrator_ap.c | 9 ++++---
arch/arm/mach-ixp4xx/common.c | 8 +++---
arch/arm/mach-ks8695/time.c | 22 ++++++++++-----
arch/arm/mach-lpc32xx/timer.c | 7 +++--
arch/arm/mach-mmp/time.c | 11 +++++---
arch/arm/mach-netx/time.c | 11 ++++----
arch/arm/mach-omap1/time.c | 7 +++--
arch/arm/mach-omap1/timer32k.c | 7 +++--
arch/arm/mach-omap2/timer.c | 7 +++--
arch/arm/mach-pxa/time.c | 7 +++--
arch/arm/mach-sa1100/time.c | 7 +++--
arch/arm/mach-spear/time.c | 10 +++----
arch/arm/mach-w90x900/time.c | 7 +++--
arch/arm/plat-iop/time.c | 8 +++---
arch/arm/plat-orion/time.c | 20 ++++++++++----
arch/avr32/kernel/time.c | 7 ++---
arch/blackfin/kernel/time-ts.c | 14 +++++++---
arch/c6x/platforms/timer64.c | 7 +++--
arch/hexagon/kernel/time.c | 11 +++++---
arch/m68k/platform/coldfire/pit.c | 7 +++--
arch/microblaze/kernel/timer.c | 7 +++--
arch/mips/alchemy/common/time.c | 14 ++++++++--
arch/mips/include/asm/cevt-r4k.h | 2 +-
arch/mips/jazz/irq.c | 14 ++++++++--
arch/mips/jz4740/time.c | 9 ++++---
arch/mips/kernel/cevt-bcm1480.c | 9 ++++---
arch/mips/kernel/cevt-ds1287.c | 12 ++++++---
arch/mips/kernel/cevt-gic.c | 14 ++++++++--
arch/mips/kernel/cevt-gt641xx.c | 12 ++++++---
arch/mips/kernel/cevt-r4k.c | 14 ++++++++--
arch/mips/kernel/cevt-sb1250.c | 9 ++++---
arch/mips/kernel/cevt-smtc.c | 2 +-
arch/mips/kernel/cevt-txx9.c | 7 +++--
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c | 8 ++++--
arch/mips/ralink/cevt-rt3352.c | 13 +++++----
arch/mips/sgi-ip27/ip27-timer.c | 14 ++++++++--
arch/mips/sni/time.c | 7 +++--
arch/mn10300/kernel/cevt-mn10300.c | 14 ++++++++--
arch/openrisc/kernel/time.c | 7 +++--
arch/powerpc/kernel/time.c | 18 ++++++++++---
arch/s390/kernel/time.c | 14 ++++++++--
arch/score/kernel/time.c | 7 ++---
arch/sh/kernel/localtimer.c | 15 +++++++++--
arch/sparc/kernel/time_32.c | 18 ++++++++-----
arch/sparc/kernel/time_64.c | 7 +++--
arch/tile/kernel/time.c | 16 ++++++++---
arch/um/kernel/time.c | 7 +++--
arch/unicore32/kernel/time.c | 7 +++--
arch/x86/kernel/apic/apic.c | 10 ++++---
arch/x86/kernel/hpet.c | 19 +++++++------
arch/x86/lguest/boot.c | 7 +++--
arch/x86/platform/uv/uv_time.c | 9 ++++---
arch/x86/xen/time.c | 14 +++++++---
arch/xtensa/kernel/time.c | 9 ++++---
drivers/clocksource/arm_arch_timer.c | 36 ++++++++++++++-----------
drivers/clocksource/arm_global_timer.c | 9 ++++---
drivers/clocksource/bcm2835_timer.c | 8 +++---
drivers/clocksource/bcm_kona_timer.c | 10 ++++---
drivers/clocksource/cadence_ttc_timer.c | 7 +++--
drivers/clocksource/cs5535-clockevt.c | 17 +++++++++---
drivers/clocksource/dummy_timer.c | 15 +++++++++--
drivers/clocksource/dw_apb_timer.c | 7 +++--
drivers/clocksource/em_sti.c | 11 +++++---
drivers/clocksource/exynos_mct.c | 16 +++++++----
drivers/clocksource/i8253.c | 8 ++++--
drivers/clocksource/metag_generic.c | 7 +++--
drivers/clocksource/moxart_timer.c | 8 +++---
drivers/clocksource/mxs_timer.c | 7 +++--
drivers/clocksource/nomadik-mtu.c | 7 +++--
drivers/clocksource/qcom-timer.c | 9 ++++---
drivers/clocksource/samsung_pwm_timer.c | 7 +++--
drivers/clocksource/sh_cmt.c | 9 ++++---
drivers/clocksource/sh_mtu2.c | 9 ++++---
drivers/clocksource/sh_tmu.c | 9 ++++---
drivers/clocksource/sun4i_timer.c | 9 ++++---
drivers/clocksource/tcb_clksrc.c | 11 +++++---
drivers/clocksource/tegra20_timer.c | 7 +++--
drivers/clocksource/time-armada-370-xp.c | 20 +++++++++-----
drivers/clocksource/time-efm32.c | 7 +++--
drivers/clocksource/time-orion.c | 17 +++++++++---
drivers/clocksource/timer-keystone.c | 9 ++++---
drivers/clocksource/timer-marco.c | 10 ++++---
drivers/clocksource/timer-prima2.c | 7 +++--
drivers/clocksource/timer-sun5i.c | 9 ++++---
drivers/clocksource/timer-u300.c | 7 +++--
drivers/clocksource/vf_pit_timer.c | 12 ++++++---
drivers/clocksource/vt8500_timer.c | 7 +++--
drivers/clocksource/zevio-timer.c | 8 +++---
include/linux/clockchips.h | 4 +--
kernel/time/clockevents.c | 7 +++--
kernel/time/tick-broadcast-hrtimer.c | 11 +++++---
kernel/time/timer_list.c | 2 +-
105 files changed, 757 insertions(+), 311 deletions(-)
--
2.0.0.rc2
Currently core file of aarch32 process prstatus note has empty
registers set. As result aarch32 core files create by V8 kernel are
not very useful.
It happens because compat_gpr_get and compat_gpr_set functions can
copy registers values to/from either kbuf or ubuf. ELF core file
collection function fill_thread_core_info calls compat_gpr_get
with kbuf set and ubuf set to 0. But current compat_gpr_get and
compat_gpr_set function handle copy to/from only ubuf case.
Fix is to handle kbuf and ubuf as two separate cases in similar
way as other functions like user_regset_copyout, user_regset_copyin do.
Signed-off-by: Victor Kamensky <victor.kamensky(a)linaro.org>
Acked-by: Will Deacon <will.deacon(a)arm.com>
Cc: stable(a)vger.kernel.org
Cc: Catalin Marinas <catalin.marinas(a)arm.com>
---
arch/arm64/kernel/ptrace.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 6a8928b..9c9c2b9 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -650,11 +650,16 @@ static int compat_gpr_get(struct task_struct *target,
reg = task_pt_regs(target)->regs[idx];
}
- ret = copy_to_user(ubuf, ®, sizeof(reg));
- if (ret)
- break;
-
- ubuf += sizeof(reg);
+ if (kbuf) {
+ memcpy(kbuf, ®, sizeof(reg));
+ kbuf += sizeof(reg);
+ } else {
+ ret = copy_to_user(ubuf, ®, sizeof(reg));
+ if (ret)
+ break;
+
+ ubuf += sizeof(reg);
+ }
}
return ret;
@@ -684,11 +689,16 @@ static int compat_gpr_set(struct task_struct *target,
unsigned int idx = start + i;
compat_ulong_t reg;
- ret = copy_from_user(®, ubuf, sizeof(reg));
- if (ret)
- return ret;
+ if (kbuf) {
+ memcpy(®, kbuf, sizeof(reg));
+ kbuf += sizeof(reg);
+ } else {
+ ret = copy_from_user(®, ubuf, sizeof(reg));
+ if (ret)
+ return ret;
- ubuf += sizeof(reg);
+ ubuf += sizeof(reg);
+ }
switch (idx) {
case 15:
--
1.8.1.4
Implement and enable context tracking for arm64 (which is
a prerequisite for FULL_NOHZ support). This patchset
builds upon earlier work by Kevin Hilman and is based on
Will Deacon's tree.
Changes v5 to v6:
* Don't save far_el1 in x26 in el0_dbg path (not needed)
* TIF_NOHZ processes go through the slow path (so no register
save/restore is needed in ct_user_enter)
Changes v4 to v5:
* Improvement to code restoring far_el1 (suggested by Christopher Covington)
* Improvement to register save/restore in ct_user_enter
Changes v3 to v4:
* Rename parameter of ct_user_exit from save to restore
* Rebased patch to Will Deacon's tree (branch remotes/origin/aarch64
of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git)
Changes v2 to v3:
* Save/restore necessary registers in ct_user_enter and ct_user_exit
* Annotate "error paths" out of el0_sync with ct_user_exit
Changes v1 to v2:
* Save far_el1 in x26 temporarily
Larry Bassel (2):
arm64: adjust el0_sync so that a function can be called
arm64: enable context tracking
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/thread_info.h | 4 +++
arch/arm64/kernel/entry.S | 58 +++++++++++++++++++++++++++++++-----
3 files changed, 56 insertions(+), 7 deletions(-)
--
1.8.3.2
Hi Catalin, Will,
I've run into situation when core of aarch32 (V7) process created
by V8 kernel has empty registers set saved in prstatus notes. As
result core file are broken. Below are details on the issues. Proposed
patch follows this cover letter.
Test Case For Problem
---------------------
V8 kernel runs with v7 rootfs. Below output for BE system but LE has
the same issue. hello test case compiled as v7 code. Notice that
all registers in core file are zeros.
root@genericarmv7ab:~# cat hello.c
#include <stdio.h>
int main (void)
{
printf("Hello, world\n");
*(int *) 0 = 0;
}
root@genericarmv7ab:~# ./hello
Hello, world
hello[825]: unhandled level 3 translation fault (11) at 0x00000000, esr 0x92000047
pgd = ffffffc07cb02000
[00000000] *pgd=00000000fcad2003, *pmd=00000000fcad9003, *pte=0000000000000000
CPU: 0 PID: 825 Comm: hello Not tainted 3.15.0-rc5+ #1
task: ffffffc07dbf0000 ti: ffffffc07c978000 task.ti: ffffffc07c978000
PC is at 0x8434
LR is at 0xf74e03c4
pc : [<0000000000008434>] lr : [<00000000f74e03c4>] pstate: 600f0210
sp : 00000000ff9ce128
x12: 000000000000000d
x11: 00000000ff9ce12c x10: 00000000f75d2000
x9 : 0000000000000000 x8 : 0000000000000000
x7 : 0000000000000000 x6 : 00000000000082f4
x5 : 0000000000000000 x4 : 00000000ff9ce148
x3 : 0000000000000000 x2 : 0000000000000000
x1 : 0000000000000000 x0 : 000000000000000d
Segmentation fault (core dumped)
root@genericarmv7ab:~# gdb hello
GNU gdb (Linaro GDB) 7.6.1-2013.10
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armeb-oe-linux-gnueabi".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/root/hello...done.
(gdb) target core core
[New LWP 825]
Program terminated with signal 11, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) info reg
r0 0x0 0
r1 0x0 0
r2 0x0 0
r3 0x0 0
r4 0x0 0
r5 0x0 0
r6 0x0 0
r7 0x0 0
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x0 0
r12 0x0 0
sp 0x0 0x0
lr 0x0 0
pc 0x0 0x0
cpsr 0x0 0
(gdb)
If one look at core file notes it can see that all registers in
PRSTATUS note are zeros:
[root@kamensky-w530 root]# eu-readelf --notes ~kamensky/v8v7-core/v8_v7_le_core
Note segment of 984 bytes at offset 0x1f4:
Owner Data size Type
CORE 148 PRSTATUS
info.si_signo: 11, info.si_code: 0, info.si_errno: 0, cursig: 11
sigpend: <>
sighold: <>
pid: 1358, ppid: 1351, pgrp: 1358, sid: 1349
utime: 0.000000, stime: 0.020000, cutime: 0.000000, cstime: 0.000000
orig_r0: 0, fpvalid: 0
r0: 0 r1: 0 r2: 0
r3: 0 r4: 0 r5: 0
r6: 0 r7: 0 r8: 0
r9: 0 r10: 0 r11: 0
r12: 0 sp: 0x00000000 lr: 0x00000000
pc: 0x00000000 spsr: 0x00000000
Writing prstatus code under debugger
------------------------------------
Here is backtrace of code that writes PRSTATUS note. compat_gpr_get
called to fill in registers value. Note kbuf has valid address,
ubuf is 0.
#0 compat_gpr_get( target = (struct task_struct*) 0xFFFFFFC07CB39400, regset = (const struct user_regset*) 0xFFFFFFC0003D5290, pos = 0, count = 72, kbuf = (void*) 0xFFFFFFC07CFE4158, ubuf = (void*) 0x0 ) at ptrace.c:622
#1 fill_note( data = (void*) 0xFFFFFFC07CFE4110, sz = 148, type = 1, name = 0xFFFFFFC0004C4670 "CORE", note = (struct memelfnote*) 0xFFFFFFC07CFE41A8 ) at binfmt_elf.c:1279
#2 fill_thread_core_info( view = (const struct user_regset_view*) 0xFFFFFFC0003D5300, view = (const struct user_regset_view*) 0xFFFFFFC0003D5300, total = (size_t*) 0xFFFFFFC07C8B3B18, signr = <Value currently has no location>, t = (struct elf_thread_core_info*) 0xFFFFFFC07CFE4100 ) at binfmt_elf.c:1541
#3 elf_core_dump( cprm = (struct coredump_params*) 0xFFFFFFC07C8B3C38 ) at binfmt_elf.c:2123
#4 write_note_info( cprm = (struct coredump_params*) 0xFFFFFFC07C8B3C38, info = (struct elf_note_info*) 0xFFFFFFFFFFFFFFF8 ) at binfmt_elf.c:1698
#5 do_coredump( siginfo = <Value optimised away by compiler> ) at coredump.c:667
#6 get_signal_to_deliver( info = (siginfo_t*) 0xFFFFFFC07C8B3DF0, return_ka = (struct k_sigaction*) 0xFFFFFFC07C8B3E70, regs = <Value optimised away by compiler>, cookie = <Value optimised away by compiler> ) at signal.c:2372
#7 do_signal( regs = (struct pt_regs*) 0xFFFFFFC07C8B3ED0 ) at signal.c:377
#8 do_notify_resume( regs = <Value optimised away by compiler>, thread_flags = <Value optimised away by compiler> ) at signal.c:413
#9 [/wd1/linaro/linux-build/_le_64_linus_062/vmlinux EL1N:0xFFFFFFC00008428C ]
p ubuf
$30 = (void*) 0x0
p kbuf
$31 = (void*) 0xFFFFFFC07CFE4158
Fix
---
In compat_gpr_get and compat_gpr_set functions
handle kbuf and ubuf as two separate cases as other similar functions do,
i.e user_regset_copyout, user_regset_copyin functions
Tests
-----
Tested core files or single threaded and multithread aarch32 processes.
Able to see registers value, execute backtrace command, etc.
Thanks,
Victor
Victor Kamensky (1):
arm64: ptrace: fix empty registers set in prstatus of aarch32 process
core
arch/arm64/kernel/ptrace.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
--
1.8.1.4
3.11.10.11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <viresh.kumar(a)linaro.org>
commit 84ea7fe37908254c3bd90910921f6e1045c1747a upstream.
switch_hrtimer_base() calls hrtimer_check_target() which ensures that
we do not migrate a timer to a remote cpu if the timer expires before
the current programmed expiry time on that remote cpu.
But __hrtimer_start_range_ns() calls switch_hrtimer_base() before the
new expiry time is set. So the sanity check in hrtimer_check_target()
is operating on stale or even uninitialized data.
Update expiry time before calling switch_hrtimer_base().
[ tglx: Rewrote changelog once again ]
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
Cc: linaro-kernel(a)lists.linaro.org
Cc: linaro-networking(a)linaro.org
Cc: fweisbec(a)gmail.com
Cc: arvind.chauhan(a)arm.com
Link: http://lkml.kernel.org/r/81999e148745fc51bbcd0615823fbab9b2e87e23.139988225…
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques(a)canonical.com>
---
kernel/hrtimer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 6de65d8a70e2..aa149222cd8e 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1002,11 +1002,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
/* Remove an active timer from the queue: */
ret = remove_hrtimer(timer, base);
- /* Switch the timer base, if necessary: */
- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
-
if (mode & HRTIMER_MODE_REL) {
- tim = ktime_add_safe(tim, new_base->get_time());
+ tim = ktime_add_safe(tim, base->get_time());
/*
* CONFIG_TIME_LOW_RES is a temporary way for architectures
* to signal that they simply return xtime in
@@ -1021,6 +1018,9 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
hrtimer_set_expires_range_ns(timer, tim, delta_ns);
+ /* Switch the timer base, if necessary: */
+ new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
+
timer_stats_hrtimer_set_start_info(timer);
leftmost = enqueue_hrtimer(timer, new_base);
--
1.9.1
Hi,
This is my third attempt to migrate clockevent drivers to use set_dev_mode(). I
have tried to fix all issues raised by Frederic/Kevin on V2.
Please let me know if I missed something. Though patches 2-7 look big, it should
be fairly easy to review them now, so do try that :)
---------
A clockevent device should be stopped, or its events should be masked, if next
event is expected at KTIME_MAX, i.e. no events are required for very long time.
This would normally happen with NO_HZ (both NO_HZ_IDLE and NO_HZ_FULL) when
tick-sched timer is removed and we don't have any more timers scheduled for
long.
If we don't STOP clockevent device, we are guaranteed to receive at least one
spurious interrupt, as hrtimer_force_reprogram() isn't reprogramming the event
device (on expires == KTIME_MAX). Depending on particular implementation of
clockevent device, this can be a spurious interrupt at tick-rate.. (When driver
is emulating ONESHOT over PERIODIC mode. This was observed on at-least one
implementation: arm_arch_timer.c).
A simple (yet hacky) solution to get this fixed could be: update
hrtimer_force_reprogram() to always reprogram clockevent device and update
clockevent drivers to STOP generating events (or delay it to max time), when
'expires' is set to KTIME_MAX. But the drawback here is that every clockevent
driver has to be hacked for this particular case and its very easy for new ones
to miss this.
However, Thomas suggested to add an optional mode: ONESHOT_STOPPED
(lkml.org/lkml/2014/5/9/508) to solve this problem.
clockevents core would need to reconfigure mode later, when event is required
again, for platforms that implement ONESHOT_STOPPED mode and so it must know
which platforms implement it and which don't. This requires ->set_mode()
callback to have capability to return 'success' or 'failure'. Currently its
return type is 'void'.
To change return type of set_mode(), Thomas suggested to implement another
callback: ->set_dev_mode(), with return type 'int'. We can then convert
clockevent drivers to use this interface instead of existing ->set_mode() and
then finally remove ->set_mode()'s support.
This patchset first adds another callback with return capability,
set_dev_mode(), then it migrates all drivers one by one and finally removes
earlier callback set_mode() when nobody is using it.
NOTE: Following issue is still unresolved as this patchset isn't making it
worse. But it should be fixed before addition of ONESHOT_STOPPED mode.
Few clockevent drivers have disabled clock events as soon as we enter their
->set_dev_mode() callbacks and so they stay disabled for unsupported modes as
well.
All clockevent drivers are handling modes in ->set_dev_mode() with help of a
'switch' block. For the currently available modes none of them would ever get
down to the 'default case' of switch block.
And so we would never hit the BUG where we failed to change mode and still
disabled clock events.
But as soon as any new mode would be introduced in clockevents core, some of
these might behave unexpectedly. Like, core may expect events to be enabled as
call to ->set_dev_mode() returned failure and may not try enabling events again.
V2->V3:
- s/WARN_ON/WARN_ON_ONCE
- improved logs
- V2 had code belonging to problem mentioned in "NOTE" above, its dropped now
and would be addressed separately.
Viresh Kumar (8):
clockevents: add ->set_dev_mode() to struct clock_event_device
clockevents: arm: migrate to ->set_dev_mode()
clockevents: mips: migrate to ->set_dev_mode()
clockevents: sparc: migrate to ->set_dev_mode()
clockevents: x86: migrate to ->set_dev_mode()
clockevents: drivers/: migrate to ->set_dev_mode()
clockevents: misc: migrate to ->set_dev_mode()
clockevents: remove ->set_mode() from struct clock_event_device
arch/alpha/kernel/time.c | 32 ++++++++++++++++++----
arch/arc/kernel/time.c | 11 +++++---
arch/arm/common/timer-sp.c | 9 ++++---
arch/arm/kernel/smp_twd.c | 10 ++++---
arch/arm/mach-at91/at91rm9200_time.c | 7 +++--
arch/arm/mach-at91/at91sam926x_time.c | 11 ++++----
arch/arm/mach-clps711x/common.c | 9 ++++---
arch/arm/mach-cns3xxx/core.c | 10 ++++---
arch/arm/mach-davinci/time.c | 7 +++--
arch/arm/mach-footbridge/dc21285-timer.c | 7 +++--
arch/arm/mach-gemini/time.c | 7 ++---
arch/arm/mach-imx/epit.c | 11 ++++----
arch/arm/mach-imx/time.c | 11 ++++----
arch/arm/mach-integrator/integrator_ap.c | 8 +++---
arch/arm/mach-ixp4xx/common.c | 8 +++---
arch/arm/mach-ks8695/time.c | 22 ++++++++++-----
arch/arm/mach-lpc32xx/timer.c | 11 ++++----
arch/arm/mach-mmp/time.c | 12 +++++----
arch/arm/mach-netx/time.c | 11 ++++----
arch/arm/mach-omap1/time.c | 7 +++--
arch/arm/mach-omap1/timer32k.c | 7 +++--
arch/arm/mach-omap2/timer.c | 7 +++--
arch/arm/mach-pxa/time.c | 8 +++---
arch/arm/mach-sa1100/time.c | 8 +++---
arch/arm/mach-spear/time.c | 10 +++----
arch/arm/mach-w90x900/time.c | 7 +++--
arch/arm/plat-iop/time.c | 8 +++---
arch/arm/plat-orion/time.c | 20 ++++++++++----
arch/avr32/kernel/time.c | 7 ++---
arch/blackfin/kernel/time-ts.c | 14 +++++++---
arch/c6x/platforms/timer64.c | 7 +++--
arch/hexagon/kernel/time.c | 11 +++++---
arch/m68k/platform/coldfire/pit.c | 7 +++--
arch/microblaze/kernel/timer.c | 7 +++--
arch/mips/alchemy/common/time.c | 14 ++++++++--
arch/mips/include/asm/cevt-r4k.h | 2 +-
arch/mips/jazz/irq.c | 14 ++++++++--
arch/mips/jz4740/time.c | 9 ++++---
arch/mips/kernel/cevt-bcm1480.c | 11 +++++---
arch/mips/kernel/cevt-ds1287.c | 12 ++++++---
arch/mips/kernel/cevt-gic.c | 14 ++++++++--
arch/mips/kernel/cevt-gt641xx.c | 12 ++++++---
arch/mips/kernel/cevt-r4k.c | 14 ++++++++--
arch/mips/kernel/cevt-sb1250.c | 11 +++++---
arch/mips/kernel/cevt-smtc.c | 2 +-
arch/mips/kernel/cevt-txx9.c | 7 +++--
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c | 12 ++++-----
arch/mips/ralink/cevt-rt3352.c | 13 +++++----
arch/mips/sgi-ip27/ip27-timer.c | 14 ++++++++--
arch/mips/sni/time.c | 9 ++++---
arch/mn10300/kernel/cevt-mn10300.c | 14 ++++++++--
arch/openrisc/kernel/time.c | 11 ++++----
arch/powerpc/kernel/time.c | 16 ++++++++---
arch/s390/kernel/time.c | 14 ++++++++--
arch/score/kernel/time.c | 8 +++---
arch/sh/kernel/localtimer.c | 15 +++++++++--
arch/sparc/kernel/time_32.c | 18 ++++++++-----
arch/sparc/kernel/time_64.c | 11 ++++----
arch/tile/kernel/time.c | 16 ++++++++---
arch/um/kernel/time.c | 7 +++--
arch/unicore32/kernel/time.c | 8 +++---
arch/x86/kernel/apic/apic.c | 10 ++++---
arch/x86/kernel/hpet.c | 19 +++++++------
arch/x86/lguest/boot.c | 9 ++++---
arch/x86/platform/uv/uv_time.c | 10 ++++---
arch/x86/xen/time.c | 23 +++++++---------
arch/xtensa/kernel/time.c | 9 ++++---
drivers/clocksource/arm_arch_timer.c | 36 ++++++++++++++-----------
drivers/clocksource/arm_global_timer.c | 9 ++++---
drivers/clocksource/bcm2835_timer.c | 8 +++---
drivers/clocksource/bcm_kona_timer.c | 10 ++++---
drivers/clocksource/cadence_ttc_timer.c | 7 +++--
drivers/clocksource/cs5535-clockevt.c | 17 +++++++++---
drivers/clocksource/dummy_timer.c | 15 +++++++++--
drivers/clocksource/dw_apb_timer.c | 7 +++--
drivers/clocksource/em_sti.c | 11 +++++---
drivers/clocksource/exynos_mct.c | 16 +++++++----
drivers/clocksource/i8253.c | 8 ++++--
drivers/clocksource/metag_generic.c | 11 ++++----
drivers/clocksource/moxart_timer.c | 8 +++---
drivers/clocksource/mxs_timer.c | 10 +++----
drivers/clocksource/nomadik-mtu.c | 7 +++--
drivers/clocksource/qcom-timer.c | 11 ++++----
drivers/clocksource/samsung_pwm_timer.c | 7 +++--
drivers/clocksource/sh_cmt.c | 9 ++++---
drivers/clocksource/sh_mtu2.c | 9 ++++---
drivers/clocksource/sh_tmu.c | 9 ++++---
drivers/clocksource/sun4i_timer.c | 9 ++++---
drivers/clocksource/tcb_clksrc.c | 11 +++++---
drivers/clocksource/tegra20_timer.c | 7 +++--
drivers/clocksource/time-armada-370-xp.c | 20 +++++++++-----
drivers/clocksource/time-efm32.c | 7 +++--
drivers/clocksource/time-orion.c | 17 +++++++++---
drivers/clocksource/timer-keystone.c | 9 ++++---
drivers/clocksource/timer-marco.c | 10 ++++---
drivers/clocksource/timer-prima2.c | 10 +++----
drivers/clocksource/timer-sun5i.c | 10 ++++---
drivers/clocksource/timer-u300.c | 7 +++--
drivers/clocksource/vf_pit_timer.c | 12 ++++++---
drivers/clocksource/vt8500_timer.c | 8 +++---
drivers/clocksource/zevio-timer.c | 9 +++----
include/linux/clockchips.h | 4 +--
kernel/time/clockevents.c | 7 +++--
kernel/time/tick-broadcast-hrtimer.c | 11 +++++---
kernel/time/timer_list.c | 2 +-
105 files changed, 756 insertions(+), 376 deletions(-)
--
2.0.0.rc2
Implement and enable context tracking for arm64 (which is
a prerequisite for FULL_NOHZ support). This patchset
builds upon earlier work by Kevin Hilman and is based on
Will Deacon's tree.
Changes v6 to v7:
* Rename parameter of ct_user_exit from restore to syscall
Changes v5 to v6:
* Don't save far_el1 in x26 in el0_dbg path (not needed)
* TIF_NOHZ processes go through the slow path (so no register
save/restore is needed in ct_user_enter)
Changes v4 to v5:
* Improvement to code restoring far_el1 (suggested by Christopher Covington)
* Improvement to register save/restore in ct_user_enter
Changes v3 to v4:
* Rename parameter of ct_user_exit from save to restore
* Rebased patch to Will Deacon's tree (branch remotes/origin/aarch64
of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git)
Changes v2 to v3:
* Save/restore necessary registers in ct_user_enter and ct_user_exit
* Annotate "error paths" out of el0_sync with ct_user_exit
Changes v1 to v2:
* Save far_el1 in x26 temporarily
Larry Bassel (2):
arm64: adjust el0_sync so that a function can be called
arm64: enable context tracking
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/thread_info.h | 4 +++
arch/arm64/kernel/entry.S | 58 +++++++++++++++++++++++++++++++-----
3 files changed, 56 insertions(+), 7 deletions(-)
--
1.8.3.2
Quoting Sebastian Capella (2014-02-28 10:17:31)
> Quoting Russell King - ARM Linux (2014-02-28 02:20:18)
> > On Thu, Feb 27, 2014 at 06:19:49PM -0800, Stephen Boyd wrote:
> > > On 02/27/14 17:47, Russ Dill wrote:
> > > > On 02/27/2014 04:09 PM, Stephen Boyd wrote:
> > > >> On 02/27/14 15:57, Sebastian Capella wrote:
> > > >>> diff --git a/arch/arm/include/asm/memory.h
> > > >>> b/arch/arm/include/asm/memory.h index 8756e4b..1079ea8 100644 ---
> > > >>> a/arch/arm/include/asm/memory.h +++
> > > >>> b/arch/arm/include/asm/memory.h @@ -291,6 +291,7 @@ static inline
> > > >>> void *phys_to_virt(phys_addr_t x) */ #define __pa(x)
> > > >>> __virt_to_phys((unsigned long)(x)) #define __va(x) ((void
> > > >>> *)__phys_to_virt((phys_addr_t)(x))) +#define __pa_symbol(x)
> > > >>> __pa(RELOC_HIDE((unsigned long)(x), 0))
> > > >> Just curious, is there a reason for the RELOC_HIDE() here? Or
> > > >> __pa_symbol() for that matter? It looks like only x86 uses this on
> > > >> the __nosave_{begin,end} symbol. Maybe it's copy-pasta?
> > > > From my understanding this needs to stick around so long as gcc 3.x is
> > > > supported (did it get dropped yet?) on ARM Linux since it doesn't
> > > > support -fno-strict-overflow.
> > >
> > > I don't think it's been dropped yet but I wonder if anyone has tried
> > > recent kernels with such a compiler?
> > >
> > > Would the usage of &__pv_table_begin in arch/arm/mm/mmu.c also need the
> > > same treatment?
> >
> > We've never had to play these kinds of games on ARM irrespective of
> > compiler version.
>
> I am using gcc 4.6.3. I can try removing it but I suspect it will just
> work without it. Let me see if I can get an older compiler and try both
> ways.
Hi,
I've been struggling a bit to test 3.x compilers on this.
I'm running an armv7 board, but the 3.x compilers I'm trying
don't appear to suport armv7.
Anyone have any suggestions? Is this a worthwhile effort?
Thanks!
Sebastian
Doug raised many important concerns on V3:
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg645134.html
and so here is another iteration with improvements.
@Stephen: I have dropped you Tested-by's as patches are updated and requires a
retest, sorry for that :(
Douglas Anderson, recently pointed out an interesting problem due to which
udelay() was expiring earlier than it should.
While transitioning between frequencies few platforms may temporarily switch to
a stable frequency, waiting for the main PLL to stabilize.
For example: When we transition between very low frequencies on exynos, like
between 200MHz and 300MHz, we may temporarily switch to a PLL running at 800MHz.
No CPUFREQ notification is sent for that. That means there's a period of time
when we're running at 800MHz but loops_per_jiffy is calibrated at between 200MHz
and 300MHz. And so udelay behaves badly.
To get this fixed in a generic way, lets introduce another set of callbacks
get_intermediate() and target_intermediate(), only for drivers with
target_index() and CPUFREQ_ASYNC_NOTIFICATION unset.
get_intermediate should return a stable intermediate frequency platform wants to
switch to, and target_intermediate() should set CPU to to that frequency, before
jumping to the frequency corresponding to 'index'. Core will take care of
sending notifications and driver doesn't have to handle them in
target_intermediate() or target_index().
This patchset also update Tegra to use this new infrastructure and is already
tested by Stephen.
V3->V4:
- Allow get_intermediate() to return zero when we don't need to switch to
intermediate first
- Get rid of 'goto' and create another routine for handling intermediate freqs
- Allow target_index() to fail, its not a crime :)
- Fix tegra driver to return zero from get_intermediate() for few situations
(refer to patch 3/4)
- Fix issues with tegra's patch, like s/rate/rate * 1000
- Overall there are more modifications that what Doug requested as I felt we
need better support from core.
- Looks much better now, thanks Doug :)
V2-V3:
- Fix spelling error: s/Uset/Used
- Update tegra with the changes Stephen suggested
- Include a dependency patch sent separately earlier (3/4)
V1-V2: Almost changed completely, V1 was here: https://lkml.org/lkml/2014/5/15/40
Viresh Kumar (3):
cpufreq: handle calls to ->target_index() in separate routine
cpufreq: add support for intermediate (stable) frequencies
cpufreq: Tegra: implement intermediate frequency callbacks
Documentation/cpu-freq/cpu-drivers.txt | 29 ++++++++-
drivers/cpufreq/cpufreq.c | 111 ++++++++++++++++++++++++++-------
drivers/cpufreq/tegra-cpufreq.c | 81 ++++++++++++++----------
include/linux/cpufreq.h | 25 ++++++++
4 files changed, 186 insertions(+), 60 deletions(-)
--
2.0.0.rc2
Hi,
This patch series fixes support for AFTR idle mode on boards with
secure firmware enabled (it also includes fix for register setup on
EXYNOS4x12 SoCs). It has been tested on Trats2 target but should
also work on (EXYNOS4412 based) Insignal Origen board.
v2:
- synced against next-20140602
- added missing Acked-by-s
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Bartlomiej Zolnierkiewicz (5):
ARM: EXYNOS: add AFTR mode support to firmware do_idle method
ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
ARM: EXYNOS: PM: use c15resume firmware method if secure firmware is
enabled
ARM: EXYNOS: PM: fix register setup on EXYNOS4x12 for AFTR mode code
ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
Kyungmin Park (1):
arm: firmware: Check firmware is running or not
Tomasz Figa (1):
ARM: EXYNOS: add support for firmware-assisted c15resume
arch/arm/common/firmware.c | 5 +++++
arch/arm/include/asm/firmware.h | 14 +++++++++++++-
arch/arm/mach-exynos/firmware.c | 18 ++++++++++++++++--
arch/arm/mach-exynos/pm.c | 40 ++++++++++++++++++++++++++++++++--------
drivers/cpuidle/cpuidle-exynos.c | 7 ++++++-
5 files changed, 72 insertions(+), 12 deletions(-)
--
1.8.2.3
Hi,
This patch series fixes support for AFTR idle mode on boards with
secure firmware enabled (it also includes fix for register setup on
EXYNOS4x12 SoCs). It has been tested on Trats2 target but should
also work on (EXYNOS4412 based) Insignal Origen board.
This patchset depends on "[PATCH V5 00/20] ARM: exynos: cpuidle:
Move the driver to drivers/cpuidle" patch series from Daniel Lezcano
("http://www.spinics.net/lists/linux-samsung-soc/msg28494.html").
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Bartlomiej Zolnierkiewicz (5):
ARM: EXYNOS: add AFTR mode support to firmware do_idle method
ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
ARM: EXYNOS: PM: use c15resume firmware method if secure firmware is
enabled
ARM: EXYNOS: PM: fix register setup on EXYNOS4x12 for AFTR mode code
ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
Kyungmin Park (1):
arm: firmware: Check firmware is running or not
Tomasz Figa (1):
ARM: EXYNOS: add support for firmware-assisted c15resume
arch/arm/common/firmware.c | 5 +++++
arch/arm/include/asm/firmware.h | 14 +++++++++++++-
arch/arm/mach-exynos/firmware.c | 18 ++++++++++++++++--
arch/arm/mach-exynos/pm.c | 40 ++++++++++++++++++++++++++++++++--------
drivers/cpuidle/cpuidle-exynos.c | 7 ++++++-
5 files changed, 72 insertions(+), 12 deletions(-)
--
1.8.2.3
From: Mark Brown <broonie(a)linaro.org>
It is not an error to have no cache so we shouldn't return an error code
and cause our callers to fail, just silently do nothing instead. Thanks
to Jarkko for identify the problematic commit.
Reported-by: Jarkko Nikula <jarkko.nikula(a)linux.intel.com>
Reported-by: Fabio Estevam <festevam(a)gmail.com>
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
sound/soc/soc-cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 8fff5b6..00e70b6 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -73,7 +73,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
if (!reg_size)
- return -EINVAL;
+ return 0;
mutex_init(&codec->cache_rw_mutex);
--
2.0.0.rc2
Currently regulator_set_voltage() returns zero when support for regulators isn't
present in kernel, i.e. CONFIG_REGULATOR=n.
Make it return -EINVAL to propagate error instead of success here.
Audit of all users of this routine is done to make sure nothing breaks due to
this change.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
V1->V2: - New patch as suggested by Mark.
include/linux/regulator/consumer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1a4a8c1..28fa089 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -394,7 +394,7 @@ static inline void regulator_bulk_free(int num_consumers,
static inline int regulator_set_voltage(struct regulator *regulator,
int min_uV, int max_uV)
{
- return 0;
+ return -EINVAL;
}
static inline int regulator_get_voltage(struct regulator *regulator)
--
2.0.0.rc2
From: Mark Brown <broonie(a)linaro.org>
In the spirit of conservatism that governs our general approach to
permissions it is better if we don't touch regulators we weren't explicitly
given permissions to control. This avoids the need to explicitly specify
unknown regulators in DT as always on, if a regulator is not otherwise
involved in software control it can be omitted from the DT.
Regulators explicitly given constraints in DT still need to have an always
on constraint specified as before.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
drivers/regulator/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index af7a17677f3d..d7f111781867 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3822,8 +3822,9 @@ static int __init regulator_init_complete(void)
mutex_lock(®ulator_list_mutex);
/* If we have a full configuration then disable any regulators
- * which are not in use or always_on. This will become the
- * default behaviour in the future.
+ * we have permission to change the status for and which are
+ * not in use or always_on. This is effectively the default
+ * for DT and ACPI as they have full constraints.
*/
list_for_each_entry(rdev, ®ulator_list, list) {
ops = rdev->desc->ops;
@@ -3832,6 +3833,9 @@ static int __init regulator_init_complete(void)
if (c && c->always_on)
continue;
+ if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS))
+ continue;
+
mutex_lock(&rdev->mutex);
if (rdev->use_count)
--
2.0.0.rc4
This is a note to let you know that I have just added a patch titled
hrtimer: Set expiry time before switch_hrtimer_base()
to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/lin…
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Luis
------
>From bbe1a6ec07f62a0a8990187a0dd7622cce772ed5 Mon Sep 17 00:00:00 2001
From: Viresh Kumar <viresh.kumar(a)linaro.org>
Date: Mon, 12 May 2014 13:42:29 +0530
Subject: hrtimer: Set expiry time before switch_hrtimer_base()
commit 84ea7fe37908254c3bd90910921f6e1045c1747a upstream.
switch_hrtimer_base() calls hrtimer_check_target() which ensures that
we do not migrate a timer to a remote cpu if the timer expires before
the current programmed expiry time on that remote cpu.
But __hrtimer_start_range_ns() calls switch_hrtimer_base() before the
new expiry time is set. So the sanity check in hrtimer_check_target()
is operating on stale or even uninitialized data.
Update expiry time before calling switch_hrtimer_base().
[ tglx: Rewrote changelog once again ]
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
Cc: linaro-kernel(a)lists.linaro.org
Cc: linaro-networking(a)linaro.org
Cc: fweisbec(a)gmail.com
Cc: arvind.chauhan(a)arm.com
Link: http://lkml.kernel.org/r/81999e148745fc51bbcd0615823fbab9b2e87e23.139988225…
Signed-off-by: Thomas Gleixner <tglx(a)linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques(a)canonical.com>
---
kernel/hrtimer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 6de65d8a70e2..aa149222cd8e 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1002,11 +1002,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
/* Remove an active timer from the queue: */
ret = remove_hrtimer(timer, base);
- /* Switch the timer base, if necessary: */
- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
-
if (mode & HRTIMER_MODE_REL) {
- tim = ktime_add_safe(tim, new_base->get_time());
+ tim = ktime_add_safe(tim, base->get_time());
/*
* CONFIG_TIME_LOW_RES is a temporary way for architectures
* to signal that they simply return xtime in
@@ -1021,6 +1018,9 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
hrtimer_set_expires_range_ns(timer, tim, delta_ns);
+ /* Switch the timer base, if necessary: */
+ new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
+
timer_stats_hrtimer_set_start_info(timer);
leftmost = enqueue_hrtimer(timer, new_base);
--
1.9.1
Implement and enable context tracking for arm64 (which is
a prerequisite for FULL_NOHZ support). This patchset
builds upon earlier work by Kevin Hilman and is based on
Will Deacon's tree.
Changes v5 to v6:
* Don't save far_el1 in x26 in el0_dbg path (not needed)
* TIF_NOHZ processes go through the slow path (so no register
save/restore is needed in ct_user_enter)
Changes v4 to v5:
* Improvement to code restoring far_el1 (suggested by Christopher Covington)
* Improvement to register save/restore in ct_user_enter
Changes v3 to v4:
* Rename parameter of ct_user_exit from save to restore
* Rebased patch to Will Deacon's tree (branch remotes/origin/aarch64
of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git)
Changes v2 to v3:
* Save/restore necessary registers in ct_user_enter and ct_user_exit
* Annotate "error paths" out of el0_sync with ct_user_exit
Changes v1 to v2:
* Save far_el1 in x26 temporarily
*** BLURB HERE ***
Larry Bassel (2):
arm64: adjust el0_sync so that a function can be called
arm64: enable context tracking
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/thread_info.h | 4 +++
arch/arm64/kernel/entry.S | 58 +++++++++++++++++++++++++++++++-----
3 files changed, 56 insertions(+), 7 deletions(-)
--
1.8.3.2
Implement and enable context tracking for arm64 (which is
a prerequisite for FULL_NOHZ support). This patchset
builds upon earlier work by Kevin Hilman and is based on
Will Deacon's tree.
Changes v4 to v5:
* Improvement to code restoring far_el1 (suggested by Christopher Covington)
* Improvement to register save/restore in ct_user_enter
Changes v3 to v4:
* Rename parameter of ct_user_exit from save to restore
* Rebased patch to Will Deacon's tree (branch remotes/origin/aarch64
of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git)
Changes v2 to v3:
* Save/restore necessary registers in ct_user_enter and ct_user_exit
* Annotate "error paths" out of el0_sync with ct_user_exit
Changes v1 to v2:
* Save far_el1 in x26 temporarily
Larry Bassel (2):
arm64: adjust el0_sync so that a function can be called
arm64: enable context tracking
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/thread_info.h | 1 +
arch/arm64/kernel/entry.S | 69 ++++++++++++++++++++++++++++++++----
3 files changed, 64 insertions(+), 7 deletions(-)
--
1.8.3.2
By default, add some padding to the DT blobs to facilitate later
patching.
An example need for DTB patching is the need to modifiy the command
line on platforms where ATAGS are not (or cannot) be used to pass the
commandline. For example, we do not support a big-endian kernel
reading ATAGS from a little-endian u-boot, so the only way to pass a
command line in the DT.
Also, without ATAG support (or if u-boot was built without
CONFIG_INITRD_TAG) the only way to pass an initrd is by adding an
initrd= option to command line (in the DT).
Therefore, to facilitate adding to the DT command line directly in the
DTB, add some padding.
Cc: Nicolas Pitre <nico(a)linaro.org>
Cc: Stephen Warren <swarren(a)wwwdotorg.org>
Cc: Thomas Petazzoni <thomas.petazzoni(a)free-electrons.com>
Signed-off-by: Kevin Hilman <khilman(a)linaro.org>
---
I kinda pulled 64 bytes out of the air here since it's enough to add
some common things to the commandline like debug, earlyprink
initrd=<addr>,<size>, etc., but I'm certainlly not opposed to more
padding.
scripts/Makefile.lib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 6a5b0decb797..d7a57c2620f3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
quiet_cmd_dtc = DTC $@
cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
+ $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 -p 64 \
-i $(dir $<) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
--
1.9.2