sched/walt: create an api for cluster boost for pipeline

Not all clusters should be unhalted when pipeline is enabled,
but all clusters are being unhalted now (through
core_ctl_sched_boost).

To prepare for only unhalting the clusters that are part
of the user selected pipeline cpus, create a per-cluster
boost api which controls the boost characteristics of
only the cluster idx specified.

Change-Id: Iad349406ffa935b8f2bfed030b28ba37ac516ebb
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
This commit is contained in:
Stephen Dickey 2023-07-14 16:51:05 -07:00 committed by Linux Image Build Automation
parent 8bd73a23cf
commit f0bca08884
2 changed files with 42 additions and 13 deletions

View File

@ -1159,6 +1159,45 @@ static void wake_up_core_ctl_thread(void)
wake_up_process(core_ctl_thread);
}
static inline int set_cluster_boost(struct cluster_data *cluster, bool boost,
bool *boost_state_changed)
{
int ret = 0;
if (boost) {
*boost_state_changed = !cluster->boost;
++cluster->boost;
} else {
if (!cluster->boost)
return -EINVAL;
--cluster->boost;
*boost_state_changed = !cluster->boost;
}
return ret;
}
int core_ctl_set_cluster_boost(int idx, bool boost)
{
struct cluster_data *cluster;
bool boost_state_changed = false;
unsigned long flags;
int ret = 0;
if (idx >= num_clusters)
return -EINVAL;
spin_lock_irqsave(&state_lock, flags);
cluster = &cluster_state[idx];
ret = set_cluster_boost(cluster, boost, &boost_state_changed);
spin_unlock_irqrestore(&state_lock, flags);
if (boost_state_changed)
sysfs_param_changed(cluster);
return ret;
}
static u64 core_ctl_check_timestamp;
int core_ctl_set_boost(bool boost)
@ -1173,19 +1212,8 @@ int core_ctl_set_boost(bool boost)
return 0;
spin_lock_irqsave(&state_lock, flags);
for_each_cluster(cluster, index) {
if (boost) {
boost_state_changed = !cluster->boost;
++cluster->boost;
} else {
if (!cluster->boost) {
ret = -EINVAL;
break;
}
--cluster->boost;
boost_state_changed = !cluster->boost;
}
}
for_each_cluster(cluster, index)
ret = set_cluster_boost(cluster, boost, &boost_state_changed);
spin_unlock_irqrestore(&state_lock, flags);
if (boost_state_changed) {

View File

@ -191,6 +191,7 @@ extern void walt_fill_ta_data(struct core_ctl_notif_data *data);
extern int sched_set_group_id(struct task_struct *p, unsigned int group_id);
extern unsigned int sched_get_group_id(struct task_struct *p);
extern void core_ctl_check(u64 wallclock, u32 wakeup_ctr_sum);
extern int core_ctl_set_cluster_boost(int idx, bool boost);
extern int sched_set_boost(int enable);
extern void walt_boost_init(void);
extern int sched_pause_cpus(struct cpumask *pause_cpus);