Commit Graph

16455 Commits

Author SHA1 Message Date
Jony.Qiu
f4a9049a56 optee : optee linux build to .ko depend on function(sched_setaffinity)
Signed-off-by: Jony.Qiu <jony.qiu@rock-chips.com>
2015-06-15 16:04:58 +08:00
Huang, Tao
ceaeb4796f add support show process information on printks
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2015-06-03 17:40:01 +08:00
Huang, Tao
e82146650e Merge branch android-common-3.10 2015-06-02 11:25:51 +08:00
Huang, Tao
3ca9efa2f8 Merge tag 'lsk-v3.10-15.05-android' into develop-3.10 2015-06-02 11:25:34 +08:00
Alex Shi
f5b00d0746 Merge branch 'linux-linaro-lsk-v3.10' into linux-linaro-lsk-v3.10-android 2015-05-21 10:02:28 +08:00
Alex Shi
baf41996d8 Merge tag 'v3.10.79' into linux-linaro-lsk-v3.10
This is the 3.10.79 stable release
2015-05-21 10:02:25 +08:00
Ruchi Kandoi
6e9c658237 suspend: Return error when pending wakeup source is found.
If a wakeup source is found to be pending in the last stage of suspend
after syscore suspend then the device doesn't suspend but the error is
not propogated which causes an error in the accounting for the number
of suspend aborts and successful suspends.

Change-Id: Ib63b4ead755127eaf03e3b303aab3c782ad02ed1
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2015-05-18 16:57:19 +00:00
Huang, Tao
55c23da59b rockchip: hmp: adjust hmp_up/down_threshold
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2015-05-18 17:25:12 +08:00
Huang, Tao
0c1b12d1c3 cpuquiet: Update averaging of nr_runnables
Doing a Exponential moving average per nr_running++/-- does not
guarantee a fixed sample rate which induces errors if there are lots of
threads being enqueued/dequeued from the rq (Linpack mt). Instead of
keeping track of the avg, the scheduler now keeps track of the integral
of nr_running and allows the readers to perform filtering on top.

Implemented a proper exponential moving average for the runnables
governor and a straight 100ms average for the balanced governor. Tweaked
the thresholds for the runnables governor to minimize latency. Also,
decreased sample_rate for the runnables governor to the absolute minimum
of 10msecs.

Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2015-05-18 17:17:28 +08:00
Huang, Tao
e615617818 cpuquiet: PM QoS: Add max/min online cpus as PM QoS parameter
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2015-05-18 17:08:55 +08:00
Christoph Hellwig
5a4d93f39c revert "softirq: Add support for triggering softirq work on softirqs"
commit fc21c0cff2 upstream.

This commit was incomplete in that code to remove items from the per-cpu
lists was missing and never acquired a user in the 5 years it has been in
the tree.  We're going to implement what it seems to try to archive in a
simpler way, and this code is in the way of doing so.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pan Xinhui <xinhuix.pan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-17 09:51:33 -07:00
Alex Shi
54db03197e Merge branch 'linux-linaro-lsk-v3.10' into linux-linaro-lsk-v3.10-android 2015-05-12 15:18:24 +08:00
Alex Shi
1f8fdf83fe Merge remote-tracking branch 'origin/v3.10/topic/zram' into linux-linaro-lsk
Conflicts:
	mm/Kconfig
	mm/Makefile
2015-05-12 14:55:30 +08:00
Alex Shi
8134585f1c Merge tag 'v3.10.77' into linux-linaro-lsk
This is the 3.10.77 stable release

 Conflicts:
	drivers/video/console/Kconfig
	scripts/kconfig/menu.c
2015-05-12 14:53:40 +08:00
Srivatsa S. Bhat
30e87174bf CPU hotplug: Provide lockless versions of callback registration functions
The following method of CPU hotplug callback registration is not safe
due to the possibility of an ABBA deadlock involving the cpu_add_remove_lock
and the cpu_hotplug.lock.

	get_online_cpus();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	register_cpu_notifier(&foobar_cpu_notifier);

	put_online_cpus();

The deadlock is shown below:

          CPU 0                                         CPU 1
          -----                                         -----

   Acquire cpu_hotplug.lock
   [via get_online_cpus()]

                                              CPU online/offline operation
                                              takes cpu_add_remove_lock
                                              [via cpu_maps_update_begin()]

   Try to acquire
   cpu_add_remove_lock
   [via register_cpu_notifier()]

                                              CPU online/offline operation
                                              tries to acquire cpu_hotplug.lock
                                              [via cpu_hotplug_begin()]

                            *** DEADLOCK! ***

The problem here is that callback registration takes the locks in one order
whereas the CPU hotplug operations take the same locks in the opposite order.
To avoid this issue and to provide a race-free method to register CPU hotplug
callbacks (along with initialization of already online CPUs), introduce new
variants of the callback registration APIs that simply register the callbacks
without holding the cpu_add_remove_lock during the registration. That way,
we can avoid the ABBA scenario. However, we will need to hold the
cpu_add_remove_lock throughout the entire critical section, to protect updates
to the callback/notifier chain.

This can be achieved by writing the callback registration code as follows:

	cpu_maps_update_begin(); [ or cpu_notifier_register_begin(); see below ]

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	/* This doesn't take the cpu_add_remove_lock */
	__register_cpu_notifier(&foobar_cpu_notifier);

	cpu_maps_update_done();  [ or cpu_notifier_register_done(); see below ]

Note that we can't use get_online_cpus() here instead of cpu_maps_update_begin()
because the cpu_hotplug.lock is dropped during the invocation of CPU_POST_DEAD
notifiers, and hence get_online_cpus() cannot provide the necessary
synchronization to protect the callback/notifier chains against concurrent
reads and writes. On the other hand, since the cpu_add_remove_lock protects
the entire hotplug operation (including CPU_POST_DEAD), we can use
cpu_maps_update_begin/done() to guarantee proper synchronization.

Also, since cpu_maps_update_begin/done() is like a super-set of
get/put_online_cpus(), the former naturally protects the critical sections
from concurrent hotplug operations.

Since the names cpu_maps_update_begin/done() don't make much sense in CPU
hotplug callback registration scenarios, we'll introduce new APIs named
cpu_notifier_register_begin/done() and map them to cpu_maps_update_begin/done().

In summary, introduce the lockless variants of un/register_cpu_notifier() and
also export the cpu_notifier_register_begin/done() APIs for use by modules.
This way, we provide a race-free way to register hotplug callbacks as well as
perform initialization for the CPUs that are already online.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 93ae4f978c)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-05-11 20:40:31 +08:00
Calvin Owens
61ea92b948 ksoftirqd: Enable IRQs and call cond_resched() before poking RCU
commit 28423ad283 upstream.

While debugging an issue with excessive softirq usage, I encountered the
following note in commit 3e339b5dae ("softirq: Use hotplug thread
infrastructure"):

    [ paulmck: Call rcu_note_context_switch() with interrupts enabled. ]

...but despite this note, the patch still calls RCU with IRQs disabled.

This seemingly innocuous change caused a significant regression in softirq
CPU usage on the sending side of a large TCP transfer (~1 GB/s): when
introducing 0.01% packet loss, the softirq usage would jump to around 25%,
spiking as high as 50%. Before the change, the usage would never exceed 5%.

Moving the call to rcu_note_context_switch() after the cond_sched() call,
as it was originally before the hotplug patch, completely eliminated this
problem.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06 21:56:27 +02:00
Oleg Nesterov
ddb56eac0e ptrace: fix race between ptrace_resume() and wait_task_stopped()
commit b72c186999 upstream.

ptrace_resume() is called when the tracee is still __TASK_TRACED.  We set
tracee->exit_code and then wake_up_state() changes tracee->state.  If the
tracer's sub-thread does wait() in between, task_stopped_code(ptrace => T)
wrongly looks like another report from tracee.

This confuses debugger, and since wait_task_stopped() clears ->exit_code
the tracee can miss a signal.

Test-case:

	#include <stdio.h>
	#include <unistd.h>
	#include <sys/wait.h>
	#include <sys/ptrace.h>
	#include <pthread.h>
	#include <assert.h>

	int pid;

	void *waiter(void *arg)
	{
		int stat;

		for (;;) {
			assert(pid == wait(&stat));
			assert(WIFSTOPPED(stat));
			if (WSTOPSIG(stat) == SIGHUP)
				continue;

			assert(WSTOPSIG(stat) == SIGCONT);
			printf("ERR! extra/wrong report:%x\n", stat);
		}
	}

	int main(void)
	{
		pthread_t thread;

		pid = fork();
		if (!pid) {
			assert(ptrace(PTRACE_TRACEME, 0,0,0) == 0);
			for (;;)
				kill(getpid(), SIGHUP);
		}

		assert(pthread_create(&thread, NULL, waiter, NULL) == 0);

		for (;;)
			ptrace(PTRACE_CONT, pid, 0, SIGCONT);

		return 0;
	}

Note for stable: the bug is very old, but without 9899d11f65 "ptrace:
ensure arch_ptrace/ptrace_request can never race with SIGKILL" the fix
should use lock_task_sighand(child).

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Pavel Labath <labath@google.com>
Tested-by: Pavel Labath <labath@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06 21:56:24 +02:00
Steven Rostedt
faf8db2e22 ring-buffer: Replace this_cpu_*() with __this_cpu_*()
commit 80a9b64e2c upstream.

It has come to my attention that this_cpu_read/write are horrible on
architectures other than x86. Worse yet, they actually disable
preemption or interrupts! This caused some unexpected tracing results
on ARM.

   101.356868: preempt_count_add <-ring_buffer_lock_reserve
   101.356870: preempt_count_sub <-ring_buffer_lock_reserve

The ring_buffer_lock_reserve has recursion protection that requires
accessing a per cpu variable. But since preempt_disable() is traced, it
too got traced while accessing the variable that is suppose to prevent
recursion like this.

The generic version of this_cpu_read() and write() are:

 #define this_cpu_generic_read(pcp)					\
 ({	typeof(pcp) ret__;						\
	preempt_disable();						\
	ret__ = *this_cpu_ptr(&(pcp));					\
	preempt_enable();						\
	ret__;								\
 })

 #define this_cpu_generic_to_op(pcp, val, op)				\
 do {									\
	unsigned long flags;						\
	raw_local_irq_save(flags);					\
	*__this_cpu_ptr(&(pcp)) op val;					\
	raw_local_irq_restore(flags);					\
 } while (0)

Which is unacceptable for locations that know they are within preempt
disabled or interrupt disabled locations.

Paul McKenney stated that __this_cpu_() versions produce much better code on
other architectures than this_cpu_() does, if we know that the call is done in
a preempt disabled location.

I also changed the recursive_unlock() to use two local variables instead
of accessing the per_cpu variable twice.

Link: http://lkml.kernel.org/r/20150317114411.GE3589@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/20150317104038.312e73d1@gandalf.local.home

Acked-by: Christoph Lameter <cl@linux.com>
Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06 21:56:21 +02:00
Huang, Tao
f07d7eb591 Merge tag 'lsk-v3.10-15.04-android'
Conflicts:
	drivers/base/cpu.c
	drivers/misc/Kconfig
	drivers/misc/Makefile
2015-05-05 10:51:31 +08:00
Al Viro
6637ecd306 move d_rcu from overlapping d_child to overlapping d_alias
commit 946e51f2bf upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Ben Hutchings <ben@decadent.org.uk>
[hujianyang: Backported to 3.10 refer to the work of Ben Hutchings in 3.2:
 - Apply name changes in all the different places we use d_alias and d_child
 - Move the WARN_ON() in __d_free() to d_free() as we don't have dentry_free()]
Signed-off-by: hujianyang <hujianyang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:34:00 +02:00
Peter Hurley
391f1c610a console: Fix console name size mismatch
commit 30a22c215a upstream.

commit 6ae9200f2c ("enlarge console.name") increased the storage
for the console name to 16 bytes, but not the corresponding
struct console_cmdline::name storage. Console names longer than
8 bytes cause read beyond end-of-string and failure to match
console; I'm not sure if there are other unexpected consequences.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-19 10:10:51 +02:00
Alex Shi
d78c0d2e46 Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android 2015-04-18 13:37:44 +08:00
Alex Shi
0bde84f402 Merge branch 'linux-3.10.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-linaro-lsk 2015-04-18 13:36:38 +08:00
Alex Shi
26fb95cac5 Merge branch 'linaro-android-3.10-lsk' of git://android.git.linaro.org/kernel/linaro-android into linux-linaro-lsk-android
Remove conflictsed drivers/staging/android/logger.c
2015-04-17 13:40:43 +08:00
Amit Pundir
5b59692ae6 Merge branch 'android-3.10' of https://android.googlesource.com/kernel/common
* android-3.10: (23 commits)
  proc: uid_cputime: create uids from kuids
  wakeup: Add last wake up source logging for suspend abort reason.
  selinux: add SOCK_DIAG_BY_FAMILY to the list of netlink message types
  selinux/nlmsg: add XFRM_MSG_MAPPING
  selinux/nlmsg: add XFRM_MSG_MIGRATE
  selinux/nlmsg: add XFRM_MSG_REPORT
  selinux/nlmsg: add XFRM_MSG_[NEW|GET]SADINFO
  selinux/nlmsg: add XFRM_MSG_GETSPDINFO
  selinux/nlmsg: add XFRM_MSG_NEWSPDINFO
  SELinux: per-command whitelisting of ioctls
  security: lsm_audit: add ioctl specific auditing
  Power: Report suspend times from last_suspend_time
  arm: crypto: Add optimized SHA-256/224
  proc: uid: Adds accounting for the cputimes per uid.
  USB: gadget: android: Integrate f_midi USB MIDI gadget driver part deux
  android: base-cfg: disable ALARM_DEV
  staging: Remove logger and alarm-dev from android Makefile
  staging: Remove the Android alarm-dev driver
  staging: Remove the Android logger driver
  net: ping: fix constness inconsistency in ipv6_chk_addr
  ...
2015-04-16 13:34:01 +05:30