Merge tag 'v3.10.56' into update
This is the 3.10.56 stable release
This commit is contained in:
@@ -1405,6 +1405,11 @@ retry:
|
||||
*/
|
||||
if (ctx->is_active) {
|
||||
raw_spin_unlock_irq(&ctx->lock);
|
||||
/*
|
||||
* Reload the task pointer, it might have been changed by
|
||||
* a concurrent perf_event_context_sched_out().
|
||||
*/
|
||||
task = ctx->task;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
@@ -1836,6 +1841,11 @@ retry:
|
||||
*/
|
||||
if (ctx->is_active) {
|
||||
raw_spin_unlock_irq(&ctx->lock);
|
||||
/*
|
||||
* Reload the task pointer, it might have been changed by
|
||||
* a concurrent perf_event_context_sched_out().
|
||||
*/
|
||||
task = ctx->task;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -1566,14 +1566,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
||||
goto bad_fork_free_pid;
|
||||
}
|
||||
|
||||
if (clone_flags & CLONE_THREAD) {
|
||||
current->signal->nr_threads++;
|
||||
atomic_inc(¤t->signal->live);
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
p->group_leader = current->group_leader;
|
||||
list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
|
||||
}
|
||||
|
||||
if (likely(p->pid)) {
|
||||
ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
|
||||
|
||||
@@ -1591,6 +1583,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
||||
list_add_tail_rcu(&p->tasks, &init_task.tasks);
|
||||
__this_cpu_inc(process_counts);
|
||||
} else {
|
||||
current->signal->nr_threads++;
|
||||
atomic_inc(¤t->signal->live);
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
p->group_leader = current->group_leader;
|
||||
list_add_tail_rcu(&p->thread_group,
|
||||
&p->group_leader->thread_group);
|
||||
list_add_tail_rcu(&p->thread_node,
|
||||
&p->signal->thread_head);
|
||||
}
|
||||
|
||||
+4
-3
@@ -44,11 +44,12 @@ static long kptr_obfuscate(long v, int type)
|
||||
*/
|
||||
static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type)
|
||||
{
|
||||
long ret;
|
||||
long t1, t2;
|
||||
|
||||
ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type);
|
||||
t1 = kptr_obfuscate((long)v1, type);
|
||||
t2 = kptr_obfuscate((long)v2, type);
|
||||
|
||||
return (ret < 0) | ((ret > 0) << 1);
|
||||
return (t1 < t2) | ((t1 > t2) << 1);
|
||||
}
|
||||
|
||||
/* The caller must have pinned the task */
|
||||
|
||||
+11
-10
@@ -319,12 +319,12 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
{
|
||||
char *s = buf;
|
||||
#ifdef CONFIG_SUSPEND
|
||||
int i;
|
||||
suspend_state_t i;
|
||||
|
||||
for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
|
||||
if (pm_states[i].state)
|
||||
s += sprintf(s,"%s ", pm_states[i].label);
|
||||
|
||||
for (i = 0; i < PM_SUSPEND_MAX; i++) {
|
||||
if (pm_states[i] && valid_state(i))
|
||||
s += sprintf(s,"%s ", pm_states[i]);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
s += sprintf(s, "%s\n", "disk");
|
||||
@@ -340,7 +340,7 @@ static suspend_state_t decode_state(const char *buf, size_t n)
|
||||
{
|
||||
#ifdef CONFIG_SUSPEND
|
||||
suspend_state_t state = PM_SUSPEND_MIN;
|
||||
const char * const *s;
|
||||
struct pm_sleep_state *s;
|
||||
#endif
|
||||
char *p;
|
||||
int len;
|
||||
@@ -354,8 +354,9 @@ static suspend_state_t decode_state(const char *buf, size_t n)
|
||||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++)
|
||||
if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
|
||||
return state;
|
||||
if (s->state && len == strlen(s->label)
|
||||
&& !strncmp(buf, s->label, len))
|
||||
return s->state;
|
||||
#endif
|
||||
|
||||
return PM_SUSPEND_ON;
|
||||
@@ -547,8 +548,8 @@ static ssize_t autosleep_show(struct kobject *kobj,
|
||||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
if (state < PM_SUSPEND_MAX)
|
||||
return sprintf(buf, "%s\n", valid_state(state) ?
|
||||
pm_states[state] : "error");
|
||||
return sprintf(buf, "%s\n", pm_states[state].state ?
|
||||
pm_states[state].label : "error");
|
||||
#endif
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
return sprintf(buf, "disk\n");
|
||||
|
||||
@@ -182,21 +182,20 @@ extern void swsusp_show_speed(struct timeval *, struct timeval *,
|
||||
unsigned int, char *);
|
||||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
/* kernel/power/suspend.c */
|
||||
extern const char *const pm_states[];
|
||||
struct pm_sleep_state {
|
||||
const char *label;
|
||||
suspend_state_t state;
|
||||
};
|
||||
|
||||
/* kernel/power/suspend.c */
|
||||
extern struct pm_sleep_state pm_states[];
|
||||
|
||||
extern bool valid_state(suspend_state_t state);
|
||||
extern int suspend_devices_and_enter(suspend_state_t state);
|
||||
//<20130327> <marc.huang> merge from android kernel 3.0 - add enter_state declarition when CONFIG_SUSPEND is defined
|
||||
extern int enter_state(suspend_state_t state);
|
||||
#else /* !CONFIG_SUSPEND */
|
||||
static inline int suspend_devices_and_enter(suspend_state_t state)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
//<20130327> <marc.huang> merge from android kernel 3.0 - add enter_state definition when CONFIG_SUSPEND is undefined
|
||||
static inline int enter_state(suspend_state_t state) { return -ENOSYS; }
|
||||
static inline bool valid_state(suspend_state_t state) { return false; }
|
||||
#endif /* !CONFIG_SUSPEND */
|
||||
|
||||
#ifdef CONFIG_PM_TEST_SUSPEND
|
||||
|
||||
+34
-35
@@ -30,14 +30,13 @@
|
||||
|
||||
#include "power.h"
|
||||
|
||||
const char *const pm_states[PM_SUSPEND_MAX] = {
|
||||
//<20130327> <marc.huang> merge from android kernel 3.0 - add [PM_SUSPEND_ON] into pm_states
|
||||
struct pm_sleep_state pm_states[PM_SUSPEND_MAX] = {
|
||||
#ifdef CONFIG_EARLYSUSPEND
|
||||
[PM_SUSPEND_ON] = "on",
|
||||
[PM_SUSPEND_ON] = { .label = "on", },
|
||||
#endif
|
||||
[PM_SUSPEND_FREEZE] = "freeze",
|
||||
[PM_SUSPEND_STANDBY] = "standby",
|
||||
[PM_SUSPEND_MEM] = "mem",
|
||||
[PM_SUSPEND_FREEZE] = { .label = "freeze", .state = PM_SUSPEND_FREEZE },
|
||||
[PM_SUSPEND_STANDBY] = { .label = "standby", },
|
||||
[PM_SUSPEND_MEM] = { .label = "mem", },
|
||||
};
|
||||
|
||||
static const struct platform_suspend_ops *suspend_ops;
|
||||
@@ -67,42 +66,34 @@ void freeze_wake(void)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(freeze_wake);
|
||||
|
||||
static bool valid_state(suspend_state_t state)
|
||||
{
|
||||
/*
|
||||
* PM_SUSPEND_STANDBY and PM_SUSPEND_MEM states need low level
|
||||
* support and need to be valid to the low level
|
||||
* implementation, no valid callback implies that none are valid.
|
||||
*/
|
||||
return suspend_ops && suspend_ops->valid && suspend_ops->valid(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* suspend_set_ops - Set the global suspend method table.
|
||||
* @ops: Suspend operations to use.
|
||||
*/
|
||||
void suspend_set_ops(const struct platform_suspend_ops *ops)
|
||||
{
|
||||
suspend_state_t i;
|
||||
|
||||
lock_system_sleep();
|
||||
|
||||
suspend_ops = ops;
|
||||
for (i = PM_SUSPEND_STANDBY; i <= PM_SUSPEND_MEM; i++)
|
||||
pm_states[i].state = valid_state(i) ? i : 0;
|
||||
|
||||
unlock_system_sleep();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(suspend_set_ops);
|
||||
|
||||
bool valid_state(suspend_state_t state)
|
||||
{
|
||||
if (state == PM_SUSPEND_FREEZE) {
|
||||
#ifdef CONFIG_PM_DEBUG
|
||||
if (pm_test_level != TEST_NONE &&
|
||||
pm_test_level != TEST_FREEZER &&
|
||||
pm_test_level != TEST_DEVICES &&
|
||||
pm_test_level != TEST_PLATFORM) {
|
||||
printk(KERN_WARNING "Unsupported pm_test mode for "
|
||||
"freeze state, please choose "
|
||||
"none/freezer/devices/platform.\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel
|
||||
* support and need to be valid to the lowlevel
|
||||
* implementation, no valid callback implies that none are valid.
|
||||
*/
|
||||
return suspend_ops && suspend_ops->valid && suspend_ops->valid(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* suspend_valid_only_mem - Generic memory-only valid callback.
|
||||
*
|
||||
@@ -335,9 +326,17 @@ int enter_state(suspend_state_t state)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!valid_state(state))
|
||||
return -ENODEV;
|
||||
|
||||
if (state == PM_SUSPEND_FREEZE) {
|
||||
#ifdef CONFIG_PM_DEBUG
|
||||
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
|
||||
pr_warning("PM: Unsupported test mode for freeze state,"
|
||||
"please choose none/freezer/devices/platform.\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
#endif
|
||||
} else if (!valid_state(state)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!mutex_trylock(&pm_mutex))
|
||||
return -EBUSY;
|
||||
|
||||
@@ -354,7 +353,7 @@ int enter_state(suspend_state_t state)
|
||||
#endif
|
||||
printk("done.\n");
|
||||
|
||||
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
|
||||
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label);
|
||||
error = suspend_prepare(state);
|
||||
if (error)
|
||||
goto Unlock;
|
||||
@@ -362,7 +361,7 @@ int enter_state(suspend_state_t state)
|
||||
if (suspend_test(TEST_FREEZER))
|
||||
goto Finish;
|
||||
|
||||
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
|
||||
pr_debug("PM: Entering %s sleep\n", pm_states[state].label);
|
||||
pm_restrict_gfp_mask();
|
||||
error = suspend_devices_and_enter(state);
|
||||
pm_restore_gfp_mask();
|
||||
|
||||
+11
-13
@@ -92,13 +92,13 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
|
||||
}
|
||||
|
||||
if (state == PM_SUSPEND_MEM) {
|
||||
printk(info_test, pm_states[state]);
|
||||
printk(info_test, pm_states[state].label);
|
||||
status = pm_suspend(state);
|
||||
if (status == -ENODEV)
|
||||
state = PM_SUSPEND_STANDBY;
|
||||
}
|
||||
if (state == PM_SUSPEND_STANDBY) {
|
||||
printk(info_test, pm_states[state]);
|
||||
printk(info_test, pm_states[state].label);
|
||||
status = pm_suspend(state);
|
||||
}
|
||||
if (status < 0)
|
||||
@@ -136,18 +136,16 @@ static char warn_bad_state[] __initdata =
|
||||
|
||||
static int __init setup_test_suspend(char *value)
|
||||
{
|
||||
unsigned i;
|
||||
suspend_state_t i;
|
||||
|
||||
/* "=mem" ==> "mem" */
|
||||
value++;
|
||||
for (i = 0; i < PM_SUSPEND_MAX; i++) {
|
||||
if (!pm_states[i])
|
||||
continue;
|
||||
if (strcmp(pm_states[i], value) != 0)
|
||||
continue;
|
||||
test_state = (__force suspend_state_t) i;
|
||||
return 0;
|
||||
}
|
||||
for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
|
||||
if (!strcmp(pm_states[i].label, value)) {
|
||||
test_state = pm_states[i].state;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk(warn_bad_state, value);
|
||||
return 0;
|
||||
}
|
||||
@@ -164,8 +162,8 @@ static int __init test_suspend(void)
|
||||
/* PM is initialized by now; is that state testable? */
|
||||
if (test_state == PM_SUSPEND_ON)
|
||||
goto done;
|
||||
if (!valid_state(test_state)) {
|
||||
printk(warn_bad_state, pm_states[test_state]);
|
||||
if (!pm_states[test_state].state) {
|
||||
printk(warn_bad_state, pm_states[test_state].label);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
@@ -529,18 +529,26 @@ static enum alarmtimer_type clock2alarm(clockid_t clockid)
|
||||
static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
|
||||
ktime_t now)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct k_itimer *ptr = container_of(alarm, struct k_itimer,
|
||||
it.alarm.alarmtimer);
|
||||
if (posix_timer_event(ptr, 0) != 0)
|
||||
ptr->it_overrun++;
|
||||
enum alarmtimer_restart result = ALARMTIMER_NORESTART;
|
||||
|
||||
spin_lock_irqsave(&ptr->it_lock, flags);
|
||||
if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) {
|
||||
if (posix_timer_event(ptr, 0) != 0)
|
||||
ptr->it_overrun++;
|
||||
}
|
||||
|
||||
/* Re-add periodic timers */
|
||||
if (ptr->it.alarm.interval.tv64) {
|
||||
ptr->it_overrun += alarm_forward(alarm, now,
|
||||
ptr->it.alarm.interval);
|
||||
return ALARMTIMER_RESTART;
|
||||
result = ALARMTIMER_RESTART;
|
||||
}
|
||||
return ALARMTIMER_NORESTART;
|
||||
spin_unlock_irqrestore(&ptr->it_lock, flags);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -635,8 +635,22 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
|
||||
work = &cpu_buffer->irq_work;
|
||||
}
|
||||
|
||||
work->waiters_pending = true;
|
||||
poll_wait(filp, &work->waiters, poll_table);
|
||||
work->waiters_pending = true;
|
||||
/*
|
||||
* There's a tight race between setting the waiters_pending and
|
||||
* checking if the ring buffer is empty. Once the waiters_pending bit
|
||||
* is set, the next event will wake the task up, but we can get stuck
|
||||
* if there's only a single event in.
|
||||
*
|
||||
* FIXME: Ideally, we need a memory barrier on the writer side as well,
|
||||
* but adding a memory barrier to all events will cause too much of a
|
||||
* performance hit in the fast path. We only need a memory barrier when
|
||||
* the buffer goes from empty to having content. But as this race is
|
||||
* extremely small, and it's not a problem if another event comes in, we
|
||||
* will fix it later.
|
||||
*/
|
||||
smp_mb();
|
||||
|
||||
if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) ||
|
||||
(cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu)))
|
||||
|
||||
Reference in New Issue
Block a user