From 1bf5b3bf669d4387215f83b8e284eaaec33cf5c1 Mon Sep 17 00:00:00 2001 From: wangzhongping Date: Fri, 23 May 2025 15:04:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9Atzdriver=E4=B8=AD=E7=BB=91=E6=A0=B8CPU0=E6=9C=AA?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E7=94=9F=E6=95=88=EF=BC=8CCA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=85=B6=E5=AE=83CPU=E6=A0=B8=E4=B8=8ETA=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=EF=BC=8C=E5=AF=BC=E8=87=B4CA=E5=8D=A1=E6=AD=BB?= =?UTF-8?q?=EF=BC=8C=E5=86=85=E6=A0=B8=E5=B4=A9=E6=BA=83=E3=80=82=EF=BC=88?= =?UTF-8?q?=E6=B3=A8=EF=BC=9Aopentrustee=E5=BD=93=E5=89=8D=E4=BB=85?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8D=95=E6=A0=B8CPU0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangzhongping --- tzdriver/core/smc_smp.c | 1 + tzdriver/include/internal_functions.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tzdriver/core/smc_smp.c b/tzdriver/core/smc_smp.c index 32d25b2..4441599 100644 --- a/tzdriver/core/smc_smp.c +++ b/tzdriver/core/smc_smp.c @@ -1794,6 +1794,7 @@ clean: static int smc_svc_thread_fn(void *arg) { (void)arg; + init_kthread_cpumask(); set_freezable(); while (!kthread_should_stop()) { struct tc_ns_smc_cmd smc_cmd = { {0}, 0 }; diff --git a/tzdriver/include/internal_functions.h b/tzdriver/include/internal_functions.h index 336da09..1a0677c 100644 --- a/tzdriver/include/internal_functions.h +++ b/tzdriver/include/internal_functions.h @@ -16,6 +16,7 @@ #define INTERNAL_FUNCTIONS_H #include +#include #include #include "teek_ns_client.h" #include "teek_client_constants.h" @@ -38,6 +39,24 @@ static inline void fault_monitor_end(void) #else static inline void init_kthread_cpumask(void) { +#ifdef CONFIG_CPU_AFF_NR + unsigned int i; + struct cpumask cpu_mask; + + for (i = 0; i < CONFIG_CPU_AFF_NR; i++) + cpumask_set_cpu(i, &cpu_mask); + + if (cpumask_empty(&cpu_mask)) + return; + if(set_cpus_allowed_ptr(current, &cpu_mask)) + return; +#ifdef CONFIG_CPU_ISOLATION_OPT + /*wait for cpu affined */ + while (!cpumask_test_cpu(task_cpu(current), &cpu_mask)) { + usleep_range(100, 500); + } +#endif /*CONFIG_CPU_ISOLATION_OPT*/ +#endif /*CONFIG_CPU_AFF_NR*/ } static inline void tz_kthread_bind_mask(struct task_struct *kthread) -- Gitee From 4ce9621550b3844715829a36cf485cd59d4fdbf8 Mon Sep 17 00:00:00 2001 From: Jowal Date: Mon, 26 May 2025 03:19:00 +0000 Subject: [PATCH 2/3] update tzdriver/core/smc_smp.c. Signed-off-by: Jowal --- tzdriver/core/smc_smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tzdriver/core/smc_smp.c b/tzdriver/core/smc_smp.c index 4441599..a3a2763 100644 --- a/tzdriver/core/smc_smp.c +++ b/tzdriver/core/smc_smp.c @@ -1794,7 +1794,7 @@ clean: static int smc_svc_thread_fn(void *arg) { (void)arg; - init_kthread_cpumask(); + //init_kthread_cpumask(); set_freezable(); while (!kthread_should_stop()) { struct tc_ns_smc_cmd smc_cmd = { {0}, 0 }; -- Gitee From 1b974dca498751ca73fb8f1d00617bf920b9b7ba Mon Sep 17 00:00:00 2001 From: Jowal Date: Mon, 26 May 2025 03:19:53 +0000 Subject: [PATCH 3/3] update tzdriver/include/internal_functions.h. Signed-off-by: Jowal --- tzdriver/include/internal_functions.h | 38 +++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tzdriver/include/internal_functions.h b/tzdriver/include/internal_functions.h index 1a0677c..72eab99 100644 --- a/tzdriver/include/internal_functions.h +++ b/tzdriver/include/internal_functions.h @@ -16,7 +16,7 @@ #define INTERNAL_FUNCTIONS_H #include -#include +//#include #include #include "teek_ns_client.h" #include "teek_client_constants.h" @@ -39,24 +39,24 @@ static inline void fault_monitor_end(void) #else static inline void init_kthread_cpumask(void) { -#ifdef CONFIG_CPU_AFF_NR - unsigned int i; - struct cpumask cpu_mask; - - for (i = 0; i < CONFIG_CPU_AFF_NR; i++) - cpumask_set_cpu(i, &cpu_mask); - - if (cpumask_empty(&cpu_mask)) - return; - if(set_cpus_allowed_ptr(current, &cpu_mask)) - return; -#ifdef CONFIG_CPU_ISOLATION_OPT - /*wait for cpu affined */ - while (!cpumask_test_cpu(task_cpu(current), &cpu_mask)) { - usleep_range(100, 500); - } -#endif /*CONFIG_CPU_ISOLATION_OPT*/ -#endif /*CONFIG_CPU_AFF_NR*/ +//#ifdef CONFIG_CPU_AFF_NR +// unsigned int i; +// struct cpumask cpu_mask; +// +// for (i = 0; i < CONFIG_CPU_AFF_NR; i++) +// cpumask_set_cpu(i, &cpu_mask); +// +// if (cpumask_empty(&cpu_mask)) +// return; +// if(set_cpus_allowed_ptr(current, &cpu_mask)) +// return; +//#ifdef CONFIG_CPU_ISOLATION_OPT +// /*wait for cpu affined */ +// while (!cpumask_test_cpu(task_cpu(current), &cpu_mask)) { +// usleep_range(100, 500); +// } +//#endif /*CONFIG_CPU_ISOLATION_OPT*/ +//#endif /*CONFIG_CPU_AFF_NR*/ } static inline void tz_kthread_bind_mask(struct task_struct *kthread) -- Gitee