Ampang Defconfig

Signed-off-by: Muhammad Najmi Ahmad Zabidi <najmi.zabidi@gmail.com>
Ampang AOSP v19

Signed-off-by: Muhammad Najmi Ahmad Zabidi <najmi.zabidi@gmail.com>
initial configuration
add basic CFLAGS for Krait
fix compiler string for prerelease compilers
so that kernel version in software information looks okay
and add signature
simplify kernel configuration: first round
also use standard performance (-O2) optimization instead of size
ARM: 7791/1: a.out: remove partial a.out support
a.out support on ARM requires that argc, argv and envp are passed in
r0-r2 respectively, which requires hacking load_aout_binary to
prevent argc being clobbered by the return code. Whilst mainline kernels
do set the registers up in start_thread, the aout loader has never
carried the hack in mainline.

Initialising the registers in this way actually goes against the libc
expectations for ELF binaries, where argc, argv and envp are passed on
the stack, with r0 being used to hold a pointer to an exit function for
cleaning up after the dynamic linker if required. If the pointer is
NULL, then it is ignored. When execing an ELF binary, Linux currently
zeroes r0, then sets it to argc and then finally clobbers it with the
return value of the execve syscall, so we actually end up with:

	r0 = 0
	stack[0] = argc
	r1 = stack[1] = argv
	r2 = stack[2] = envp

libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve
works for user-spawned threads, but when executing an ELF binary from a
kernel thread (via call_usermodehelper), the execve is performed on the
ret_from_fork path, which restores r0 from the saved pt_regs, resulting
in argc being presented to the C library. This has horrible consequences
when the application exits, since we have an exit function registered
using argc, resulting in a jump to hyperspace.

This patch solves the problem by removing the partial a.out support from
arch/arm/ altogether.

Cc: <stable@vger.kernel.org>
Cc: Ashish Sangwan <ashishsangwan2@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

adapted from Linux 3.11-rc4 by mrg666
revert: debug: Make CONFIG_EXPERT select CONFIG_DEBUG_KERNEL to unhide debug options

and also disable DEBUG_KERNEL and several other DEBUG options
Unhide DEBUG_BUGVERBOSE when EXPERT=y, even if DEBUG_KERNEL=n

CONFIG_DEBUG_BUGVERBOSE defaults to y.  Embedded systems might want to
disable this to save space; however, disabling it requires enabling
CONFIG_DEBUG_KERNEL to see it.  Unhide it for CONFIG_EXPERT=y as well,
so it shows up as an option for embedded users without having to turn on
CONFIG_DEBUG_KERNEL.

Also make the option show up if CONFIG_DEBUG_KERNEL=y and
CONFIG_EXPERT=n, which seems sensible for a debug feature.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
To me, it seemed highly counterintuitive to have to enable
CONFIG_DEBUG_KERNEL in order to *disable* debugging features; hence this
patch to expose one of the two that defaults to y.
disable NET_SCHED
FIFO is more than enough on a device used as a smart phone
[v4] binfmt_elf.c: use get_random_int() to fix entropy depleting
Entropy is quickly depleted under normal operations like ls(1), cat(1),
etc...  between 2.6.30 to current mainline, for instance:

$ cat /proc/sys/kernel/random/entropy_avail
3428
$ cat /proc/sys/kernel/random/entropy_avail
2911
$cat /proc/sys/kernel/random/entropy_avail
2620

We observed this problem has been occurring since 2.6.30 with
fs/binfmt_elf.c: create_elf_tables()->get_random_bytes(), introduced by
f06295b44c296c8f ("ELF: implement AT_RANDOM for glibc PRNG seeding").

/*
 * Generate 16 random bytes for userspace PRNG seeding.
 */
get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));

The patch introduces a wrapper around get_random_int() which has lower
overhead than calling get_random_bytes() directly.

With this patch applied:
$ cat /proc/sys/kernel/random/entropy_avail
2731
$ cat /proc/sys/kernel/random/entropy_avail
2802
$ cat /proc/sys/kernel/random/entropy_avail
2878

Analyzed by John Sobecki.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <aedilger@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnn@arndb.de>
Cc: John Sobecki <john.sobecki@oracle.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Ulrich Drepper <drepper@redhat.com>
disable DEBUG in Prima WiFi driver
what a messy code! ... Why did you guys bother defining a DEBUG build
parameter if you were going to hardcode debugging in the end? Sheesh!

I think the WiFi driver is working with these changes saving ~200K in
compressed kernel size.
--mrg666

Conflicts:

	drivers/staging/prima/Kbuild
autogroup sched: per-uid task group for android
and enable autogroup scheduler

Thanks to Andrea Righi
http://arighi.blogspot.com/2011/01/android-automated-per-uid-task-group.html

Conflicts:

	kernel/sys.c
workqueue: cond_resched() after processing each work item
commit b22ce27 upstream.

If !PREEMPT, a kworker running work items back to back can hog CPU.
This becomes dangerous when a self-requeueing work item which is
waiting for something to happen races against stop_machine.  Such
self-requeueing work item would requeue itself indefinitely hogging
the kworker and CPU it's running on while stop_machine would wait for
that CPU to enter stop_machine while preventing anything else from
happening on all other CPUs.  The two would deadlock.

Jamie Liu reports that this deadlock scenario exists around
scsi_requeue_run_queue() and libata port multiplier support, where one
port may exclude command processing from other ports.  With the right
timing, scsi_requeue_run_queue() can end up requeueing itself trying
to execute an IO which is asked to be retried while another device has
an exclusive access, which in turn can't make forward progress due to
stop_machine.

Fix it by invoking cond_resched() after executing each work item.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Jamie Liu <jamieliu@google.com>
References: http://thread.gmane.org/gmane.linux.kernel/1552567
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
enable ROW scheduler as default and disable CFQ
cpufreq: interactive: port latest from common/android-3.4
remove MSM_RUN_QUEUE_STATS
this is not necessary since user-space msm_mpdecision will not be used
disable MSM-DCVS
this is not needed since msm_mpdecision will be replaced
add kernel-based msm_autosmp.c
bring msm_mpdecision.c from my shooter kernel, renamed as msm_autosmp.c
to avoid confusing with msm_mpdecision.c in the original source,
also modified for quad-core cpu
enable MSM_ASMP and set CPU_FREQ_DEFAULT_GOV_INTERACTIVE