Commit Graph

1104520 Commits

Author SHA1 Message Date
qctecmdr
e092e6d615 Merge "Merge scheduler changes from 5.15 into msm-pineapple" 2022-07-08 18:18:32 -07:00
qctecmdr
80189a228c Merge "pinctrl: qcom: Add support to set wakeup_enable bit" 2022-07-08 18:18:32 -07:00
qctecmdr
976c0c810f Merge "build.config.msm.gki: Only trim GKI build" 2022-07-08 18:18:31 -07:00
qctecmdr
f799138aa3 Merge "soc: qcom: msm_perf: Port for msm_performance include" 2022-07-08 18:18:29 -07:00
qctecmdr
d835cb2d8b Merge "qcom-iommu-util: Introduce qcom_iommu_get_asid_nr()" 2022-07-08 13:25:16 -07:00
qctecmdr
ae06d58362 Merge "build.config: pineapple: Enable device tree overlay" 2022-07-07 10:50:15 -07:00
Sai Harshini Nimmala
8ea8ed4c91 Merge scheduler changes from 5.15 into msm-pineapple
Merge remote-tracking branch 'quic/tmp-5204e04' into msm-pineapple

* quic/tmp-5204e04:
  sched: improve the scheduler
  sched: walt: handle support for single and two cluster system
  sched/walt: check for -1 for first_idle cpu
  sched/walt: Remove avg_cap check in packing CPU feature
  sched/walt: Add walt_disabled checks
  sched/walt: Fix excess detach_task in walt_lb_pull_tasks
  sched/walt: Check reserved CPU during walt_newidle_balance
  treewide: Fixup copyright attribution
  Revert "sched/walt: print all history samples"
  Revert "sched: Use bitshift over division"
  sched: walt: handle CTS failure for sched_set/getaffinity
  sched: walt: add nested spinlock api
  sched/walt: Ensure driving cpu is used for region3
  sched: walt: Drop double rq locks for migrations
  sched/walt: handle misaligned task window start
  sched/walt: reject queue_wakelist() is cpu is same as waker cpu
  sched/walt: Improve the scheduler
  sched/walt/halt: track halt reasons
  sched/walt: properly account irq entry/exit
  sched/walt: Prevent within cluster load balance of misfits
  sched/walt: Cleanup CPUFREQ flags and reasons
  sched/walt: Add thermal pressure to cpu_util TP
  sched/walt: Add global_ws to walt dump
  sched: walt: allow silver to help prime during newidle balance
  sched/walt cfs: rt: find a packing cpu
  sched/walt: add functionality for choosing a packing cpu
  sched/walt/avg: cache window based statistics
  sched/walt: Kick newidle balance after unhalting
  Revert "sched: walt: Remove finding historical runtimes in pred"
  sched/walt: window rollover missing fix
  sched/walt/halt: prevent selection of non-32 bit cpu
  sched/walt: Ensure one 32bit capable cpu is never halted
  sched/walt: print global ws in UTRA traces
  sched/walt: remove set_window_start
  sched/walt: prevent main walt_irq_work execution for no notif
  sched/walt: add wrq->latest_clock to the walt dump
  sched/walt: use rq->clock_task from scheduler tick hook
  sched/walt: Improve the scheduler
  sched/walt: use num_mvp_tasks for check if rq have mvp task
  sched/walt: don't requeue mvp task if only have one mvp task on rq
  sched/walt: add num_mvp_tasks for get the number of mvp task in walt rq
  sched/walt: get rcu lock before use task's cgroups
  sched/walt: check current task's mvp_list instead of mvp prio
  sched/walt: skip long running RT task detection for stopper tasks
  sched: Re-fix lock_cpus mask setting during IC migrations
  sched: Improve the Scheduler
  sched: Use bitshift over division
  sched/walt: remove duplicate definitions of rt_task_arrival_time
  sched/walt: check for incorrect cpu assignment
  sched/walt: fix deadlock due to recursive rq locking
  sched/walt: fix incorrect migrations for RT task
  sched/walt: streamline affinity mask
  sched: Revert "sched/walt: Account for changing task affinity"
  sched/walt: Fix lock_cpus mask setting during IC migrations
  sched/walt/halt: ra-arrange the code
  sched/walt: Add yield case to LRRT task detection
  sched/walt/core_control: disable need_all_cpus()
  sched/walt: Add parameter for CPUFREQ reasons
  sched: Align window start with tick boundary
  sched/walt: Account for changing task affinity
  sched/walt/rt: limit long running RT task detection to FIFO
  sched/walt: print all history samples
  sched/walt: stop accounting stopper threads as long running RT
  sched/walt: Improve comments
  sched/walt: Optimize update_task_ravg() calls
  sched/walt/core_ctl: do core control immediately
  sched/walt/halt: use kthread to launch cpu drain operations
  sched: walt: fix stale window_start for walt load
  sched: walt: properly account for migrating mvp task
  sched/walt: Fix in long running RT task detection
  sched/walt: Disable long running RT task detection
  sched/walt: Remove unused sysctl node
  sched/walt: cleanup copyright issues
  sched/walt: walt hooks skipped during rt throttling
  sched/walt: kick unhalted cpu for load-balancing
  sched/walt: Fix setting RTG Boost Freq
  sched: walt: add trace in update_cpu_capacity
  sched: Fix negative capacity issue under thermal conditions
  sched/walt/halt: prevent migration of migration_disabled tasks
  sched/walt: cleanup hooks for halt
  sched: walt: Use pred_demand_scaled for all predictive ops
  sched: walt: Introduce bucket bitmask
  sched: walt: Remove finding historical runtimes in pred
  sched: walt: Use rq_clock instead of sched_ktime_get
  sched/walt: avoid halted cpus in get_nohz_timer_target
  sched: walt: use the is_cpu_allowed tracehook to restrict cpus
  Revert "sched/walt_cfs: temporarily disable MVP feature"
  sched/walt_cfs: set_next_entity hierarchy
  sched/walt: do not perform unnecessary migrations
  sched/walt: Deprecate RT task throttling
  sched/walt: Handle long running RT tasks
  sched/walt: rename to sched_get_cpu_util_pct
  sched/walt: guarantee result from energy efficient cpu
  sched: walt: take runnable into account for placement descision
  sched/walt: Fix in walt_lb_tick
  sched/walt_cfs: temporarily disable MVP feature
  sched: walt: update the copyright
  sched/walt: catch any set_task_cpu to unaffined cpus
  sched/walt: allow checking of last halt time against threshold
  sched/walt: create conditions for walt-bug and console output
  sched/walt: Compare cluster IDs instead of capacities
  sched: walt: fix rounding off error
  sched/walt: update select_task_rq_rt to filter halted cpus
  sched/walt: Deal with mvp_list at the very initial stage
  sched: Simplify sliding window logic
  sched/walt: remove unused can_halt cpu mask
  sched/walt: cleanup cpu_active and cpu_online usage
  sched/walt: catch tasks running on disallowed cpus
  sched/walt/halt: cleaup issues post-review
  sched/walt: Increase the number of history samples
  sched: Remove references to min/max capacity cpus
  sched/walt: make cmt aware of boosted/colocated task
  sched/walt: move trace_sched_compute_energy tracepoint
  sched/walt: kick Gold if farthest cluster needs help
  sched/walt: avoid halted cpus in walt_find_energy_efficient_cpu
  sched/walt: avoid halted cpus for rt in find_lowest_rq
  sched/walt: limit the cpu selected by rto_next_cpu
  sched/walt: limited the dest_cpu with set_cpus_allowed_ptr_locked
  sched/walt: do not allow migration to halted CPU
  sched/walt/rt: check halted flag for rt task wakeups
  sched/walt: avoid halted cpus for prev cpu fastpath
  sched/walt: avoid halted cpus in newidle balance
  sched/walt/core_ctl: minimum changes for halt
  sched/walt/halt: update tracepoints for halt/start
  sched/walt/pause: remove pause functionality from build
  sched/walt/halt: walt halt functionality
  sched/walt: walt irq work reduce locking
  sched/walt: remove task from mvp list if task in yield
  sched/walt: Fix frequent frequency updates
  sched/walt: Remove unsused function
  sched/walt: Restore obj file in Makefile
  sched/walt: Improve the scheduler
  sched: Improve the scheduler
  sched: walt: Improve the scheduler
  sched: walt: Fix stale walt CPU reservation flag
  sched: walt: Fix bad casting in trace
  sched: Improve the Scheduler
  walt_lb: Read push_task under lock
  sched/walt: Remove duplicate get_task_struct
  sched/walt: improve preemptirq template based tracepoints
  sched/walt/walt_rt: Improve the scheduler
  include/linux/cpu: Remove get_online_cpus and put_online_cpus wrapper
  sched/walt: Remove vendor hook for resume_cpus
  Revert "sched:walt: register tracehooks for race with pause"
  sched/walt: Improve the scheduler
  sched/walt: Clear scale_frequency_data during init
  pause: port the users of pause
  sched/walt: complain if num clusters is high
  sched/walt: Change rq lock variable as per upstream
  sched/walt: Remove redefinition of 'task_of' function
  sched_walt: Change from MAX_USER_RT_PRIO to MAX_RT_PRIO
  sched/walt: Change task state variable
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Remove newline in traces
  sched: walt: Create pipeline "low latency" tasks
  sched/walt: fix target load crossover
  sched: walt: Add target load tunables
  sched/walt: Fix caching freq earlier than down rate limit check
  sched/walt: improve task_util trace and variable names
  sched: walt: Don't crash unless crash mode enabled
  sched: Improve the scheduler
  sched/walt: Improve the scheduler
  sched: walt: Imrpove the scheduler
  sched: Improve the Scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched: walt: Improve the scheduler
  sched: walt: Improve the Scheduler
  sched/walt: Improve the scheduler
  sched: walt: Do dequeue task accounting after dequeue
  sched: walt: Use CRA for sum util
  sched/walt: eval_need code and trace cleanup
  sched/walt: Improve the scheduler
  sched/walt: update the value of active_cpus
  sched: walt: Increase nr_threshold to 40 percent
  sched: walt: add sched_switch_ctrs_cfg event
  sched: walt: Account rt scale to cpu_capacity
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Check if necessary for sched_boost modify
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt/walt_cfs: Improve the scheduler
  sched/walt: reduce severity of walt pause warning
  sched/walt: reduce severity of core_ctl warning
  sched/walt: convert existing walt debug to use macro
  sched/walt: sysctl node to allow capture of walt issues
  sched/walt: when idle task is scheduled cra must be zero
  sched/walt: check next task state
  Sched/walt/walt_cfs: Improve the scheduler
  sched: walt: Register restricted trace hook for libunity fixup
  sched/walt: test to ensure dequeue cpu same as enqueue cpu
  sched/walt/walt_rt: Improve the scheduler
  sched/walt: choose best cpu based on spare cap
  sched/walt: skip finding max when energy evaluating
  sched/walt: skip enery evaluation for need_idle when idle CPU is available
  sched/walt/core_ctl: use printk_deferred() in case of errors
  sched/walt: allow reference to walt debug capabilities
  sched: walt: Use unsigned long type for counter values
  sched/walt_rt: Honor sync wakeups
  sched: walt: use scale_cpu for energy evals
  sched/walt: correct return value for walt_pause/resume_cpus()
  sched/walt: Improve the scheduler
  sched: walt: Fix the logic for detecting enq/deq
  sched: Use IS_ENABLED macro to check if config is enabled
  sched: suppress silver region frequency boost
  sched: walt: Add AMU based instructions and cycle counts
  sched:walt: register restricted tracehooks for race with pause
  sched: walt: Ensure only valid cpu selected
  sched: walt: Add cgroup_attach trace point
  Revert "sched:walt: register tracehooks for race with pause"
  sched/walt: prevent lockup when system is suspending
  sched:walt: register tracehooks for race with pause
  sched/walt: Fix scheduling while atomic
  sched: Enable walt debug module in first stage
  sched: walt: Fix max_util calculation
  sched/walt: print per cluster energy
  sched/walt: consolidate multiple rcu unlock statements
  sched: walt: Setup complex sibling hints at init
  sched/walt: Improve the scheduler
  sched/walt: use just 3% energy criteria
  sched/walt: Improve the scheduler
  sched/walt: initiate initialization after topology
  sched/walt: Improve the scheduler
  sched/walt: handle overlap between silver and gold
  sched/walt: use prs for energy evaluation
  sched/walt: skip energy for uninvolved cluster
  sched/walt: create walt friendly energy apis
  sched/walt: Track best target cpu for each cluster
  sched: walt: Move perf counter trace to dynamic trace point
  sched: walt: support dynamic trace event registration
  sched: Disable LPM if CONSERVATIVE_BOOST is enabled
  sched: walt: Fix waltgov_next_freq format specifiers
  sched/walt: improve debug of strange rq situations in walt
  sched/walt: add sched_busy_hyst_time trace event
  sched: Add util_busy_hist feature
  sched: Add util busy hist sysctl tunables
  sched/walt: improve logging in the error paths
  sched/walt: Do the rq clock update before MVP tasks update
  sched/walt: Fix locking issue in MVP tasks update
  sched/walt: Improve the scheduler
  sched: walt: Adjust nomenclature
  sched: walt: expand waltgov_util_update trace point
  sched/fair: Add sched_sync_hint_enable node
  sched/walt: fix lock ordering issue between RTG lock and task's RQ lock
  sched/walt: Improve the scheduler
  sched/walt: fixup_busy_time: Correct typo in lockdep_assert_held
  sched/walt: Improve the scheduler
  sched/walt: Fix newline issues
  sched/walt: Improve the scheduler
  walt: honor affinity in placement path
  sched/walt: Add MVP tasks feature
  sched/walt: cleanup references to pr_emerg
  sched: Improve the scheduler
  sched/walt: Add small task filtering to uclamp
  sched/walt: Cache the affinity of a user space task
  sched/walt: enhanced debug for double enqueue/dequeue
  sched/walt: debug for fixup_cumulative_runnable_avg
  sched/walt: Improve the scheduler
  sched/walt: improved debug for tracking accounting cases
  sched/walt: Apply binder vendor hook performance tune
  sched/walt: Improve the scheduler
  sched/walt: Initialize task groups from vendor hook
  sched: walt: Cleanup fbt_env boosted member
  sched: walt: Improve FEEC energy variable nomenclature
  sched: walt: Shift boost status of current task
  sched: walt: Move spare_cap calculation
  sched: walt: remove extra function call
  sched/walt: add rt_time to dump_throttled_rt_tasks
  sched/walt: null ptr dereference fix in walt_lb_active_migration
  sched/walt: core_ctl init out of order
  sched/walt: Read sysctl_sched_ravg_window_nr_ticks under mutex
  sched/walt: Remove unused sched_dynamic_ravg_window_enable tunable
  sched/walt: sched_task_util trace point updates
  sched/walt: Modify sched_task_util tracepoint
  sched/walt: update check during debug module init
  sched/walt: Adjust code as per new dequeue_task() hook invocation
  sched/walt: Update CPU capacity based on cpufreq constraints
  thermal/pause: thermal driver not tracking pause state
  walt/core_ctl: handle error conditions
  walt/pause: switch over to mutex and protect call to pause/resume
  sched/pause: handle cpu online processing for pause
  sched: walt: Improve the scheduler
  sched/walt: Remove incorrect TODO/FIXME comments
  sched/walt: Track wake_q length using newer parameter
  sched: walt: Improve the Scheduler
  sched: walt: Move task_boost_type declarations
  sched/walt: Improve the chance of RT task pull
  sched/walt: Improve walt_newidle_balance trace point
  sched/walt: improve debug for time_delta < 0
  sched/pause: support refcounting on pause cpus operation
  sched/walt: Track CPUs that can't be paused
  sched/walt: Fix !idle case in walt_get_idle_exit_latency
  sched/walt: Remove left over references to cum_window_demand
  sched/walt: Add fair task check in tick path load balance
  sched/walt: Remove duplicate restricted vendor hook registration
  sched/walt: Implement balance_rt vendor hook
  binder: update low_latency selection for binder transactions
  sched/walt: Use nr_running > 1 condition for same cluster lb
  sched/walt: Use unbounded cpu util in load balancer
  sched/walt: Don't migrate running task to a busy CPU
  sched/walt: Fix misfit accounting issues
  sched/walt: Fix walt_lb_find_busiest_lower_cap_cpu() condition
  sched/walt: implement select_task_rq_rt trace hook
  sched/trace: support compat in enq/deq trace
  sched/walt: Temporarily disable sibling_count_hint
  sched/walt: Clean up the code
  sched/walt: Make debug module depend on SCHED_WALT
  sched/walt: Remove the active task special case from wfbt()
  sched/walt: Fix waking new tasks on higher capacity CPUs
  sched/walt: Move public declarations of core_ctl.h to walt.h
  sched/walt: remove unused functions and variables
  sched/walt: Make wake_up_idle related functions public
  sched/walt: Make walt_task_struct struct public
  sched/walt: Export set_task_boost() API
  sched/walt: Introduce waltgov boost feature
  sched/walt: Remove sched_load_boost related code
  sched/walt: Update cpufreq_driver_fast_switch() invocation
  sched/walt: Remove references to schedutil flags
  sched/walt: Simplify core_ctl active cpu count management
  sched/walt: Fix lockdep warning
  sched/walt: Remove left over code related to kernel command line param
  sched/walt: Implement sched_lpm_disallowed_time() API
  sched: walt: Cleanup core_ctl
  sched/walt: Remove should_we_pause() function
  sched/walt: Remove evaluation from the core_ctl thread context
  sched/wakeup: Optimize core_ctl thread wakeup
  sched/walt: Remove unused sched_pause trace point
  sched/walt: Add window rollover trace event
  sched/walt: Synchronize per-task sysctl and sysctl_task_read_pid
  sched/walt: Improve the scheduler
  sched/walt: Add a build time test for vendor data size check
  sched: walt: Fixup root domain selection
  sched/walt: Remove obsolete TODO comments
  sched/walt: wait for cpufreq policies
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched/walt: Improve the scheduler
  sched: Improve the scheduler
  sched/walt: Restrict new idle load balance based on avg_idle
  sched/walt: Introduce WALT as a module

Change-Id: Iad463c5cdd9384cc09f68b47fdadbc5e2a8143ac
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-07-06 10:44:46 -07:00
Maulik Shah
5ea61b95b8 pinctrl: qcom: Add support to set wakeup_enable bit
Wakeup_enable bit controls the interrupt routing to parent irqchip.
Add support to set it during interrupt allocation for the GPIOs which
are used as interrupt.

While at this update the intr_target_bit value to correct one.

Change-Id: I2eae47aa07be9ba2cb1bcc814a234c9181d1a7d0
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
2022-07-06 22:44:16 +05:30
Elliot Berman
1200a838de build.config.msm.gki: Only trim GKI build
Only enable symbol trimming on the common/ GKI build.

Change-Id: I9a503b2d3beedb6babc8f079ab423cbe374a8a17
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2022-06-30 15:21:49 -07:00
qctecmdr
8e1b2c93b4 Merge "arm64: defconfig: Enable rq_stats driver for pineapple" 2022-06-30 08:42:15 -07:00
qctecmdr
42549563e8 Merge "arm64: deconfig: Enable support for QC specific function drivers" 2022-06-30 02:10:37 -07:00
qctecmdr
25434185af Merge "defconfig: pineapple-gki: Enable our lazy mapping module" 2022-06-29 23:11:42 -07:00
qctecmdr
3070733372 Merge "android: abi_gki_aarch64_qcom: Add mem_section to whitelist" 2022-06-29 20:31:59 -07:00
qctecmdr
3055a3ac2c Merge "soc: qcom: aoss: Add IPC logs" 2022-06-29 17:54:52 -07:00
qctecmdr
fef7f57f76 Merge "mem-buf: Import the DMA-BUF symbol namespace" 2022-06-29 17:54:50 -07:00
qctecmdr
1b9186ec6a Merge "soc: qcom: aoss: Add debugfs entry" 2022-06-29 14:55:00 -07:00
Badri Sampath
0608822629 soc: qcom: msm_perf: Port for msm_performance include
Port for msm_performance include file from 5.15 to KP3.0

Change-Id: Ia7cc1116ad7a74da9a191ee8a7a3d087a371ab8d
Signed-off-by: Badri Sampath <quic_badris@quicinc.com>
2022-06-29 14:48:13 -07:00
qctecmdr
55a9a55c6e Merge "soc: qcom: smp2p: Add IPC logging support" 2022-06-29 11:35:31 -07:00
qctecmdr
5a1f4af368 Merge "soc: qcom: smp2p: Add proper retrigger detection" 2022-06-29 08:29:08 -07:00
qctecmdr
c7dc685673 Merge "trace: Add snapshot of ipc_logging driver" 2022-06-29 01:22:24 -07:00
qctecmdr
a449dca5fd Merge "defconfig: pineapple-gki: Enable the secure-buffer driver" 2022-06-28 20:49:19 -07:00
Hareesh Gundu
6f1f9d433d qcom-iommu-util: Introduce qcom_iommu_get_asid_nr()
Introduce qcom_iommu_get_asid_nr() for clients to query
ASID number to program it during the page table update.

Change-Id: Ia32981ba31c4d333a3227c4e127e1a4606be7483
Signed-off-by: Hareesh Gundu <quic_hareeshg@quicinc.com>
2022-06-28 20:48:08 -07:00
Shaleen Agrawal
5204e04124 sched: improve the scheduler
This change is for general scheduler improvement.

Change-Id: I98af51b7efd49aeec5a7b405625a1db12c654cd5
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:14:08 -07:00
Ashay Jaiswal
4bb9750f22 sched: walt: handle support for single and two cluster system
Update walt_newidle load balance to support single and two
cluster topology.

Change-Id: Ic2bbbe7a273267c1a7aa340f9908b5e5325d21ba
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
2022-06-28 19:14:06 -07:00
Abhijeet Dharmapurikar
336aaa54a7 sched/walt: check for -1 for first_idle cpu
There is a typo in the current code it is checking a value
of 1 for unavailability of idle kick cpu. It should check for
-1 instead.

Fix it.

Change-Id: I8796b4c6315d157834ecc8dc2263bcfb7f50e582
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
2022-06-28 19:14:06 -07:00
Sai Harshini Nimmala
ca90b4c36e sched/walt: Remove avg_cap check in packing CPU feature
The current scheduler code uses avg_cap that is calculated by waltgov.
This is stored in a private structure wg_policy in waltgov.

The problem with this is wg_policy could be freed when the governor
changes or all the CPUs in the policy get offlined. This leads to a
use-after-free access of wg_policy->avg_cap. Besides, WALT introduced
checks between avg_cap and cur_freq to identify if scheduler guided
frequency is overridden by CPU frequency min/max limits. However, avg_cap
doesn't reflect the scheduler guided frequency and instead represents
the frequency from min/max limits. IOW, cur_freq will always be
equal to avg_cap when CPU frequency limits are active, rendering the
check useless and thus allowing packing.

Remove the code that retrieves and checks avg_cap.

Change-Id: I9b32c6798fb209d63d688ed89dc17674a7859475
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:14:05 -07:00
Sai Harshini Nimmala
84bb530ed3 sched/walt: Add walt_disabled checks
Entry into WALT code via tracehooks should be guarded based on the
completion of WALT initialization.
Add check for the same in functions where it is missing.

Change-Id: I2a04003977832087be681108c15bd6bbb24fc7e8
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:14:04 -07:00
Shaleen Agrawal
f41f3a4e0c sched/walt: Fix excess detach_task in walt_lb_pull_tasks
There's three loops to find a task to pull.

In the first iteration, we look for a task that is not running,
which fits a strict criteria.

In the second iteration, we look for a task that is not running,
which fits a lax criteria.

If we have still not found a valid task to pull, we intended to pull the
running task servicing an active load migration.

However, there is some leftover code, wherein a task that is not running
will end up being detached and pulled. This was not intended, and leads
to incorrect behavior. Essentially, this is negating the effects of the
first two iterations.

Change-Id: Ia225d89043c76ec6e661771a39d058498346920d
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:14:03 -07:00
Shaleen Agrawal
b18d15cb16 sched/walt: Check reserved CPU during walt_newidle_balance
Currently, it is observed that multiple calls to active_load_balance can
take place.

For example, say two Big threads are running on Golds, and
become misfits at the same time. Then, Prime which is currently say
halted, will end up pulling both threads. This is because first, as
Prime is unhalted, the CPU is kicked to enable it to pull tasks.
However, while Prime is kicked, it goes back to idle briefly, causing
the upstream newidle_balance path to come into play.

As a consequence, both threads are queued on Prime, and eventually, the
one sitting in the runqueue is put back on a Gold. This behavior is
unoptimal and unnecessary.

Ensure that walt_newidle_balance only takes when the CPU is not marked
as reserved.

Change-Id: I00feb8df3c4433333a356f2e855fb7a3ee848789
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:14:03 -07:00
Elliot Berman
626213d61b treewide: Fixup copyright attribution
Clean up missing LF copyright attribution.

Change-Id: Ic8c44271696144adc4555b5c7ff6573c166de5c3
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:12:47 -07:00
Shaleen Agrawal
bd98fea5e6 Revert "sched/walt: print all history samples"
This reverts commit feb7fa207560e9b759964df7b6566a8758bb535c.

Change-Id: I992beae0327b2e44eade80c4f50f18eda125d16e
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:07:11 -07:00
Shaleen Agrawal
181cb9d560 Revert "sched: Use bitshift over division"
This reverts commit bec4f0b0ebe82f2c99c519b424794c17ae2ff8b7.

Change-Id: Ib7f02388dfcb5b263a636e261c4e43ee5f4f93b6
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:07:10 -07:00
Stephen Dickey
492decfdc4 sched: walt: handle CTS failure for sched_set/getaffinity
During CTS testing, the user-space code can get an affinity
that includes a halted cpu, and immediately use that to set
the affinity. Currently sched_setaffinity will cause an error
if a halted cpu is selected.

Port the change that was in use prior to the introduction of
pause, correcting the CTS test case.

Change-Id: I9bfc819e4a6904494c199931e76f2702b7990758
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-06-28 19:07:10 -07:00
Ashay Jaiswal
7f927567ff sched: walt: add nested spinlock api
Use nested spin lock api to avoid deadlock warning

Change-Id: Ia2aed8f025bb209876ff87ba5a9e32b2b80718d8
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:07:09 -07:00
Shaleen Agrawal
f8314d13b2 sched/walt: Ensure driving cpu is used for region3
Currently, wg_cpu is used, however, this is incorrect, as the driving
CPU should be used when evaluating region3 conditions.

Change-Id: I4f86ec6021b718e35d84f589dc9be68a53ab9523
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:07:08 -07:00
Shaleen Agrawal
c42b241161 sched: walt: Drop double rq locks for migrations
Currently, WALT holds rq lock for both the cpus when handling task
migration. Upstream code however (PELT) holds rq locks consecutively for
migrations. This results in cumbersome tricks in WALT to hold them at
the same time - rq locks need to be acquired in order of cpu numbers.
Besides that, holding two rq locks for every migration results in
contentions in busy situations.

Split the migration accounting in two steps - subtracting time from src
cpu and adding time to the dest cpu. Subtract when we know the task is
moving i.e. the migration hook and add on the dest cpu during subsequent
enqueue.

Upstream code guarantees the rq lock for src cpu is held during
migration hook for queued or running task. For a waking task grab the
src cpu lock. No need to grab rq lock for dest cpu as enqueue hook is
always run with that lock held.

The basic idea of walt migration accounting, non group tasks move their
contributions only for inter cluster migration while group tasks do that
for every migration, stays.

Change-Id: I5d319e26bcbc088448954fd83bbcd1981ee7fb5c
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:06:31 -07:00
Shaleen Agrawal
2fc529c88a sched/walt: handle misaligned task window start
Introduce awareness for task window start and identify if task
window_start doesn't match that of the CPUs just before accounting.

Change-Id: I58d806e2a75bc647dc28b1f95d00352d29c5c447
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:36 -07:00
Abhijeet Dharmapurikar
421ed6261a sched/walt: reject queue_wakelist() is cpu is same as waker cpu
The upstream code has a WARN when wakelist is being enforced on the same
cpu where the waker runs. Although WALT tries its best to skip the
current cpu during many_wakeups situation, it may have to put the task
on it during highload/offline or 32 bit situations.

Simply disable queue_wakelist() if we wakeup the task on the waker cpu.

Change-Id: Ie13f1156bf0389570dbe0fbac70e271db2b9b211
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:35 -07:00
Shaleen Agrawal
0a354ab6ac sched/walt: Improve the scheduler
This change is for general scheduler improvement.

Change-Id: I2b95dc15c0dbe88966c90acfa4dca6aebf1a3f95
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:35 -07:00
Shaleen Agrawal
4014533422 sched/walt/halt: track halt reasons
Currently, there are no protections under conditions where CPUs may be
halted or unhalted twice, which could lead to undesired behavior. Track
reasons for refcounts per CPU to ensure proper accounting.

Change-Id: Ic85a13f3536e3287fc76a02004d2b4601ada7a1a
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:34 -07:00
Abhijeet Dharmapurikar
99a0b1fcbc sched/walt: properly account irq entry/exit
Due to restructuring of upstream logic, it is necessary to properly
deduce start and end times of irqs to maintain correct accounting.

Change-Id: I8f0ff9b0f9137283315e5b67cdf2cfb1dede033f
Signed-off-by: Abhijeet Dharmapurikar <quic_adharmap@quicinc.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:33 -07:00
Sai Harshini Nimmala
89feaab758 sched/walt: Prevent within cluster load balance of misfits
A misfit task can be pulled to a CPU within the same cluster in the
newly-idle balance path.
Since that just increases migration count and does not show any
significant benefits, prevent pulling of a task if it is going to be a
misfit on the destination CPU. Only pull if there are many such tasks and
the source CPU needs help from a newly idle CPU.

Change-Id: Ief55e3916d5902e473c0eaa101e8aefa01c04398
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
2022-06-28 19:05:32 -07:00
Shaleen Agrawal
301ac5032a sched/walt: Cleanup CPUFREQ flags and reasons
Currently, the flags and reasons are defined based off left shifts,
which requires manual translation when printed in traces. Change those
definitions to be directly in hex format, maintaining congruence.
Additionally, in the event that a boost_util is 0, ensure that a reason
is not inappropriately assigned.

Change-Id: Ia8e9c1628373f3355a3fcd9707a5950a9757e42b
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:31 -07:00
Shaleen Agrawal
8075477f59 sched/walt: Add thermal pressure to cpu_util TP
In the event that thermal throttling is under way, and user has not
enabled update_cpu_capacity trace point, add a backup way of quickly
determining scheduler under thermal constraints by displaying the
thermal pressure in the sched_cpu_util trace point.

Change-Id: I36b8f23e37b4e9b42770e1535feabb9d513fb730
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:31 -07:00
Shaleen Agrawal
7adf761c84 sched/walt: Add global_ws to walt dump
This change is for general scheduler improvement.

Change-Id: I88cf8678b918aed530f3af122edea2bca5b60503
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
2022-06-28 19:05:30 -07:00
Ashay Jaiswal
4c409fadbe sched: walt: allow silver to help prime during newidle balance
Present newidle balance design doesn't allow farthest cluster to help
during newidle balance (silver's newidle balance cannot help prime and
prime cannot help silver).
For Example:
If silver is entering idle and it find's prime core busy then newidle
balance will try to find and kick an idle gold core but it will not
participate in pulling task from prime to silver.

Update the logic to allow silver cluster to help and pull task during
newidle balance if none of the cores in the nearest cluster (Gold here)
are idle.

Change-Id: I0908058d55f344467f559b50209a6bf8bb18b0ef
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
2022-06-28 19:05:29 -07:00
Stephen Dickey
36c37e32ce sched/walt cfs: rt: find a packing cpu
Under low-util conditions, small tasks can be packed onto
a single dedicated cpu per cluster, the first cpu in the
cluster. This can improve performance by ensuring fewer
exits from wfi or deep-idle, and reduce power by keeping
more of the other cpus in wfi or deep-idle, for longer.

Add the functionality to perform choosing of the packing cpu
and incorporate this into the select_rq path for fair and rt
in walt hooks.

Change-Id: I02675ceb6dd2e5fb40f4b14308159cc1fdde245e
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-06-28 19:05:28 -07:00
Stephen Dickey
e7853f5841 sched/walt: add functionality for choosing a packing cpu
Very small tasks can end up spread across all cpus
in a cluster, and cause excessive wfi and lpm exit
latencies. This can be reduced significantly by combining
these tasks on to a single cpu.

Create the functionality to be used in cfs/rt that can
make the decision as to whether a packing cpu should
be chosen. Add supporting sysctl nodes to tune the
thresholds for this.

Change-Id: I68723b8dc461efffeba3069bfd5d41724f071bd2
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-06-28 19:05:28 -07:00
Stephen Dickey
bd66d3a04f sched/walt/avg: cache window based statistics
Previously it was possible to update core control with new
statistics and those statistics would be unavailable to
any other decisions that need to be made.

Update sched_avg to cache the statistics locally and simply
pass a reference to that information back to core control.
Provide a cluster util function to provide window based load.
Create a sysctl node and threshold to use to compare against
cluster util.

Change-Id: I8cc40603e49e29e7f8a343f6ff667ce9abe09cb5
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-06-28 19:05:27 -07:00
Stephen Dickey
86a2dd10da sched/walt: Kick newidle balance after unhalting
When a cpu is unhalted currently, it will attempt to perform
a balance through the normal ipi kick interface. However, this
can fail because a balance might have happened in the current
4mS tick, while the cpu was still halted. The next kick as a
result of unhalting, fails to execute (min 1 tick between kicks).

Instead, use walt_newidle_balance() to ensure that this cpu can
take a task. Perform an smp async function call to the target
cpu, invoke newidle balance, and allow the cpu to pull tasks
immediately after unhalting.

Change-Id: Ide1bb51f80dc8c4eba079588ffb6a7ed341e8628
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
2022-06-28 19:05:26 -07:00