Commit Graph

42392 Commits

Author SHA1 Message Date
qctecmdr
2f58165738 Merge "sched/walt: make partially halted cpus equivalent cap to silvers" 2023-10-09 17:01:42 -07:00
qctecmdr
ae3730a124 Merge "Merge keystone/android14-6.1-keystone-qcom-release.6.1.25 (86b3899) into qcom-6.1" 2023-10-04 13:23:11 -07:00
Stephen Dickey
c017cdda8a sched/walt: make partially halted cpus equivalent cap to silvers
In certain usecases there are extensive runnables on
silver cpus while there is ample opportunity to perform newidle
balance to partially halted cpus to relieve the load on silvers.

Currently, the check_for_higher_capacity() indicates that the
partially halted cpus are to be considered higher cap than min-cap
cpus.

Change this such that the capacities of the cpus are seen
as being the same during comparison, regardless of any small offset
in capacity between the two. This should mean that load balance
should happen more readily between the two, since this is a similar
cap operation.

Also in walt_lb_find_busiest_similar_cap_cpu() there was a change
introduced to prevent partially halted cpus from pulling tasks from
its unhalted sibling. This was done for cleanliness. Since the
partially halted cpu typically runs at the same or higher
frequency as its sibling, there is no need to prevent it from helping
an unhalted sibling. This is no longer correct when the cpus are exactly
the same capcity.

Update walt_lb_find_busiest_similar_cap_cpu() to delete
this condition such that a busiest cpu can be found when considering
a partially halted cpu as a destination or source cpu.

Change-Id: I6bc840d707752fa641e9616b42c8d28775d74a88
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-28 10:57:33 -07:00
jianzhou
758df84ac0 Merge keystone/android14-6.1-keystone-qcom-release.6.1.25 (86b3899) into
qcom-6.1

* refs/heads/tmp-86b3899:
  ANDROID: abi_gki_aarch64_qcom: update abi symbols
  ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration
  ANDROID: GKI: Update symbol list for xiaomi
  ANDROID: vendor_hooks: export cgroup_threadgroup_rwsem
  ANDROID: GKI: Update symbol list for xiaomi
  ANDROID: vendor_hooks:vendor hook for percpu-rwsem

Change-Id: Ib7decf73afc6f7cb89aa69436934f298ec7a027c
Upstream-Build: ks_qcom-android14-6.1-keystone-qcom-release@10868863 UKQ2.230927.001
Signed-off-by: jianzhou <quic_jianzhou@quicinc.com>
2023-09-27 21:48:09 -07:00
qctecmdr
fabdaf8b4a Merge "sched/walt: make partially halted cpus higher cap than silvers" 2023-09-27 11:18:25 -07:00
Stephen Dickey
5b12347695 sched/walt: make partially halted cpus higher cap than silvers
Power/Perf evaluation happened with a configuration where partially
halted cpus were higher than the silver capacity. However, with
various frequency capping schemes capacities may flip.

Introduce a forcing scheme where silvers capacity is always
treated at lower than partially halted cpu.

Also, if a partially halted cpu is helping silver, there is no
need to check util worthiness of the task in
_walt_can_migrate_task(). If the task is running on a silver
cpu, it is sure enough eligible to run on a partially halted cpu.

Change-Id: I5982d9ed090f527546ad5392bccfc6e69ebb26c6
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
2023-09-26 16:31:21 -07:00
keystone-kernel-automerger
26d8266725 Merge android14-6.1-2023-08_r5 into HEAD
* commit 'd96859ba8012783ffcc0a1e60c04d073a9c4ed3a':
  ANDROID: abi_gki_aarch64_qcom: update abi symbols
  ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration

Change-Id: Ibf9a1aca36c966542d0af45333e7e6d13fbfef62
Signed-off-by: keystone-kernel-automerger <keystone-kernel-automerger@google.com>
2023-09-25 07:29:30 +00:00
Stephen Dickey
fa8b59ab72 sched/walt: drain_rq_cpu_stop should unpin the rq lock
When drain_rq_cpu_stop calls __balance_callback, a subsequent
operation for pushing a task, can unlock the runqueue.

 lock_release
 _raw_spin_unlock
 raw_spin_rq_unlock
 find_lowest_rq
 push_rt_task
 push_rt_tasks
 __balance_callbacks
 drain_rq_cpu_stop

This is causing a "releasing a pinned lock" warning, because
drain_rq_cpu_stop locks and pins the rq lock.

Address this issue by ensuring that the rq lock is unpinned
upon the call to __balance_callbacks, and that before exiting
the pin state of the lock is no longer checked.

Change-Id: Ib0ce4a2954567631b49c52c94bb6a0ce25e3153f
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-22 17:08:03 -07:00
qctecmdr
0ca6e7644e Merge "sched/walt: make packing control nodes per cluster" 2023-09-21 19:06:36 -07:00
qctecmdr
586b0cd031 Merge "Merge keystone/android14-6.1-keystone-qcom-release.6.1.25 (bd65f1b) into qcom-6.1" 2023-09-21 08:22:42 -07:00
Stephen Dickey
c00042bcd3 sched/walt: make packing control nodes per cluster
To enhance tuning capability, ensure that the idle_enough and
util_thres_pct control nodes can be tuned per cluster, enabling
different levels of demand and util comparison per cluster.
These nodes are used only in the packing_cpu fastpath decision
making, for rt and cfs.

Change-Id: I29131d9dbce0e29b74cef69fe153bd009eb4fd58
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-20 14:17:14 -07:00
Pavankumar Kondeti
89b1916f96 ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration
In Android GKI, CONFIG_FAIR_GROUP_SCHED is enabled [1] to help
prioritize important work. Given that CPU shares of root cgroup
can't be changed, leaving the tasks inside root cgroup will give
them higher share compared to the other tasks inside important
cgroups. This is mitigated by moving all tasks inside root cgroup to
a different cgroup after Android is booted. However, there are many
kernel tasks stuck in the root cgroup after the boot.

It is possible to relax kernel threads and kworkers migrations under
certain scenarios. However the patch [2] posted at upstream is not
accepted. Hence add a restricted vendor hook to notify modules when a
kernel thread is requested for cgroup migration. The modules can relax
the restrictions forced by the kernel and allow the cgroup migration.

[1] f08f049de1
[2] https://lore.kernel.org/lkml/1617714261-18111-1-git-send-email-pkondeti@codeaurora.org

Bug: 184594949
Bug: 301261126
Change-Id: I445a170ba797c8bece3b4b59b7a42cdd85438f1f
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
[quic_dickey@quicinc.com: port to android-mainline kernel]
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
(cherry picked from commit 7551a1a2a1)
2023-09-20 13:39:17 -07:00
keystone-kernel-automerger
3157cbfe25 Merge android14-6.1-2023-08_r4 into HEAD
* commit '5c1ed513eded33d20e713b1d346e5766251ac98b':
  ANDROID: GKI: Update symbol list for xiaomi
  ANDROID: vendor_hooks: export cgroup_threadgroup_rwsem
  ANDROID: GKI: Update symbol list for xiaomi
  ANDROID: vendor_hooks:vendor hook for percpu-rwsem

Change-Id: If18accea139ba3bbac0db069fad65553ed39b2f5
Signed-off-by: keystone-kernel-automerger <keystone-kernel-automerger@google.com>
2023-09-20 07:28:42 +00:00
qctecmdr
d9cc7fb819 Merge "sched/walt: Update capacities instantly on capping" 2023-09-16 09:22:00 -07:00
liuxudong5
a63af2386a ANDROID: vendor_hooks: export cgroup_threadgroup_rwsem
When the task wakes up from percpu_rwsem_wait, it will enter a long
runnable state, which will cause frame loss when the application
starts. In order to solve this problem, we need to let the process
enter the "vip" queue when it is woken up, so we need to set a flag
for the process holding the lock to prove that it is about to hold
the lock. Most of this long runnable state occurs in the
cgroup_threadgroup_rwsem, so we only care cgroup_threadgroup_rwsem,
and cgroup_threadgroup_rwsem should be exported. Finally, if the
semaphore is of cgroup_threadgroup_rwsem type and has a flag,
then let it join the "vip" queue.

Bug: 300614317
Bug: 300361495
Bug: 297785167
Signed-off-by: liuxudong <liuxudong5@xiaomi.com>
Change-Id: I2297dfbc2f2681581241f85a3b4fd59415ea67db
2023-09-15 12:16:51 +00:00
liuxudong5
c05c6a233c ANDROID: vendor_hooks:vendor hook for percpu-rwsem
We need a new vendor hook for two reasons:
1.The position of the previous vendor hook is inappropriate: when the task wakes up from percpu_rwsem_wait, it will enter a long runnable state, which will cause frame loss when the application starts. In order to solve this problem, we need to let the process enter the "vip" queue when it is woken up, so we need to set a flag for the process holding the lock to prove that it is about to hold the lock. The timing of setting the flag should be at the beginning of percpu_down_read/percpu_down_write rather than the end.
2.Most of this long runnable state occurs in the cgroup_threadgroup_rwsem, so we only care cgroup_threadgroup_rwsem, and cgroup_threadgroup_rwsem should be exported. At the same time, one more parameter "struct percpu_rw_semaphore *sem", is needed for this vendor hook.

Bug: 300614317
Bug: 300361495
Bug: 294496814
Change-Id: I5f014cfb68a60c29bbfd21452336e381e31e81b1
Signed-off-by: liuxudong5 <liuxudong5@xiaomi.com>
2023-09-15 12:15:44 +00:00
qctecmdr
3206597414 Merge "sched/walt: Remove QOS request libraries" 2023-09-15 02:30:26 -07:00
qctecmdr
afd45e0158 Merge "sched/walt: Switch from QOS request to in-kernel freq updates" 2023-09-14 23:55:28 -07:00
jianzhou
dd83e88d4d Merge keystone/android14-6.1-keystone-qcom-release.6.1.25 (bd65f1b) into qcom-6.1
* refs/heads/tmp-bd65f1b:
  ANDROID: uid_sys_stats: Use llist for deferred work
  UPSTREAM: usb: typec: ucsi: Fix command cancellation
  ANDROID: GKI: update symbol list file for xiaomi
  UPSTREAM: erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF
  UPSTREAM: erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
  UPSTREAM: erofs: Fix detection of atomic context
  UPSTREAM: erofs: fix compact 4B support for 16k block size
  UPSTREAM: erofs: kill hooked chains to avoid loops on deduplicated compressed images
  UPSTREAM: erofs: fix potential overflow calculating xattr_isize
  UPSTREAM: erofs: stop parsing non-compact HEAD index if clusterofs is invalid
  UPSTREAM: erofs: initialize packed inode after root inode is assigned
  ANDROID: GKI: Update ABI for zsmalloc fixes
  BACKPORT: zsmalloc: fix races between modifications of fullness and isolated
  UPSTREAM: zsmalloc: consolidate zs_pool's migrate_lock and size_class's locks
  ANDROID: consolidate.fragment: Enable slub debug in consolidate-fragment
  BACKPORT: FROMGIT: mm: handle faults that merely update the accessed bit under the VMA lock
  FROMLIST: mm: Allow fault_dirty_shared_page() to be called under the VMA lock
  FROMGIT: mm: handle swap and NUMA PTE faults under the VMA lock
  FROMGIT: mm: run the fault-around code under the VMA lock
  FROMGIT: mm: move FAULT_FLAG_VMA_LOCK check down from do_fault()
  FROMGIT: mm: move FAULT_FLAG_VMA_LOCK check down in handle_pte_fault()
  BACKPORT: FROMGIT: mm: handle some PMD faults under the VMA lock
  BACKPORT: FROMGIT: mm: handle PUD faults under the VMA lock
  FROMGIT: mm: move FAULT_FLAG_VMA_LOCK check from handle_mm_fault()
  BACKPORT: FROMGIT: mm: allow per-VMA locks on file-backed VMAs
  FROMGIT: mm: remove CONFIG_PER_VMA_LOCK ifdefs
  FROMGIT: mm: fix a lockdep issue in vma_assert_write_locked
  FROMGIT: mm: handle userfaults under VMA lock
  FROMGIT: mm: handle swap page faults under per-VMA lock
  FROMGIT: mm: change folio_lock_or_retry to use vm_fault directly
  BACKPORT: FROMGIT: mm: drop per-VMA lock when returning VM_FAULT_RETRY or VM_FAULT_COMPLETED
  BACKPORT: FROMGIT: mm: move vma locking out of vma_prepare and dup_anon_vma
  BACKPORT: FROMGIT: mm: always lock new vma before inserting into vma tree
  FROMGIT: mm: lock vma explicitly before doing vm_flags_reset and vm_flags_reset_once
  FROMGIT: mm: replace mmap with vma write lock assertions when operating on a vma
  FROMGIT: mm: for !CONFIG_PER_VMA_LOCK equate write lock assertion for vma and mmap
  FROMGIT: mm: don't drop VMA locks in mm_drop_all_locks()
  BACKPORT: riscv: mm: try VMA lock-based page fault handling first
  BACKPORT: FROMGIT: mm: enable page walking API to lock vmas during the walk
  BACKPORT: mm: lock VMA in dup_anon_vma() before setting ->anon_vma
  UPSTREAM: mm: fix memory ordering for mm_lock_seq and vm_lock_seq
  FROMGIT: usb: host: ehci-sched: try to turn on io watchdog as long as periodic_count > 0
  FROMGIT: BACKPORT: usb: ehci: add workaround for chipidea PORTSC.PEC bug
  UPSTREAM: tty: n_gsm: fix UAF in gsm_cleanup_mux
  UPSTREAM: mm/mmap: Fix extra maple tree write
  FROMGIT: Multi-gen LRU: skip CMA pages when they are not eligible
  UPSTREAM: mm: skip CMA pages when they are not available
  UPSTREAM: dma-buf: fix an error pointer vs NULL bug
  UPSTREAM: dma-buf: keep the signaling time of merged fences v3
  UPSTREAM: netfilter: nf_tables: skip bound chain on rule flush
  UPSTREAM: net/sched: sch_qfq: account for stab overhead in qfq_enqueue
  UPSTREAM: net/sched: sch_qfq: refactor parsing of netlink parameters
  UPSTREAM: netfilter: nft_set_pipapo: fix improper element removal
  ANDROID: Add checkpatch target.
  UPSTREAM: USB: Gadget: core: Help prevent panic during UVC unconfigure
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: vendor_hook: fix the error record position of mutex
  ANDROID: ABI: add allowed list for galaxy
  ANDROID: gfp: add __GFP_CMA in gfpflag_names
  ANDROID: ABI: Update to fix slab-out-of-bounds in xhci_vendor_get_ops
  ANDROID: usb: host: fix slab-out-of-bounds in xhci_vendor_get_ops
  ANDROID: GKI: update pixel symbol list for xhci
  FROMGIT: fs: drop_caches: draining pages before dropping caches
  ANDROID: GKI: update symbol list file for xiaomi
  ANDROID: uid_sys_stats: Use a single work for deferred updates
  ANDROID: ABI: Update symbol for Exynos SoC
  ANDROID: GKI: Add symbols to symbol list for vivo
  ANDROID: vendor_hooks: Add tune scan type hook in get_scan_count()
  FROMGIT: BACKPORT: Multi-gen LRU: Fix can_swap in lru_gen_look_around()
  FROMGIT: Multi-gen LRU: Avoid race in inc_min_seq()
  FROMGIT: Multi-gen LRU: Fix per-zone reclaim
  ANDROID: ABI: update symbol list for galaxy
  ANDROID: oplus: Update the ABI xml and symbol list
  ANDROID: vendor_hooks: Add hooks for lookaround
  ANDROID: ABI: Update STG ABI to format version 2
  ANDROID: ABI: Update symbol list for imx
  FROMGIT: erofs: fix wrong primary bvec selection on deduplicated extents
  UPSTREAM: media: Add ABGR64_12 video format
  BACKPORT: media: Add BGR48_12 video format
  UPSTREAM: media: Add YUV48_12 video format
  UPSTREAM: media: Add Y212 v4l2 format info
  UPSTREAM: media: Add Y210, Y212 and Y216 formats
  UPSTREAM: media: Add Y012 video format
  UPSTREAM: media: Add P012 and P012M video format
  ANDROID: GKI: Create symbol files in include/config
  ANDROID: fuse-bpf: Use stored bpf for create_open
  ANDROID: fuse-bpf: Add bpf to negative fuse_dentry
  ANDROID: fuse-bpf: Check inode not null
  ANDROID: fuse-bpf: Fix flock test compile error
  ANDROID: fuse-bpf: Add partial ioctl support
  ANDROID: ABI: Update oplus symbol list
  UPSTREAM: mm/mempolicy: Take VMA lock before replacing policy
  BACKPORT: mm: lock_vma_under_rcu() must check vma->anon_vma under vma lock
  BACKPORT: FROMGIT: irqchip/gic-v3: Workaround for GIC-700 erratum 2941627
  ANDROID: GKI: update xiaomi symbol list
  UPSTREAM: mm: lock newly mapped VMA with corrected ordering
  UPSTREAM: fork: lock VMAs of the parent process when forking
  UPSTREAM: mm: lock newly mapped VMA which can be modified after it becomes visible
  UPSTREAM: mm: lock a vma before stack expansion
  ANDROID: GKI: bring back find_extend_vma()
  BACKPORT: mm: always expand the stack with the mmap write lock held
  BACKPORT: execve: expand new process stack manually ahead of time
  ANDROID: abi_gki_aarch64_qcom: ufshcd_mcq_poll_cqe_lock
  UPSTREAM: mm: make find_extend_vma() fail if write lock not held
  UPSTREAM: powerpc/mm: convert coprocessor fault to lock_mm_and_find_vma()
  UPSTREAM: mm/fault: convert remaining simple cases to lock_mm_and_find_vma()
  UPSTREAM: arm/mm: Convert to using lock_mm_and_find_vma()
  UPSTREAM: riscv/mm: Convert to using lock_mm_and_find_vma()
  UPSTREAM: mips/mm: Convert to using lock_mm_and_find_vma()
  UPSTREAM: powerpc/mm: Convert to using lock_mm_and_find_vma()
  BACKPORT: arch/arm64/mm/fault: Fix undeclared variable error in do_page_fault()
  BACKPORT: arm64/mm: Convert to using lock_mm_and_find_vma()
  UPSTREAM: mm: make the page fault mmap locking killable
  ANDROID: Inherit "user-aware property" across rtmutex.
  BACKPORT: blk-crypto: use dynamic lock class for blk_crypto_profile::lock
  ANDROID: ABI: update symbol list for Xclipse GPU
  ANDROID: drm/ttm: export ttm_tt_unpopulate()
  ANDROID: GKI: Add ABI symbol list(devlink) for MTK
  ANDROID: devlink: Select CONFIG_NET_DEVLINK in Kconfig.gki
  ANDROID: KVM: arm64: Fix memory ordering for pKVM module callbacks
  BACKPORT: mm: introduce new 'lock_mm_and_find_vma()' page fault helper
  BACKPORT: maple_tree: fix potential out-of-bounds access in mas_wr_end_piv()
  UPSTREAM: x86/smp: Cure kexec() vs. mwait_play_dead() breakage
  UPSTREAM: x86/smp: Use dedicated cache-line for mwait_play_dead()
  UPSTREAM: x86/smp: Remove pointless wmb()s from native_stop_other_cpus()
  UPSTREAM: x86/smp: Dont access non-existing CPUID leaf
  UPSTREAM: x86/smp: Make stop_other_cpus() more robust
  UPSTREAM: x86/microcode/AMD: Load late on both threads too
  BACKPORT: mm, hwpoison: when copy-on-write hits poison, take page offline
  UPSTREAM: mm, hwpoison: try to recover from copy-on write faults
  BACKPORT: mm/mmap: Fix error return in do_vmi_align_munmap()
  BACKPORT: mm/mmap: Fix error path in do_vmi_align_munmap()
  UPSTREAM: HID: logitech-hidpp: add HIDPP_QUIRK_DELAYED_INIT for the T651.
  UPSTREAM: HID: hidraw: fix data race on device refcount
  UPSTREAM: can: isotp: isotp_sendmsg(): fix return error fix on TX path
  UPSTREAM: fbdev: fix potential OOB read in fast_imageblit()
  ANDROID: GKI: add function symbols for unisoc
  ANDROID: cgroup: Cleanup android_rvh_cgroup_force_kthread_migration
  UPSTREAM: net/sched: cls_fw: Fix improper refcount update leads to use-after-free
  UPSTREAM: netfilter: nf_tables: fix chain binding transaction logic
  ANDROID: abi_gki_aarch64_qcom: update abi
  UPSTREAM: fs/ntfs3: Check fields while reading
  ANDROID: GKI: Update abi_gki_aarch64_qcom
  ANDROID: ABI: Update pixel symbol list
  ANDROID: GKI: Move GKI module headers to generated includes
  ANDROID: set kmi_symbol_list_add_only for Kleaf builds.
  ANDROID: GKI: Add Android ABI padding to wwan_port_ops
  ANDROID: GKI: Add Android ABI padding to wwan_ops
  ANDROID: update symbol list for unisoc regmap vendor hook
  ANDROID: GKI: Update mtk ABI symbol list
  UPSTREAM: media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*()
  ANDROID: abi_gki_aarch64_qcom: Update QCOM symbol list
  ANDROID: ABI: Update pixel symbol list
  ANDROID: GKI: add ABI symbol for xiaomi
  ANDROID: vendor_hooks: add vendor hook to support SAGT
  FROMLIST: fuse: revalidate: don't invalidate if interrupted
  ANDROID: GKI: Update pixel symbol list for thermal
  ANDROID: thermal: Add vendor thermal genl check
  ANDROID: GKI: Update the pixel symbol list
  ANDROID: GKI: Update protected exports
  FROMGIT: mm: add missing VM_FAULT_RESULT_TRACE name for VM_FAULT_COMPLETED
  FROMGIT: swap: remove remnants of polling from read_swap_cache_async
  UPSTREAM: io_uring/poll: serialize poll linked timer start with poll removal

Change-Id: Ib4aaa987f777d4cdb0897af78aecb19aaee8d68b
Upstream-Build: ks_qcom-android14-6.1-keystone-qcom-release@10801570 UKQ2.230913.001
Signed-off-by: jianzhou <quic_jianzhou@quicinc.com>
2023-09-14 23:00:37 -07:00
Shaleen Agrawal
466227f983 sched/walt: Update capacities instantly on capping
Currently, there is an up to a window's worth of delay between when
frequencies are capped/uncapped to when the capacities are updated to
reflect this capping.

While the change in the frequency itself may be delayed until the next
cpufreq update, it is prudent to update the cpu capacities to reflect
the latest capped/uncapped reality as soon as the settings take place as
rq locks are not required to update cpu capacties.

Change-Id: I93963ac04f7c5bf746d294c5bae586d58390b782
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-14 12:03:02 -07:00
Shaleen Agrawal
7158f837fb sched/walt: Introduce fmax uncap cluster-based need hysteresis
When the smart fmax capping feature is enabled, introduce a feature to
monitor the clusters for utilization, specifically to identify, if a
cluster continuously operates at or above 90% of the utilization
threshold associated with the capped frequency for at least 300ms.
In such a case, lift the smart fmax capping restrictions and
ungate the capping across all clusters.

Change-Id: Ib95319b8a06d42109327bec5122874d738502d39
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-14 12:02:19 -07:00
Shaleen Agrawal
7ad48233fe sched/walt: Remove QOS request libraries
In order to handle QOS requests within WALT, infrastructure in the form
of numerous helper functions and enums was introduced. As QOS requests
will no longer be used to limit fmax, remove these functions for code
cleanliness.

Change-Id: Ica8855522b68b60b35e14b047441e69777467fcd
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 11:34:24 -07:00
Shaleen Agrawal
a2292bd3e3 sched/walt: Switch from QOS request to in-kernel freq updates
Instead of doing a proper QOS request, internally cap the fmax from
WALT cpufreq side.

Will address capacity restrictions in a followup patch.

Change-Id: Ic0904590fbfd84e22767e89aeaa1f6eb9e2b2618
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-13 11:34:24 -07:00
Shaleen Agrawal
8123d0957d sched/walt: Remove QOS request hooks
As QOS requests have been replaced with an internal handling of
frequency capping directly by the CPUFREQ governor, remove them from
WALT.

Change-Id: Iaaabd8bdb7079379a72a735847f9b491219720f2
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 11:34:24 -07:00
Shaleen Agrawal
63541c45d0 sched/walt: Add reasons flags for fmax capping
Introduce flags to help with trace analysis in understanding why a
particular CPU frequency was selected when capping is involved.

Change-Id: I9a0a90800d3eb87a83a88e7637739395a7f11626
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-13 11:34:24 -07:00
Shaleen Agrawal
b6c73ba824 sched/walt: Reduce capacities in accordance with frequencies
When WALT caps the frequencies, ensure, with proper locks held, the
capacities of the frequency capped CPUs are updated accordingly.

Change-Id: I98868038d6129caff0a00b78c2645150747c29a2
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-09-13 11:34:24 -07:00
Shaleen Agrawal
0e85c23095 sched/walt: Improve code readability in update_history
There is a convoluted set of if/else statements to select the demand
based off of the window policy. Restructure to use a switch expression
for additional clarity.

Change-Id: I4b95b1dbcc96c110f3cceb72641bb979376cdfeb
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 11:28:54 -07:00
Shaleen Agrawal
bc8c838a9d sched/walt: Boost ramp-up demands
If the recent runtime is larger than the average in a history update,
consider if the task is a heavy task by examining the predictive buckets,
and determining if the second from the top or top most buckets have any
hysteresis present.

In such a case, so long as the hysteresis is above a certain threshold,
update demand to reflect a demand of 1024.

Change-Id: Ia3eeaa10b0afeea38ce442230a05b4968591a144
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 11:24:11 -07:00
Shaleen Agrawal
9adca62c76 sched/walt: Fix clusters alignment in 4 cluster parts
Clusters are organized by capacities, which can cause the clusters to be
out of order in the case of Golds and Golds- on parts where Golds have a
higher capacity than Golds-.

An earlier fix attempted to address this by swapping the cluster IDs,
however, that doesn't address the positions of the clusters list, which
is actually referenced by the scheduler whenever for_each_sched_cluster
routine is run.

As a consequence, the cluster_state in core_ctl is incorrectly mapping
the Gold cluster to Gold- and vice versa, causing incorrect behavior
when boosting clusters.

Fix this by swapping the clusters list instead of swapping the cluster
IDs. This ensures that not only are the cluster IDs assigned properly,
but also, for_each_sched_cluster loops through clusters in the correct
order.

Change-Id: If90e4ccf0e276b31b2dca92e66049db67ffa1f9e
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 10:18:29 -07:00
Shaleen Agrawal
9a6e046e52 sched/walt: Fix delay rearrange pipeline tasks
In the present case, in the AUTO_PIPELINE usecase, it is possible for
heavy tasks to be identified, however, the swap procedure could be
delayed due to delay_rearrange. Ensure that as soon as heavy tasks have
been identified, any rearrange takes place immediately, rather than wait
for the hysteresis. Instead, the hysteresis should start from the point
where heavy tasks are identified.

Change-Id: I90e60ef3e1b6738b1c2523059c4261338d3f347e
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 10:18:29 -07:00
Shaleen Agrawal
e7555763ee sched/walt: Add pipeline tracing
Add tracing to help debug pipeline related issues which may come up from
swapping pipeline tasks as well as listing all auto selected pipeline
tasks.

Change-Id: I47c15cea8204f382a502f4ff2999ae201e8a0bbd
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 10:18:29 -07:00
Shaleen Agrawal
d600d4959b sched/walt: Fix coloc demand based pipeline CPU selection
Currently, while coloc demand is used to rearrange tasks, regular demand
in being used to find the pipeline tasks. Fix this discrepancy by
ensuring coloc demand is also used to find tasks.

Change-Id: Ie97ba822becef40d3572f44b3372f5b3eafc1ae8
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-13 10:18:29 -07:00
Omkar Sai Sandeep Katadi
e401e169ba Merge remote-tracking branch into HEAD
* keystone/mirror-android14-6.1-2023-08: (162 commits)
  ANDROID: uid_sys_stats: Use llist for deferred work
  UPSTREAM: usb: typec: ucsi: Fix command cancellation
  ANDROID: GKI: update symbol list file for xiaomi
  UPSTREAM: erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF
  UPSTREAM: erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
  UPSTREAM: erofs: Fix detection of atomic context
  UPSTREAM: erofs: fix compact 4B support for 16k block size
  UPSTREAM: erofs: kill hooked chains to avoid loops on deduplicated compressed images
  UPSTREAM: erofs: fix potential overflow calculating xattr_isize
  UPSTREAM: erofs: stop parsing non-compact HEAD index if clusterofs is invalid
  UPSTREAM: erofs: initialize packed inode after root inode is assigned
  ANDROID: GKI: Update ABI for zsmalloc fixes
  BACKPORT: zsmalloc: fix races between modifications of fullness and isolated
  UPSTREAM: zsmalloc: consolidate zs_pool's migrate_lock and size_class's locks
  BACKPORT: FROMGIT: mm: handle faults that merely update the accessed bit under the VMA lock
  FROMLIST: mm: Allow fault_dirty_shared_page() to be called under the VMA lock
  FROMGIT: mm: handle swap and NUMA PTE faults under the VMA lock
  FROMGIT: mm: run the fault-around code under the VMA lock
  FROMGIT: mm: move FAULT_FLAG_VMA_LOCK check down from do_fault()
  FROMGIT: mm: move FAULT_FLAG_VMA_LOCK check down in handle_pte_fault()
  ...

Change-Id: Ic33be5a9dae71958c187029751cb599a83110ab9
2023-09-11 22:08:38 +00:00
Shaleen Agrawal
d05fcdbc3e sched/walt: Remove references to EXPORT_SYMBOL
In accordance with guidelines, remove any references to EXPORT_SYMBOL
and use EXPORT_SYMBOL_GPL instead.

Change-Id: Ie37d5d5da24e0a5daf0569054622399723fe98f8
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-09-07 12:01:00 -07:00
jianzhou
e1fcc974b1 Merge keystone/android14-6.1-keystone-qcom-release.6.1.25 (af4467f) into
qcom-6.1

* refs/heads/tmp-af4467f:
  ANDROID: ABI: Update STG ABI to format version 2
  ANDROID: GKI: Update pixel symbol list for thermal
  ANDROID: thermal: Add vendor thermal genl check
  ANDROID: ABI: Update symbol for Exynos SoC
  ANDROID: GKI: Update mtk ABI symbol list
  ANDROID: ABI: Update symbol list for imx
  FROMGIT: Multi-gen LRU: Fix per-zone reclaim
  ANDROID: GKI: Update abi_gki_aarch64_qcom
  ANDROID: ABI: Update STG ABI to format version 2
  BACKPORT: FROMGIT: irqchip/gic-v3: Workaround for GIC-700 erratum 2941627
  ANDROID: ABI: update symbol list for Xclipse GPU
  ANDROID: drm/ttm: export ttm_tt_unpopulate()
  ANDROID: fuse-bpf: Add partial flock support
  ANDROID: Incremental fs: Allocate data buffer based on input request size
  UPSTREAM: gfs2: Don't deref jdesc in evict
  ANDROID: KVM: arm64: Fix MMU context save/restore over TLB invalidation
  ANDROID: Update symbol list for VIVO
  ANDROID: add initial symbol list file for ExynosAuto SoCs
  ANDROID: sched: Export sched_domains_mutex for lockdep
  ANDROID: Update symbol for Exynos SoC
  ANDROID: ABI: Update symbol for Exynos SoC
  ANDROID: Update symbol list for mtk
  UPSTREAM: dma-remap: use kvmalloc_array/kvfree for larger dma memory remap
  ANDROID: vendor_hooks: Supplement the missing hook call point.
  ANDROID: GKI: Add WWAN as GKI protected module
  ANDROID: GKI: regmap: Add regmap vendor hook for of_syscon_register
  UPSTREAM: kasan: suppress recursive reports for HW_TAGS
  UPSTREAM: kasan, arm64: add arch_suppress_tag_checks_start/stop
  UPSTREAM: arm64: mte: rename TCO routines
  BACKPORT: kasan, arm64: rename tagging-related routines
  UPSTREAM: kasan: drop empty tagging-related defines
  ANDROID: usb: xhci-plat: Fix double-free in xhci_plat_remove
  ANDROID: ABI: update symbol list for galaxy
  ANDROID: GKI: update the ABI symbol list
  ANDROID: ABI: Update symbol for Exynos SoC
  ANDROID: GKI: ABI: update whitelist for the kmsg_dump and native_hang symbols used by unisoc for kernel6.1
  ANDROID: ABI: Update symbols to unisoc whitelist for ims_bridge module
  ANDROID: abi_gki_aarch64_qcom: Add drm_plane_from_index and drm_gem_prime_export
  ANDROID: abi_gki_aarch64_qcom: Update symbol list
  UPSTREAM: fsverity: reject FS_IOC_ENABLE_VERITY on mode 3 fds
  UPSTREAM: fsverity: explicitly check for buffer overflow in build_merkle_tree()
  ANDROID: update unisoc symbol list
  ANDROID: update symbol for unisoc whitelist
  UPSTREAM: f2fs: fix deadlock in i_xattr_sem and inode page lock
  ANDROID: GKI: update xiaomi symbol list
  Revert "FROMLIST: f2fs: remove i_xattr_sem to avoid deadlock and fix the original issue"
  ANDROID: ABI: Update pixel symbol list
  ANDROID: Set arch attribute for allmodconfig builds
  UPSTREAM: usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
  ANDROID: ABI: Add to QCOM symbols list
  UPSTREAM: arm64: mm: pass original fault address to handle_mm_fault() in PER_VMA_LOCK block
  UPSTREAM: media: rkvdec: fix use after free bug in rkvdec_remove
  ANDROID: GKI: Update symbol list for MediatTek
  UPSTREAM: scsi: ufs: core: Remove dedicated hwq for dev command
  BACKPORT: scsi: ufs: mcq: Fix the incorrect OCS value for the device command
  FROMLIST: scsi: ufs: ufs-mediatek: Add MCQ support for MTK platform
  FROMLIST: scsi: ufs: core: Export symbols for MTK driver module
  UPSTREAM: blk-mq: check on cpu id when there is only one ctx mapping
  UPSTREAM: relayfs: fix out-of-bounds access in relay_file_read
  UPSTREAM: net/sched: flower: fix possible OOB write in fl_set_geneve_opt()
  UPSTREAM: x86/mm: Avoid using set_pgd() outside of real PGD pages
  UPSTREAM: iommu/amd: Add missing domain type checks
  UPSTREAM: tty: serial: qcom_geni: avoid duplicate struct member init
  UPSTREAM: scsi: ufs: core: bsg: Fix cast to restricted __be16 warning
  UPSTREAM: netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE
  ANDROID: fix build error when use cpu_cgroup_online vh
  ANDROID: ABI: add android_debug_symbol to whitelist
  ANDROID: defconfig: Enable debug_symbol driver
  ANDROID: android: Create debug_symbols driver
  ANDROID: ABI: update symbol list for exynos
  ANDROID: KVM: arm64: Remove 'struct kvm_vcpu' from the KMI
  UPSTREAM: KVM: arm64: Restore GICv2-on-GICv3 functionality
  UPSTREAM: KVM: arm64: vgic: Wrap vgic_its_create() with config_lock
  UPSTREAM: KVM: arm64: vgic: Fix a circular locking issue
  UPSTREAM: KVM: arm64: vgic: Don't acquire its_lock before config_lock
  BACKPORT: KVM: arm64: Avoid lock inversion when setting the VM register width
  UPSTREAM: KVM: arm64: Avoid vcpu->mutex v. kvm->lock inversion in CPU_ON
  BACKPORT: KVM: arm64: Use config_lock to protect data ordered against KVM_RUN
  UPSTREAM: KVM: arm64: Use config_lock to protect vgic state
  BACKPORT: KVM: arm64: Add helper vgic_write_guest_lock()
  ANDROID: sound: usb: Fix wrong behavior of vendor hooking
  ANDROID: GKI: USB: XHCI: add Android ABI padding to struct xhci_vendor_ops
  Revert "ANDROID: android: Create debug_symbols driver"
  ANDROID: android: Create debug_symbols driver
  UPSTREAM: ipvlan:Fix out-of-bounds caused by unclear skb->cb
  ANDROID: update symbol list for unisoc vendor hook
  ANDROID: thermal: Add hook to enable/disable thermal power throttle
  ANDROID: ABI: Update symbol for Exynos SoC
  BACKPORT: FROMGIT: usb: gadget: udc: Handle gadget_connect failure during bind operation
  FROMGIT: usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens
  ANDROID: GKI: Update symbol list for xiaomi
  ANDROID: vendor_hooks: vendor hook for MM
  ANDROID: add a symbol to unisoc symbol list
  ANDROID: GKI: update symbol list file for xiaomi
  UPSTREAM: net/sched: cls_u32: Fix reference counter leak leading to overflow
  ANDROID: db845c: Fix build when using --kgdb
  FROMGIT: usb: host: xhci-plat: Set XHCI_STATE_REMOVING before resuming XHCI HC
  FROMGIT: usb: host: xhci: Do not re-initialize the XHCI HC if being removed
  FROMLIST: kheaders: dereferences the source tree
  FROMLIST: f2fs: remove i_xattr_sem to avoid deadlock and fix the original issue
  ANDROID: db845c: Local define for db845c targets
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: Export memcg functions to allow module to add new files
  ANDROID: rockpi4: Fix build when using --kgdb
  ANDROID: GKI: update symbol list file for xiaomi
  ANDROID: kleaf: android/gki_system_dlkm_modules is generated.
  ANDROID: ABI: Update pixel symbol list
  ANDROID: fuse-bpf: Move FUSE_RELEASE to correct place
  ANDROID: fuse-bpf: Ensure bpf field can never be nulled
  ANDROID: GKI: Increase CMA areas to 32
  ANDROID: Delete MODULES_LIST from build configs.
  ANDROID: ABI: Update symbols to unisoc whitelist
  ANDROID: HID: Only utilise UHID provided exports if UHID is enabled

 Conflicts:
	BUILD.bazel

Change-Id: Ibeee32bbc28dd5ad943cfb512ae73094cce2027c
Upstream-Build: ks_qcom-android14-6.1-keystone-qcom-release@10659679
UKQ2.230815.001
Signed-off-by: jianzhou <quic_jianzhou@quicinc.com>
2023-08-30 02:32:26 -07:00
qctecmdr
ad947e0d93 Merge "sched/walt: Fix cluster index swap" 2023-08-29 08:37:02 -07:00
qctecmdr
e42c084b1f Merge "sched/walt: Ensure always in state2 if no partial halted CPUs" 2023-08-25 10:57:11 -07:00
Shaleen Agrawal
8ac97c5dab sched/walt: Fix cluster index swap
In the event of a 4 cluster system, where gold- cluster has a lower
max capacity than gold cluster, the positions of the sched_clusters are
swapped to ensure preset order. However, the cluster ids themselves were
improperly set.

Fix this by ensuring the cluster IDs are appropriately swapped.

Change-Id: I43447a5c1cf89bdbbc7f3ed4eff1a970ada1e3a7
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-08-25 10:47:44 -07:00
Shaleen Agrawal
7acd4b7dba sched/walt: Ensure always in state2 if no partial halted CPUs
is_state1 is supposed to return true, if and only if all CPUs that are
capable of being partially halted are either partially halted or fully
halted.

In the event that there are no partially halted CPUs in a system,
meaning min_partial_cpus is defined as 0, the expectation is for
is_state1 to return false.

However, cpumask_subset will return true if the first source CPU mask is
empty. This leads to unexpected behavior, as it would result in a case
where the system is always under state1 when min_partial_cpus is set to
0, resulting in a side effect where frequencies would never be synced.

Fix this by ensuring that if the number of CPUs that are capable of
being partially halted is 0, is_state1 returns false, thereby ensuring
that in such a system, state2, and therefore frequency sync, is always
the norm.

Change-Id: I2fb7cf27659d42fe713bdacf08db9b7c88c06800
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-08-24 10:38:18 -07:00
qctecmdr
97f56eed2b Merge "sched/walt: Introduce bug_on lockdep failures" 2023-08-24 01:55:46 -07:00
qctecmdr
fc59f95c92 Merge "sched/walt: Fix WALT_BUG crash observed" 2023-08-23 12:28:59 -07:00
qctecmdr
303abc30ea Merge "sched/walt: revise incorrect passed parameter for pipeline_reset_boost()" 2023-08-21 12:21:45 -07:00
qctecmdr
c44359bbad Merge "sched/walt: manual pipeline should allow cpu 0" 2023-08-21 12:21:44 -07:00
Tengfei Fan
09d0b48fe9 sched/walt: revise incorrect passed parameter for pipeline_reset_boost()
Revise incorrect passed parameter for pipeline_reset_boost().

Change-Id: I01b4f0f546fcebfea1b474f675ddfe05d5d50c84
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
2023-08-16 18:44:38 -07:00
Stephen Dickey
bd7a3e0fba sched/walt: manual pipeline should allow cpu 0
If cpu 0 is to be allowed as a pipeline cpu, then the existing
code is incorrect because it will by default skip cpu 0 for
manual pipeline assignment.

Correct this by feeding -1 into cpumask_any_and, in the event
that it is time to roll-over and start re-selecting from the
cpus mask again.

Change-Id: Ia5e170e287db9ff7010555d51da3ea9789e2ec1e
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2023-08-16 15:12:13 -07:00
Shaleen Agrawal
ff989fe194 sched/walt: Fix WALT_BUG crash observed
A WALT_BUG crash was intermittently observed, where a task's mark_start
would appear to have moved ahead of a task's window_start by more than
one window.

In order to debug this further, a series of additional WALT_BUGs were
introduce, which yielded in a crash where mark_task_starting was being
called by a task whose mark_start had already been set.

In wake_up_new_task, prior to trace_android_rvh_new_task_stats being
referenced (which is where mark_start is supposed to be initialized), it
is possible that another call to UTRA sneaks by during the fork
balancing step, at the end of which, mark_start would be initialized.

Address this by reorganizing mark_task_starting to acknowledge that
another UTRA may have initialized mark_start, and further add clarity by
updating the CPU cycles through a reference to UTRA rather than doing so
directly.

Change-Id: Iae4efad890417d3708048ae95eea0532776ad24a
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-08-16 10:58:37 -07:00
qctecmdr
91de49da25 Merge "sched/walt: Print colocation thresholds" 2023-08-16 10:56:10 -07:00
qctecmdr
976ef61b65 Merge "sched/walt: Introduce WALT_BUG if mark_task_starting occurs twice" 2023-08-15 13:31:20 -07:00
Stephen Dickey
4f09aeb3c8 sched/walt: Introduce bug_on lockdep failures
In the event that lockdep_asserts fail, indicating that runqueue locks
are not held in a path where they should be in WALT, crash instantly to
prevent unpredictable behavior and gain insights to enable fixing the
underlying issue.

Change-Id: I940c958a77221cd1d8eb1976e0f69dfc3b33ce1e
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-08-15 11:04:45 -07:00
Shaleen Agrawal
3cec0c1971 sched/walt: Print colocation thresholds
Add colocation thresholds in the trace which helps debug information
regarding colocation status.

Change-Id: I908cd868b0cc9b431a3ba49696d5a0328748bf1c
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2023-08-14 16:16:47 -07:00