Hi Rafael/Daniel,
This is a small cleanup patchset for CPUIdle which can go in 3.13 if it looks
okay to you guys..
Mostly trivial patches but few are doing good/significant changes. Tested on my
thinkpad with suspend/resume and didn't found any broken stuff with it.
I a not very sure about this patch (As I don't know about all aspects of CPUIdle
framework):
cpuidle: don't call poll_idle_init() for every cpu
--
viresh
Viresh Kumar (21):
cpuidle: fix indentation of cpumask
cpuidle: Fix comments in cpuidle core
cpuidle: make __cpuidle_get_cpu_driver() inline
cpuidle: make __cpuidle_device_init() return void
cpuidle: make __cpuidle_driver_init() return void
cpuidle: rearrange code in __cpuidle_driver_init()
cpuidle: rearrange __cpuidle_register_device() to keep minimal exit
points
cpuidle: use cpuidle_disabled() instead of "off"
cpuidle: merge two if() statements for checking error cases
cpuidle: reduce code duplication inside cpuidle_idle_call()
cpuidle: replace multiline statements with single line in
cpuidle_idle_call()
cpuidle: call cpuidle_get_driver() from after taking
cpuidle_driver_lock
cpuidle: use drv instead of cpuidle_driver in show_current_driver()
cpuidle: coupled: don't compare cpu masks unnecessarily
cpuidle: free all state kobjects from cpuidle_free_state_kobj()
cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_device_kobj
cpuidle: avoid unnecessary kzalloc/free of struct cpuidle_driver_kobj
cpuidle: don't call poll_idle_init() for every cpu
cpuidle: create list of registered drivers
cpuidle: don't calculate time-diff if entered_state == 0
cpuidle: change governor from within cpuidle_replace_governor()
drivers/cpuidle/coupled.c | 9 +--
drivers/cpuidle/cpuidle.c | 95 +++++++------------------
drivers/cpuidle/driver.c | 171 ++++++++++++++++++++-------------------------
drivers/cpuidle/governor.c | 24 +++----
drivers/cpuidle/sysfs.c | 74 +++++++-------------
include/linux/cpuidle.h | 25 +++++--
6 files changed, 161 insertions(+), 237 deletions(-)
--
1.7.12.rc2.18.g61b472e
It will be very useful for user space (QEMU/KVMTOOL) if it has a
method of querying VCPU target type matching to underlying Host.
We can use such querying mechanism and implement machine models
in user space where VCPU target type is always same-as/similar-to
underlying Host (i.e. Target CPU=Host).
This patch series implements KVM_ARM_PREFERRED_TARGET vm ioclt for
querying VCPU target type matching underlying host. Using this new
ioctl we can implement VCPU target CPU=Host in user space.
Also, it is not mandatory to call KVM_ARM_PREFERRED_TARGET vm ioctl
and the old method of trying all possible target types using the
KVM_ARM_VCPU_INIT ioctl to initialize VCPU works fine.
V5:
- Update documentation based on review comments
V4:
- Fixed files exchanged between patches
- For now return zeroed features in struct kvm_vcpu_init instance
V3:
- Return -ENODEV if no preferred target available for host
- Make KVM_ARM_PREFERRED_TARGET ioctl as vm ioctl
V2:
- Renamed the ioclt to KVM_ARM_PREFERRED_TARGET
- Return struct kvm_vcpu_init instace instead of just target type
V1:
- Initial patch-set with ioctl named as KVM_ARM_SUITABLE_TARGET
Anup Patel (4):
ARM: KVM: Implement kvm_vcpu_preferred_target() function
ARM64: KVM: Implement kvm_vcpu_preferred_target() function
ARM/ARM64: KVM: Implement KVM_ARM_PREFERRED_TARGET ioctl
KVM: Add documentation for KVM_ARM_PREFERRED_TARGET ioctl
Documentation/virtual/kvm/api.txt | 31 +++++++++++++++++++++++++++----
arch/arm/include/asm/kvm_host.h | 1 +
arch/arm/kvm/arm.c | 13 +++++++++++++
arch/arm/kvm/guest.c | 20 ++++++++++++++++++++
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/kvm/guest.c | 20 ++++++++++++++++++++
include/uapi/linux/kvm.h | 1 +
7 files changed, 83 insertions(+), 4 deletions(-)
--
1.7.9.5
In ftrace_syscall_enter(),
syscall_get_arguments(..., 0, n, ...)
if (i == 0) { <handle orig_x0> ...; n--;}
memcpy(..., n * sizeof(args[0]));
If 'number of arguments(n)' is zero and 'argument index(i)' is also zero in
syscall_get_arguments(), none of arguments should be copied by memcpy().
Otherwise 'n--' can be a big positive number and unexpected amount of data
will be copied. Tracing system calls which take no argument, say sync(void),
may hit this case and eventually make the system corrupted.
This patch fixes the issue both in syscall_get_arguments() and
syscall_set_arguments().
Please note, however, that asm-generic/syscall.h says,
* syscall_get_arguments - extract system call parameter values
* @i: argument index [0,5]
* @n: number of arguments; n+i must be [1,6].
and so we'd better change the caller's code(ftrace_syscall_enter).
Signed-off-by: AKASHI Takahiro <takahiro.akashi(a)linaro.org>
---
arch/arm64/include/asm/syscall.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index c89821f..01bb8cc 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -63,6 +63,9 @@ static inline void syscall_get_arguments(struct task_struct *task,
unsigned int i, unsigned int n,
unsigned long *args)
{
+ if (n == 0)
+ return;
+
if (i + n > SYSCALL_MAX_ARGS) {
unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
@@ -86,6 +89,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
unsigned int i, unsigned int n,
const unsigned long *args)
{
+ if (n == 0)
+ return;
+
if (i + n > SYSCALL_MAX_ARGS) {
pr_warning("%s called with max args %d, handling only %d\n",
__func__, i + n, SYSCALL_MAX_ARGS);
--
1.7.9.5
The sleep_length is computed in the tick_nohz_stop_sched_tick function but it
is used later in the code with in between the local irq enabled.
cpu_idle_loop
tick_nohz_idle_enter [ exits with local irq enabled ]
__tick_nohz_idle_enter
tick_nohz_stop_sched_tick
...
arch_cpu_idle
menu_select [ uses here 'sleep_length' ]
...
Between the computation of the sleep length and its usage, some interrupts
can occur, making the sleep length shorter than actually it is.
This patch fixes that by moving the sleep_length computation in the
tick_nohz_get_sleep_length function and store the next_event for the device
instead of the sleep_length.
Signed-off-by: Daniel Lezcano <daniel.lezcano(a)linaro.org>
---
include/linux/tick.h | 2 +-
kernel/time/tick-sched.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 5128d33..4932004 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -67,7 +67,7 @@ struct tick_sched {
ktime_t idle_exittime;
ktime_t idle_sleeptime;
ktime_t iowait_sleeptime;
- ktime_t sleep_length;
+ ktime_t next_event;
unsigned long last_jiffies;
unsigned long next_jiffies;
ktime_t idle_expires;
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3612fc7..2007a7f 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -673,7 +673,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
out:
ts->next_jiffies = next_jiffies;
ts->last_jiffies = last_jiffies;
- ts->sleep_length = ktime_sub(dev->next_event, now);
+ ts->next_event = dev->next_event;
return ret;
}
@@ -837,8 +837,9 @@ void tick_nohz_irq_exit(void)
ktime_t tick_nohz_get_sleep_length(void)
{
struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
+ ktime_t now = ktime_get();
- return ts->sleep_length;
+ return ktime_sub(ts->next_event, now);
}
static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
--
1.7.9.5