firefly-linux-kernel-4.4.55.git
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>
11 years agoAdd security hooks to binder and implement the hooks for SELinux.
Stephen Smalley [Mon, 5 Nov 2012 13:15:34 +0000 (08:15 -0500)]
Add security hooks to binder and implement the hooks for SELinux.

Add security hooks to the binder and implement the hooks for SELinux.
The security hooks enable security modules such as SELinux to implement
controls over binder IPC.  The security hooks include support for
controlling what process can become the binder context manager
(binder_set_context_mgr), controlling the ability of a process
to invoke a binder transaction/IPC to another process (binder_transaction),
controlling the ability a process to transfer a binder reference to
another process (binder_transfer_binder), and controlling the ability
of a process to transfer an open file to another process (binder_transfer_file).

This support is used by SE Android, http://selinuxproject.org/page/SEAndroid.

Change-Id: I9a64a87825df2e60b9c51400377af4a9cd1c4049
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
11 years agoinput: misc: keychord: log when keychord triggered
JP Abgrall [Tue, 5 Mar 2013 22:25:36 +0000 (14:25 -0800)]
input: misc: keychord: log when keychord triggered

log keychord id at info level just before waking up processes.

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agotrace/events: add gpu trace events
Jamie Gennis [Fri, 22 Feb 2013 01:55:28 +0000 (17:55 -0800)]
trace/events: add gpu trace events

Change-Id: I0607b9c776acf61cb796b8572cf8cfb8b2dc1377
Signed-off-by: Jamie Gennis <jgennis@google.com>
11 years agogpu: ion: Add support for sharing buffers with dma buf kernel handles
Johan Mossberg [Fri, 11 Jan 2013 12:38:13 +0000 (13:38 +0100)]
gpu: ion: Add support for sharing buffers with dma buf kernel handles

Currently ion can only share buffers with dma buf fd's. Fd's can not be
used inside the kernel as they are process specific so support for
sharing buffers with dma buf kernel handles is needed to support kernel
only use cases. An example use case could be a GPU driver using ion
that wants to share its output buffers with a 3d party display
controller driver supporting dma buf.

Change-Id: If1b3753ddbd5b44c5a3e622055d5473e16fc1c48
Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
11 years agonet: bluetooth: Remove the AID_NET_BT* gid numbers
JP Abgrall [Thu, 21 Feb 2013 01:39:53 +0000 (17:39 -0800)]
net: bluetooth: Remove the AID_NET_BT* gid numbers

Removed bluetooth checks for AID_NET_BT and AID_NET_BT_ADMIN
which are not useful anymore.
This is in preparation for getting rid of all the AID_* gids.

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agopower: android-battery: push uevent whenever charge source changes
Todd Poynor [Wed, 13 Feb 2013 04:47:48 +0000 (20:47 -0800)]
power: android-battery: push uevent whenever charge source changes

Ensure userspace reads an up-to-date value for charging status whenever the
charge source is updated.  Avoid races where stale charging state may be
reflected in userspace until the next battery state poll.

Change-Id: Ia744db48584e9e9abf442710c279af9e3a25c079
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agopower: android-battery: remove ac and usb supplies
Todd Poynor [Wed, 9 Jan 2013 02:46:41 +0000 (18:46 -0800)]
power: android-battery: remove ac and usb supplies

Should no longer need to fix up AC/USB online state via these.

Change-Id: I48d2ef0fbefee58cb47eafc11d9a44759920df7a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agonetfilter: xt_qtaguid: Allow tracking loopback
JP Abgrall [Thu, 7 Feb 2013 01:40:07 +0000 (17:40 -0800)]
netfilter: xt_qtaguid: Allow tracking loopback

In the past it would always ignore interfaces with loopback addresses.
Now we just treat them like any other.
This also helps with writing tests that check for the presence
of the qtaguid module.

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: xt_qtaguid: extend iface stat to report protocols
JP Abgrall [Tue, 29 Jan 2013 00:50:44 +0000 (16:50 -0800)]
netfilter: xt_qtaguid: extend iface stat to report protocols

In the past the iface_stat_fmt would only show global bytes/packets
for the skb-based numbers.
For stall detection in userspace, distinguishing tcp vs other protocols
makes it easier.
Now we report
  ifname total_skb_rx_bytes total_skb_rx_packets total_skb_tx_bytes
  total_skb_tx_packets {rx,tx}_{tcp,udp,ohter}_{bytes,packets}

Bug: 6818637
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agogpu: ion: Only flush buffers in the chunk heap if they were used cached
Rebecca Schultz Zavin [Mon, 14 Jan 2013 23:29:10 +0000 (15:29 -0800)]
gpu: ion: Only flush buffers in the chunk heap if they were used cached

Change-Id: I4ffcf81a6be09e968310bbd882fb017415d61b48
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Refactor the code to zero buffers
Rebecca Schultz Zavin [Wed, 9 Jan 2013 19:26:37 +0000 (11:26 -0800)]
gpu: ion: Refactor the code to zero buffers

Refactor the code in the system heap used to map and zero the buffers
into a seperate utility so it can be called from other heaps.  Use it from
the chunk heap.

Change-Id: I706341ae42b80bc4aae8a8614b4f73435bbf05d9
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agocpufreq: interactive: fix race on governor start/stop
Lianwei Wang [Mon, 7 Jan 2013 06:15:51 +0000 (14:15 +0800)]
cpufreq: interactive: fix race on governor start/stop

There is race condition when both two cpu do CPUFREQ_GOV_STOP and one cpu
do CPUFREQ_GOV_START soon. The sysfs_remove_group is not done yet on one
cpu, but sysfs_create_group is called on another cpu, which cause governor
start failed and then kernel panic in timer callback because the policy and
cpu mask are all kfree in cpufreq driver.

Replace atomic with mutex to lock the whole START/STOP sequence.

Change-Id: I3762b3d44315ae021b8275aca84f5ea9147cc540
Signed-off-by: Lianwei Wang <a22439@motorola.com>
11 years agonetfilter: xt_qtaguid: remove AID_* dependency for access control
JP Abgrall [Sat, 5 Jan 2013 02:18:36 +0000 (18:18 -0800)]
netfilter: xt_qtaguid: remove AID_* dependency for access control

qtaguid limits what can be done with /ctrl and /stats based on group
membership.
This changes removes AID_NET_BW_STATS and AID_NET_BW_ACCT, and picks
up the groups from the gid of the matching proc entry files.

Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: I42e477adde78a12ed5eb58fbc0b277cdaadb6f94

11 years agogpu: ion: Modify zeroing code so it only allocates address space once
Rebecca Schultz Zavin [Wed, 19 Dec 2012 06:46:57 +0000 (22:46 -0800)]
gpu: ion: Modify zeroing code so it only allocates address space once

vmap/vunmap spend a significant amount of time allocating the
address space to map into.  Rather than allocating address space
for each page, instead allocate once for the entire allocation
and then just map and unmap each page into that address space.

Change-Id: I4a5c850717c80f75506a36b7ec2bcd55857b8dea
Signed-off-by: Rebecca Schultz Zavin <rschultz@google.com>
11 years agocpufreq: interactive: fix deadlock on spinlock in timer
Todd Poynor [Wed, 2 Jan 2013 21:14:00 +0000 (13:14 -0800)]
cpufreq: interactive: fix deadlock on spinlock in timer

Need to use irqsave/restore spinlock calls to avoid a deadlock in calls
from the timer.

Change-Id: I15b6b590045ba1447e34ca7b5ff342723e53a605
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: don't handle transition notification if not enabled
Todd Poynor [Sun, 23 Dec 2012 20:28:49 +0000 (12:28 -0800)]
cpufreq: interactive: don't handle transition notification if not enabled

If multiple governors are in use then avoid processing frequency transition
notifications for CPUs on which the interactive governor is not enabled.

Change-Id: Ibd75255b921d887501a64774a8c4f62302f2d4e4
Reported-by: Francisco Franco <francisco.franco@cloudcar.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: init default values at compile time
Todd Poynor [Fri, 21 Dec 2012 23:32:21 +0000 (15:32 -0800)]
cpufreq: interactive: init default values at compile time

Change-Id: Ia4966e949a6c24c34fdbd4a6e522cd7c37e4108e
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: default go_hispeed_load 99%, doc updates
Todd Poynor [Fri, 21 Dec 2012 23:13:01 +0000 (15:13 -0800)]
cpufreq: interactive: default go_hispeed_load 99%, doc updates

Update default go_hispeed_load from 85% to 99%.  Recent changes to the
governor now use a default target_load of 90%.  go_hispeed_load should
not be lower than the target load for hispeed_freq, which could lead
to oscillating speed decisions.  Other recent changes reduce the need
to dampen speed jumps on load spikes, while input event boosts from
userspace are the preferred method for anticipating load spikes with
UI impacts.

General update to the documentation to reflect recent changes.

Change-Id: I1b92f3091f42c04b10503cd1169a943b5dfd6faf
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: fix race on timer restart on governor start
Todd Poynor [Thu, 20 Dec 2012 23:51:00 +0000 (15:51 -0800)]
cpufreq: interactive: fix race on timer restart on governor start

Starting the governor, or restarting on a hotplugged-in CPU, can race
with the timer start in idle, triggering a BUG on timer already pending.
Start the timer before setting the enable flag, and use enable_sem to
protect the sequence (and ensure correct order of the update to the
enable flag).  Delete any existing timer for safety.

Change-Id: Ife77cf9fe099e8fd8543224cbf148c6722c2ffb0
Reported-by: Francisco Franco <francisco.franco@cloudcar.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: fix racy timer stopping
Todd Poynor [Wed, 19 Dec 2012 01:50:44 +0000 (17:50 -0800)]
cpufreq: interactive: fix racy timer stopping

When stopping the governor, del_timer_sync() can race against an
invocation of the idle notifier callback, which has the potential
to reactivate the timer.

To fix this issue, a read-write semaphore is used. Multiple readers are
allowed as long as pcpu->governor_enabled is true.  However it can be
moved to false only after taking a write semaphore which would wait for
any on-going asynchronous activities to complete and prevent any more of
those activities to be initiated.

[toddpoynor@google.com: cosmetic and commit text changes]
Change-Id: Ib51165a735d73dcf964a06754c48bdc1913e13d0
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
11 years agocpufreq: interactive: fix boosting logic
Todd Poynor [Thu, 20 Dec 2012 00:06:48 +0000 (16:06 -0800)]
cpufreq: interactive: fix boosting logic

35a84de cpufreq: interactive: apply above_hispeed_delay to each step above hispeed

caused the speed choice logic to osciallate between boosting and not boosting.
Add back code to ensure speed does not drop below boost frequency while
boosting.

Change-Id: Id420068480fcc7f5c4989ff523e2a8d22e2f4db2
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: add timer slack to limit idle at speed > min
Todd Poynor [Wed, 19 Dec 2012 01:50:10 +0000 (17:50 -0800)]
cpufreq: interactive: add timer slack to limit idle at speed > min

Always use deferrable timer for load sampling.

Set a non-deferrable timer to an additional slack time to allow prior to
waking up from idle to drop speed when not at minimum speed.  Slack value
-1 avoids wakeups to drop speed.  Default is 80ms.

Remove the governidle module param and its timer management in idle.  For
platforms on which holding speed above mimum in idle costs power, use the
new timer slack to select how long to wait before waking up to drop speed.

Change-Id: I270b3980667e2c70a68e5bff534124b4411dbad5
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agohardlockup: detect hard lockups without NMIs using secondary cpus
Colin Cross [Fri, 11 Jan 2013 21:51:48 +0000 (13:51 -0800)]
hardlockup: detect hard lockups without NMIs using secondary cpus

Emulate NMIs on systems where they are not available by using timer
interrupts on other cpus.  Each cpu will use its softlockup hrtimer
to check that the next cpu is processing hrtimer interrupts by
verifying that a counter is increasing.

This patch is useful on systems where the hardlockup detector is not
available due to a lack of NMIs, for example most ARM SoCs.
Without this patch any cpu stuck with interrupts disabled can
cause a hardware watchdog reset with no debugging information,
but with this patch the kernel can detect the lockup and panic,
which can result in useful debugging info.

Signed-off-by: Colin Cross <ccross@android.com>
11 years agocpufreq: interactive: specify duration of CPU speed boost pulse
Todd Poynor [Sat, 15 Dec 2012 01:31:19 +0000 (17:31 -0800)]
cpufreq: interactive: specify duration of CPU speed boost pulse

Sysfs attribute boostpulse_duration specifies the duration of boosting CPU
speed in response to bootpulse events.  Duration is specified in usecs,
default 80ms.

Change-Id: Ifd41625574891a44f1787a4e85d1e7b4f2afb52b
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: adjust load for changes in speed
Todd Poynor [Wed, 12 Dec 2012 00:05:03 +0000 (16:05 -0800)]
cpufreq: interactive: adjust load for changes in speed

Add notifier for speed transitions.  Keep a count of CPU active
microseconds times current frequency, converted to a percentage relative
to the current frequency when load is evaluated.

Change-Id: I5c27adb11081c50490219784ca57cc46e97fc28c
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agogpu: ion: Remove heapmask from client
Rebecca Schultz Zavin [Tue, 11 Dec 2012 23:23:14 +0000 (15:23 -0800)]
gpu: ion: Remove heapmask from client

The heapmask in the client generally wasn't being used.  This
patch removes it.

Change-Id: I3526723fbf8f2e81c28c0733deb583ea14bdd837
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Export ion_client_create
Johan Mossberg [Mon, 10 Dec 2012 16:46:16 +0000 (17:46 +0100)]
gpu: ion: Export ion_client_create

Will enable modules to allocate memory with ion.

Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
11 years agogpu: ion: Clarify variable names and comments around heap ids v types
Rebecca Schultz Zavin [Tue, 11 Dec 2012 19:45:59 +0000 (11:45 -0800)]
gpu: ion: Clarify variable names and comments around heap ids v types

There is some confusion between when to use the heap type and when
the id.  This patch clarifies this by using clearer variable names
and describing the intention in the comments.  Also fixes the client
debug code to print heaps by id instead of type.

Change-Id: Ie8b3dadded52e18590fcb2ca94001f6ed46ef07d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Add chunk heap
Rebecca Schultz Zavin [Thu, 15 Nov 2012 18:52:45 +0000 (10:52 -0800)]
gpu: ion: Add chunk heap

This patch adds support for a chunk heap that allows for buffers that are
made up of a list of fixed size chunks taken from a carveout.  Chunk sizes
are configured when the heaps are created by passing the chunk size in the
priv field of the heap platform data.

Change-Id: Ia9e003f727b553a92804264debe119dcf78b14e0
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Refactor common mapping functions out of system heap
Rebecca Schultz Zavin [Thu, 15 Nov 2012 18:43:46 +0000 (10:43 -0800)]
gpu: ion: Refactor common mapping functions out of system heap

The system heap contained several general purpose functions to map
buffers to the kernel and userspace.  This patch refactors those
into ion_heap.c so they can be used by other heaps.

Change-Id: If64591798bdc2c248bf9064ace2c927909d7adb8
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Switch heap rbtree to a prio list
Rebecca Schultz Zavin [Thu, 15 Nov 2012 18:36:10 +0000 (10:36 -0800)]
gpu: ion: Switch heap rbtree to a prio list

Switches the rbtree tree of heaps for a plist.  This significantly
simplifies the code and the list is small and is modified only at
first boot so the rbtree is unnecessary.  This also switches
the traversal of the heap list to traverse from highest to lowest
id's.  This allows allocations to pass a heap mask that falls
back on the system heap -- typically id 0, which is the common case.

Change-Id: I715be6f4cf020a84ca4f1947c30ee3d2559fb523
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Fix bug where MAP ioctl was no longer supported
Rebecca Schultz Zavin [Thu, 15 Nov 2012 18:34:45 +0000 (10:34 -0800)]
gpu: ion: Fix bug where MAP ioctl was no longer supported

Change-Id: Idbe628ed7dbd6a14469194120b94934d6e99d367
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Modify reserve function for carveouts with no start address
Rebecca Schultz Zavin [Thu, 15 Nov 2012 18:31:02 +0000 (10:31 -0800)]
gpu: ion: Modify reserve function for carveouts with no start address

This patch allows you to specify a heap that requires carveout memory
but that doesn't specify a start address.  Memblock_alloc will be called
to find a location for these heaps.

Change-Id: I9c79b30e3105e796060fc74b058f04093ee5e96e
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agocpufreq: interactive: remove load since last speed change
Todd Poynor [Sat, 8 Dec 2012 04:08:45 +0000 (20:08 -0800)]
cpufreq: interactive: remove load since last speed change

The longer-term load since last speed change isn't terribly useful,
may delay recognition of dropping load, and would need forthcoming
changes to adjust load for changing CPU speeds.  Drop it.

Change-Id: Ic3cbb0542cc3484617031787e03ed9bdd632dec1
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: allow arbitrary speed / target load mappings
Todd Poynor [Wed, 14 Nov 2012 19:41:21 +0000 (11:41 -0800)]
cpufreq: interactive: allow arbitrary speed / target load mappings

Accept a string of target loads and speeds at which to apply the
target loads, per the documentation update in this patch.  For example,
"85 1000000:90 1700000:99" targets CPU load 85% below speed 1GHz,  90%
at or above 1GHz, until 1.7GHz and above, at which load 99% is targeted.

Attempt to avoid oscillations by evaluating the current speed
weighted by current load against each new choice of speed, choosing a
higher speed if the current load requires a higher speed.

Change-Id: Ie3300206047c84eca5a26b0b63ea512e5207550e
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agogpu: ion: fix compilation warning
Benjamin Gaignard [Tue, 9 Oct 2012 11:39:25 +0000 (13:39 +0200)]
gpu: ion: fix compilation warning

use atomic_read to get the refcount value to avoid compilation warning

Change-Id: I9bf0a07c787af8f87ac19314f996a78142f72f6b
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11 years agogpu: ion: fix carveout ops
Benjamin Gaignard [Wed, 17 Oct 2012 09:32:02 +0000 (11:32 +0200)]
gpu: ion: fix carveout ops

when using carveout heap ion_buffer_create function failed because
map_dma and unmap_dma operations aren't set by carveout heap.

Change-Id: I817bfad742abfab10b01d9b3d2e18bdf812a1307
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11 years agogpu: ion: Fix bug in zeroing pages in system heap
Rebecca Schultz Zavin [Mon, 3 Dec 2012 19:43:49 +0000 (11:43 -0800)]
gpu: ion: Fix bug in zeroing pages in system heap

Pages are zeroed for security purposes when returned to the
ion heap.  There was a bug in this code preventing this
from happening.

Bug: 7573871
Change-Id: I79c22ee1da98f306199f3a192eaec4e81d5fd059
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agocpufreq: interactive: apply above_hispeed_delay to each step above hispeed
Todd Poynor [Thu, 8 Nov 2012 23:06:55 +0000 (15:06 -0800)]
cpufreq: interactive: apply above_hispeed_delay to each step above hispeed

Apply above_hispeed_delay whenever increasing speed to a new speed above
hispeed (not just the first step above hispeed).

Change-Id: Ibb7add7db47f2a4306a9458c4e1ebabb60698636
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: change speed according to current speed and target load
Todd Poynor [Thu, 29 Nov 2012 01:58:17 +0000 (17:58 -0800)]
cpufreq: interactive: change speed according to current speed and target load

Add a target_load attribute that specifies how aggressively the governor is
to adjust speed to meet the observed load.  New target speed is calculated
as the current actual speed (may be higher than target speed on SMP) times
the CPU load (as a fraction) divided by target load (fraction).

cpufreq_frequency_table_target() call use CPUFREQ_RELATION_L to set
the next higher speed rather than next lower speed.

Change-Id: If432451da82f5fed12e15c9421d7d27792376150
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: trace actual speed in target speed decisions
Todd Poynor [Thu, 29 Nov 2012 01:56:09 +0000 (17:56 -0800)]
cpufreq: interactive: trace actual speed in target speed decisions

Tracing adds actual speed since this is expected to be key to the
choice of target speed.

Change-Id: Iec936102d0010c4e9dfa143c38a9fd0d551189c3
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agousb: gadget: accessory: Fix section mismatch (again)
Todd Poynor [Wed, 28 Nov 2012 21:03:40 +0000 (13:03 -0800)]
usb: gadget: accessory: Fix section mismatch (again)

create_bulk_endpoints should not be __init since it is called when
accessory is enabled.

Change-Id: Iac6e9f29d53c93760e926efd8e7603432632acb4
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agonetfilter: qtaguid: Don't BUG_ON if create_if_tag_stat fails
Pontus Fuchs [Mon, 19 Nov 2012 19:44:51 +0000 (11:44 -0800)]
netfilter: qtaguid: Don't BUG_ON if create_if_tag_stat fails

If create_if_tag_stat fails to allocate memory (GFP_ATOMIC) the
following will happen:

qtaguid: iface_stat: tag stat alloc failed
...
kernel BUG at xt_qtaguid.c:1482!

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
11 years agocpufreq: interactive: kick timer on idle exit past expiry
Todd Poynor [Tue, 9 Oct 2012 03:14:34 +0000 (20:14 -0700)]
cpufreq: interactive: kick timer on idle exit past expiry

The deferrable timer list isn't checked on all idle exits, such as when
hi-res timers expire or ISRs schedule workers.  If the idle loop is
exited and it's past time to run the governor load polling timer,
run it immediately.  This ensures we handle load spikes caused by actvity
that does not run the normal timer list.

Rename the field that timestamps the "time_in_idle" value to be more
accurate.

Change-Id: Ied590ecbefc83c9a9ec5eb9e31903557f6fa1614
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: use deferrable timer by default
Lianwei Wang [Thu, 1 Nov 2012 01:59:52 +0000 (09:59 +0800)]
cpufreq: interactive: use deferrable timer by default

Avoid wakeups only to handle the governor timer when the system is otherwise
idle.

For platforms where the power cost of remaining in idle at higher CPU
speed may outweigh the cost of a governor wakeup from idle to lower the speed,
set parameter cpufreq_interactive.governidle=1.

Change-Id: Id6c43eb35caecf9b0574fcdd5b769711bc7e6de6
Signed-off-by: LianWei WANG <a22439@motorola.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: pin timers to associated CPU
Todd Poynor [Mon, 5 Nov 2012 21:09:03 +0000 (13:09 -0800)]
cpufreq: interactive: pin timers to associated CPU

Helps avoid waking up other CPUs to react to activity on the local CPU.

Change-Id: Ife272aaa7916894a437705d44521b1a1693fbe8e
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoARM: fiq_debugger: fix uninitialised spin_lock.
Mars [Sat, 3 Nov 2012 04:15:38 +0000 (12:15 +0800)]
ARM: fiq_debugger: fix uninitialised spin_lock.

Backtrace:
[<c0045ea0>] (dump_backtrace+0x0/0x10c) from [<c0575c60>] (dump_stack+0x1)
 r6:c07a489c r5:c0c9b9dc r4:00000002 r3:271aed3b
[<c0575c48>] (dump_stack+0x0/0x1c) from [<c00b1b00>] (__lock_acquire+0x93)
[<c00b11c8>] (__lock_acquire+0x0/0xad4) from [<c00b219c>] (lock_acquire+0)
[<c00b210c>] (lock_acquire+0x0/0xa4) from [<c057e544>] (_raw_spin_lock_ir)
[<c057e4f8>] (_raw_spin_lock_irq+0x0/0x5c) from [<c005297c>] (fiq_tty_wri)
 r5:e30f0000 r4:e36f0c00
[<c005293c>] (fiq_tty_write+0x0/0x80) from [<c023168c>] (n_tty_write+0x18)
 r8:e370fc40 r7:e378a000 r6:e3572d1c r5:e36f0c00 r4:00000002
r3:c005293c
[<c0231500>] (n_tty_write+0x0/0x440) from [<c022d4a4>] (tty_write+0x100/0)
[<c022d3a4>] (tty_write+0x0/0x2a8) from [<c0100b80>] (vfs_write+0xa4/0x14)
[<c0100adc>] (vfs_write+0x0/0x148) from [<c0100cdc>] (sys_write+0x40/0x78)
 r8:00000002 r7:4076d2c4 r6:e370fc40 r5:00000000 r4:00000000
[<c0100c9c>] (sys_write+0x0/0x78) from [<c0041740>] (ret_fast_syscall+0x0)
 r8:c0041908 r7:00000004 r6:00000002 r5:00000000 r4:4007cbe0

[ccross: moved spin_lock_init into existing #ifdef]
Change-Id: If400d084eb20433c126ea1dd027a6be7f2ebb1f6
Signed-off-by: Mars <caoziqiang@meizu.com>
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fiq_debugger: lock between tty and console writes
Colin Cross [Thu, 1 Nov 2012 00:41:39 +0000 (17:41 -0700)]
ARM: fiq_debugger: lock between tty and console writes

debug_console_write calls debug_uart_flush, which will usually wait
until the serial port fifo empties.  If another thread is continuously
calling fiq_tty_write, the fifo will constantly be refilled and
debug_uart_flush might never return.

Add a spinlock that is locked in debug_console_write and fiq_tty_write
to ensure they can't run at the same time.  This has an extra advantage
of preventing lines from the console and tty from being mixed together.

Also reduce the size returned by fiq_tty_write_room to keep the time
spent with the spinlock held to a reasonable value.

In addition, make sure fiq context can't loop forever by never calling
debug_uart_flush when the console is enabled.

Change-Id: I5712b01f740ca0c84f680d2032c9fa16b7656939
Signed-off-by: Colin Cross <ccross@android.com>
11 years agosync: add Documentation/sync.txt
Erik Gilling [Fri, 14 Sep 2012 21:36:34 +0000 (14:36 -0700)]
sync: add Documentation/sync.txt

Change-Id: Ic7f3a6d4622083be607b82ddd8d676609225bb8f
Signed-off-by: Erik Gilling <konkers@android.com>
11 years agogpu: ion: Fix bug in ion_system_heap map_user
Rebecca Schultz Zavin [Tue, 23 Oct 2012 17:47:04 +0000 (10:47 -0700)]
gpu: ion: Fix bug in ion_system_heap map_user

When the requested mmap length was not an integer number of
chunks or the buffer, or if an offset was provided, a bug
would cause extra or incorrect pages of the buffer to be mapped.

Change-Id: I2766763d86048f026eeef0e0388b7de0e25c2093
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Don't flush allocatoins that come from the page pools
Rebecca Schultz Zavin [Fri, 19 Oct 2012 04:54:01 +0000 (21:54 -0700)]
gpu: ion: Don't flush allocatoins that come from the page pools

Change-Id: Ib08cb2cea3b6ea4b1ebf5a1b28abe6b9374fd2bd
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Clear GFP_WAIT flag on high order allocations
Rebecca Schultz Zavin [Fri, 19 Oct 2012 04:51:53 +0000 (21:51 -0700)]
gpu: ion: Clear GFP_WAIT flag on high order allocations

This will prevent the kernel from kicking off compaction
when higher order allocations are made.  Instead we will
get these high order allocations only if they are readily
available.

Change-Id: I5c038781ef4028c1c0a1a52b6cb549d26550a124
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agopower: android-battery: Allow changing current in charging state
Danke Xie [Tue, 16 Oct 2012 22:24:41 +0000 (15:24 -0700)]
power: android-battery: Allow changing current in charging state

When a new charge source is set, enable charging and set the charging
current, unless we've paused charging due to battery full or battery
health problems.

Change-Id: I129e621c455a941e264dc431b4eb9db6a17c9f7b
Signed-off-by: Danke Xie <d.xie@sta.samsung.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agostaging:iio:events: Don't copy data to user-space with a locked spinlock.
Arve Hjønnevåg [Tue, 16 Oct 2012 03:58:20 +0000 (20:58 -0700)]
staging:iio:events: Don't copy data to user-space with a locked spinlock.

iio_event_chrdev_read would return -EFAULT if the user-space page was
not resident.

Change-Id: I4ac5d3bc791bb503d014d9db576b9d6d522505b2
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agogpu: ion: Refactor locking
Rebecca Schultz Zavin [Thu, 11 Oct 2012 19:46:05 +0000 (12:46 -0700)]
gpu: ion: Refactor locking

Removes contention for lock between allocate and free by reducing
the length of time the lock is held for.  Split out a seperate
lock to protect the list of heaps and replace it with a rwsem since
the list will most likely only be updated during initialization.

Change-Id: I3017ccaa2126c7a24ab22b18e1ee553983977c37
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agopower: android-battery: Battery health check only when connected to charger
HongMin Son [Thu, 11 Oct 2012 10:42:54 +0000 (19:42 +0900)]
power: android-battery: Battery health check only when connected to charger

Only check battery health when connected to a charger.

Change-Id: I43e3f73ac1e5862f8e6dbaa19daa6d322f3bba20
Signed-off-by: HongMin Son <hongmin.son@samsung.com>
11 years agogpu: ion: Switch to using a single shrink function
Rebecca Schultz Zavin [Wed, 10 Oct 2012 21:19:17 +0000 (14:19 -0700)]
gpu: ion: Switch to using a single shrink function

The single shrink function will free lower order pages first. This
enables compaction to work properly.

Change-Id: Icbeefa9e84c2eacf6962d9536ab66a8b059cc941

11 years agogpu: ion: Fix lockdep issue in ion_page_pool
Rebecca Schultz Zavin [Wed, 10 Oct 2012 17:34:50 +0000 (10:34 -0700)]
gpu: ion: Fix lockdep issue in ion_page_pool

Currently the mutex is held while kmalloc is called, under a low memory
condition this might trigger the shrinker which also takes this mutex.
Refactor so the mutex is not held during allocation.

Change-Id: Ic1d3b2f69e61209191bac84724ba56f6b98e2bc4
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agonetfilter: xt_qtaguid: fix error exit that would keep a spinlock.
JP Abgrall [Wed, 10 Oct 2012 03:38:21 +0000 (20:38 -0700)]
netfilter: xt_qtaguid: fix error exit that would keep a spinlock.

qtudev_open() could return with a uid_tag_data_tree_lock held
when an kzalloc(..., GFP_ATOMIC) would fail.
Very unlikely to get triggered AND survive the mayhem of running out of mem.

Signed-off-by: JP Abgrall <jpa@google.com>
11 years agogpu: ion: Fix several issues with page pool
Rebecca Schultz Zavin [Tue, 9 Oct 2012 06:01:23 +0000 (23:01 -0700)]
gpu: ion: Fix several issues with page pool

Split out low and high mem pages so they are correctly reported
when the shrinker is called.
Fix potential deadlock caused by holding the page pool lock while
allocationg and also needing that lock from the shrink function

Change-Id: I6def3a3111f59914ef6b5b59d81a6fde37cb60c5
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agopower: android-battery: use freezable workqueue for monitor
Todd Poynor [Fri, 5 Oct 2012 09:04:45 +0000 (02:04 -0700)]
power: android-battery: use freezable workqueue for monitor

Alarmtimer may execute the monitor early in the resume sequence.  Freeze the
monitor while suspended, and unfreeze after the battery charger and fuel gauge,
etc. drivers are resumed.

Change-Id: Iefda1c642d4b2440169d90d2bee2888fc70e030a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agomm: vmscan: Add a debug file for shrinkers
Rebecca Schultz Zavin [Fri, 5 Oct 2012 20:54:59 +0000 (13:54 -0700)]
mm: vmscan: Add a debug file for shrinkers

This patch adds a debugfs file called "shrinker" when read this calls
all the shrinkers in the system with nr_to_scan set to zero and prints
the result.  These results are the number of objects the shrinkers have
available and can thus be used an indication of the total memory
that would be availble to the system if a shrink occurred.

Change-Id: Ied0ee7caff3d2fc1cb4bb839aaafee81b5b0b143
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agopower: android-battery: Fix battery alarm timer not modified at suspend
HongMin Son [Fri, 5 Oct 2012 04:22:31 +0000 (13:22 +0900)]
power: android-battery: Fix battery alarm timer not modified at suspend

     - Alarm Timer driver is suspended before battery driver, so alarm
       timer was not changed to slow poll speed at suspend.  Use PM
       notifiers instead.
     - If charger is connected, keep 1 min alarm timer.

Signed-off-by: HongMin Son <hongmin.son@samsung.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Change-Id: Id0f3bda5d0749fd90f1964073bc30c1a73fc317f

11 years agopower: android-battery: leave full/not-charging status when charger re-sensed
Todd Poynor [Thu, 4 Oct 2012 23:11:53 +0000 (16:11 -0700)]
power: android-battery: leave full/not-charging status when charger re-sensed

If charger was connected and a charge source change event occurs such that
the charger is still connected (or a different charge source connected),
do not overwrite an existing state such as full or not-charging.  Only
switch from discharging to charging on a charge source change event.

Change-Id: I1b841c8f3a92bf15074999e18b17d1d19ce028d7
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agopower: android-battery: Add state locking
Todd Poynor [Thu, 4 Oct 2012 22:09:52 +0000 (15:09 -0700)]
power: android-battery: Add state locking

Change-Id: I83abd61f0ee2541f5406258b2c07f76af7d2acb5
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agopower: android-battery: add charge timeouts and recharge logic
HongMin Son [Fri, 28 Sep 2012 05:03:31 +0000 (14:03 +0900)]
power: android-battery: add charge timeouts and recharge logic

Add recharge logic when voltage threshold reached.

Add charge and recharge timeouts.

Change-Id: I3ef3b926ce694115dde7f8056072bef63884a5d0
Signed-off-by: HongMin Son <hongmin.son@samsung.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: run at fraction of hispeed_freq when load is low
Todd Poynor [Wed, 3 Oct 2012 07:39:56 +0000 (00:39 -0700)]
cpufreq: interactive: run at fraction of hispeed_freq when load is low

When load is below go_hispeed_load, apply the percentage of CPU load to
a max frequency of hispeed_freq instead of the max speed.  This avoids
jumping too quickly to hispeed_freq when it is a relatively low
percentage of max speed.  This also allows go_hispeed_load to be set to
a high percentage relative to hispeed_freq (as a percentage of max speed,
again useful when hispeed_freq is a low fraction of max speed), to cap
larger loads at hispeed_freq.  For example, a load of 60% will typically
move to 60% of hispeed_freq, not 60% of max speed.  This causes the
governor to apply two different speed caps, depending on whether load is
below or above go_hispeed_load.

Also fix the type of hispeed_freq, which was u64, to match other
speed data types (and avoid overhead and allow division).

Change-Id: Ie2d0668be161c074aaad77db2037505431457b3a
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agogpu: ion: Modify gfp flags in ion_system_heap
Rebecca Schultz Zavin [Wed, 3 Oct 2012 05:43:41 +0000 (22:43 -0700)]
gpu: ion: Modify gfp flags in ion_system_heap

When allocations larger than order 4 are made, use _GFP_NORETRY
and __GFP_NO_KSWAPD so kswapd doesn't get kicked off to reclaim
these larger chunks.  For smaller allocaitons, these are
unnecessary, as the system should be able to reclaim these.

Change-Id: I6b45cd1a595d25cc39622e3dbcc04d84fa1b7db8
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Use the ion_page_pool from the system heap
Rebecca Schultz Zavin [Tue, 7 Aug 2012 04:37:23 +0000 (21:37 -0700)]
gpu: ion: Use the ion_page_pool from the system heap

With this change the system heap will use pagepools to avoid
having to invalidate memory when it is allocated, a
significant performance improvement on some systems.

Change-Id: I96ab778d67c4b19805883dcfa44d750811cdff48
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Add ion_page_pool.
Rebecca Schultz Zavin [Thu, 7 Jun 2012 23:36:44 +0000 (16:36 -0700)]
gpu: ion: Add ion_page_pool.

This patch adds a new utility heaps can use to manage
memory.  In the past we have found it can be very
expensive to manage the caches when allocating memory,
but it is imposible to know whether a previous user of a
given memory allocation had a cached mapping. This patch
adds the ability to store a pool of pages that were
previously used uncached so that cache maintenance
only need be done when growing this pool.  The pool also
contains a shrinker so memory from the pool can be
recovered in low memory conditions.

Change-Id: I686fd7d192060fd32d34ef66471f62b7829006ee
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: use vmalloc to allocate page array to map kernel
Rebecca Schultz Zavin [Sun, 30 Sep 2012 21:53:27 +0000 (14:53 -0700)]
gpu: ion: use vmalloc to allocate page array to map kernel

When ion_map_kernel is execute the system must allocate
an array large enough to hold a pointer to each page in
the buffer.  If the buffer is very large and the system
memory has become very fragmented, there may not be
sufficient high order allocations available from kmalloc.
Use vmalloc instead.

Change-Id: I5fabf79be6cfd158f7805bfca6267a60c4708582
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agostaging: android: lowmemorykiller: Add config option to support oom_adj values
Arve Hjønnevåg [Wed, 26 Sep 2012 00:37:14 +0000 (17:37 -0700)]
staging: android: lowmemorykiller: Add config option to support oom_adj values

The conversion to use oom_score_adj instead of the deprecated oom_adj
values breaks existing user-space code. Add a config option to convert
oom_adj values written to oom_score_adj values if they appear to be
valid oom_adj values.

Change-Id: I68308125059b802ee2991feefb07e9703bc48549
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agogpu: ion: ion_system_heap: Fix bug preventing compilation
Rebecca Schultz Zavin [Wed, 26 Sep 2012 17:58:30 +0000 (10:58 -0700)]
gpu: ion: ion_system_heap: Fix bug preventing compilation

Change-Id: I91d77492b99d09c7abdfaa09df280a20ee83f428
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: Stop trying to allocate from an order on first failure
Rebecca Schultz Zavin [Wed, 26 Sep 2012 03:55:27 +0000 (20:55 -0700)]
gpu: ion: Stop trying to allocate from an order on first failure

With this patch the system heap will only try to allocate from each
order as long as allocations succeed.  If it failes to obtain a higher
order allocation, it doesn't retry that order.

Change-Id: I0d9144b4c30cc0e427acdcad2f1f12ae7f37f827
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agogpu: ion: optimize system heap for non fault buffers
Rebecca Schultz Zavin [Fri, 21 Sep 2012 18:46:06 +0000 (11:46 -0700)]
gpu: ion: optimize system heap for non fault buffers

If a buffer's user mappings are not going to be faulted
in it need not be allocated page wise.  We can optimize
this common case by allocating an sglist of larger chunks
rather than creating an entry for each page in the
allocation.

Change-Id: I47814990e55c7bdb7abeaa2af824744b0a97602d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agocpufreq: interactive: always limit initial speed bump to hispeed
Todd Poynor [Tue, 25 Sep 2012 01:03:58 +0000 (18:03 -0700)]
cpufreq: interactive: always limit initial speed bump to hispeed

First bump speed up to hispeed_freq whenever the current speed is below
hispeed_freq, instead of only when the current speed is the minimum speed.
The previous code made it too difficult to use hispeed_freq as a common
intermediate speed on systems that frequently run at speeds between
minimum and hispeed_freq.

Change-Id: I04ec30bafabf5741e267ff289209b8c2d846824b
Signed-off-by: Todd Poynor <toddpoynor@google.com>