68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
|
|
From 3beeb13f9040b0c78aa5f246bedfa4d5475787ae Mon Sep 17 00:00:00 2001
|
||
|
|
From: zhengxiaoxiao <zhengxiaoxiao2@huawei.com>
|
||
|
|
Date: Tue, 13 Aug 2024 20:43:31 +0800
|
||
|
|
Subject: [PATCH] support CPU core binding
|
||
|
|
|
||
|
|
---
|
||
|
|
inc/host_inc/secgear_uswitchless.h | 7 ++++++-
|
||
|
|
src/enclave_src/gp/itrustee/CMakeLists.txt | 2 ++
|
||
|
|
src/enclave_src/gp/itrustee/itrustee_tswitchless.c | 1 +
|
||
|
|
3 files changed, 9 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/inc/host_inc/secgear_uswitchless.h b/inc/host_inc/secgear_uswitchless.h
|
||
|
|
index 2ea4691..b7c68d5 100644
|
||
|
|
--- a/inc/host_inc/secgear_uswitchless.h
|
||
|
|
+++ b/inc/host_inc/secgear_uswitchless.h
|
||
|
|
@@ -41,7 +41,9 @@
|
||
|
|
#ifndef SECGEAR_USWITCHLESS_H
|
||
|
|
#define SECGEAR_USWITCHLESS_H
|
||
|
|
|
||
|
|
+#include <sched.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
+#include <stdbool.h>
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
@@ -85,9 +87,12 @@ typedef struct {
|
||
|
|
|
||
|
|
/* Indicates whether to roll back to common invoking when asynchronous switchless invoking fails, only for GP */
|
||
|
|
uint32_t rollback_to_common;
|
||
|
|
+
|
||
|
|
+ /* Specifies the name of the bound core. */
|
||
|
|
+ cpu_set_t tworkers_cores;
|
||
|
|
} cc_sl_config_t;
|
||
|
|
|
||
|
|
-#define CC_USWITCHLESS_CONFIG_INITIALIZER {1, 1, 1, 16, 0, 0, WORKERS_POLICY_BUSY, 0}
|
||
|
|
+#define CC_USWITCHLESS_CONFIG_INITIALIZER {1, 1, 1, 16, 0, 0, WORKERS_POLICY_BUSY, 0, {{0}} }
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
diff --git a/src/enclave_src/gp/itrustee/CMakeLists.txt b/src/enclave_src/gp/itrustee/CMakeLists.txt
|
||
|
|
index 14b3c64..c44fc38 100644
|
||
|
|
--- a/src/enclave_src/gp/itrustee/CMakeLists.txt
|
||
|
|
+++ b/src/enclave_src/gp/itrustee/CMakeLists.txt
|
||
|
|
@@ -19,6 +19,8 @@ set(SOURCE_FILES ${SOURCE_FILES} ../gp.c ../gp_ocall.c itrustee_seal_data.c erro
|
||
|
|
set(ITRUSTEE_TEEDIR ${SDK_PATH}/)
|
||
|
|
set(ITRUSTEE_LIBC ${SDK_PATH}/thirdparty/open_source/musl/libc)
|
||
|
|
|
||
|
|
+add_definitions(-D_GNU_SOURCE)
|
||
|
|
+
|
||
|
|
if (CMAKE_COMPILER_IS_GNUCC)
|
||
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpfullversion -dumpversion
|
||
|
|
OUTPUT_VARIABLE GCC_VERSION)
|
||
|
|
diff --git a/src/enclave_src/gp/itrustee/itrustee_tswitchless.c b/src/enclave_src/gp/itrustee/itrustee_tswitchless.c
|
||
|
|
index 3955ff9..4048507 100644
|
||
|
|
--- a/src/enclave_src/gp/itrustee/itrustee_tswitchless.c
|
||
|
|
+++ b/src/enclave_src/gp/itrustee/itrustee_tswitchless.c
|
||
|
|
@@ -342,6 +342,7 @@ static pthread_t *tswitchless_init_workers(sl_task_pool_t *pool)
|
||
|
|
SLogError("Create tee thread failed, index:%u, ret:%d.", i, ret);
|
||
|
|
return NULL;
|
||
|
|
}
|
||
|
|
+ pthread_setaffinity_np(tids[i], sizeof(pool_cfg->tworkers_cores), &(pool_cfg->tworkers_cores));
|
||
|
|
}
|
||
|
|
|
||
|
|
CC_THREAD_ATTR_DESTROY(&attr);
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|