diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch index 80405a46b084860998ce16877bb237704e6d89e1..fcd5109853d025cc72b442e621c4ac8a6edaea02 100755 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -1757317,16 +1757317,7 @@ diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index b68de0d09632..cbab2f812db6 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c -@@ -335,6 +335,8 @@ static struct cpuset top_cpuset = { - * guidelines for accessing subsystem state in kernel/cgroup.c - */ - -+static DEFINE_MUTEX(cpuset_mutex); -+ - DEFINE_STATIC_PERCPU_RWSEM(cpuset_rwsem); - - void cpuset_read_lock(void) -@@ -352,9 +354,9 @@ static DEFINE_SPINLOCK(callback_lock); +@@ -374,9 +374,9 @@ static DEFINE_SPINLOCK(callback_lock); static struct workqueue_struct *cpuset_migrate_mm_wq; /* @@ -1757338,7 +1757329,7 @@ index b68de0d09632..cbab2f812db6 100644 static DECLARE_WORK(cpuset_hotplug_work, cpuset_hotplug_workfn); static DECLARE_WAIT_QUEUE_HEAD(cpuset_attach_wq); -@@ -374,18 +376,29 @@ static inline bool is_in_v2_mode(void) +@@ -396,18 +396,29 @@ static inline bool is_in_v2_mode(void) } /* @@ -1757374,7 +1757365,7 @@ index b68de0d09632..cbab2f812db6 100644 cs = parent_cs(cs); if (unlikely(!cs)) { /* -@@ -395,11 +408,13 @@ static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask) +@@ -417,11 +428,13 @@ static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask) * cpuset's effective_cpus is on its way to be * identical to cpu_online_mask. */ @@ -1757391,7 +1757382,7 @@ index b68de0d09632..cbab2f812db6 100644 } /* -@@ -490,6 +505,9 @@ static inline int alloc_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) +@@ -512,6 +525,9 @@ static inline int alloc_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) if (cs && !zalloc_cpumask_var(pmask4, GFP_KERNEL)) goto free_three; @@ -1757401,34 +1757392,15 @@ index b68de0d09632..cbab2f812db6 100644 return 0; free_three: -@@ -940,7 +958,7 @@ static void rebuild_root_domains(void) - struct cpuset *cs = NULL; - struct cgroup_subsys_state *pos_css; - -- percpu_rwsem_assert_held(&cpuset_rwsem); -+ lockdep_assert_held(&cpuset_mutex); - lockdep_assert_cpus_held(); - lockdep_assert_held(&sched_domains_mutex); - -@@ -1000,8 +1018,7 @@ static void rebuild_sched_domains_locked(void) +@@ -1025,7 +1041,6 @@ static void rebuild_sched_domains_locked(void) struct cpuset *cs; int ndoms; - lockdep_assert_cpus_held(); -- percpu_rwsem_assert_held(&cpuset_rwsem); -+ lockdep_assert_held(&cpuset_mutex); + lockdep_assert_held(&cpuset_mutex); /* - * If we have raced with CPU hotplug, return early to avoid -@@ -1052,12 +1069,18 @@ static void rebuild_sched_domains_locked(void) - void rebuild_sched_domains(void) - { - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - rebuild_sched_domains_locked(); -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); +@@ -1083,6 +1098,12 @@ void rebuild_sched_domains(void) put_online_cpus(); } @@ -1757441,7 +1757413,7 @@ index b68de0d09632..cbab2f812db6 100644 /** * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset. * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed -@@ -1080,7 +1103,7 @@ static void update_tasks_cpumask(struct cpuset *cs) +@@ -1105,7 +1126,7 @@ static void update_tasks_cpumask(struct cpuset *cs) if (top_cs && (task->flags & PF_KTHREAD) && kthread_is_per_cpu(task)) continue; @@ -1757450,7 +1757422,7 @@ index b68de0d09632..cbab2f812db6 100644 } css_task_iter_end(&it); } -@@ -1105,8 +1128,7 @@ static void compute_effective_cpumask(struct cpumask *new_cpus, +@@ -1130,8 +1151,7 @@ static void compute_effective_cpumask(struct cpumask *new_cpus, cpumask_and(new_cpus, new_cpus, cs->cpus_requested); cpumask_and(new_cpus, new_cpus, cpu_active_mask); } else { @@ -1757460,60 +1757432,16 @@ index b68de0d09632..cbab2f812db6 100644 } } -@@ -1171,7 +1193,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, - int new_prs; - bool part_error = false; /* Partition error? */ - -- percpu_rwsem_assert_held(&cpuset_rwsem); -+ lockdep_assert_held(&cpuset_mutex); - - /* - * The parent must be a partition root. -@@ -2171,7 +2193,7 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) - cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset, &css)); - cs = css_cs(css); - -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - - /* allow moving tasks into an empty cpuset if on default hierarchy */ - ret = -ENOSPC; -@@ -2195,7 +2217,7 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) - cs->attach_in_progress++; - ret = 0; - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - return ret; - } - -@@ -2207,11 +2229,11 @@ static void cpuset_cancel_attach(struct cgroup_taskset *tset) - cgroup_taskset_first(tset, &css); - cs = css_cs(css); - -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - cs->attach_in_progress--; - if (!cs->attach_in_progress) - wake_up(&cpuset_attach_wq); -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - } - - /* -@@ -2235,22 +2257,20 @@ static void cpuset_attach(struct cgroup_taskset *tset) - cs = css_cs(css); - +@@ -2302,20 +2322,18 @@ static void cpuset_attach(struct cgroup_taskset *tset) lockdep_assert_cpus_held(); /* see cgroup_attach_lock() */ -- percpu_down_write(&cpuset_rwsem); -- + mutex_lock(&cpuset_mutex); + - /* prepare for attach */ - if (cs == &top_cpuset) - cpumask_copy(cpus_attach, cpu_possible_mask); - else - guarantee_online_cpus(cs, cpus_attach); -+ mutex_lock(&cpuset_mutex); - +- guarantee_online_mems(cs, &cpuset_attach_nodemask_to); cgroup_taskset_for_each(task, css, tset) { @@ -1757530,140 +1757458,7 @@ index b68de0d09632..cbab2f812db6 100644 cpuset_change_task_nodemask(task, &cpuset_attach_nodemask_to); cpuset_update_task_spread_flag(cs, task); -@@ -2289,7 +2309,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) - if (!cs->attach_in_progress) - wake_up(&cpuset_attach_wq); - -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - } - - /* The various types of files and directories in a cpuset file system */ -@@ -2321,7 +2341,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, - int retval = 0; - - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - if (!is_cpuset_online(cs)) { - retval = -ENODEV; - goto out_unlock; -@@ -2357,7 +2377,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, - break; - } - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - return retval; - } -@@ -2370,7 +2390,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, - int retval = -ENODEV; - - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - if (!is_cpuset_online(cs)) - goto out_unlock; - -@@ -2383,7 +2403,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, - break; - } - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - return retval; - } -@@ -2424,7 +2444,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, - flush_work(&cpuset_hotplug_work); - - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - if (!is_cpuset_online(cs)) - goto out_unlock; - -@@ -2448,7 +2468,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, - - free_cpuset(trialcs); - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - kernfs_unbreak_active_protection(of->kn); - css_put(&cs->css); -@@ -2581,13 +2601,13 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf, - - css_get(&cs->css); - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - if (!is_cpuset_online(cs)) - goto out_unlock; - - retval = update_prstate(cs, val); - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - css_put(&cs->css); - return retval ?: nbytes; -@@ -2795,7 +2815,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) - return 0; - - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - - set_bit(CS_ONLINE, &cs->flags); - if (is_spread_page(parent)) -@@ -2847,7 +2867,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) - cpumask_copy(cs->effective_cpus, parent->cpus_allowed); - spin_unlock_irq(&callback_lock); - out_unlock: -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - return 0; - } -@@ -2868,7 +2888,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) - struct cpuset *cs = css_cs(css); - - get_online_cpus(); -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - - if (is_partition_root(cs)) - update_prstate(cs, 0); -@@ -2887,7 +2907,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) - cpuset_dec(); - clear_bit(CS_ONLINE, &cs->flags); - -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - put_online_cpus(); - } - -@@ -2900,7 +2920,7 @@ static void cpuset_css_free(struct cgroup_subsys_state *css) - - static void cpuset_bind(struct cgroup_subsys_state *root_css) - { -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - spin_lock_irq(&callback_lock); - - if (is_in_v2_mode()) { -@@ -2913,7 +2933,7 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) - } - - spin_unlock_irq(&callback_lock); -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - } - - /* -@@ -2923,10 +2943,10 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) +@@ -2994,10 +3012,10 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) */ static void cpuset_fork(struct task_struct *task) { @@ -1757675,59 +1757470,7 @@ index b68de0d09632..cbab2f812db6 100644 task->mems_allowed = current->mems_allowed; } -@@ -2955,7 +2975,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = { - - int __init cpuset_init(void) - { -- BUG_ON(percpu_init_rwsem(&cpuset_rwsem)); - - BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL)); - BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_requested, GFP_KERNEL)); -@@ -3030,7 +3049,7 @@ hotplug_update_tasks_legacy(struct cpuset *cs, - is_empty = cpumask_empty(cs->cpus_allowed) || - nodes_empty(cs->mems_allowed); - -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - - /* - * Move tasks to the nearest ancestor with execution resources, -@@ -3040,7 +3059,7 @@ hotplug_update_tasks_legacy(struct cpuset *cs, - if (is_empty) - remove_tasks_in_empty_cpuset(cs); - -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - } - - static void -@@ -3090,14 +3109,14 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) - retry: - wait_event(cpuset_attach_wq, cs->attach_in_progress == 0); - -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - - /* - * We have raced with task attaching. We wait until attaching - * is finished, so we won't attach a task to an empty cpuset. - */ - if (cs->attach_in_progress) { -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - goto retry; - } - -@@ -3169,7 +3188,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) - hotplug_update_tasks_legacy(cs, &new_cpus, &new_mems, - cpus_updated, mems_updated); - -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - } - - /** -@@ -3188,7 +3207,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) +@@ -3257,7 +3275,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) * Note that CPU offlining during suspend is ignored. We don't modify * cpusets across suspend/resume cycles at all. */ @@ -1757736,25 +1757479,7 @@ index b68de0d09632..cbab2f812db6 100644 { static cpumask_t new_cpus; static nodemask_t new_mems; -@@ -3199,7 +3218,7 @@ static void cpuset_hotplug_workfn(struct work_struct *work) - if (on_dfl && !alloc_cpumasks(NULL, &tmp)) - ptmp = &tmp; - -- percpu_down_write(&cpuset_rwsem); -+ mutex_lock(&cpuset_mutex); - - /* fetch the available cpus/mems and find out which changed how */ - cpumask_copy(&new_cpus, cpu_active_mask); -@@ -3256,7 +3275,7 @@ static void cpuset_hotplug_workfn(struct work_struct *work) - update_tasks_nodemask(&top_cpuset); - } - -- percpu_up_write(&cpuset_rwsem); -+ mutex_unlock(&cpuset_mutex); - - /* if cpus or mems changed, we need to propagate to descendants */ - if (cpus_updated || mems_updated) { -@@ -3300,6 +3319,7 @@ void cpuset_wait_for_hotplug(void) +@@ -3369,6 +3387,7 @@ void cpuset_wait_for_hotplug(void) { flush_work(&cpuset_hotplug_work); } @@ -1757762,7 +1757487,7 @@ index b68de0d09632..cbab2f812db6 100644 /* * Keep top_cpuset.mems_allowed tracking node_states[N_MEMORY]. -@@ -3358,11 +3378,11 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) +@@ -3427,11 +3446,11 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) spin_lock_irqsave(&callback_lock, flags); rcu_read_lock(); @@ -1757776,7 +1757501,7 @@ index b68de0d09632..cbab2f812db6 100644 /** * cpuset_cpus_allowed_fallback - final fallback before complete catastrophe. * @tsk: pointer to task_struct with which the scheduler is struggling -@@ -3377,9 +3397,17 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) +@@ -3446,9 +3465,17 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) void cpuset_cpus_allowed_fallback(struct task_struct *tsk) {