Hi Thomas,
These are separate cleanups from the timers/hrtimers ones I did. I was waiting
for the merge window to close in order to send these and by the time it
happened, I got a long pending list.
These are mostly cleanups, reorders for better readability or efficiency, and
few bugfixes.
I have pushed these here as well:
git://git.linaro.org/people/viresh.kumar/linux.git tick-cleanups
They will be tested by kbuild bot also starting from tonight.
Viresh Kumar (38):
tick: align to Coding Guidelines
tick: update doc comments for struct tick_sched
tick: rearrange members of 'struct tick_sched'
tick: move declaration of tick_cpu_device to tick.h
tick: move definition of tick_get_device() to tick.h
tick: create tick_get_cpu_device() to get tick_cpu_device on this cpu
tick-oneshot: drop local_irq_save/restore from
tick_switch_to_oneshot()
tick-oneshot: move tick_is_oneshot_available() to tick-oneshot.c
tick-oneshot: remove tick_resume_oneshot()
tick-common: remove extra checks from tick_check_new_device()
tick-common: fix wrong check in tick_check_replacement()
tick-common: call tick_check_percpu() from tick_check_preferred()
tick-common: don't check tick_oneshot_mode_active() from
tick_check_preferred()
tick-common: do additional checks in tick_check_preferred()
tick-common: remove tick_check_replacement()
tick-common: don't pass cpumask to tick_setup_device()
tick-common: call tick_install_replacement() from
tick_check_new_device()
tick-common: don't set mode to CLOCK_EVT_MODE_UNUSED in
tick_shutdown()
tick-common: remove local variable 'broadcast' from tick_resume()
tick-sched: initialize 'cpu' while defining it in
tick_nohz_full_setup()
tick-sched: no need to rewrite '1' to tick_nohz_enabled
tick-sched: no need to recheck cpu_online() in can_stop_idle_tick()
tick-sched: invert parameter of tick_check_oneshot_change()
tick-sched: don't check tick_nohz_full_cpu() in
__tick_nohz_task_switch()
tick-sched: don't call local_softirq_pending() thrice in
can_stop_idle_tick()
tick-sched: don't call update_wall_time() when delta is lesser than
tick_period
tick-sched: remove 'regs' parameter of tick_sched_handle()
tick-sched: remove parameters to {__}tick_nohz_task_switch() routines
tick-sched: remove wrapper around __tick_nohz_task_switch()
tick-sched: move nohz_full_buf[] inside tick_nohz_init()
tick-sched: initialize 'ts' during its definition
__tick_nohz_idle_enter()
tick-sched: add comment about 'idle_active' in tick_nohz_idle_exit()
tick-sched: replace tick_nohz_active with tick_nohz_enabled in
tick_nohz_switch_to_nohz()
tick-sched: remove local variable 'now' from tick_setup_sched_timer()
tick-broadcast: do checks before taking locks in
tick_do_broadcast_on_off()
tick-broadcast: get rid of extra comparison in
tick_do_broadcast_on_off()
tick-broadcast: merge tick_do_broadcast_on_off() into
tick_broadcast_on_off()
clockevents: set event_handler to clockevents_handle_noop() in
clockevents_exchange_device()
include/linux/clockchips.h | 2 -
include/linux/hrtimer.h | 3 -
include/linux/tick.h | 65 ++++++++++-------
kernel/hrtimer.c | 4 +-
kernel/sched/core.c | 2 +-
kernel/time/clockevents.c | 11 +--
kernel/time/tick-broadcast.c | 74 +++++++-------------
kernel/time/tick-common.c | 126 +++++++++++++--------------------
kernel/time/tick-internal.h | 15 ++--
kernel/time/tick-oneshot.c | 37 +++++-----
kernel/time/tick-sched.c | 163 +++++++++++++++++++++++--------------------
11 files changed, 232 insertions(+), 270 deletions(-)
--
1.7.12.rc2.18.g61b472e
Hi Thomas,
As suggested by you (https://lkml.org/lkml/2014/4/14/797), this is the first lot
of changes I have. These are all potential bug fixes (Sorry if I haven't read
the most obvious code correctly at some place :) ).
Patch 2/5 isn't a bug fix but was required as a dependency for 3/5.
Some discussions already happened for 5/5 here:
https://lkml.org/lkml/2014/4/9/243https://lkml.org/lkml/2014/4/9/346
I have tried to mark stable release wherever possible.
Viresh Kumar (5):
tick-common: fix wrong check in tick_check_replacement()
tick-common: don't check tick_oneshot_mode_active() from
tick_check_preferred()
tick-common: do additional checks in tick_check_preferred()
tick-sched: don't call update_wall_time() when delta is lesser than
tick_period
tick-sched: replace tick_nohz_active with tick_nohz_enabled in
tick_nohz_switch_to_nohz()
kernel/time/tick-common.c | 29 +++++++++++++++++++----------
kernel/time/tick-sched.c | 34 ++++++++++++++++++----------------
2 files changed, 37 insertions(+), 26 deletions(-)
--
1.7.12.rc2.18.g61b472e
Currently, KVM ARM/ARM64 only provides in-kernel emulation of Power State
and Coordination Interface (PSCI) v0.1.
This patchset aims at providing newer PSCI v0.2 for KVM ARM/ARM64 VCPUs
such that it does not break current KVM ARM/ARM64 ABI.
The user space tools (i.e. QEMU or KVMTOOL) will have to explicitly enable
KVM_ARM_VCPU_PSCI_0_2 feature using KVM_ARM_VCPU_INIT ioctl for providing
PSCI v0.2 to VCPUs.
Changlog:
V9:
- Rename undefined PSCI_VER_xxx defines to PSCI_VERSION_xxx defines
V8:
- Add #define for possible values of migrate type in uapi/linux/psci.h
- Simplified psci_affinity_mask() in psci.c
- Update comments in kvm_psci_vcpu_suspend() to indicate that for KVM
wakeup events are interrupts.
- Unconditionally update r0 (or x0) in kvm_psci_vcpu_on()
V7:
- Make uapi/linux/psci.h inline with Ashwin's patch
http://www.spinics.net/lists/arm-kernel/msg319090.html
- Incorporate Rob's suggestions for uapi/linux/psci.h
- Treat CPU_SUSPEND power-down request to be same as standby
request. This further simplifies CPU_SUSPEND emulation.
V6:
- Introduce uapi/linux/psci.h for sharing PSCI defines between
ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space
- Make CPU_SUSPEND emulation similar to WFI emulation
V5:
- Have separate last patch to advertise KVM_CAP_ARM_PSCI_0_2
- Use kvm_psci_version() in kvm_psci_vcpu_on()
- Return ALREADY_ON for PSCI v0.2 CPU_ON if VCPU is not paused
- Remove per-VCPU suspend context
- As-per PSCI v0.2 spec, only current CPU can suspend itself
V4:
- Implement all mandatory functions required by PSCI v0.2
V3:
- Make KVM_ARM_VCPU_PSCI_0_2 feature experiementatl for now so that
it fails for user space till all mandatory PSCI v0.2 functions are
emulated by KVM ARM/ARM64
- Have separate patch for making KVM_ARM_VCPU_PSCI_0_2 feature available
to user space. This patch can be defferred for now
V2:
- Don't rename PSCI return values KVM_PSCI_RET_NI and KVM_PSCI_RET_INVAL
- Added kvm_psci_version() to get PSCI version available to VCPU
- Fixed grammer in Documentation/virtual/kvm/api.txt
V1:
- Initial RFC PATCH
Anup Patel (12):
KVM: Add capability to advertise PSCI v0.2 support
ARM/ARM64: KVM: Add common header for PSCI related defines
ARM/ARM64: KVM: Add base for PSCI v0.2 emulation
KVM: Documentation: Add info regarding KVM_ARM_VCPU_PSCI_0_2 feature
ARM/ARM64: KVM: Make kvm_psci_call() return convention more flexible
KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header
ARM/ARM64: KVM: Emulate PSCI v0.2 SYSTEM_OFF and SYSTEM_RESET
ARM/ARM64: KVM: Emulate PSCI v0.2 AFFINITY_INFO
ARM/ARM64: KVM: Emulate PSCI v0.2 MIGRATE_INFO_TYPE and related
functions
ARM/ARM64: KVM: Fix CPU_ON emulation for PSCI v0.2
ARM/ARM64: KVM: Emulate PSCI v0.2 CPU_SUSPEND
ARM/ARM64: KVM: Advertise KVM_CAP_ARM_PSCI_0_2 to user space
Documentation/virtual/kvm/api.txt | 17 +++
arch/arm/include/asm/kvm_host.h | 2 +-
arch/arm/include/asm/kvm_psci.h | 6 +-
arch/arm/include/uapi/asm/kvm.h | 19 ++--
arch/arm/kvm/arm.c | 1 +
arch/arm/kvm/handle_exit.c | 10 +-
arch/arm/kvm/psci.c | 222 +++++++++++++++++++++++++++++++++----
arch/arm64/include/asm/kvm_host.h | 2 +-
arch/arm64/include/asm/kvm_psci.h | 6 +-
arch/arm64/include/uapi/asm/kvm.h | 21 ++--
arch/arm64/kvm/handle_exit.c | 10 +-
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/kvm.h | 9 ++
include/uapi/linux/psci.h | 78 +++++++++++++
14 files changed, 356 insertions(+), 48 deletions(-)
create mode 100644 include/uapi/linux/psci.h
--
1.7.9.5
sched_can_stop_tick() was using 7 spaces instead of 8 spaces or a 'tab' at the
beginning of each line. Which doesn't align with the Coding Guidelines.
Also it removes the *rq variable as it was used at only one place and hence we
can directly use this_rq() instead.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
V1->V2: Rebased over:
https://lkml.org/lkml/2014/3/19/456
kernel/sched/core.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1fadf61..3a4bb63 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -666,19 +666,15 @@ static inline bool got_nohz_idle_kick(void)
#ifdef CONFIG_NO_HZ_FULL
bool sched_can_stop_tick(void)
{
- struct rq *rq;
-
- rq = this_rq();
-
- /*
- * More than one running task need preemption.
- * nr_running update is assumed to be visible
- * after IPI is sent from wakers.
- */
- if (rq->nr_running > 1)
- return false;
+ /*
+ * More than one running task need preemption.
+ * nr_running update is assumed to be visible
+ * after IPI is sent from wakers.
+ */
+ if (this_rq()->nr_running > 1)
+ return false;
- return true;
+ return true;
}
#endif /* CONFIG_NO_HZ_FULL */
--
1.7.12.rc2.18.g61b472e
sched_can_stop_tick() was using 7 spaces instead of 8 spaces or a 'tab' at the
beginning of each line. Which doesn't align with the Coding Guidelines.
Also it removes the *rq variable as it was used at only one place and hence we
can directly use this_rq() instead.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
I don't think rq = tihs_rq() has to be done before smp_mb(), in case yes sorry
for this patch :(
kernel/sched/core.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 268a45e..13299c5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -666,18 +666,14 @@ static inline bool got_nohz_idle_kick(void)
#ifdef CONFIG_NO_HZ_FULL
bool sched_can_stop_tick(void)
{
- struct rq *rq;
-
- rq = this_rq();
-
- /* Make sure rq->nr_running update is visible after the IPI */
- smp_rmb();
+ /* Make sure rq->nr_running update is visible after the IPI */
+ smp_rmb();
- /* More than one running task need preemption */
- if (rq->nr_running > 1)
- return false;
+ /* More than one running task need preemption */
+ if (this_rq()->nr_running > 1)
+ return false;
- return true;
+ return true;
}
#endif /* CONFIG_NO_HZ_FULL */
--
1.7.12.rc2.18.g61b472e
Currently, KVM ARM/ARM64 only provides in-kernel emulation of Power State
and Coordination Interface (PSCI) v0.1.
This patchset aims at providing newer PSCI v0.2 for KVM ARM/ARM64 VCPUs
such that it does not break current KVM ARM/ARM64 ABI.
The user space tools (i.e. QEMU or KVMTOOL) will have to explicitly enable
KVM_ARM_VCPU_PSCI_0_2 feature using KVM_ARM_VCPU_INIT ioctl for providing
PSCI v0.2 to VCPUs.
Changlog:
V8:
- Add #define for possible values of migrate type in uapi/linux/psci.h
- Simplified psci_affinity_mask() in psci.c
- Update comments in kvm_psci_vcpu_suspend() to indicate that for KVM
wakeup events are interrupts.
- Unconditionally update r0 (or x0) in kvm_psci_vcpu_on()
V7:
- Make uapi/linux/psci.h inline with Ashwin's patch
http://www.spinics.net/lists/arm-kernel/msg319090.html
- Incorporate Rob's suggestions for uapi/linux/psci.h
- Treat CPU_SUSPEND power-down request to be same as standby
request. This further simplifies CPU_SUSPEND emulation.
V6:
- Introduce uapi/linux/psci.h for sharing PSCI defines between
ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space
- Make CPU_SUSPEND emulation similar to WFI emulation
V5:
- Have separate last patch to advertise KVM_CAP_ARM_PSCI_0_2
- Use kvm_psci_version() in kvm_psci_vcpu_on()
- Return ALREADY_ON for PSCI v0.2 CPU_ON if VCPU is not paused
- Remove per-VCPU suspend context
- As-per PSCI v0.2 spec, only current CPU can suspend itself
V4:
- Implement all mandatory functions required by PSCI v0.2
V3:
- Make KVM_ARM_VCPU_PSCI_0_2 feature experiementatl for now so that
it fails for user space till all mandatory PSCI v0.2 functions are
emulated by KVM ARM/ARM64
- Have separate patch for making KVM_ARM_VCPU_PSCI_0_2 feature available
to user space. This patch can be defferred for now
V2:
- Don't rename PSCI return values KVM_PSCI_RET_NI and KVM_PSCI_RET_INVAL
- Added kvm_psci_version() to get PSCI version available to VCPU
- Fixed grammer in Documentation/virtual/kvm/api.txt
V1:
- Initial RFC PATCH
Anup Patel (12):
KVM: Add capability to advertise PSCI v0.2 support
ARM/ARM64: KVM: Add common header for PSCI related defines
ARM/ARM64: KVM: Add base for PSCI v0.2 emulation
KVM: Documentation: Add info regarding KVM_ARM_VCPU_PSCI_0_2 feature
ARM/ARM64: KVM: Make kvm_psci_call() return convention more flexible
KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header
ARM/ARM64: KVM: Emulate PSCI v0.2 SYSTEM_OFF and SYSTEM_RESET
ARM/ARM64: KVM: Emulate PSCI v0.2 AFFINITY_INFO
ARM/ARM64: KVM: Emulate PSCI v0.2 MIGRATE_INFO_TYPE and related
functions
ARM/ARM64: KVM: Fix CPU_ON emulation for PSCI v0.2
ARM/ARM64: KVM: Emulate PSCI v0.2 CPU_SUSPEND
ARM/ARM64: KVM: Advertise KVM_CAP_ARM_PSCI_0_2 to user space
Documentation/virtual/kvm/api.txt | 17 +++
arch/arm/include/asm/kvm_host.h | 2 +-
arch/arm/include/asm/kvm_psci.h | 6 +-
arch/arm/include/uapi/asm/kvm.h | 19 ++--
arch/arm/kvm/arm.c | 1 +
arch/arm/kvm/handle_exit.c | 10 +-
arch/arm/kvm/psci.c | 222 +++++++++++++++++++++++++++++++++----
arch/arm64/include/asm/kvm_host.h | 2 +-
arch/arm64/include/asm/kvm_psci.h | 6 +-
arch/arm64/include/uapi/asm/kvm.h | 21 ++--
arch/arm64/kvm/handle_exit.c | 10 +-
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/kvm.h | 9 ++
include/uapi/linux/psci.h | 77 +++++++++++++
14 files changed, 355 insertions(+), 48 deletions(-)
create mode 100644 include/uapi/linux/psci.h
--
1.7.9.5
Cc: Russ Dill <Russ.Dill(a)ti.com>
Cc: "Rafael J. Wysocki" <rjw(a)rjwysocki.net>
Cc: Russell King <linux(a)arm.linux.org.uk>
Cc: Pavel Machek <pavel(a)ucw.cz>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi(a)arm.com>
Cc: Stephen Warren <swarren(a)nvidia.com>
Cc: Len Brown <len.brown(a)intel.com>
Cc: Nicolas Pitre <nico(a)linaro.org>
Cc: Santosh Shilimkar <santosh.shilimkar(a)ti.com>
Cc: Will Deacon <will.deacon(a)arm.com>
Cc: Jonathan Austin <jonathan.austin(a)arm.com>
Cc: Catalin Marinas <catalin.marinas(a)arm.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig(a)pengutronix.de>
Cc: Stephen Boyd <sboyd(a)codeaurora.org>
Cc: Laura Abbott <lauraa(a)codeaurora.org>
Cc: Jiang Liu <liuj97(a)gmail.com>
Cc: Sricharan R <r.sricharan(a)ti.com>
Cc: Victor Kamensky <victor.kamensky(a)linaro.org>
Cc: Stefano Stabellini <stefano.stabellini(a)eu.citrix.com>
Cc: Ben Dooks <ben.dooks(a)codethink.co.uk>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Robin Holt <robin.m.holt(a)gmail.com>
Cc: Konstantin Khlebnikov <k.khlebnikov(a)samsung.com>
Cc: Steven Capper <steve.capper(a)linaro.org>
Cc: Tejun Heo <tj(a)kernel.org>
Patches adding support for hibernation on ARM
- ARM hibernation / suspend-to-disk
- Change soft_restart to use non-tracing raw_local_irq_disable
Patches based on v3.14-rc7 tag, verified hibernation on beaglebone black on a
branch based on 3.13 merged with initial omap support from Russ Dill which
can be found here (includes v1 patchset):
http://git.linaro.org/git-ro/people/sebastian.capella/linux.git hibernation_3.13_russMerge
[PATCH v9 1/2] ARM: avoid tracers in soft_restart
arch/arm/kernel/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Use raw_local_irq_disable in place of local_irq_disable to avoid
infinite abort recursion while tracing. (unchanged since v3)
[PATCH v9 2/2] ARM hibernation / suspend-to-disk
arch/arm/Kconfig | 5 ++
arch/arm/include/asm/memory.h | 1 +
arch/arm/kernel/Makefile | 1 +
arch/arm/kernel/hibernate.c | 107 +++++++++++++++++++++++++++++++++++++++++
include/linux/suspend.h | 2 +
5 files changed, 116 insertions(+)
Adds support for ARM based hibernation
Additional notes:
-----------------
There are two checkpatch warnings added by this patch. These follow
behavior in existing hibernation implementations on other platforms.
WARNING: externs should be avoided in .c files
#131: FILE: arch/arm/kernel/hibernate.c:25:
+extern const void __nosave_begin, __nosave_end;
This extern is picking up the linker nosave region definitions, only
used in hibernate. Follows same extern line used mips, powerpc, s390,
sh, sparc, x86 & unicore32
WARNING: externs should be avoided in .c files
#209: FILE: arch/arm/kernel/hibernate.c:103:
+ extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
This extern is used in the arch/arm/ in hibernate, process and bL_switcher
Changes in v9:
--------------
* replace pfn calculationwith virt_to_pfn
* automatically allow ARCH_HIBERNATION_POSSIBLE if SUSPEND permitted
* move handling of ARCH config flag to arch/arm/Kconfig
Changes in v8:
--------------
* remove definition and use of __pa_symbol
Changes in v7:
--------------
* remove use of RELOC_HIDE macro
* remove unused #includes
* fixup comment for arch_restore_image
* ensure alignment of resume stack on 8 byte boundary
Changes in v6:
--------------
* Simplify static variable names
Changes in v5:
--------------
* Fixed checkpatch warning on trailing whitespace
Changes in v4:
--------------
* updated comment for soft_restart with review feedback
* dropped freeze_processes patch which was queued separately
to 3.14 by Rafael Wysocki:
https://lkml.org/lkml/2014/2/25/683
Changes in v3:
--------------
* added comment to use of soft_restart
* drop irq disable soft_restart patch
* add patch to avoid tracers in soft_restart by using raw_local_irq_*
Changes in v2:
--------------
* Removed unneeded flush_thread, use of __naked and cpu_init.
* dropped Cyril Chemparathy <cyril(a)ti.com> from Cc: list as
emails are bouncing.
Thanks,
Sebastian Capella