[libos] Implement IO_Uring feature config

This commit is contained in:
ClawSeven 2024-04-30 14:59:42 +08:00 committed by volcano
parent de90f265c1
commit 5dfa017a76
6 changed files with 25 additions and 2 deletions

@ -18,5 +18,6 @@ runs:
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/rust-sgx-sdk";
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/sefs";
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/serde-json-sgx";
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/serde-sgx"
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/serde-sgx";
docker exec ${{ inputs.container-name }} bash -c "git config --global --add safe.directory /root/occlum/deps/io-uring"
shell: bash

@ -72,6 +72,13 @@ The template of `Occlum.json` is shown below.
},
// Features
"feature": {
// Determines the use of the IO_Uring feature in Occlum for network I/O operations.
// Enabling IO_Uring feature can improve network I/O performance.
//
// "io_uring": 0 - Disables IO_Uring; network I/O uses Ocall instead.
// "io_uring": 1 - Enables IO_Uring with a single IO_Uring instance.
// "io_uring": n (1 < n <= 16) - Enables IO_Uring with 'n' IO_Uring instances.
"io_uring": 0,
// Whether to turn on AMX feature in Occlum
// Occlum supports AMX instruction running inside the enclave when user enables it
//

@ -38,6 +38,7 @@
"feature": {
"amx": 0,
"pkru": 0,
"io_uring": 0,
"enable_edmm": false,
"enable_posix_shm": false
},

@ -148,6 +148,7 @@ pub struct ConfigApp {
pub struct ConfigFeature {
pub amx: u32,
pub pkru: u32,
pub io_uring: u32,
pub enable_edmm: bool,
pub enable_posix_shm: bool,
}
@ -307,6 +308,7 @@ impl ConfigFeature {
Ok(ConfigFeature {
amx: input.amx,
pkru: input.pkru,
io_uring: input.io_uring,
enable_edmm: input.enable_edmm,
enable_posix_shm: input.enable_posix_shm,
})
@ -538,6 +540,8 @@ struct InputConfigFeature {
#[serde(default)]
pub pkru: u32,
#[serde(default)]
pub io_uring: u32,
#[serde(default)]
pub enable_edmm: bool,
#[serde(default)]
pub enable_posix_shm: bool,
@ -548,6 +552,7 @@ impl Default for InputConfigFeature {
InputConfigFeature {
amx: 0,
pkru: 0,
io_uring: 0,
enable_edmm: false,
enable_posix_shm: false,
}

@ -44,6 +44,7 @@
"feature": {
"amx": 0,
"pkru": 0,
"io_uring": 0,
"enable_edmm": false,
"enable_posix_shm": true
},

@ -160,6 +160,12 @@ fn main() {
"WITHOUT"
}
);
debug!(
"Enable IO_Uring feature with {:?} instances",
occlum_config.feature.io_uring
);
debug!(
"user config init num of threads = {:?}",
occlum_config.resource_limits.init_num_of_threads
@ -448,7 +454,7 @@ fn main() {
TCSNum: tcs_init_num,
TCSMinPool: tcs_min_pool,
TCSMaxNum: tcs_max_num,
TCSPolicy: 1,
TCSPolicy: 0,
DisableDebug: match occlum_config.metadata.debuggable {
true => 0,
false => 1,
@ -758,6 +764,8 @@ struct OcclumFeature {
#[serde(default)]
pkru: u32,
#[serde(default)]
io_uring: u32,
#[serde(default)]
enable_edmm: bool,
#[serde(default)]
enable_posix_shm: bool,