Commit graph

853011 commits

Author SHA1 Message Date
Gagan Malvi
a70e1f1469
kernel: update gitignore.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-25 13:11:11 +02:00
Francisco Franco
ce0a4f83d4
msm: kgsl: run kgsl-workqueue as a high prio wq 2021-08-25 05:30:47 +02:00
Alex Naidis
6c262f7c81
kgsl: Increase priority of RT thread
We need kgsl_worker_thread to preempt
all userspace surfaceflinger threads to
avoid a possible deadlock.

This will prevent the SF
threads from "stealing" cputime from
kgsl_worker_thread.
This is important, since kgsl_worker_thread
executes work which blocks SF from proceeding.

Signed-off-by: Alex Naidis <alex.naidis@linux.com>
2021-08-25 05:30:30 +02:00
myfluxi
90753ad1c5
PM: devfreq: Use high priority workqueue
It does not make sense to run kgsl on high and devfreq on regular
priority.

Change-Id: Ie5e6c9353a4e1324a6a49278e5ad3638462f551c

Signed-off-by: flar2 <asegaert@gmail.com>
2021-08-25 05:30:22 +02:00
Gagan Malvi
c15c850491
ARM64/configs: bengal-perf: Enable Boeffla wakelock blocker.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-25 05:27:51 +02:00
Panchajanya1999
c120d3322b
boeffla_wl_blocker: Populate block list a bit
These wakelocks has pretty high wakeups [ rmnet_ipa had 496 wakeups in just 20 minutes, IPA_CLIENT_ had 329 wakeups in ~1hr]. Block them to ensure they aren't causing "unnecessary"(might vary) wakeups.

Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Sudeep Duhoon <rishi.gothic@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-08-25 05:27:02 +02:00
Francisco Franco
08cd97ac60
wl_blocker: add more wakelocks to the default block list
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Yasir-Siddiqui <www.mohammad.yasir.s@gmail.com>
Signed-off-by: billaids <jimmy.nelle@hsw-stud.de>
2021-08-25 05:26:57 +02:00
Joe Maples
c05b3ca9ec
wl_blocker: Populate default list
Signed-off-by: Joe Maples <joe@frap129.org>
Signed-off-by: Yasir-Siddiqui <www.mohammad.yasir.s@gmail.com>
Signed-off-by: billaids <jimmy.nelle@hsw-stud.de>
2021-08-25 05:26:51 +02:00
andip71
4ebf097f1f
boeffla_wl_blocker: update to wakelock blocker driver v1.1.0
There are now two lists:
- the previously existing list of user defined wakelocks to block
- a new list called "wakelock_blocker_default" which comes prepopulated with the most common
  and safe wakelocks to block:

    qcom_rx_wakelock;wlan;wlan_wow_wl;wlan_extscan_wl;netmgr_wl;NETLINK

A combination of both wakelock lists will be blocked finally.
2021-08-25 05:25:54 +02:00
andip71
488d0a40ba
boeffla_wl_blocker: update to wakelock blocker driver v1.0.1
- currently active wakelocks on the list are forcefully killed
2021-08-25 05:25:49 +02:00
andip71
c50c7ccf15
boeffla_wl_blocker: add generic wakelock blocker driver v1.0.0
Based on ideas of FranciscoFranco's non-generic driver.

Sysfs node:

	/sys/class/misc/boeffla_wakelock_blocker/wakelock_blocker

		- list of wakelocks to be blocked, separated by semicolons

	/sys/class/misc/boeffla_wakelock_blocker/debug

		- write: 0/1 to switch off and on debug logging into dmesg
		- read:  get current driver internals

	/sys/class/misc/boeffla_wakelock_blocker/version

		- show driver version

Signed-off-by: andip71 <andreasp@gmx.de>
2021-08-25 05:25:42 +02:00
Gagan Malvi
9352f491dd
drivers: video: fbdev: msm: enable ULPS, and phy-poweroff.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 19:31:28 +02:00
Sultan Alsawaf
a08b2f039e
msm: kgsl: Remove sync fence names
Generating a sync fence name by allocating memory dynamically and using
scnprintf in a hot path results in excessive CPU time wasted on unneeded
debug info. Remove the name generation entirely to cut down CPU waste in
the GPU's rendering hot path.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-08-23 19:17:58 +02:00
Sultan Alsawaf
4de9de3a1e
msm: kgsl: Remove POPP
POPP constantly attempts to lower the GPU's frequency behind the
governor's back in order to save power; however, the GPU governor in use
(msm-adreno-tz) is very good at determining the GPU's load and selecting
an appropriate frequency to run the GPU at.

POPP was created long ago, perhaps when msm-adreno-tz didn't exist or
didn't work so well, so it is clearly deprecated. Remove it.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-08-23 19:17:44 +02:00
Sultan Alsawaf
4df2819595
msm: kgsl: Wake GPU upon receiving an ioctl rather than upon touch input
Waking the GPU upon touch wastes power when the screen is being touched
in a way that does not induce animation or any actual need for GPU usage.
Instead of preemptively waking the GPU on touch input, wake it up upon
receiving a IOCTL_KGSL_GPU_COMMAND ioctl since it is a sign that the GPU
will soon be needed.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-08-23 19:17:31 +02:00
Sultan Alsawaf
938a706b23
Makefile: Use -O3 optimization for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
-O3 is much more stable with modern compilers these days than it was a
decade ago. Using -O3 on the kernel results in significantly improved
hackbench performance, which is a sign that overall performance in the
kernel is improved. It works especially well in conjunction with LTO.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-08-23 19:14:58 +02:00
Gagan Malvi
67d97cca47
build: disable format warnings.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 18:58:23 +02:00
Gagan Malvi
0260e530fa
power: supply: remove redundant endif.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 18:32:03 +02:00
Gagan Malvi
00ad9455f6
tree: Add build script.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 18:20:04 +02:00
Gagan Malvi
29c034da72
tree: Init DroneCI
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 18:17:43 +02:00
Danny Lin
16d194501e
arm64: Add missing dependency for ARM erratum 1188873 workaround
ARM erratum 1188873 can cause very severe issues if left unmitigated on
affected cores. However, if unrelated ARM arch timer mitigations are
disabled (e.g. Freescale, Hisilicon, and Cortex-A73 errata), the
mitigation for 1188873 will no longer be applied even if the config
option is on. This is because this mitigation is implemented as a
generic OOL erratum workaround, and disabling other mitigations will
cause the OOL workaround framework to stop being compiled.

Add an explicit dependency on the workaround framework to fix this, and
also add a dependency on ARM_ARCH_TIMER while we're at it.

On Android, leaving this erratum causes the AlarmManager thread in
system_server to use 100% CPU in the background after 20 minutes of
screen-off idle. The CPU hogging never stops until sytem_server is
killed and sometimes also causes system_server crashes due to invalid
negative durations in batterystats resulting from the corrupted timer
values.

Test: Let device idle for 20 minutes and check AlarmManager CPU usage
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 18:02:38 +02:00
Sultan Alsawaf
02a5724e02
bengal-perf_defconfig: Disable unused errata fixes
The fix for ARM erratum 1188873 is the only configurable one in use.
Disable the rest.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 18:02:13 +02:00
Sultan Alsawaf
aec9371d28
dma-buf/sync_file: Speed up ioctl by omitting debug names
A lot of CPU time is wasted on allocating, populating, and copying
debug names back and forth with userspace when they're not actually
needed. We can't just remove the name buffers from the various sync data
structures though because we must preserve ABI compatibility with
userspace, but instead we can just pretend the name fields of the
user-shared structs aren't there. This massively reduces the sizes of
memory allocated for these data structures and the amount of data passed
between userspace, as well as eliminates a kzalloc() entirely from
sync_file_ioctl_fence_info(), thus improving graphics performance.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-08-23 17:59:09 +02:00
Danny Lin
d969d8bb17
cpuidle: lpm-levels: Remove debug event logging
A measurably significant amount of CPU time is spent on logging events
for debugging purposes in lpm_cpuidle_enter. Kill the useless logging to
reduce overhead.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
Danny Lin
5209588e2f
techpack: audio: Remove build timestamps
These are causing parts of techpack/audio to get rebuilt on every build
for no reason.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
NeilBrown
a1ac400e39
VFS: use synchronize_rcu_expedited() in namespace_unlock()
The synchronize_rcu() in namespace_unlock() is called every time
a filesystem is unmounted.  If a great many filesystems are mounted,
this can cause a noticable slow-down in, for example, system shutdown.

The sequence:
  mkdir -p /tmp/Mtest/{0..5000}
  time for i in /tmp/Mtest/*; do mount -t tmpfs tmpfs $i ; done
  time umount /tmp/Mtest/*

on a 4-cpu VM can report 8 seconds to mount the tmpfs filesystems, and
100 seconds to unmount them.

Boot the same VM with 1 CPU and it takes 18 seconds to mount the
tmpfs filesystems, but only 36 to unmount.

If we change the synchronize_rcu() to synchronize_rcu_expedited()
the umount time on a 4-cpu VM drop to 0.6 seconds

I think this 200-fold speed up is worth the slightly high system
impact of using synchronize_rcu_expedited().

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> (from general rcu perspective)
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2021-08-23 17:41:46 +02:00
Danny Lin
2b8f19d665
power: Silence debug logging if logbuffer is disabled
If logbuffer is disabled, we want to silence logging, not dump it to
kmsg.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
Danny Lin
86ff466dde
arm64: lse: Prefetch operands to speed up atomic operations
On a Kryo 485 CPU (semi-custom Cortex-A76 derivative) in a Snapdragon
855 (SM8150) SoC, switching from traditional LL/SC atomics to LSE
causes LKDTM's ATOMIC_TIMING test to regress by 2x:

LL/SC ATOMIC_TIMING:    34.14s  34.08s
LSE ATOMIC_TIMING:      70.84s  71.06s

Prefetching the target operands fixes the regression and makes LSE
perform better than LSE as expected:

LSE+prfm ATOMIC_TIMING: 21.36s  21.21s

"dd if=/dev/zero of=/dev/null count=10000000" also runs faster:
    LL/SC:  3.3 3.2 3.3 s
    LSE:    3.1 3.2 3.2 s
    LSE+p:  2.3 2.3 2.3 s

Commit 0ea366f5e1 applied the same change
to LL/SC atomics, but it was never ported to LSE.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
Ard Biesheuvel
82cc0f5548
FROMLIST: arm64: kernel: implement fast refcount checking
This adds support to arm64 for fast refcount checking, as contributed
by Kees for x86 based on the implementation by grsecurity/PaX.

The general approach is identical: the existing atomic_t helpers are
cloned for refcount_t, with the arithmetic instruction modified to set
the PSTATE flags, and one or two branch instructions added that jump to
an out of line handler if overflow, decrement to zero or increment from
zero are detected.

One complication that we have to deal with on arm64 is the fact that
it has two atomics implementations: the original LL/SC implementation
using load/store exclusive loops, and the newer LSE one that does mostly
the same in a single instruction. So we need to clone some parts of
both for the refcount handlers, but we also need to deal with the way
LSE builds fall back to LL/SC at runtime if the hardware does not
support it.

As is the case with the x86 version, the performance gain is substantial
(ThunderX2 @ 2.2 GHz, using LSE), even though the arm64 implementation
incorporates an add-from-zero check as well:

perf stat -B -- echo ATOMIC_TIMING >/sys/kernel/debug/provoke-crash/DIRECT

      116252672661      cycles                    #    2.207 GHz

      52.689793525 seconds time elapsed

perf stat -B -- echo REFCOUNT_TIMING >/sys/kernel/debug/provoke-crash/DIRECT

      127060259162      cycles                    #    2.207 GHz

      57.243690077 seconds time elapsed

For comparison, the numbers below were captured using CONFIG_REFCOUNT_FULL,
which uses the validation routines implemented in C using cmpxchg():

perf stat -B -- echo REFCOUNT_TIMING >/sys/kernel/debug/provoke-crash/DIRECT

 Performance counter stats for 'cat /dev/fd/63':

      191057942484      cycles                    #    2.207 GHz

      86.568269904 seconds time elapsed

As a bonus, this code has been found to perform significantly better on
systems with many CPUs, due to the fact that it no longer relies on the
load/compare-and-swap combo performed in a tight loop, which is what we
emit for cmpxchg() on arm64.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Jayachandran Chandrasekharan Nair <jnair@marvell.com>,
Cc: Kees Cook <keescook@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Cc: Jan Glauber <jglauber@cavium.com>,
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Cc: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

[kdrag0n]
 - Backported to k4.14 from:
     https://www.spinics.net/lists/arm-kernel/msg735992.html
 - Forward-ported to k4.19
 - Benchmarked on sm8150 using perf and LKDTM REFCOUNT_TIMING:
     https://docs.google.com/spreadsheets/d/14CctCmWzQAGhOmpHrBJfXQy_HuNFTpEkMEYSUGKOZR8/edit

         | Fast checking      | Generic checking
---------+--------------------+-----------------------
Cycles   | 79235532616        | 102554062037
         | 79391767237        | 99625955749
Time     | 32.99879212 sec    | 42.5354029 sec
         | 32.97133254 sec    | 41.31902045 sec

Average:
Cycles   | 79313649927        | 101090008893
Time     | 33 sec             | 42 sec

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
Will Deacon
42d8bf43e2
arm64: debug: Separate debug hooks based on target exception level
Mixing kernel and user debug hooks together is highly error-prone as it
relies on all of the hooks to figure out whether the exception came from
kernel or user, and then to act accordingly.

Make our debug hook code a little more robust by maintaining separate
hook lists for user and kernel, with separate registration functions
to force callers to be explicit about the exception levels that they
care about.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
[kdrag0n: Ported to android-4.19 with adaptations for KASAN hook]
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
Danny Lin
0c187c0649
disp: msm: Disable unused and debug config options
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-08-23 17:41:46 +02:00
zhanandong
8c6a87a88f
ASoC: pcm: Add 24bit playback audio support
Change-Id: I60b81c6fd03f24bad21d3fc31a1486606e28b831
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-08-23 17:41:46 +02:00
Gagan Malvi
cea51b0605
techpack: audio: fix printing APIs.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 17:41:45 +02:00
Gagan Malvi
33270c93ab
input: focaltech: disable debugging.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 17:41:45 +02:00
Gagan Malvi
06ef34e86c
input: focaltech: disable debugging.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 17:41:45 +02:00
UtsavBalar1231
9b632cee97
input: touchscreen: nt36672a: disable debugging.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-23 17:41:45 +02:00
Demon000
ca1b647142
workqueue: queue everything on system's power efficient wq
Signed-off-by: Raphiel Rollerscaperers <raphielscape@outlook.com>
2021-08-23 17:41:31 +02:00
Carlos Ayrton Lopez Arroyo
a6812bc397
techpack: display: silence logging and debug
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2021-08-23 17:41:31 +02:00
spakkkk
6ea03ed65e
techpack: video: remove log spam
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2021-08-23 17:41:31 +02:00
darkhz
4d3e91d36a
sched/fair: Switch sched scaling to linear
* improves performance

Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2021-08-23 17:41:31 +02:00
Gagan Malvi
4cee9a4684
ARM64: configs: bengal: Disable MSM Performance and QHEE memory protection.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-22 20:17:23 +02:00
mady51
c0c9d214ee
kernel/power: faster deepsleep 2021-08-22 20:14:59 +02:00
Gagan Malvi
384da20238
char: Mark random_read as maybe unused.
Signed-off-by: Gagan Malvi <malvigagan@gmail.com>
2021-08-22 19:44:26 +02:00
alk3pInjection
5239b814ed
drivers/gpu: msm: Set GPU idle timeout to 58ms
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Signed-off-by: dreamisbaka <jolinux.g@gmail.com>
2021-08-21 17:16:18 +02:00
Sultan Alsawaf
03726a03ae
arm64: dts: bengal: Set GPU idle timeout to 58 ms
This matches the ULPS timeout used in msm_drm, which is defined as 58 ms
by IDLE_POWERCOLLAPSE_DURATION. No need to keep the GPU running after
the display enters a low-power state.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Signed-off-by: dreamisbaka <jolinux.g@gmail.com>
Change-Id: I465a6aca32b6cded284fbcebf0dd0c52f2d7732d
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
2021-08-21 17:16:18 +02:00
Park Ju Hyung
b9d49b1364
random: always use /dev/urandom
/dev/random on Android cannot even properly generate a UUID;
it's practically unusable.

There are no programs/applications on Android that should use /dev/random.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
2021-08-21 17:16:01 +02:00
Daniel Micay
092842330e
add toggle for disabling newly added USB devices
Based on the public grsecurity patches.

Change-Id: I2cbea91b351cda7d098f4e1aa73dff1acbd23cce
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
2021-08-21 17:15:54 +02:00
Sultan Alsawaf
4b2b333bbb
msm: camera: Stub out the camera_debug_util API and compile it out
A measurably significant amount of CPU time is spent in these routines
while the camera is open. These are also responsible for a grotesque
amount of dmesg spam, so let's nuke them.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I1711e1e815e7c5abebdf888b752823bded926ebd
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
2021-08-21 17:15:45 +02:00
Sultan Alsawaf
cf2cb68019
kernel: Use the stock defconfig for /proc/config.gz
Userspace reads /proc/config.gz and spits out an error message after boot
finishes when it doesn't like the kernel's configuration. In order to
preserve our freedom to customize the kernel however we'd like, show
userspace the stock defconfig so that it never complains about our
kernel configuration.

Signed-off-by: Sultan Alsawaf <sultanxda@gmail.com>

lime-r-oss defconfig from kernel 4.19.113-perf Redmi 9 Power A11 Miui

Signed-off-by: Carlos Jimenez (JavaShin-X) <javashin1986@gmail.com>
Change-Id: Ibbe0a7d8d34298369a5e939882984fe882786767
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
2021-08-21 17:15:38 +02:00
Gagan Malvi
4d9ef52bcf
kernel: Set Shadow Call Stack as default.
Signed-off-by: Gagan Malvi <malvi@aospa.co>
2021-08-21 17:11:21 +02:00