Commit Graph

214827 Commits

Author SHA1 Message Date
Mark Salyzyn 7c2433eca7 USB: gadget: android: Integrate f_midi USB MIDI gadget driver part deux
free_ep_req and alloc_ep_req are static open coded and conflicting
in f_midi.c. The exported versions are present in f_sourcesink.c.
Changed names to protect the innocent.

Change-Id: I4aee40054b5715d0532d433d23dea2bccff7ec30
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Git-commit: ae2019d83ecf14454315240c16dc3136212f0da2
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
2020-07-11 13:58:23 +02:00
Oliver Neukum fb1fbb441b Input: ff-memless - kill timer in destroy()
commit fa3a5a1880c91bb92594ad42dfe9eedad7996b86 upstream.

No timer must be left running when the device goes away.

Change-Id: Icd16bfab1811857f77e026577f340ad072aadab0
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-and-tested-by: syzbot+b6c55daa701fc389e286@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/1573726121.17351.3.camel@suse.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2020-07-11 12:51:00 +02:00
Monika Singh 265e1a22ad ARM: dts: msm: Untrusted pointer dereference
To avoid access of variable after being freed, using
list_first_entry_safe function to iterate over list
of given type, safe against removal of list entry.

Change-Id: I70611fddf3e9b80b1affa3e5235be24eac0d0a58
Signed-off-by: Monika Singh <monising@codeaurora.org>
CVE-2018-11988
2020-07-11 12:50:34 +02:00
voidanix a064cc8a2b SSM: Remove support for SSM driver
SSM driver is not enabled and hence needs deprecation.
Remove all the SSM driver references.

CRs-Fixed: 2268386
Change-Id: I02f82817023d2fcc6d05a2f0d7eb3aec8f60a7d5
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
CVE-2018-12010
2020-07-11 12:49:16 +02:00
Yavuz, Tuba 4240dbc1c4 USB: gadget: f_midi: fixing a possible double-free in f_midi
It looks like there is a possibility of a double-free vulnerability on an
error path of the f_midi_set_alt function in the f_midi driver. If the
path is feasible then free_ep_req gets called twice:

         req->complete = f_midi_complete;
         err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);
            => ...
             usb_gadget_giveback_request
               =>
                 f_midi_complete (CALLBACK)
                   (inside f_midi_complete, for various cases of status)
                   free_ep_req(ep, req); // first kfree
         if (err) {
                 ERROR(midi, "%s: couldn't enqueue request: %d\n",
                             midi->out_ep->name, err);
                 free_ep_req(midi->out_ep, req); // second kfree
                 return err;
         }

The double-free possibility was introduced with commit ad0d1a058eac
("usb: gadget: f_midi: fix leak on failed to enqueue out requests").

Found by MOXCAFE tool.

Signed-off-by: Tuba Yavuz <tuba@ece.ufl.edu>
Fixes: ad0d1a058eac ("usb: gadget: f_midi: fix leak on failed to enqueue out requests")
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Change-Id: I93342475b7e72ae44fed7d7c8f92d5f8dbf53c8a
2020-07-11 12:42:21 +02:00
Felipe F. Tonello 6ff18ae943 usb: gadget: f_midi: fail if set_alt fails to allocate requests
This ensures that the midi function will only work if the proper number of
IN and OUT requrests are allocated. Otherwise the function will work with less
requests then what the user wants.

Change-Id: If5964d44ebd1dfc7e705c7695ce9d12f83007cd2
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2020-07-11 12:42:21 +02:00
Felipe F. Tonello 51be2df5c4 usb: gadget: f_midi: fix leak on failed to enqueue out requests
This patch fixes a memory leak that occurs when an endpoint fails to enqueue
the request. If that happens the complete function will never be called, thus
never freeing the request.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

Change-Id: Ia0bcb5cbb7db7adb920402340f7ae658e2d32ae7
2020-07-11 12:42:21 +02:00
Hardik Arya 85a9ae72d3 diag: Reallocate dci buffer with proper required capacity
DCI command buffer reallocation is not done properly with
required capacity. The patch reallocates the same buffer and
updated capacity properly with header and response length.

Bug: 129549913
Bug: 144528162
Bug: 140423420
Change-Id: I7b5fd132b9241d0f1493bcb602a6b361e4ad9a04
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2020-07-11 12:31:00 +02:00
Hardik Arya 76926dada2 diag: Prevent out-of-bound access while processing dci transaction
Proper buffer length check is missing for dci userspace data
buffer before processing the dci transaction. The patch adds
proper check for the same.

Change-Id: I68c0e8c41d4e05493adecf8a1fcacea708dfafa2
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2020-07-11 12:30:28 +02:00
Manish Poddar 93e3a2e263 msm: Camera buffer overflow fix
find_first_zero bit is considering addr parameter as unsigned
long and we are passing int variable.In the function it access
addr[i], so it tries to access 8 bytes , actual size of
open_idx and stream_id are 4 bytes.we change open_idx and
stream_id to long to fix it.

Change-Id: I510059cc8f495957bd2b5af9973b3495761edd06
Signed-off-by: Manish Poddar <mpoddar@codeaurora.org>
2020-07-11 12:29:52 +02:00
jitendrathakare 9b32c32588 qseecom : Clear client handle after unmap the resources
When unloading the app, reset all client members to NULL
to protect from accessing the memory after being freed.

Change-Id: I573b9c6fde03539522d2b04724a2246660c62518
Signed-off-by: jitendra thakare <jitendrathakare@codeaurora.org>
2020-07-11 12:28:35 +02:00
Sultan Alsawaf 8a4a457523 msm: kgsl: Increase worker thread priority
Currently, the kgsl worker thread is erroneosly ranked right below
Android's audio threads in terms of priority.

The kgsl worker thread is in the critical path for rendering frames to the
display, so increase its priority to match the priority of MDSS' kthread (mdss_fb0).

Signed-off-by: Sultan Alsawaf <sultanxda@gmail.com>
Change-Id: I5635d6c8135726b3d9955121515996065f1a8eb2
2020-07-11 12:27:04 +02:00
Alan Stern 955b32c381 USB: core: Fix races in character device registration and deregistraion
The syzbot fuzzer has found two (!) races in the USB character device
registration and deregistration routines.  This patch fixes the races.

The first race results from the fact that usb_deregister_dev() sets
usb_minors[intf->minor] to NULL before calling device_destroy() on the
class device.  This leaves a window during which another thread can
allocate the same minor number but will encounter a duplicate name
error when it tries to register its own class device.  A typical error
message in the system log would look like:

    sysfs: cannot create duplicate filename '/class/usbmisc/ldusb0'

The patch fixes this race by destroying the class device first.

The second race is in usb_register_dev().  When that routine runs, it
first allocates a minor number, then drops minor_rwsem, and then
creates the class device.  If the device creation fails, the minor
number is deallocated and the whole routine returns an error.  But
during the time while minor_rwsem was dropped, there is a window in
which the minor number is allocated and so another thread can
successfully open the device file.  Typically this results in
use-after-free errors or invalid accesses when the other thread closes
its open file reference, because the kernel then tries to release
resources that were already deallocated when usb_register_dev()
failed.  The patch fixes this race by keeping minor_rwsem locked
throughout the entire routine.

Reported-and-tested-by: syzbot+30cf45ebfe0b0c4847a1@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.1908121607590.1659-100000@iolanthe.rowland.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: If9d91bedfcb49daa98f0fdd57845fc89adcf90d0
2020-07-11 12:25:34 +02:00
Alan Stern 4cd3c61d73 HID: Fix assumption that devices have inputs
commit d9d4b1e46d9543a82c23f6df03f4ad697dab361b upstream.

The syzbot fuzzer found a slab-out-of-bounds write bug in the hid-gaff
driver.  The problem is caused by the driver's assumption that the
device must have an input report.  While this will be true for all
normal HID input devices, a suitably malicious device can violate the
assumption.

The same assumption is present in over a dozen other HID drivers.
This patch fixes them by checking that the list of hid_inputs for the
hid_device is nonempty before allowing it to be used.

Reported-and-tested-by: syzbot+403741a091bf41d4ae79@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ica4d1b6adc1bcb30ce077f7d954cb8ba94bce730
2020-07-11 12:23:33 +02:00
Hillf Danton 17dd99e7e1 HID: hiddev: do cleanup in failure of opening a device
Undo what we did for opening before releasing the memory slice.

Reported-by: syzbot <syzbot+62a1e04fd3ec2abf099e@syzkaller.appspotmail.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: I77d0012394e6f517943f6b67e8dfce55b44389e0
2020-07-11 12:23:03 +02:00
Suren Baghdasaryan 3c2f8a8d47 staging: android: ashmem: Disallow ashmem memory from being remapped
When ashmem file is being mmapped the resulting vma->vm_file points to the
backing shmem file with the generic fops that do not check ashmem
permissions like fops of ashmem do. Fix that by disallowing mapping
operation for backing shmem file.

Bug: 142938932
Bug: 142903466
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I718dfca02c83845f8a41d88506871b0aa21326d7
2020-07-11 12:21:47 +02:00
Hikari-no-Tenshi 3f9930c3ec drivers: power: Fix 2% battery level drop
Signed-off-by: Shreyansh Lodha <slodha96@gmail.com>
Change-Id: I5b4354a877459b2c008fe32bda5b333d6dda8726
2020-06-19 15:11:09 +02:00
voidanix bff960c878 Revert "mdss: mdss_fb: backlight dimmer option"
This reverts commit ff1ca19734
2019-09-11 19:14:33 +00:00
voidanix a77da6f7bd leds-qpnp: add missing parenthesis 2019-08-26 18:32:32 +02:00
dianlujitao d7251620e2 ANDROID: dm: Always mount as linear target
* rootdev is mounted via device mapper with system-as-root layout
 * Lineage builds don't have verity enabled i.e it does even have verity
   metadata appended to the parition. Therefore always add rootdev as
   linear device and map the entire partition.

Change-Id: Idcc7a2e8ad7e709b86bc4b2cec9d4229bc1b9a5f
2019-08-26 17:34:14 +02:00
Badhri Jagan Sridharan 6892d3d9ca ANDROID: dm: mount as linear target if eng build
eng builds dont have verity enabled i.e it does even
have verity metadata appended to the parition. Therefore
add rootdev as linear device and map the entire partition
if build variant is "eng".

BUG: 29276559
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I8f5c2289b842b820ca04f5773525e5449bb3f355
2019-08-26 17:34:13 +02:00
Badhri Jagan Sridharan 55476bf555 ANDROID: dm: use default verity public key
If the dm-android-verity target does not provide a default
key try using the default public key from the system keyring.
The default verity keyid is passed as a kernel command line
argument veritykeyid=.

The order of the dm-android-verity params have been reversed
to facilitate the change.

Old format example:
dm="system none ro,0 1 android-verity Android:#7e4333f9bba00adfe0ede979e28ed1920492b40f /dev/mmcblk0p43"

New formats supported:
dm="system none ro,0 1 android-verity /dev/mmcblk0p43 Android:#7e4333f9bba00adfe0ede979e28ed1920492b40f"

(or)

dm="system none ro,0 1 android-verity /dev/mmcblk0p43"
when veritykeyid= is set in the kernel command line.

BUG: 28384658
Bug: 28845874
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I506c89b053d835ab579e703eef2bc1f8487250de
2019-08-26 17:34:13 +02:00
Badhri Jagan Sridharan 2943b35063 ANDROID: dm: fix signature verification flag
The bug was that the signature verification was only
happening when verity was disabled. It should always
happen when verity is enabled.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I2d9354e240d36ea06fc68c2d18d8e87b823a4c2f
2019-08-26 17:34:12 +02:00
Jeremy Compostella c7a1db302f ANDROID: dm: use name_to_dev_t
This patch makes android_verity_ctr() parse its block device string
parameter with name_to_dev_t().  It allows the use of less hardware
related block device reference like PARTUUID for instance.

(Cherry-picked from https://android-review.googlesource.com/#/c/215901)

Change-Id: Idb84453e70cc11abd5ef3a0adfbb16f8b5feaf07
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2019-08-26 17:34:12 +02:00
Badhri Jagan Sridharan b0301870b0 ANDROID: dm: rename dm-linear methods for dm-android-verity
This keeps linear_target as static variable and just exposes
the linear target methods for android-verity

Cherry-picked: https://android-review.googlesource.com/#/c/212858

Change-Id: I4a377e417b00afd9ecccdb3e605fea31a7df112e
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
2019-08-26 17:34:11 +02:00
Jan-Simon Möller c1abb3a029 crypto, dm: LLVMLinux: Remove VLAIS usage from dm-crypt
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This patch allocates the appropriate amount of memory
using a char array using the SHASH_DESC_ON_STACK macro.

The new code can be compiled with both gcc and clang.

Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: pageexec@freemail.hu
Cc: gmazyland@gmail.com
Cc: "David S. Miller" <davem@davemloft.net>
Change-Id: Ie015d031358bd419c87acb872cd2006e88b29acc
2019-08-26 17:34:08 +02:00
Will Drewry 928c8cb2e0 CHROMIUM: dm: boot time specification of dm=
This is a wrap-up of three patches pending upstream approval.
I'm bundling them because they are interdependent, and it'll be
easier to drop it on rebase later.

1. dm: allow a dm-fs-style device to be shared via dm-ioctl

Integrates feedback from Alisdair, Mike, and Kiyoshi.

Two main changes occur here:

- One function is added which allows for a programmatically created
mapped device to be inserted into the dm-ioctl hash table.  This binds
the device to a name and, optional, uuid which is needed by udev and
allows for userspace management of the mapped device.

- dm_table_complete() was extended to handle all of the final
functional changes required for the table to be operational once
called.

2. init: boot to device-mapper targets without an initr*

Add a dm= kernel parameter modeled after the md= parameter from
do_mounts_md.  It allows for device-mapper targets to be configured at
boot time for use early in the boot process (as the root device or
otherwise).  It also replaces /dev/XXX calls with major:minor opportunistically.

The format is dm="name uuid ro,table line 1,table line 2,...".  The
parser expects the comma to be safe to use as a newline substitute but,
otherwise, uses the normal separator of space.  Some attempt has been
made to make it forgiving of additional spaces (using skip_spaces()).

A mapped device created during boot will be assigned a minor of 0 and
may be access via /dev/dm-0.

An example dm-linear root with no uuid may look like:

root=/dev/dm-0  dm="lroot none ro, 0 4096 linear /dev/ubdb 0, 4096 4096 linear /dv/ubdc 0"

Once udev is started, /dev/dm-0 will become /dev/mapper/lroot.

Older upstream threads:
http://marc.info/?l=dm-devel&m=127429492521964&w=2
http://marc.info/?l=dm-devel&m=127429499422096&w=2
http://marc.info/?l=dm-devel&m=127429493922000&w=2

Latest upstream threads:
https://patchwork.kernel.org/patch/104859/
https://patchwork.kernel.org/patch/104860/
https://patchwork.kernel.org/patch/104861/

BUG: 27175947

Signed-off-by: Will Drewry <wad@chromium.org>
Review URL: http://codereview.chromium.org/2020011
Change-Id: I92bd53432a11241228d2e5ac89a3b20d19b05a31
2019-08-26 17:33:56 +02:00
Wei Wang ef5f39d4f3 ANDROID: fix uninitilized variable
Currently we set CONFIG_CC_OPTIMIZE_FOR_SIZE which suppressed the compiler
warning of unused variables which can lead undefined behavior e.g. memory
corruption and panic. See https://lkml.org/lkml/2013/3/25/347.

This patch fixes all the uninitilized variables in kernel

Bug: 33353384
Test: On device
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I0ae1082f447b435d71156d471878ba71aa16c378
2019-08-26 17:31:59 +02:00
Badhri Jagan Sridharan aa1d2f492e ANDROID: dm: Mounting root as linear device when verity disabled
This CL makes android-verity target to be added as linear
dm device if when bootloader is unlocked and verity is disabled.

Bug: 27175947
Change-Id: Ic41ca4b8908fb2777263799cf3a3e25934d70f18
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
2019-08-26 17:18:20 +02:00
Rafael J. Wysocki add5314f44 USB: hcd: Mark secondary HCD as dead if the primary one died
Make usb_hc_died() clear the HCD_FLAG_RH_RUNNING flag for the shared
HCD and set HCD_FLAG_DEAD for it, in analogy with what is done for
the primary one.

Among other thigs, this prevents check_root_hub_suspended() from
returning -EBUSY for dead HCDs which helps to work around system
suspend issues in some situations.

This actually fixes occasional suspend failures on one of my test
machines.

Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-26 17:12:26 +02:00
Alan Stern b8d96bf497 usb-storage: fix deadlock involving host lock and scsi_done
Christoph Hellwig says that since version 4.12, the kernel switched to
using blk-mq by default.  The old code used a softirq for handling
request completions, but blk-mq can handle completions in the caller's
context.  This may cause a problem for usb-storage, because it invokes
the ->scsi_done callback while holding the host lock, and the
completion routine sometimes tries to acquire the same lock (when
running the error handler, for example).

The consequence is that the existing code will sometimes deadlock upon
error completion of a SCSI command (with a lockdep warning).

This is easy enough to fix, since usb-storage doesn't really need to
hold the host lock while the callback runs.  It was simpler to write
it that way, but moving the call outside the locked region is pretty
easy and there's no downside.  That's what this patch does.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Arthur Marsh <arthur.marsh@internode.on.net>
CC: Christoph Hellwig <hch@lst.de>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-26 17:12:25 +02:00
Greg Kroah-Hartman e22655317e uid_sys_stats: make hash_table static
Having a global variabled called "hash_table" is not a good idea, it
should be static, so mark it as such.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-08-26 17:12:24 +02:00
Jin Qian 851c999279 ANDROID: uid_sys_stats: defer io stats calulation for dead tasks
Store sum of dead task io stats in uid_entry and defer uid io
calulation until next uid proc stat change or dumpsys.

Bug: 37754877
Change-Id: I970f010a4c841c5ca26d0efc7e027414c3c952e0
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:24 +02:00
Ganesh Mahendran 8a14652b7a ANDROID: uid_sys_stats: fix access of task_uid(task)
struct task_struct *task should be proteced by tasklist_lock.

Change-Id: Iefcd13442a9b9d855a2bbcde9fd838a4132fee58
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
(cherry picked from commit 90d78776c4a0e13fb7ee5bd0787f04a1730631a6)
2019-08-26 17:12:23 +02:00
Jin Qian 820c025be9 ANDROID: uid_sys_stats: reduce update_io_stats overhead
Replaced read_lock with rcu_read_lock to reduce time that preemption
is disabled.

Added a function to update io stats for specific uid and moved
hash table lookup, user_namespace out of loops.

Bug: 37319300
Change-Id: I2b81b5cd3b6399b40d08c3c14b42cad044556970
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:23 +02:00
Jin Qian d31b2d168c ANDROID: uid_sys_stats: fix typo in init
Change-Id: I8a41b331c973898015d11d2018257727083f7910
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:22 +02:00
Wei Wang e97d4797d1 ANDROID: uid_sys_stats: change to use rt_mutex
We see this happens multiple times in heavy workload in systrace
and AMS stuck in uid_lock.

Running process:        Process 953
Running thread: android.ui
State:  Uninterruptible Sleep
Start:
1,025.628 ms
Duration:
27,955.949 ms
On CPU:
Running instead:        system_server
Args:
{kernel callsite when blocked:: "uid_procstat_write+0xb8/0x144"}

Changing to rt_mutex can mitigate the priority inversion

Bug: 34991231
Bug: 34193533
Change-Id: I481baad840b7bc2dfa9b9a59b4dff93cafb90077
Test: on marlin
Signed-off-by: Wei Wang <wvw@google.com>
2019-08-26 17:12:22 +02:00
Jin Qian 3a3330d616 ANDROID: uid_sys_stats: account for fsync syscalls
Change-Id: Ie888d8a0f4ec7a27dea86dc4afba8e6fd4203488
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:21 +02:00
Jin Qian ee1ba6d2f9 ANDROID: uid_sys_stats: fix negative write bytes.
A task can cancel writes made by other tasks. In rare cases,
cancelled_write_bytes is larger than write_bytes if the task
itself didn't make any write. This doesn't affect total size
but may cause confusion when looking at IO usage on individual
tasks.

Bug: 35851986
Change-Id: If6cb549aeef9e248e18d804293401bb2b91918ca
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:20 +02:00
Jin Qian aad84f7cc2 ANDROID: uid_sys_stats: remove unnecessary code in procstat switch
No need to aggregate the switched uid separately since
update_io_stats_locked covers all uids.

Bug: 34198239
Change-Id: Ifed347264b910de02e3f3c8dec95d1a2dbde58c0
Signed-off-by: Jin Qian <jinqian@google.com>
2019-08-26 17:12:20 +02:00
Jin Qian e3a11b22a8 ANDROID: uid_sys_stats: return full size when state is not changed.
Userspace keeps retrying when it sees nothing is written.

Bug: 34364961
Change-Id: Ie288c90c6a206fb863dcad010094fcd1373767aa
2019-08-26 17:12:19 +02:00
Jin Qian f198d67c29 ANDROID: uid_sys_stats: allow writing same state
Signed-off-by: Jin Qian <jinqian@google.com>
Bug: 34360629
Change-Id: Ia748351e07910b1febe54f0484ca1be58c4eb9c7
2019-08-26 17:12:19 +02:00
Nathan Chancellor aa4551d954 misc: kconfig: Update UID_SYS_STATS to depend on TASKSTATS
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2019-08-26 17:12:18 +02:00
Jin Qian e737fb0b4d ANDROID: uid_sys_stats: rename uid_cputime.c to uid_sys_stats.c
This module tracks cputime and io stats.

Signed-off-by: Jin Qian <jinqian@google.com>
Bug: 34198239
Change-Id: I9ee7d9e915431e0bb714b36b5a2282e1fdcc7342
2019-08-26 17:12:02 +02:00
Jin Qian 67db9f4868 ANDROID: uid_cputime: add per-uid IO usage accounting
IO usages are accounted in foreground and background buckets.
For each uid, io usage is calculated in two steps.

delta = current total of all uid tasks - previus total
current bucket += delta

Bucket is determined by current uid stat. Userspace writes to
/proc/uid_procstat/set <uid> <stat> when uid stat is updated.

/proc/uid_io/stats shows IO usage in this format.
<uid> <foreground IO> <background IO>

Signed-off-by: Jin Qian <jinqian@google.com>
Bug: 34198239
Change-Id: I3369e59e063b1e5ee0dfe3804c711d93cb937c0c
2019-08-26 17:07:12 +02:00
flar2 ff1ca19734 mdss: mdss_fb: backlight dimmer option
[@nathanchance: enabled by default]
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2019-08-26 17:06:52 +02:00
Nathan Chancellor 2e3e24c54c qcom: mpm-of: Convert __bitmap_empty in preparation for removal
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2019-08-26 17:06:01 +02:00
Nathan Chancellor bf50b84620 clk: qcom: clock-cpu-8994: Use CLKFLAG_NO_RATE_CACHE for a57_hf_mux_v2
Inspired by fe511bd5e3

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2019-08-26 17:03:33 +02:00
Sultanxda a93eac4dd9 qcom-cpufreq: Use CLKFLAG_NO_RATE_CACHE
After a CPU comes online, clk_set_rate() silently refuses to change said CPU's
frequency to the frequency it was running at before going offline (since it
thinks that we are setting the same frequency redundantly). By default, each CPU
runs at its minimum frequency when coming online, so if the governor decides to
keep a CPU running at the frequency it used before going offline, then
clk_set_rate() will ignore the frequency change request and the CPU will stay
stuck running at its minimum frequency for a potentially long period of time
(i.e. until the governor decides to change the frequency to something
different). This can cause severe lag when a device is woken up from deep sleep.

In order to prevent a CPU from being stuck at its default frequency for a
potentially long period of time, set the CLKFLAG_NO_RATE_CACHE flag so that the
governor's frequency change requests will always be honored right after a CPU
comes online.

Note that this requires a CPU's component clocks to be using CLKFLAG_NO_RATE_CACHE
as well in order to fix the issue.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
2019-08-26 17:03:32 +02:00
Tarun Karra 1a04a7e355 msm: kgsl: Prevent deadlock in cmdbatch timer
Dispatcher can acquire drawctxt->lock if context is pending
and the fence it is waiting on just got signalled.
Dispatcher acquires drawctxt->lock and tries to delete the
cmdbatch timer using delete_timer_sync(). Delete_timer_sync()
waits till timer and its pending handlers are deleted.
But if the timer expires at the same time, timer handler
could be waiting on drawctxt->lock leading to a
deadlock. To prevent this use spin_trylock_bh() instead of
spin_lock_bh(). spin_trylock_bh() does not wait for the lock
if it does not get it and allows the timer handler to finish.
This prevents the deadlock.

Change-Id: Ic2344fed5fccb581b58ec0b66b45ba68af9f1459
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Santhosh Punugu <spunug@codeaurora.org>
2019-08-26 17:01:17 +02:00