[libos] Implement IO_Uring feature config
This commit is contained in:
		
							parent
							
								
									de90f265c1
								
							
						
					
					
						commit
						5dfa017a76
					
				| @ -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/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/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-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 |       shell: bash | ||||||
| @ -72,6 +72,13 @@ The template of `Occlum.json` is shown below. | |||||||
|     }, |     }, | ||||||
|     // Features |     // Features | ||||||
|     "feature": { |     "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 |         // Whether to turn on AMX feature in Occlum | ||||||
|         // Occlum supports AMX instruction running inside the enclave when user enables it |         // Occlum supports AMX instruction running inside the enclave when user enables it | ||||||
|         // |         // | ||||||
|  | |||||||
| @ -38,6 +38,7 @@ | |||||||
|     "feature": { |     "feature": { | ||||||
|         "amx": 0, |         "amx": 0, | ||||||
|         "pkru": 0, |         "pkru": 0, | ||||||
|  |         "io_uring": 0, | ||||||
|         "enable_edmm": false, |         "enable_edmm": false, | ||||||
|         "enable_posix_shm": false |         "enable_posix_shm": false | ||||||
|     }, |     }, | ||||||
|  | |||||||
| @ -148,6 +148,7 @@ pub struct ConfigApp { | |||||||
| pub struct ConfigFeature { | pub struct ConfigFeature { | ||||||
|     pub amx: u32, |     pub amx: u32, | ||||||
|     pub pkru: u32, |     pub pkru: u32, | ||||||
|  |     pub io_uring: u32, | ||||||
|     pub enable_edmm: bool, |     pub enable_edmm: bool, | ||||||
|     pub enable_posix_shm: bool, |     pub enable_posix_shm: bool, | ||||||
| } | } | ||||||
| @ -307,6 +308,7 @@ impl ConfigFeature { | |||||||
|         Ok(ConfigFeature { |         Ok(ConfigFeature { | ||||||
|             amx: input.amx, |             amx: input.amx, | ||||||
|             pkru: input.pkru, |             pkru: input.pkru, | ||||||
|  |             io_uring: input.io_uring, | ||||||
|             enable_edmm: input.enable_edmm, |             enable_edmm: input.enable_edmm, | ||||||
|             enable_posix_shm: input.enable_posix_shm, |             enable_posix_shm: input.enable_posix_shm, | ||||||
|         }) |         }) | ||||||
| @ -538,6 +540,8 @@ struct InputConfigFeature { | |||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pub pkru: u32, |     pub pkru: u32, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|  |     pub io_uring: u32, | ||||||
|  |     #[serde(default)] | ||||||
|     pub enable_edmm: bool, |     pub enable_edmm: bool, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pub enable_posix_shm: bool, |     pub enable_posix_shm: bool, | ||||||
| @ -548,6 +552,7 @@ impl Default for InputConfigFeature { | |||||||
|         InputConfigFeature { |         InputConfigFeature { | ||||||
|             amx: 0, |             amx: 0, | ||||||
|             pkru: 0, |             pkru: 0, | ||||||
|  |             io_uring: 0, | ||||||
|             enable_edmm: false, |             enable_edmm: false, | ||||||
|             enable_posix_shm: false, |             enable_posix_shm: false, | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -44,6 +44,7 @@ | |||||||
|     "feature": { |     "feature": { | ||||||
|         "amx": 0, |         "amx": 0, | ||||||
|         "pkru": 0, |         "pkru": 0, | ||||||
|  |         "io_uring": 0, | ||||||
|         "enable_edmm": false, |         "enable_edmm": false, | ||||||
|         "enable_posix_shm": true |         "enable_posix_shm": true | ||||||
|     }, |     }, | ||||||
|  | |||||||
| @ -160,6 +160,12 @@ fn main() { | |||||||
|                 "WITHOUT" |                 "WITHOUT" | ||||||
|             } |             } | ||||||
|         ); |         ); | ||||||
|  | 
 | ||||||
|  |         debug!( | ||||||
|  |             "Enable IO_Uring feature with {:?} instances", | ||||||
|  |             occlum_config.feature.io_uring | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|         debug!( |         debug!( | ||||||
|             "user config init num of threads = {:?}", |             "user config init num of threads = {:?}", | ||||||
|             occlum_config.resource_limits.init_num_of_threads |             occlum_config.resource_limits.init_num_of_threads | ||||||
| @ -448,7 +454,7 @@ fn main() { | |||||||
|             TCSNum: tcs_init_num, |             TCSNum: tcs_init_num, | ||||||
|             TCSMinPool: tcs_min_pool, |             TCSMinPool: tcs_min_pool, | ||||||
|             TCSMaxNum: tcs_max_num, |             TCSMaxNum: tcs_max_num, | ||||||
|             TCSPolicy: 1, |             TCSPolicy: 0, | ||||||
|             DisableDebug: match occlum_config.metadata.debuggable { |             DisableDebug: match occlum_config.metadata.debuggable { | ||||||
|                 true => 0, |                 true => 0, | ||||||
|                 false => 1, |                 false => 1, | ||||||
| @ -758,6 +764,8 @@ struct OcclumFeature { | |||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pkru: u32, |     pkru: u32, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|  |     io_uring: u32, | ||||||
|  |     #[serde(default)] | ||||||
|     enable_edmm: bool, |     enable_edmm: bool, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     enable_posix_shm: bool, |     enable_posix_shm: bool, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user