Commit Graph

870714 Commits

Author SHA1 Message Date
Chris Lew
1582fcb2ee soc: qcom: smp2p_sleepstate: Add suspend delay
Add delay in smp2p_sleepstate suspend path to prevent wakeup loop with
non wakeup streaming from sensors. This delay should be the maximum
time for sensors samples in flight to be drained.

Change-Id: I79f944caa2ccdd65dc1649aef8d6359f44612479
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Ananth Raghavan Subramanian <sananth@codeaurora.org>
Signed-off-by: Kelly Rossmoyer <krossmo@google.com>
Bug: 123377615
Bug: 131260677
2022-11-12 11:24:37 +00:00
celtare21
a6700dbb48 rmnet_ipa: Fix netdev watchdog triggering on suspend
Sometimes remnet_ipa fails to suspend with the following trace:

NETDEV WATCHDOG: rmnet_ipa0 (): transmit queue 0 timed out

Signed-off-by: celtare21 <celtare21@gmail.com>
2022-11-12 11:24:37 +00:00
Weiyi Chen
c203bbded3 qmi_rmnet: Do not use alarm timer for DFC
Not using alarm timer for dfc powersave check and eliminate the need
for a wakelock. This allows AP to go to suspend quicker.

Change-Id: I7153055d0231a65125ad88808db9e1d0032f24d9
Signed-off-by: Weiyi Chen <quic_weiyic@quicinc.com>
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2022-11-12 11:24:37 +00:00
LibXZR
ce3006a555 subsystem_restart: Always performs soft resets when subsystems crash
* Oneplus is using a dirty list and userspace nodes to override restart_level
for some subsystems. Why not just ignore all RESET_SOC and use a soft reset
instead? Nobody wanna to see their device goes randomly reboot sometimes.

* Note that commit 578bed2 is also needed to fix broken irq free when soft
reset the modem.

Signed-off-by: LibXZR <xzr467706992@163.com>
2022-11-12 11:24:37 +00:00
Yaroslav Furman
aefe7a673f drivers: power: Add timeouts to wakelocks
These can get stuck sometimes and prevert system from sleeping.

Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Jebaitedneko <Jebaitedneko@gmail.com>
2022-11-12 11:24:36 +00:00
Danny Lin
3078e78e38 tcp: Enable ECN negotiation by default
This is now the default for all connections in iOS 11+, and we have
RFC 3168 ECN fallback to detect and disable ECN for broken flows.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2022-11-12 11:24:36 +00:00
spakkkk
3d75a15a21 arm64: config: disable seccomp 2022-11-12 11:24:36 +00:00
Park Ju Hyung
1bc273fcb0 kernel: fake system calls on seccomp to succeed
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2022-11-12 11:24:36 +00:00
spakkkk
f0625025f0 thermal: tsens: remove unused 2022-11-12 11:24:36 +00:00
Tyler Nijmeh
39420e241e block: Do not collect I/O statistics
This adds a great deal of latency to block requests due to disabling
preemption temporarily during statistics collection.

Signed-off-by: Tyler Nijmeh <tylernij@gmail.com>
2022-11-12 11:24:35 +00:00
Zlatan Radovanovic
2eaf0ecf44 Makefile: Enable opaque pointers mode
https://llvm.org/docs/OpaquePointers.html

Signed-off-by: Zlatan Radovanovic <zlatan.radovanovic@fet.ba>
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
2022-11-12 11:24:35 +00:00
Tashfin Shakeer Rhythm
b597386ece Makefile: Pass more feature modifiers to -march
• armv8.1-a: Includes armv8-a, +crc, +lse, +rdma by default.
• fp16: Enables FP16 extension. This also enables floating-point instructions.
• rcpc: Enables the RcPc extension. This is passed on to the assembler,
	enabling inline asm statements to use instructions from the RcPc extension.

Lookup: https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/AArch64-Options.html
Test: A successful build with both Clang & GCC. Kernel booted just fine.

Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
2022-11-12 11:24:35 +00:00
mikairyuu
96243a34cc Makefile: allow missing prototypes 2022-11-12 11:24:35 +00:00
mikairyuu
34ead8f146 Makefile: return -O3
looks like it got fixed on latest clang-15 builds
2022-11-12 11:24:35 +00:00
John Galt
45aa6f5477 Makefile/Polly: update optimizations 2022-11-12 11:24:34 +00:00
mikairyuu
ab85d010c5 arm64: config: enforce LTO/Polly and SCS 2022-11-12 11:24:34 +00:00
mikairyuu
77aef8ee79 Kbuild: Make polly enabled by default 2022-11-12 11:24:34 +00:00
mikairyuu
d92b446b14 arm64: config: Enable optimize inlining 2022-11-12 11:24:34 +00:00
kondors1995
95410c538b Makefile: update polly and inline optimizations 2022-11-12 11:24:34 +00:00
Diab Neiroukh
2c336746e6 kbuild: Add a config to optimise inlining.
Increased inlining can provide an improvement in performance, but also
increases the size of the final kernel image. This config peovides a bit
more control on how much is inlined to further optimise the kernel for
certain workloads.

Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:33 +00:00
mikairyuu
7285dd1a70 Makefile: LTO Tweaks
* Ensure -O3 is always set no matter linker (doesn't impact release
   builds).
 * Enable fwhole-program-vtables with LTO for better inlining decisions
   (0.00489045% binary size decrease).
 * Set import-instr-limit to 40:
   * Decreases output size by 10.0308%, and also where measurable
     performance changes stop occurring. Chromium found 10 was a good
     limit for performance/binary size, and AOSP found 5 was a good
     compromise. However we're a kernel, and a bit different.

import-instr-limit tests (compared to no limit):
import-instr-limit=10: 15.1171% binary size decrease.
import-instr-limit=20: 15.1025% binary size decrease.
import-instr-limit=30: 10.0455% binary size decrease.
import-instr-limit=40: 10.0308% binary size decrease.
import-instr-limit=50: 5.01785% binary size decrease.
import-instr-limit=60: 5.01296%% binary size decrease.

Makefile: re address lto tweaks

Subsequent to 28d40c3798

After additional clean testing, it was found 20 is the reasonable limit
before any measurable performance loss occurs.

Makefile: re address lto tweaks

All previous testing was embarrassingly flawed.

Since further investigation, the upstream determined 5 is a good fit.
2022-11-12 11:24:33 +00:00
idkwhoiam322
46064cafed Makefile: strip debug always 2022-11-12 11:24:33 +00:00
kdrag0n
927592765e Makefile: Set --lto-O3 LLD linker flag when building with clang LTO
Signed-off-by: kdrag0n <dragon@khronodragon.com>
Change-Id: I87faddd3bb5ca6e132ff3831bfddd2a0b4511fb9
2022-11-12 11:24:33 +00:00
Adam W. Willis
cfc65fcfc4 Kbuild: Support LLVM Polyhedral Loop Optimizations
Polly is able to optimize various loops throughout the kernel for cache
locality. A mathematical representation of the program, based on
polyhedra, is analysed to find opportunistic optimisations in memory
access patterns which then leads to loop transformations.

I generally see static Kconfig entries being created to enable
these flags, which inevitably breaks builds and emits misleading
errors for those trying to compile the kernel with standard Clang
toolchains (AOSP, Snapdragon, etc.) which do not natively support
Polly.

Let's instead take advantage of Kconfig compile time checks and
determine compatibility dynamically, similarly to how RELR
relocations and other compiler specific features are handled on
4.19.

[0ctobot: Based on kdrag0n/proton_bluecross@0537f23]

Change-Id: I8c8e4e62f54dc4f84b043030b75d745039c786e8
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Co-authored-by: Diab Neiroukh <lazerl0rd@thezest.dev>

Makefile: Restore support for -polly-run-dce

This flag was initially omitted due to incompatibility with Clang
13 development builds, which has since been resolved.

Change-Id: I8f75c6498df1d3e2c7886da9d0c15446a971edc4
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:33 +00:00
Danny Lin
0d7292a8ba Makefile: Use O3 optimization level for Clang LTO
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:32 +00:00
spakkkk
a3a0b6d9f7 arm64: config: enable DCE 2022-11-12 11:24:32 +00:00
Adam W. Willis
3bdb4cf8c6 Kbuild: Select LD_DEAD_CODE_DATA_ELIMINATION with LTO_CLANG
This selection being the default behavior for Clang LTO has been
reverted upstream over concerns that the use of -gc-sections
carries a greater potential risk of breakage.

That being said, as someone who has been using these features in
tandem for several years to no ill effect, this is a risk that I
am willing to take in order to trim the fat from LTO's thick
kernel images and potentially reduce boot times.

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:32 +00:00
spakkkk
a020141124 arm64: config: Switch to LLD, enable RELR and ThinLTO 2022-11-12 11:24:32 +00:00
Adam W. Willis
89d916cc45 HACK: lib: Compile out nmi_backtrace for ARM64
This silences the following compilation warning, presumably emitted
by llvm-ar in conjunction with Clang (Thin)LTO:

lib/nmi_backtrace.o: no symbols

This is a watchdog support library which is no-op on this
architecture, hence the empty object file, so let's avoid building
it entirely until a more aesthetically pleasing solution presents
itself.

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Co-authored-by: Panchajanya1999 <panchajanya@azure-dev.live>
2022-11-12 11:24:32 +00:00
Jerin Jacob
c099ad7b62 arm64: bpf: optimize modulo operation
Optimize modulo operation instruction generation by
using single MSUB instruction vs MUL followed by SUB
instruction scheme.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:31 +00:00
Ard Biesheuvel
1802058d43 arm64/bpf: don't allocate BPF JIT programs in module memory
The arm64 module region is a 128 MB region that is kept close to
the core kernel, in order to ensure that relative branches are
always in range. So using the same region for programs that do
not have this restriction is wasteful, and preferably avoided.

Now that the core BPF JIT code permits the alloc/free routines to
be overridden, implement them by vmalloc()/vfree() calls from a
dedicated 128 MB region set aside for BPF programs. This ensures
that BPF programs are still in branching range of each other, which
is something the JIT currently depends upon (and is not guaranteed
when using module_alloc() on KASLR kernels like we do currently).
It also ensures that placement of BPF programs does not correlate
with the placement of the core kernel or modules, making it less
likely that leaking the former will reveal the latter.

This also solves an issue under KASAN, where shadow memory is
needlessly allocated for all BPF programs (which don't require KASAN
shadow pages since they are not KASAN instrumented)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
[@0ctobot: Avoid using module memory in CFI alignment check subsequent
to cfd89c3 ("ANDROID: arm64: bpf: implement arch_bpf_jit_check_func")]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:31 +00:00
Ard Biesheuvel
8229027985 bpf: add __weak hook for allocating executable memory
By default, BPF uses module_alloc() to allocate executable memory,
but this is not necessary on all arches and potentially undesirable
on some of them.

So break out the module_alloc() and module_memfree() calls into __weak
functions to allow them to be overridden in arch code.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:31 +00:00
Danny Lin
69b8fbef2c bpf: Allow building BPF JIT without module support on arm64
arm64 no longer uses the module_alloc and module_free functions to
allocate JIT memory for the BPF JIT, so we can safely build and use the
BPF JIT without module support.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:31 +00:00
Kazuki Hashimoto
c5cb7c90bf Revert "devfreq: memlat: track cpu during ipi to cluster"
Gosh no.

This reverts commit 92735374a16196d19ae7ff3c32c6cf5ec9561657.

Signed-off-by: Kazuki Hashimoto <kazukih@tuta.io>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Change-Id: I99d2f77c64e728ea949a4b8f4b08408648da0781
2022-11-12 11:24:31 +00:00
UtsavBalar1231
a673075611 devfreq: qcom: Align with qcom 5.4 kernel
Change-Id: I8287072c88de5b8d754617c0d72b2a70aee33d10
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:30 +00:00
Biao Long
d3d5d91db5 BACKPORT: devfreq: Support opp table for devfreq_simple_dev
Support read opp value for dev_target.
Use previous_freq instead of get_cur_freq when opp
table parsed success.

Change-Id: I37bb74ef18a822b05ed3be411bc59ae4dadb7a0d
Signed-off-by: Biao Long <blong@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:30 +00:00
Kasin Li
b754c73d68 BACKPORT: msm_adreno_tz: make some functions static
These functions are used in local

Change-Id: Ia56d70e2ff69295a31b5ac411dcfdcdc854bda18
Signed-off-by: Kasin Li <donglil@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:30 +00:00
Mohammed Mirza Mandayappurath Manzoor
cf001c5fb1 BACKPORT: msm: kgsl: Fix maximum allowed power level for A660
Update the logic that checks maximum allowed power level to
accommodate new frequency corners.

Change-Id: I85c9db7e39c75b14ee77464ca6fcdf5855653b25
Signed-off-by: Mohammed Mirza Mandayappurath Manzoor <mmandaya@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:30 +00:00
Santosh Mardi
090380024d BACKPORT: PM / devfreq: devbw: move init call to late init call
Move devfreq_devbw to late init call to defer the probing.

Change-Id: I5eecb8f4c3e177696f8c4ebd04b84daef6fc65c2
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:30 +00:00
Santosh Mardi
acd5e73e56 BACKPORT: devfreq: suppress platform driver bind / unbind feature
devfreq_qcom_qoslat platform driver does not
support the manual bind / unbind feature through sysfs,
Suppress the bind / unbind calls using driver attribute.

Change-Id: I13a61826435e16849aeb15ebdaa792c849ba45c2
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:29 +00:00
Amir Vajid
ff91ee4dd3 BACKPORT: PM / devfreq: qoslat: add support for multiple clients
Add support for multiple clients in qoslat by maintaining a
list of devices and aggregating across them during updates.

Change-Id: I3e9970b324938eecdd85f3970ba3acc2c5880fdf
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:29 +00:00
Amir Vajid
d2d0647e6b BACKPORT: PM / devfreq: qoslat: move registration to late init
Move qoslat to late init to ensure all resources it
needs have finished probing.

Change-Id: Ib4f2315aae186f64f531388b2b989c7db9970050
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:29 +00:00
Amir Vajid
00d9729f97 BACKPORT: PM / devfreq: qoslat: implement get_dev_status()
The qoslat devfreq device does not implement the
get_dev_status() devfreq profile API. This will
lead to a crash if a governor tries to invoke
devfreq_update_stats(). Implement the API to prevent
this from happening.

Change-Id: I668c3b55a1585d8eb561da03475e1567b194feef
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:29 +00:00
Abhishek Shah
27d18bd7b7 BACKPORT: devfreq: governor_bw_hwmon: fix deadlock warning due to state_lock usage
lockdep is detecting possible circular locking dependency
due to state_lock mutex as shown below:

Possible unsafe locking scenario:

      CPU0                    CPU1
      ----                    ----
 lock(devfreq_list_lock);
                              lock(state_lock#2);
                              lock(devfreq_list_lock);
 lock(state_lock#2);

*** DEADLOCK ***

Below is partial call stacks (in reverse order) showing relevant
locking paths:

Call stack for CPU0:
devfreq_bw_hwmon_ev_handler+0x4c/0x5e0	[may acquire &state_lock]
devfreq_add_device+0x418/0x538		[may acquire &devfreq_list_lock]
devfreq_add_icc+0x41c/0x528
devfreq_icc_probe+0x20/0x30

Call stack for CPU1:
devfreq_add_governor+0x3c/0x260 	[may acquire &devfreq_list_lock]
register_bw_hwmon+0x1e8/0x248		[may acquire &state_lock]
bimc_bwmon_driver_probe+0x310/0x408

Practically, this race is not possible, since devfreq_add_device first
tries to find the governor, and only if it is succeeds,
devfreq_bw_hwmon_ev_handler is called. And the governor would be found
only if devfreq_add_governor has added it priorly.
We have mechanism(initcall_level) in place to make sure that
governor is added before devfreq_add_device happens.

In attempt to quiet the lockdep warning, below fix is adopted:
Since state_lock mutex has different purpose, introduce a new
event_handle_lock mutex for devfreq_bw_hwmon_ev_handler
to avoid this warning.

Change-Id: I53c4514aa2357bf39e9405683f5e73ada0160ba5
Signed-off-by: Abhishek Shah <abhshah@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:29 +00:00
Jordan Crouse
97000eccc7 BACKPORT: devfreq: bwmon: Export symbols
Export symbols to fix the following modpost errors:

  ERROR: "bw_hwmon_sample_end" [drivers/devfreq/bimc-bwmon.ko] undefined!
  ERROR: "register_bw_hwmon" [drivers/devfreq/bimc-bwmon.ko] undefined!
  ERROR: "update_bw_hwmon" [drivers/devfreq/bimc-bwmon.ko] undefined!

Change-Id: Ic0dedbad2f49e98b415a2ded471b2c35b97157a8
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:28 +00:00
Santosh Mardi
6a1ca2be6f BACKPORT: devfreq: delete l2wb feature pmu events during governor stop
Delete l2wb and l3 access pmu events when the governor
is stopped.

Change-Id: If443cb6b53e2ad43ebee04a1fc3274a31b05e5b9
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:28 +00:00
Jordan Crouse
5b39df2081 BACKPORT: PM / devfreq: memlat: Use the cpumask_pr_args macros
When using the %*pbl printk format a special macro is needed to decode
the cpu mask and format it correctly.

Fixes: 74b58a6 ("PM / devfreq: memlat: Aggregate memlat mons under a controller")
Change-Id: Ic0dedbada86cf9cec02b1a5292aaf05f50c0c42f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:28 +00:00
Jordan Crouse
3c302d6437 BACKPORT: PM / devfreq: Add MODULE_LICENSE for arm-memlat-mon
Fix the following warning from modpost:

   WARNING: modpost: missing MODULE_LICENSE() in drivers/devfreq/arm-memlat-mon.o

Fixes: a4e0d26 ("PM / devfreq: Introduce a memory-latency governor")
Change-Id: Ic0dedbad2d3462ee407e5f2d5bcb9ded6e6ac83f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:28 +00:00
Amir Vajid
fa58d5b752 BACKPORT: PM / devfreq: Make governor registration less verbose
Several devfreq governors print to kernel logs for each
device that registers. Update them to only print when
debugging is enabled.

Change-Id: Id7cf8c9ef70363cdfd4fc1fc72b109f28ab07288
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:28 +00:00
Jordan Crouse
833d396103 BACKPORT: PM / devfreq: memlat: Export symbols
Fix the following modpost errors:

  ERROR: "register_memlat" [drivers/devfreq/arm-memlat-mon.ko] undefined!
  ERROR: "register_compute" [drivers/devfreq/arm-memlat-mon.ko] undefined!

Change-Id: Ic0dedbadbcf146483ec6810e11b8a2e82e399ebd
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:24:27 +00:00