firefly-linux-kernel-4.4.55.git
11 years agocpufreq: Interactive: Implement per policy instances of governor
Viresh Kumar [Thu, 16 May 2013 09:28:54 +0000 (14:58 +0530)]
cpufreq: Interactive: Implement per policy instances of governor

If we have a multi-package system, where we have multiple instances of struct
policy (per package), currently we can't have multiple instances of same
governor. i.e. We can't have multiple instances of Interactive governor for
multiple packages.

This is a bottleneck for multicluster system, where we want different packages
to use Interactive governor, but with different tunables.

This patch uses the infrastructure provided by earlier patches pushed in
Mainline in v3.10-rc1/rc2 and implements per policy instances of Interactive
governor.

Change-Id: I70436d4a5a45c6cb6edf37f3e46d0b9fbc930982
[toddpoynor@google.com: merge with later code, minor changes]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
11 years agocpufreq: interactive: Move definition of cpufreq_gov_interactive downwards
Viresh Kumar [Thu, 16 May 2013 09:28:53 +0000 (14:58 +0530)]
cpufreq: interactive: Move definition of cpufreq_gov_interactive downwards

This moves definition of cpufreq_gov_interactive towards the bottom of file, so
that we don't have to add prototype of cpufreq_governor_interactive() in the
beginning of file.

Change-Id: I04bd1004954eb36502c5cd7e35d3d7274cddaf95
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
11 years agocpufreq: interactive: Remove unnecessary cpu_online() check
Viresh Kumar [Thu, 16 May 2013 09:28:52 +0000 (14:58 +0530)]
cpufreq: interactive: Remove unnecessary cpu_online() check

Cpufreq no longer calls governor callback for offlined cpus. i.e. All
policy->cpus are guaranteed to be online. Hence we don't need explicit check to
see if cpu is online or not.

Change-Id: I9ad85ea4addd5b4a40952e59ed730dd15e328690
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
11 years agosync: signal pt before sync_timeline object gets destroyed
Prakash Kamliya [Fri, 4 Oct 2013 12:20:50 +0000 (17:50 +0530)]
sync: signal pt before sync_timeline object gets destroyed

There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline->kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
  -> (some function calls)
   -> sync_timeline_destory()
    -> sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
> sync_fence_release() -> because of fclose() on fence object
 -> sync_fence_free()
  -> sync_pt_free()
   -> kref_put(&pt->parent->kref, sync_timeline_free);
    -> sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Change-Id: Ic680e4d0bbef1c46bcb7cfba693395645241d203
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
11 years agomm: remove compressed copy from zram in-memory
Minchan Kim [Wed, 3 Jul 2013 22:01:24 +0000 (15:01 -0700)]
mm: remove compressed copy from zram in-memory

Swap subsystem does lazy swap slot free with expecting the page would be
swapped out again so we can avoid unnecessary write.

But the problem in in-memory swap(ex, zram) is that it consumes memory
space until vm_swap_full(ie, used half of all of swap device) condition
meet.  It could be bad if we use multiple swap device, small in-memory
swap and big storage swap or in-memory swap alone.

This patch makes swap subsystem free swap slot as soon as swap-read is
completed and make the swapcache page dirty so the page should be
written out the swap device to reclaim it.  It means we never lose it.

I tested this patch with kernel compile workload.

1. before

   compile time : 9882.42
   zram max wasted space by fragmentation: 13471881 byte
   memory space consumed by zram: 174227456 byte
   the number of slot free notify: 206684

2. after

   compile time : 9653.90
   zram max wasted space by fragmentation: 11805932 byte
   memory space consumed by zram: 154001408 byte
   the number of slot free notify: 426972

[akpm@linux-foundation.org: tweak comment text]
[artem.savkov@gmail.com: fix BUG due to non-swapcache pages in end_swap_bio_read()]
[akpm@linux-foundation.org: invert unlikely() test, augment comment, 80-col cleanup]
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoAdd compat_ioctl support for VFAT_IOCTL_GET_VOLUME_ID
Bintian Wang [Sun, 30 Jun 2013 12:34:24 +0000 (20:34 +0800)]
Add compat_ioctl support for VFAT_IOCTL_GET_VOLUME_ID

Add VFAT_IOCTL_GET_VOLUME_ID to vfat dir compat_ioctl() interface,
which enable you read vfat volume ID from a 32bit app on a 64bit
kernel

Change-Id: I3e93dfcc1e7a364a6b11bc7e3f5f210e82f306ed
Signed-off-by: Bintian Wang <bintian.wang@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agoUSB: remove duplicate out endpoint creation in MTP mode
Peter Oh [Thu, 12 Sep 2013 01:42:18 +0000 (01:42 +0000)]
USB: remove duplicate out endpoint creation in MTP mode

Android MTP gadget uses 3 endpoints which are 1 in endpoint,
1 out endpoint, and 1 interrupt endpoint. However when MTP
gadget creates its endpoints, it creates the out endpoint twice
and overwrites the first created out endpoint with the second one,
so that it causes a leak of endpoint resources.

Change-Id: Iba82950095610b26b362f4b10a67cedfb1fee366
Signed-off-by: Peter Oh <poh@broadcom.com>
Reviewed-on: http://mps-gerrit.broadcom.com/37744
Reviewed-by: Graham Williams <gwilli@broadcom.com>
Reviewed-by: John Garry <jgarry@broadcom.com>
Branch-Open: Branch Status <branch_status_noreply@broadcom.com>
Reviewed-by: Checkpatch Status <checkpatch_status_noreply@broadcom.com>
Reviewed-by: Joyjit Nath <joyjit@broadcom.com>
Tested-by: AutoSubmit Status <autosubmit_status_noreply@broadcom.com>
11 years agocpufreq: interactive: fix show_target_loads and show_above_hispeed_delay
Minsung Kim [Sun, 25 Aug 2013 10:23:34 +0000 (19:23 +0900)]
cpufreq: interactive: fix show_target_loads and show_above_hispeed_delay

Remove a trailing whitespace from target_loads and above_hispeed_delay. Problem
happens when user-space program tried to restore parameters that saved before
changing parameters. In this case was returned error(EINVAL).

Change-Id: I5a74e3824602cd6f2b74651adda5ec1b627e61e9
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
11 years agoion: don't use id 0 for handle cookie
Colin Cross [Fri, 23 Aug 2013 02:29:44 +0000 (19:29 -0700)]
ion: don't use id 0 for handle cookie

ion userspace clients think that the cookie is a pointer, so they
use NULL to check if the handle has been initialized.  Set the first
id number to 1.

Change-Id: Ifb9af6029a8b08f57e41bc6160cc11e11001a2a9
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: index client->handles rbtree by buffer
Colin Cross [Wed, 21 Aug 2013 18:23:12 +0000 (11:23 -0700)]
ion: index client->handles rbtree by buffer

The only remaining users of the client->handles rbtree are
iterating through it like a list.  Keep the rbtree, but change
its index to be the buffer address instead of the handle address,
which makes ion_handle_lookup a fast rbtree search.

Change-Id: Ie7d974b3a5d9831c0d664de85ddae8db3c3abdf9
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: replace userspace handle cookies with idr
Colin Cross [Wed, 21 Aug 2013 05:59:41 +0000 (22:59 -0700)]
ion: replace userspace handle cookies with idr

Userspace handles should not leak kernel virtual addresses to
userspace.  They have to be validated by looking them up in an
rbtree anyways, so replace them with an idr and validate them
by using idr_find to convert the id number to the struct
ion_handle pointer.

Change-Id: Iab5667ba6f3a73256fec3949b23a9a6f8e14a283
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: remove IS_ERR_OR_NULL
Colin Cross [Wed, 21 Aug 2013 04:31:34 +0000 (21:31 -0700)]
ion: remove IS_ERR_OR_NULL

IS_ERR_OR_NULL is often part of a bad pattern that can accidentally
return 0 on error:
if (IS_ERR_OR_NULL(ptr))
    return PTR_ERR(ptr);

It also usually means that the errors of a function are not well
defined.  Replace all uses in ion.c by ensure that the return
type of any function in ion is an ERR_PTR.

Specify that the expected return value from map_kernel or map_dma
heap ops is ERR_PTR, and warn if a heap returns NULL.

Change-Id: I6e7ea0d2e62fa08d4e372a7ef6da649f7a62289c
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: convert map_kernel to return ERR_PTR
Colin Cross [Wed, 21 Aug 2013 19:50:37 +0000 (12:50 -0700)]
ion: convert map_kernel to return ERR_PTR

ion is going to stop accepting NULL as an error value, use ERR_PTR.

Change-Id: I030e8b72138904e38a4a5d225beaaa98427651fb
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: add free list size to heap debug files
Colin Cross [Wed, 14 Aug 2013 21:10:19 +0000 (14:10 -0700)]
ion: add free list size to heap debug files

Change-Id: I3c6309afdbd661a2f870fd1ba3fea9543e229882
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoion: chunk_heap: fix leak in allocated counter
Colin Cross [Wed, 14 Aug 2013 21:03:55 +0000 (14:03 -0700)]
ion: chunk_heap: fix leak in allocated counter

buffer->size is controlled by the outer ion layer, don't modify it
inside the heap.  Instead, compute the rounded up allocated size
on demand.

Change-Id: I288ffc1221ce96cfe2591468502ac3279065bde4
Signed-off-by: Colin Cross <ccross@android.com>
11 years agomm: add a field to store names for private anonymous memory
Colin Cross [Thu, 27 Jun 2013 00:26:01 +0000 (17:26 -0700)]
mm: add a field to store names for private anonymous memory

Userspace processes often have multiple allocators that each do
anonymous mmaps to get memory.  When examining memory usage of
individual processes or systems as a whole, it is useful to be
able to break down the various heaps that were allocated by
each layer and examine their size, RSS, and physical memory
usage.

This patch adds a user pointer to the shared union in
vm_area_struct that points to a null terminated string inside
the user process containing a name for the vma.  vmas that
point to the same address will be merged, but vmas that
point to equivalent strings at different addresses will
not be merged.

Userspace can set the name for a region of memory by calling
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);
Setting the name to NULL clears it.

The names of named anonymous vmas are shown in /proc/pid/maps
as [anon:<name>] and in /proc/pid/smaps in a new "Name" field
that is only present for named vmas.  If the userspace pointer
is no longer valid all or part of the name will be replaced
with "<fault>".

The idea to store a userspace pointer to reduce the complexity
within mm (at the expense of the complexity of reading
/proc/pid/mem) came from Dave Hansen.  This results in no
runtime overhead in the mm subsystem other than comparing
the anon_name pointers when considering vma merging.  The pointer
is stored in a union with fieds that are only used on file-backed
mappings, so it does not increase memory usage.

Change-Id: Ie2ffc0967d4ffe7ee4c70781313c7b00cf7e3092
Signed-off-by: Colin Cross <ccross@android.com>
11 years agopower_supply: kill android-battery driver
Todd Poynor [Tue, 30 Jul 2013 23:45:24 +0000 (16:45 -0700)]
power_supply: kill android-battery driver

Discontinued in favor of future userspace charging helpers.

Change-Id: I840a94ff42e2219cfd8759f919f6188355a63d92
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoadd extra free kbytes tunable
Rik van Riel [Thu, 1 Sep 2011 19:26:50 +0000 (15:26 -0400)]
add extra free kbytes tunable

Add a userspace visible knob to tell the VM to keep an extra amount
of memory free, by increasing the gap between each zone's min and
low watermarks.

This is useful for realtime applications that call system
calls and have a bound on the number of allocations that happen
in any short time period.  In this application, extra_free_kbytes
would be left at an amount equal to or larger than than the
maximum number of allocations that happen in any burst.

It may also be useful to reduce the memory use of virtual
machines (temporarily?), in a way that does not cause memory
fragmentation like ballooning does.

[ccross]
Revived for use on old kernels where no other solution exists.
The tunable will be removed on kernels that do better at avoiding
direct reclaim.

Change-Id: I765a42be8e964bfd3e2886d1ca85a29d60c3bb3e
Signed-off-by: Rik van Riel<riel@redhat.com>
Signed-off-by: Colin Cross <ccross@android.com>
11 years agogpu: ion: Fix performance issue in faulting code
Rebecca Schultz Zavin [Wed, 12 Jun 2013 22:22:16 +0000 (15:22 -0700)]
gpu: ion: Fix performance issue in faulting code

Previously the code to fault ion buffers in one page at a time had a
performance problem caused by the requirement to traverse the sg list
looking for the right page to load in (a result of the fact that the items in
the list may not be of uniform size).  To fix the problem, for buffers
that will be faulted in, also keep a flat array of all the pages in the buffer
to use from the fault handler.  To recover some of the additional memory
footprint this creates per buffer, dirty bits used to indicate which
pages have been faulted in to the cpu are now stored in the low bit of each
page struct pointer in the page array.

Change-Id: I891b077dc0c88ed6d416b256626d8778fd67be84
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: add CMA heap
Benjamin Gaignard [Fri, 22 Mar 2013 17:08:30 +0000 (18:08 +0100)]
gpu: ion: add CMA heap

New heap type ION_HEAP_TYPE_DMA where allocation is done with dma_alloc_coherent API.
device coherent_dma_mask must be set to DMA_BIT_MASK(32).
ion_platform_heap private field is used to retrieve the device linked to CMA,
if NULL the default CMA area is used.
ion_cma_get_sgtable is a copy of dma_common_get_sgtable function which should
be in kernel 3.5

Change-Id: If4b1a3f9c8a6bd72053226208832f4971e44372f
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11 years agogpu: ion: fix ion_platform_data definition
Benjamin Gaignard [Fri, 22 Mar 2013 17:08:29 +0000 (18:08 +0100)]
gpu: ion: fix ion_platform_data definition

fix ion_platform_heap to make is use an usual way in board configuration file.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11 years agoARM: kgdb: ignore breakpoint instructions from user mode
Todd Poynor [Wed, 3 Jul 2013 22:48:04 +0000 (15:48 -0700)]
ARM: kgdb: ignore breakpoint instructions from user mode

Avoid conflicts with user mode usage of the same instructions, as with
Clang -ftrapv.

Change-Id: I12d1c6d8f94376bfd2503cb0be843d7e478fb6ea
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agokconfig: Fix defconfig when one choice menu selects options that another choice menu...
Arve Hjønnevåg [Fri, 7 Jun 2013 03:05:40 +0000 (20:05 -0700)]
kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on

The defconfig and Kconfig combination below, which is based on 3.10-rc4
Kconfigs, resulted in several options getting set to "m" instead of "y".

defconfig:
---
CONFIG_MODULES=y
CONFIG_USB_GADGET=y
CONFIG_USB_ZERO=y
---

Kconfig:
---
menuconfig MODULES
bool "Enable loadable module support"

config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"

config OCFS2_FS
        tristate "OCFS2 file system support"
        depends on CONFIGFS_FS
        select CRC32

config USB_LIBCOMPOSITE
tristate
select CONFIGFS_FS

choice
tristate "USB Gadget Drivers"
default USB_ETH

config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE

config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
select USB_LIBCOMPOSITE

endchoice

config CRC32
        tristate "CRC32/CRC32c functions"
        default y

choice
        prompt "CRC32 implementation"
        depends on CRC32
        default CRC32_SLICEBY8

config CRC32_SLICEBY8
        bool "Slice by 8 bytes"

endchoice

---

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agonetfilter: xt_qtaguid: 3.10 fixes
Arve Hjønnevåg [Tue, 14 May 2013 03:45:02 +0000 (20:45 -0700)]
netfilter: xt_qtaguid: 3.10 fixes

Stop using obsolete procfs api.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agomisc: uidstat: Remove use of obsolete create_proc_read_entry api
Arve Hjønnevåg [Tue, 14 May 2013 03:34:22 +0000 (20:34 -0700)]
misc: uidstat: Remove use of obsolete create_proc_read_entry api

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agonetfilter: xt_quota2: 3.10 fixes.
Arve Hjønnevåg [Tue, 14 May 2013 03:42:46 +0000 (20:42 -0700)]
netfilter: xt_quota2: 3.10 fixes.

- Stop using obsolete create_proc_entry api.
- Use proc_set_user instead of directly accessing the private structure.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agonet: activity_stats: Stop using obsolete create_proc_read_entry api
Arve Hjønnevåg [Tue, 14 May 2013 03:39:30 +0000 (20:39 -0700)]
net: activity_stats: Stop using obsolete create_proc_read_entry api

Convert to use seq_read

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agopstore: Update Documentation/android.txt
John Stultz [Tue, 9 Apr 2013 17:30:26 +0000 (10:30 -0700)]
pstore: Update Documentation/android.txt

Update Documentation/android.txt to reference PSTORE_CONSOLE
and PSTORE_RAM instead of ANDROID_RAM_CONSOLE

Change-Id: I2c56e73f8c65c3ddbe6ddbf1faadfacb42a09575
Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agoARM: mm: Allow an empty PMD in alloc_init_pte()
Jon Medhurst (Tixy) [Wed, 28 Nov 2012 11:17:51 +0000 (11:17 +0000)]
ARM: mm: Allow an empty PMD in alloc_init_pte()

The Android patch titled "ARM: allow the kernel text section to
be made read-only" modifies alloc_init_pte() and adds a BUG_ON
to detect the case where a section mapping is being overwritten.
However the test doesn't allow for the legitimate case where the
PMD is empty, as can happen for kernels built with CONFIG_ARM_LPAE.
So extend the test to allow this.

Change-Id: I28eeaefd856bae63a5532980e41e0fd4d8922e79
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agommc: core: Remove stray CONFIG_EXPERIMENTAL dependencies
John Stultz [Mon, 18 Mar 2013 18:57:28 +0000 (11:57 -0700)]
mmc: core: Remove stray CONFIG_EXPERIMENTAL dependencies

CONFIG_EXPERIMENTAL has been removed from the kernel, so clean
up its use in MMC_EMBEDDED_SDIO and MMC_PARANOID_SD_INIT options.

Change-Id: If414c265134b36740a84564274a631803c8e81b4
Cc: Arve Hjønnevåg <arve@android.com>
Cc: San Mehat <san@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agoion: Add Kconfig dependency to ARM
John Stultz [Fri, 15 Mar 2013 00:50:50 +0000 (17:50 -0700)]
ion: Add Kconfig dependency to ARM

The ion code has some very specific arm-isms which keeps it
from building on other architectures. These should probably be
resolved, but in the mean time, add a dependency on CONFIG_ARM
to avoid build failures.

v2: Fix earlier flub, sending out an early untested version of
the patch.

Change-Id: I5979af1ad59d1eeddd9e08763b1cbc946cf82339
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Rebecca Schultz Zavin <rebecca@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agoselinux: binder: Fix COMMON_AUDIT_DATA_INIT compile issue
John Stultz [Thu, 14 Mar 2013 20:26:14 +0000 (13:26 -0700)]
selinux: binder: Fix COMMON_AUDIT_DATA_INIT compile issue

The COMMON_AUDIT_DATA_INIT macros have been removed, and are
now replaced with open coded ad.type initialization.

Thus, this patch updates the selinux_binder_transfer_file function
so it builds.

Change-Id: Ide41069a87638e294899768d09302f4013794e4c
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
11 years agonetfilter: xt_qtaguid: fix bad tcp_time_wait sock handling
JP Abgrall [Thu, 21 Feb 2013 00:38:34 +0000 (16:38 -0800)]
netfilter: xt_qtaguid: fix bad tcp_time_wait sock handling

Since (41063e9 ipv4: Early TCP socket demux), skb's can have an sk which
is not a struct sock but the smaller struct inet_timewait_sock without an
sk->sk_socket. Now we bypass sk_state == TCP_TIME_WAIT

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agousb: gadget: android: 3.10 fixes
Arve Hjønnevåg [Fri, 17 May 2013 03:27:45 +0000 (20:27 -0700)]
usb: gadget: android: 3.10 fixes

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agousb: gadget: android: move init to late_initcall for now
Arve Hjønnevåg [Tue, 5 Mar 2013 03:14:10 +0000 (19:14 -0800)]
usb: gadget: android: move init to late_initcall for now

gserial_alloc_line crashes when called from module_init

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agousb: gadget: android: Fixes and hacks to make android usb gadget compile on 3.9
Arve Hjønnevåg [Tue, 5 Mar 2013 01:41:34 +0000 (17:41 -0800)]
usb: gadget: android: Fixes and hacks to make android usb gadget compile on 3.9

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agousb: gadget: Fix android gadget driver build
Benoit Goby [Tue, 6 Nov 2012 02:47:08 +0000 (18:47 -0800)]
usb: gadget: Fix android gadget driver build

Removed obsolete f_adb function

Change-Id: Idfb4110429bc0ea63f493c68ad667f49ca471987
Signed-off-by: Benoit Goby <benoit@android.com>
11 years agoHACK: usb: gadget: Fix enumeration on boot
Benoit Goby [Thu, 1 Mar 2012 21:17:07 +0000 (13:17 -0800)]
HACK: usb: gadget: Fix enumeration on boot

The Android gadget driver disconnects the gadget on bind
and expects the gadget to stay disconnected until it calls
usb_gadget_connect when userspace is ready. Removed the call
to usb_gadget_connect in usb_gadget_probe_driver to avoid
enabling the pullup before userspace is ready.

Change-Id: I63707ac6e16a44eca52351a4bf80407d25fbd35e
Signed-off-by: Benoit Goby <benoit@android.com>
11 years agousb: gadget: android: Fixes and hacks to make android usb gadget compile on 3.8
Arve Hjønnevåg [Wed, 28 Nov 2012 03:29:04 +0000 (19:29 -0800)]
usb: gadget: android: Fixes and hacks to make android usb gadget compile on 3.8

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: decompressor: Flush tlb before swiching domain 0 to client mode
Arve Hjønnevåg [Sat, 1 Dec 2012 01:05:40 +0000 (17:05 -0800)]
ARM: decompressor: Flush tlb before swiching domain 0 to client mode

If the bootloader used a page table that is incompatible with domain 0
in client mode, and boots with the mmu on, then swithing domain 0 to
client mode causes a fault if we don't flush the tlb after updating
the page table pointer.

v2: Add ISB before loading dacr.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: mm: Split memory banks that span multiple sections when sparsemem is enabled
Arve Hjønnevåg [Fri, 7 Dec 2012 04:46:49 +0000 (20:46 -0800)]
ARM: mm: Split memory banks that span multiple sections when sparsemem is enabled

This fixes a crash in mem_init which assumes all pages in a memory bank
are part of the same page array.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agommc: block: Remove call to mmc_blk_set_blksize
Arve Hjønnevåg [Tue, 27 Nov 2012 03:30:22 +0000 (19:30 -0800)]
mmc: block: Remove call to mmc_blk_set_blksize

It no longer exists.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agogpu: ion: Remove __GFP_NO_KSWAPD
Arve Hjønnevåg [Tue, 27 Nov 2012 01:20:21 +0000 (17:20 -0800)]
gpu: ion: Remove __GFP_NO_KSWAPD

It no longer exists.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agogpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hack
Arve Hjønnevåg [Tue, 27 Nov 2012 01:14:58 +0000 (17:14 -0800)]
gpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hack

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: fiq_debugger: Update tty code for 3.9
Arve Hjønnevåg [Tue, 15 Jan 2013 23:10:31 +0000 (15:10 -0800)]
ARM: fiq_debugger: Update tty code for 3.9

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: fiq_debugger: Use kmsg_dumper to dump kernel logs
Arve Hjønnevåg [Tue, 27 Nov 2012 04:05:37 +0000 (20:05 -0800)]
ARM: fiq_debugger: Use kmsg_dumper to dump kernel logs

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: fiq_debugger: Fix to compile on 3.7
Arve Hjønnevåg [Tue, 27 Nov 2012 00:23:33 +0000 (16:23 -0800)]
ARM: fiq_debugger: Fix to compile on 3.7

Use for_each_irq_desc in arch/arm/common/fiq_debugger.c

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agousb: otg: otg-wakelock: Fix build for 3.7
Arve Hjønnevåg [Tue, 27 Nov 2012 00:09:13 +0000 (16:09 -0800)]
usb: otg: otg-wakelock: Fix build for 3.7

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agocpufreq: interactive: resched timer if max freq raised
Lianwei Wang [Fri, 26 Apr 2013 05:30:51 +0000 (13:30 +0800)]
cpufreq: interactive: resched timer if max freq raised

When the policy max freq is raised, and before the timer is
rescheduled in idle callback, the cpu freq may stuck at a
lower freq.

The target_freq shall be updated too, else on a high load
situation, the new_freq is always equal to target_freq and
which will cause freq stuck at a lower freq too.

Reschedule the timer on gov limits callback.

Change-Id: I6c187001ab43e859731429b64f75a74eebc37a24
Signed-off-by: Lianwei Wang <a22439@motorola.com>
11 years agocpufreq: interactive: fix race on cpufreq TRANSITION notifier
Lianwei Wang [Thu, 16 May 2013 04:07:23 +0000 (12:07 +0800)]
cpufreq: interactive: fix race on cpufreq TRANSITION notifier

The cpufreq TRANSTION notifier callback does not check the
governor_enabled state on affected CPUS, which will case
kernel panic in update_load because the policy object maybe
NULL or invalid when governor_enabled is false.

Change-Id: Ie0f1718124f61e2f9b5da57abc6981ada5b83908
Signed-off-by: Lianwei Wang <a22439@motorola.com>
11 years agoaf_unix: use freezable blocking calls in read
Colin Cross [Mon, 6 May 2013 23:50:21 +0000 (23:50 +0000)]
af_unix: use freezable blocking calls in read

Avoid waking up every thread sleeping in read call on an AF_UNIX
socket during suspend and resume by calling a freezable blocking
call.  Previous patches modified the freezer to avoid sending
wakeups to threads that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: I788246a76780ea892659526e70be018b18f646c4
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agosigtimedwait: use freezable blocking call
Colin Cross [Mon, 6 May 2013 23:50:20 +0000 (23:50 +0000)]
sigtimedwait: use freezable blocking call

Avoid waking up every thread sleeping in a sigtimedwait call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: Ic27469b60a67d50cdc0d0c78975951a99c25adcd
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agonanosleep: use freezable blocking call
Colin Cross [Mon, 6 May 2013 23:50:19 +0000 (23:50 +0000)]
nanosleep: use freezable blocking call

Avoid waking up every thread sleeping in a nanosleep call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: I93383201d4dd62130cd9a9153842d303fc2e2986
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofutex: use freezable blocking call
Colin Cross [Mon, 6 May 2013 23:50:18 +0000 (23:50 +0000)]
futex: use freezable blocking call

Avoid waking up every thread sleeping in a futex_wait call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: I9ccab9c2d201adb66c85432801cdcf43fc91e94f
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoselect: use freezable blocking call
Colin Cross [Mon, 6 May 2013 23:50:17 +0000 (23:50 +0000)]
select: use freezable blocking call

Avoid waking up every thread sleeping in a select call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: I0d7565ec0b6bc5d44cb55f958589c56e6bd16348
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoepoll: use freezable blocking call
Colin Cross [Mon, 6 May 2013 23:50:16 +0000 (23:50 +0000)]
epoll: use freezable blocking call

Avoid waking up every thread sleeping in an epoll_wait call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: I848d08d28c89302fd42bbbdfa76489a474ab27bf
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agobinder: use freezable blocking calls
Colin Cross [Mon, 6 May 2013 23:50:15 +0000 (23:50 +0000)]
binder: use freezable blocking calls

Avoid waking up every thread sleeping in a binder call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: Ic4458ae90447f6caa895cc62f08e515caa7790ba
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: add new freezable helpers using freezer_do_not_count()
Colin Cross [Mon, 6 May 2013 23:50:14 +0000 (23:50 +0000)]
freezer: add new freezable helpers using freezer_do_not_count()

Freezing tasks will wake up almost every userspace task from
where it is blocking and force it to run until it hits a
call to try_to_sleep(), generally on the exit path from the syscall
it is blocking in.  On resume each task will run again, usually
restarting the syscall and running until it hits the same
blocking call as it was originally blocked in.

To allow tasks to avoid running on every suspend/resume cycle,
this patch adds additional freezable wrappers around blocking calls
that call freezer_do_not_count().  Combined with the previous patch,
these tasks will not run during suspend or resume unless they wake
up for another reason, in which case they will run until they hit
the try_to_freeze() in freezer_count(), and then continue processing
the wakeup after tasks are thawed.

Additional patches will convert the most common locations that
userspace blocks in to use freezable helpers.

Change-Id: Id909760ce460f2532801a4b00d344f0816bfefc9
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: convert freezable helpers to static inline where possible
Colin Cross [Mon, 6 May 2013 23:50:13 +0000 (23:50 +0000)]
freezer: convert freezable helpers to static inline where possible

Some of the freezable helpers have to be macros because their
condition argument needs to get evaluated every time through
the wait loop.  Convert the others to static inline to make
future changes easier.

Change-Id: I69d3fc10d26522cb9bf3a616ff4f21245f9c071a
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: convert freezable helpers to freezer_do_not_count()
Colin Cross [Mon, 6 May 2013 23:50:12 +0000 (23:50 +0000)]
freezer: convert freezable helpers to freezer_do_not_count()

Freezing tasks will wake up almost every userspace task from
where it is blocking and force it to run until it hits a
call to try_to_sleep(), generally on the exit path from the syscall
it is blocking in.  On resume each task will run again, usually
restarting the syscall and running until it hits the same
blocking call as it was originally blocked in.

Convert the existing wait_event_freezable* wrappers to use
freezer_do_not_count().  Combined with a previous patch,
these tasks will not run during suspend or resume unless they wake
up for another reason, in which case they will run until they hit
the try_to_freeze() in freezer_count(), and then continue processing
the wakeup after tasks are thawed.

This results in a small change in behavior, previously a race
between freezing and a normal wakeup would be won by the wakeup,
now the task will freeze and then handle the wakeup after thawing.

Change-Id: I532e62251f58c1a9ca488b3fb6220c53acf7d33d
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: skip waking up tasks with PF_FREEZER_SKIP set
Colin Cross [Mon, 6 May 2013 23:50:11 +0000 (23:50 +0000)]
freezer: skip waking up tasks with PF_FREEZER_SKIP set

Android goes through suspend/resume very often (every few seconds when
on a busy wifi network with the screen off), and a significant portion
of the energy used to go in and out of suspend is spent in the
freezer.  If a task has called freezer_do_not_count(), don't bother
waking it up.  If it happens to wake up later it will call
freezer_count() and immediately enter the refrigerator.

Combined with patches to convert freezable helpers to use
freezer_do_not_count() and convert common sites where idle userspace
tasks are blocked to use the freezable helpers, this reduces the
time and energy required to suspend and resume.

Change-Id: I6ba019d24273619849af757a413271da3261d7db
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: shorten freezer sleep time using exponential backoff
Colin Cross [Mon, 6 May 2013 23:50:10 +0000 (23:50 +0000)]
freezer: shorten freezer sleep time using exponential backoff

All tasks can easily be frozen in under 10 ms, switch to using
an initial 1 ms sleep followed by exponential backoff until
8 ms.  Also convert the printed time to ms instead of centiseconds.

Change-Id: I7b198b16eefb623c2b0fc45dce50d9bca320afdc
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agolockdep: check that no locks held at freeze time
Mandeep Singh Baines [Mon, 6 May 2013 23:50:09 +0000 (23:50 +0000)]
lockdep: check that no locks held at freeze time

We shouldn't try_to_freeze if locks are held.  Holding a lock can cause a
deadlock if the lock is later acquired in the suspend or hibernate path
(e.g.  by dpm).  Holding a lock can also cause a deadlock in the case of
cgroup_freezer if a lock is held inside a frozen cgroup that is later
acquired by a process outside that group.

History:
This patch was originally applied as 6aa9707099c and reverted in
dbf520a9d7d4 because NFS was freezing with locks held.  It was
deemed better to keep the bad freeze point in NFS to allow laptops
to suspend consistently.  The previous patch in this series converts
NFS to call _unsafe versions of the freezable helpers so that
lockdep doesn't complain about them until a more correct fix
can be applied.

Change-Id: Ib9d4299fb75a39e611b868be42e413909a994baa
[akpm@linux-foundation.org: export debug_check_no_locks_held]
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agolockdep: remove task argument from debug_check_no_locks_held
Colin Cross [Mon, 6 May 2013 23:50:08 +0000 (23:50 +0000)]
lockdep: remove task argument from debug_check_no_locks_held

The only existing caller to debug_check_no_locks_held calls it
with 'current' as the task, and the freezer needs to call
debug_check_no_locks_held but doesn't already have a current
task pointer, so remove the argument.  It is already assuming
that the current task is relevant by dumping the current stack
trace as part of the warning.

This was originally part of 6aa9707099c (lockdep: check that
no locks held at freeze time) which was reverted in
dbf520a9d7d4.

Change-Id: Idbaf1332ce6c80dc49c1d31c324c7fbf210657c5
Original-author: Mandeep Singh Baines <msb@chromium.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: add unsafe versions of freezable helpers for CIFS
Colin Cross [Tue, 7 May 2013 17:52:05 +0000 (17:52 +0000)]
freezer: add unsafe versions of freezable helpers for CIFS

CIFS calls wait_event_freezekillable_unsafe with a VFS lock held,
which is unsafe and will cause lockdep warnings when 6aa9707
"lockdep: check that no locks held at freeze time" is reapplied
(it was reverted in dbf520a).  CIFS shouldn't be doing this, but
it has long-running syscalls that must hold a lock but also
shouldn't block suspend.  Until CIFS freeze handling is rewritten
to use a signal to exit out of the critical section, add a new
wait_event_freezekillable_unsafe helper that will not run the
lockdep test when 6aa9707 is reapplied, and call it from CIFS.

In practice the likley result of holding the lock while freezing
is that a second task blocked on the lock will never freeze,
aborting suspend, but it is possible to manufacture a case using
the cgroup freezer, the lock, and the suspend freezer to create
a deadlock.  Silencing the lockdep warning here will allow
problems to be found in other drivers that may have a more
serious deadlock risk, and prevent new problems from being added.

Change-Id: I420c5392bacf68e58e268293b2b36068ad4df753
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agofreezer: add unsafe versions of freezable helpers for NFS
Colin Cross [Mon, 6 May 2013 23:50:06 +0000 (23:50 +0000)]
freezer: add unsafe versions of freezable helpers for NFS

NFS calls the freezable helpers with locks held, which is unsafe
and will cause lockdep warnings when 6aa9707 "lockdep: check
that no locks held at freeze time" is reapplied (it was reverted
in dbf520a).  NFS shouldn't be doing this, but it has
long-running syscalls that must hold a lock but also shouldn't
block suspend.  Until NFS freeze handling is rewritten to use a
signal to exit out of the critical section, add new *_unsafe
versions of the helpers that will not run the lockdep test when
6aa9707 is reapplied, and call them from NFS.

In practice the likley result of holding the lock while freezing
is that a second task blocked on the lock will never freeze,
aborting suspend, but it is possible to manufacture a case using
the cgroup freezer, the lock, and the suspend freezer to create
a deadlock.  Silencing the lockdep warning here will allow
problems to be found in other drivers that may have a more
serious deadlock risk, and prevent new problems from being added.

Change-Id: Ia17d32cdd013a6517bdd5759da900970a4427170
Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agotimerfd: add alarm timers
Todd Poynor [Wed, 8 May 2013 22:50:50 +0000 (15:50 -0700)]
timerfd: add alarm timers

Add support for clocks CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM.

Change-Id: Iafc8445d3d7ffb35110c860f1607bf03f1edb895
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoalarmtimer: add alarm_expires_remaining
Todd Poynor [Wed, 8 May 2013 03:43:29 +0000 (20:43 -0700)]
alarmtimer: add alarm_expires_remaining

Similar to hrtimer_expires_remaining, return the amount of time
remaining until alarm expiry.

Change-Id: I8c57512d619ac66bcdaf2d9ccdf0d7f74af2ff66
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoalarmtimer: add alarm_start_relative
Todd Poynor [Sat, 11 May 2013 00:41:06 +0000 (17:41 -0700)]
alarmtimer: add alarm_start_relative

Start an alarmtimer with an expires time relative to the current time
of the associated clock.

Change-Id: Ifb5309a15e0d502bb4d0209ca5510a56ee7fa88c
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoalarmtimer: add alarm_forward_now
Todd Poynor [Sat, 11 May 2013 00:10:42 +0000 (17:10 -0700)]
alarmtimer: add alarm_forward_now

Similar to hrtimer_forward_now, move the expires time forward to an
interval from the current time of the associated clock.

Change-Id: I73fed223321167507b6eddcb7a57d235ffcfc1be
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoalarmtimer: add alarm_restart
Todd Poynor [Wed, 8 May 2013 22:49:18 +0000 (15:49 -0700)]
alarmtimer: add alarm_restart

Analogous to hrtimer_restart, restart an alarmtimer after the expires
time has already been updated (as with alarm_forward).

Change-Id: Ia2613bbb467404cb2c35c11efa772bc56294963a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: avoid underflow on active time calculation
Minsung Kim [Tue, 23 Apr 2013 13:32:01 +0000 (22:32 +0900)]
cpufreq: interactive: avoid underflow on active time calculation

Check for idle time delta less than elapsed time delta, avoid
underflow computing active time.

Change-Id: I3e4c6ef1ad794eec49ed379c0c50fa727fd6ad28
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
11 years agocpufreq: interactive: reduce chance of zero time delta on load eval
Todd Poynor [Fri, 5 Apr 2013 20:25:21 +0000 (13:25 -0700)]
cpufreq: interactive: reduce chance of zero time delta on load eval

Reschedule load sampling timer after timestamp of sample start taken,
hold spinlock across entire sequence to avoid preemption.  Avoid the
WARN for zero time delta in the load sampling timer function.

Change-Id: Idc10a756f09141decb6df92669521a1ebf0dbc10
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: handle errors from cpufreq_frequency_table_target
Todd Poynor [Mon, 22 Apr 2013 23:44:58 +0000 (16:44 -0700)]
cpufreq: interactive: handle errors from cpufreq_frequency_table_target

Add checks for error return from cpufreq_frequency_table_target, and be
less noisy on the existing call with an error check.  CPU hotplug and
system shutdown may cause this call to return -EINVAL.

Bug: 8613560
Change-Id: Id78d8829920462c0db1c7e14e717d91740d6cb44
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoandroid: configs: no MODULES for base, no SIP for recommended
JP Abgrall [Fri, 7 Jun 2013 22:23:31 +0000 (15:23 -0700)]
android: configs: no MODULES for base, no SIP for recommended

We don't like CONFIG_MODULES anymore.
Connection tracker handling of large SIP fails.

Change-Id: Ie3c65aefcc6181752d6656c97e63035e5b5653ff
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agoandroid: configs: Reorder config fragments
JP Abgrall [Fri, 7 Jun 2013 18:56:34 +0000 (11:56 -0700)]
android: configs: Reorder config fragments

Because there is not tool to consistently generate these config
fragments, lets keep the alphabetical instead of random.

Change-Id: I0f098f6be6bdd272544295a3d5a48d04411e4514
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agoashmem: avoid deadlock between read and mmap calls
Todd Poynor [Wed, 5 Jun 2013 00:29:38 +0000 (17:29 -0700)]
ashmem: avoid deadlock between read and mmap calls

Avoid holding ashmem_mutex across code that can page fault.  Page faults
grab the mmap_sem for the process, which are also held by mmap calls
prior to calling ashmem_mmap, which locks ashmem_mutex.  The reversed
order of locking between the two can deadlock.

The calls that can page fault are read() and the ASHMEM_SET_NAME and
ASHMEM_GET_NAME ioctls.  Move the code that accesses userspace pages
outside the ashmem_mutex.

Bug: 9261835
Change-Id: If1322e981d29c889a56cdc9dfcbc6df2729a45e9
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Conflicts:
drivers/staging/android/ashmem.c

11 years agoandroid: configs: Enable KSM support by default
Rom Lemarchand [Fri, 31 May 2013 18:54:35 +0000 (11:54 -0700)]
android: configs: Enable KSM support by default

This will be a noop unless the KSM thread is enabled by userspace

Change-Id: Ia5fde14504cc0da50522e2f875d8d021f9e054ba
Signed-off-by: Rom Lemarchand <romlem@google.com>
11 years agoandroid: configs: Add Logitech unifying receivers to recommended
Michael Wright [Wed, 8 May 2013 21:50:11 +0000 (14:50 -0700)]
android: configs: Add Logitech unifying receivers to recommended

Change-Id: I7647cd7037731df69dfdd513a0808b396d9d5bdd
Signed-off-by: Michael Wright <michaelwr@android.com>
11 years agogpu: ion: Also shrink memory cached in the deferred free list
Rebecca Schultz Zavin [Thu, 23 May 2013 20:37:25 +0000 (13:37 -0700)]
gpu: ion: Also shrink memory cached in the deferred free list

When the system is low on memory, we want to shrink any cached
system memory ion is holding.  Previously we were shrinking memory
in the page pools, but not in the deferred free list.  This patch
makes it possible to shrink both.  It also moves the shrinker
code into the heaps so they can correctly manage any caches they
might contain.

Change-Id: I177f587f999a5220eddbf7af94745aae736cac75
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agomisc: uidstat: avoid create_stat() race and blockage.
JP Abgrall [Thu, 30 May 2013 22:31:17 +0000 (15:31 -0700)]
misc: uidstat: avoid create_stat() race and blockage.

* create_stat() race would lead to:
  [   58.132324] proc_dir_entry 'uid_stat/10061' already registered

* blocking kmalloc reported by sbranden
 tcp_read_sock()
  uid_stat_tcp_rcv()
    create_stat()
      kmalloc(GFP_KERNEL)

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agommc: Add tracepoints of mmc block operations
Ken Sumrall [Thu, 16 May 2013 03:13:13 +0000 (20:13 -0700)]
mmc: Add tracepoints of mmc block operations

Add tracepoints to record the start and end of each mmc block
operation.  This includes read, write, erase, secure erase,
trim, secure trim1 and secure trim 2, discard and
sanitize commands.

Change-Id: Ic5d1cbdb9adb940d8b1a2a13c73970023575df50
Signed-off-by: Ken Sumrall <ksumrall@android.com>
11 years agolowmemorykiller: make default lowmemorykiller debug message useful
Colin Cross [Fri, 3 May 2013 21:57:29 +0000 (14:57 -0700)]
lowmemorykiller: make default lowmemorykiller debug message useful

lowmemorykiller debug messages are inscrutable and mostly useful
for debugging the lowmemorykiller, not explaining why a process
was killed.  Make the messages more useful by prefixing them
with "lowmemorykiller: " and explaining in more readable terms
what was killed, who it was killed for, and why it was killed.

The messages now look like:
[   76.997631] lowmemorykiller: Killing 'droid.gallery3d' (2172), adj 1000,
[   76.997635]    to free 27436kB on behalf of 'kswapd0' (29) because
[   76.997638]    cache 122624kB is below limit 122880kB for oom_score_adj 1000
[   76.997641]    Free memory is -53356kB above reserved

A negative number for free memory above reserved means some of the
reserved memory has been used and is being regenerated by kswapd,
which is likely what called the shrinkers.

Change-Id: I1fe983381e73e124b90aa5d91cb66e55eaca390f
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fault: assume no context when IRQs are disabled during data abort.
JP Abgrall [Mon, 29 Apr 2013 23:07:00 +0000 (16:07 -0700)]
ARM: fault: assume no context when IRQs are disabled during data abort.

Bail out early if IRQs are disabled in do_page_fault or else
  [14415.157266] BUG: sleeping function called from invalid context at arch/arm/mm/fault.c:301

Russell King's idea from
  http://comments.gmane.org/gmane.linux.ports.arm.omap/59256

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agocpufreq: interactive: fix uninitialized spinlock
Minsung Kim [Tue, 16 Apr 2013 12:52:50 +0000 (21:52 +0900)]
cpufreq: interactive: fix uninitialized spinlock

Add missing spinlock init

Backtrace:
[<c0011ce4>] (dump_backtrace+0x0/0x10c) from [<c0662a68>] (dump_stack+0x18/0x1c)
 r6:00000032 r5:c0bd09ec r4:e6848000 r3:00000000
[<c0662a50>] (dump_stack+0x0/0x1c) from [<c06670b0>] (spin_dump+0x80/0x94)
[<c0667030>] (spin_dump+0x0/0x94) from [<c06670f0>] (spin_bug+0x2c/0x30)
 r5:c08f91fc r4:c0bd09ec
[<c06670c4>] (spin_bug+0x0/0x30) from [<c0245f74>] (do_raw_spin_unlock+0x88/0xcc)
 r5:e547bac0 r4:c0bd09ec
[<c0245eec>] (do_raw_spin_unlock+0x0/0xcc) from [<c066c9cc>] (_raw_spin_unlock_irqrestore+0x14/0x40)
 r5:e547bac0 r4:60000013
[<c066c9b8>] (_raw_spin_unlock_irqrestore+0x0/0x40) from [<c044b884>] (store_above_hispeed_delay+0x6c/0x80)
 r4:c0b4cf78 r3:00000007
[<c044b818>] (store_above_hispeed_delay+0x0/0x80) from [<c0235d24>] (kobj_attr_store+0x1c/0x28)
 r7:e68ff000 r6:00000032 r5:e58137c0 r4:e61cde80
[<c0235d08>] (kobj_attr_store+0x0/0x28) from [<c0156b78>] (sysfs_write_file+0x104/0x184)
[<c0156a74>] (sysfs_write_file+0x0/0x184) from [<c0100680>] (vfs_write+0xb0/0x140)
[<c01005d0>] (vfs_write+0x0/0x140) from [<c0100900>] (sys_write+0x44/0x70)
 r8:00000000 r7:00000004 r6:00000032 r5:bee43c90 r4:e5600300
[<c01008bc>] (sys_write+0x0/0x70) from [<c000e400>] (ret_fast_syscall+0x0/0x30)
 r9:e6842000 r8:c000e584 r6:00000032 r5:bee43c90 r4:00000009

Change-Id: I80a1e0b3fecb24adba501ff44f568479deeff7fa
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
11 years agoandroid: configs: Initial commit of Android config fragments
Rom Lemarchand [Wed, 6 Feb 2013 23:49:47 +0000 (15:49 -0800)]
android: configs: Initial commit of Android config fragments

- Add 2 files that contain the minimal and recommended kernel config
options respectively.
- Add a README to explain their purpose and how to use them to
generate a device config compatible with Android.

Change-Id: I3a4883f3b04d2820e90ceb3c4d02390d6458d6ce
Signed-off-by: Rom Lemarchand <romlem@google.com>
11 years agogpu: ion: Fix bug in ion shrinker
Rebecca Schultz Zavin [Wed, 24 Apr 2013 21:33:55 +0000 (14:33 -0700)]
gpu: ion: Fix bug in ion shrinker

The high variable was sometimes used uninitialized

Change-Id: I2f51413fd2d063fdff325047e824dc8c749d9e0a
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agotrace/events: fix gpu event timestamp formatting
Jamie Gennis [Fri, 19 Apr 2013 03:36:21 +0000 (20:36 -0700)]
trace/events: fix gpu event timestamp formatting

This change fixes the how the gpu_sched_switch timestamp field is formatted.

Signed-off-by: Jamie Gennis <jgennis@google.com>
Change-Id: I273234935254ed15772c9e561c9af20e480004ae

11 years agoARM: convert build of appended dtb zImage to list of dtbs
Colin Cross [Wed, 17 Apr 2013 23:58:36 +0000 (16:58 -0700)]
ARM: convert build of appended dtb zImage to list of dtbs

Allow CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES to specify
a space separated list of dtbs to append to the zImage,
and name the resulting file zImage-dtb

Change-Id: I36d9108a2349bdbb373e95076dcb1417d8c7dce6
Signed-off-by: Colin Cross <ccross@android.com>
Conflicts:
arch/arm/boot/Makefile
scripts/Makefile.lib

11 years agogpu: ion: ion_chunk_heap: Zero chunk heap memory at creation time
Rebecca Schultz Zavin [Mon, 1 Apr 2013 23:40:02 +0000 (16:40 -0700)]
gpu: ion: ion_chunk_heap: Zero chunk heap memory at creation time

Allocations from the ion heap need to be zeroed to protect userspace
from seeing memory belonging to other processes.  First allocations
from this heap were not zero'd allowing users to see memory from other
processes on a warm reset.

Change-Id: I524a7b79cb76c390c870fcf8b30d213185fc85a0
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: fix kfree/list_del order
JP Abgrall [Mon, 15 Apr 2013 21:23:14 +0000 (14:23 -0700)]
gpu: ion: fix kfree/list_del order

With CONFIG_SLUB_DEBUG_ON it would panic during
ion_alloc()
 ion_buffer_create()
   io_heap_drain_freelist()

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: qtaguid: rate limit some of the printks
JP Abgrall [Mon, 8 Apr 2013 22:09:26 +0000 (15:09 -0700)]
netfilter: qtaguid: rate limit some of the printks

Some of the printks are in the packet handling path.
We now ratelimit the very unlikely errors to avoid
kmsg spamming.

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agocpufreq: interactive: base above_hispeed_delay on target freq, not current
Todd Poynor [Fri, 22 Mar 2013 03:46:00 +0000 (20:46 -0700)]
cpufreq: interactive: base above_hispeed_delay on target freq, not current

Time to wait should be based on the intended target speed, not the
actual speed (which may be held high by another CPU).

Change-Id: Ifc5bb55d06adddb9a02af90af05398a78f282272
Reported-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoARM: add config option to build zImage/dtb combo
Erik Gilling [Mon, 25 Mar 2013 22:04:41 +0000 (15:04 -0700)]
ARM: add config option to build zImage/dtb combo

Allows a defconfig to set a default dtb to concatenate with a zImage
to create a zImage-dtb.<dtb name>

Signed-off-by: Erik Gilling <konkers@android.com>
Change-Id: I34b643b1c49228fbae88a56e46c93c478089620d

11 years agocpufreq: interactive: fix crash on error paths in get_tokenized_data
Todd Poynor [Wed, 20 Mar 2013 22:40:46 +0000 (15:40 -0700)]
cpufreq: interactive: fix crash on error paths in get_tokenized_data

Use separate variable for error code, free proper pointer.

Change-Id: Ia83cccb195997789ac6afbf5b8761f7b278196d6
Reported-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: add io_is_busy interface
Lianwei Wang [Fri, 22 Feb 2013 03:39:18 +0000 (11:39 +0800)]
cpufreq: interactive: add io_is_busy interface

Previously the idle time returned from get_cpu_idle_time_us included the
iowait time. So the iowait time was always calculated as idle time.

But now the idle time returned from get_cpu_idle_time_us does not include
the iowait time anymore because of below commit which cause the iowait time
always calculated as busy time:
    6beea0c nohz: Fix update_ts_time_stat idle accounting

Add the io_is_busy interface, as does the ondemand governor, and let the user
configure the iowait time as busy or idle through the io_is_busy sysfs
interface.

By default, io_is_busy is disabled.

[toddpoynor@google.com: minor updates]
Change-Id: If7d70ff864c43bc9c8d7fd7cfc66f930d339f9b4
Signed-off-by: Lianwei Wang <lian-wei.wang@motorola.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: allow arbitrary speed / delay mappings
Minsung Kim [Mon, 25 Feb 2013 14:48:04 +0000 (23:48 +0900)]
cpufreq: interactive: allow arbitrary speed / delay mappings

Accept a string of delays and speeds at which to apply the delay before
raising each step above hispeed. For example, "80000 1300000:200000
1500000:40000" means that the delay at or above 1GHz, until 1.3GHz is 80 msecs,
the delay until 1.5GHz is 200 msecs and the delay at or above 1.5GHz is 40
msecs when hispeed_freq is 1GHz.

[toddpoynor@google.com: add documentation]
Change-Id: Ifeebede8b1acbdd0a53e5c6916bccbf764dc854f
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
11 years agotrace: add non-hierarchical function_graph option
Jamie Gennis [Thu, 22 Nov 2012 04:14:09 +0000 (20:14 -0800)]
trace: add non-hierarchical function_graph option

Add the 'funcgraph-flat' option to the function_graph tracer to use the default
trace printing format rather than the hierarchical formatting normally used.

Change-Id: If2900bfb86e6f8f51379f56da4f6fabafa630909
Signed-off-by: Jamie Gennis <jgennis@google.com>
11 years agogpu: ion: Make ion_free asynchronous
Rebecca Schultz Zavin [Wed, 13 Feb 2013 22:48:11 +0000 (14:48 -0800)]
gpu: ion: Make ion_free asynchronous

Add the ability for a heap to free buffers asynchrounously.  Freed buffers
are placed on a free list and freed from a low priority background thread.
If allocations from a particular heap fail, the free list is drained.  This
patch also enable asynchronous frees from the chunk heap.

Change-Id: Idfdbc8608b6cbd9e27d2e31ea4fd84fea9f69f7d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agotrace: Add an option to show tgids in trace output
Jamie Gennis [Wed, 21 Nov 2012 23:04:25 +0000 (15:04 -0800)]
trace: Add an option to show tgids in trace output

The tgids are tracked along side the saved_cmdlines tracking, and can be
included in trace output by enabling the 'print-tgid' trace option. This is
useful when doing post-processing of the trace data, as it allows events to be
grouped by tgid.

Change-Id: I52ed04c3a8ca7fddbb868b792ce5d21ceb76250e
Signed-off-by: Jamie Gennis <jgennis@google.com>