random: backport updates from Linux master (3.13-rc4)
lib, net: make isodigit() public and use it	Andy Shevchenko
random: add debugging code to detect early use of get_random_bytes()	Theodore Ts'o
random: initialize the last_time field in struct timer_rand_state	Theodore Ts'o
random: don't zap entropy count in rand_initialize()	Theodore Ts'o
random: printk notifications for urandom pool initialization	Theodore Ts'o
random: make add_timer_randomness() fill the nonblocking pool first	Theodore Ts'o
random: convert DEBUG_ENT to tracepoints	Theodore Ts'o
random: push extra entropy to the output pools	Theodore Ts'o
random: drop trickle mode	Theodore Ts'o
random: adjust the generator polynomials in the mixing function slightly	Theodore Ts'o
random: speed up the fast_mix function by a factor of four	Theodore Ts'o
random: cap the rate which the /dev/urandom pool gets reseeded	Theodore Ts'o
random: optimize the entropy_store structure	Theodore Ts'o
random: optimize spinlock use in add_device_randomness()	Theodore Ts'o
random: fix the tracepoint for get_random_bytes(_arch)	Theodore Ts'o
random: account for entropy loss due to overwrites	H. Peter Anvin
random: allow fractional bits to be tracked	H. Peter Anvin
random: statically compute poolbitshift, poolbytes, poolbits	H. Peter Anvin
random: mix in architectural randomness earlier in extract_buf()	Theodore Ts'o
random: allow architectures to optionally define random_get_entropy()	Theodore Ts'o
random: run random_int_secret_init() run after all late_initcalls	Theodore Ts'o
char: Convert use of typedef ctl_table to struct ctl_table	Joe Perches	1
random: fix accounting race condition with lockless irq entropy_count update	Jiri Kosina
drivers/char/random.c: fix priming of last_data	Jarod Wilson
lib/string_helpers: introduce generic string_unescape	Andy Shevchenko
random: fix locking dependency with the tasklist_lock	Theodore Ts'o
locking: Various static lock initializer fixes	Thomas Gleixner
random: prime last_data value per fips requirements	Jarod Wilson
random: fix debug format strings	Jiri Kosina
random: make it possible to enable debugging without rebuild	Jiri Kosina
random: mix in architectural randomness in extract_buf()	H. Peter Anvin
random: Add comment to random_initialize()	Tony Luck
random: add tracepoints for easier debugging and verification	Theodore Ts'o
[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>
workqueue: backport from Linux 3.6.11
to get the following patches by Tejun Heo that improves the latency of cpu
hotplug events.
workqueue: simplify CPU hotplug code
workqueue: remove CPU offline trustee
workqueue: don't butcher idle workers on an offline CPU
workqueue: reimplement CPU online rebinding to handle idle workers
https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/Hotplug#Workqueue
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>