-
Notifications
You must be signed in to change notification settings - Fork 16
lind-perf: add benchmarks for threei.
#847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: lind-perf-init
Are you sure you want to change the base?
Changes from all commits
987038e
0f03fea
9a86a1a
fe84851
0151b27
bdb359e
e43ecf2
12e1524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| pub mod handler_table; | ||
| pub mod perf; | ||
| pub mod threei; | ||
| pub mod threei_const; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| use lind_perf::Counter; | ||
|
|
||
| pub static CALL_GRATE_FUNC: Counter = Counter::new("threei::_call_grate_func"); | ||
| pub static MAKE_SYSCALL: Counter = Counter::new("threei::make_syscall"); | ||
| pub static RAWPOSIX_DISPATCH: Counter = Counter::new("threei::rawposix_dispatch"); | ||
|
|
||
| pub static ALL_COUNTERS: &[&Counter] = &[&CALL_GRATE_FUNC, &MAKE_SYSCALL, &RAWPOSIX_DISPATCH]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ use crate::handler_table::{ | |
| _check_cage_handler_exists, _get_handler, _rm_cage_from_handler, _rm_grate_from_handler, | ||
| copy_handler_table_to_cage_impl, print_handler_table, register_handler_impl, | ||
| }; | ||
| use crate::perf; | ||
| use crate::threei_const; | ||
|
|
||
| pub const EXIT_SYSCALL: u64 = 60; // exit syscall number. Public for tests. | ||
|
|
@@ -201,6 +202,8 @@ fn _call_grate_func( | |
| arg6: u64, | ||
| arg6_cageid: u64, | ||
| ) -> Option<i32> { | ||
| let _timer = lind_perf::get_timer!(perf::CALL_GRATE_FUNC); | ||
|
|
||
| let runtimeid = match get_cage_runtime(grateid) { | ||
| Some(r) => r, | ||
| None => panic!( | ||
|
|
@@ -412,6 +415,13 @@ pub fn make_syscall( | |
| arg6: u64, | ||
| arg6_cageid: u64, | ||
| ) -> i32 { | ||
| // Only enable timers for syscalls that are explicitly benchmarking related (2000-3000) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to be cfg'd?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for everything in a 3i file
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All cfg's are handled within lind-perf, which has no-op shims when the feature is not enabled. This allows us to not have to use cfg's here. When building without lind_perf, the get_timer!() just returns None, and will not cause overheads. |
||
| let _timer = if syscall_num > 2000 && syscall_num < 3000 { | ||
| Some(lind_perf::get_timer!(perf::MAKE_SYSCALL)) | ||
| } else { | ||
| None | ||
| }; | ||
|
|
||
| // Return error if the target cage/grate is exiting. We need to add this check beforehead, because make_syscall will also | ||
| // contain cases that can directly redirect a syscall when self_cageid == target_id, which will bypass the handlertable check | ||
| if EXITING_TABLE.contains(&target_cageid) && syscall_num != EXIT_SYSCALL { | ||
|
|
@@ -428,9 +438,14 @@ pub fn make_syscall( | |
| if grateid == lind_platform_const::RAWPOSIX_CAGEID | ||
| || grateid == lind_platform_const::WASMTIME_CAGEID | ||
| { | ||
| let _rpx_dispatch_timer = if syscall_num > 2000 && syscall_num < 3000 { | ||
| Some(lind_perf::get_timer!(perf::RAWPOSIX_DISPATCH)) | ||
| } else { | ||
| None | ||
| }; | ||
| let func: RawCallFunc = | ||
| unsafe { std::mem::transmute::<u64, RawCallFunc>(in_grate_fn_ptr_u64) }; | ||
| return func( | ||
| let r = func( | ||
| self_cageid, | ||
| arg1, | ||
| arg1_cageid, | ||
|
|
@@ -445,6 +460,9 @@ pub fn make_syscall( | |
| arg6, | ||
| arg6_cageid, | ||
| ); | ||
| drop(_rpx_dispatch_timer); | ||
|
|
||
| return r; | ||
| } | ||
| // Threei special case: if the call is an interposed 3i call | ||
| if grateid == lind_platform_const::THREEI_CAGEID { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are others range gated but not this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_call_grate_func doesn't have access to the syscall_num that was called so we can't gate it.
besides, the rationale for gating make_syscall was to ensure we dont see measurement from other syscalls. _call_grate_func is only called for interposed syscalls, and we can easily have a setup where only the syscall being benchmarked is interposed.