setaffinity system call not supported
SGX-LKL-OE currently doesn't seem to support applications or application runtimes setting thread affinities within the enclave, at least with OpenMP programs. It should be possible to reproduce this using the sample OMP app at: https://github.com/lsds/sgx-lkl/tree/oe_port/samples/languages/openmp
I was testing this with the LLVM omp runtime, which I had to build for the alpine docker containers, let me know if you need help doing this.
Then just execute the test application with: OMP_PLACES=cores OMP_PROC_BIND=spread OMP_NUM_THREADS=4
This should produce an output similar to:
OMP: Warning #74: KMP_AFFINITY: setaffinity system call not supported.
OMP: System error #38: Function not implemented
OMP: Warning #74: KMP_AFFINITY: setaffinity system call not supported.
OMP: System error #38: Function not implemented
OMP: Warning #71: KMP_AFFINITY: affinity not supported, using "disabled".
Thanks. Supporting this is something I'd like to see, but it's nontrivial. We will need the following changes:
- [ ] Add an affinity mask to each lthread.
- [ ] Modify the lthread scheduler to skip lthreads that are bound to an ethread set that does not include the current scheduler.
- [ ] Intercept system calls that return topology information to provide the ethread state.
- [ ] Ensure that the CPUID trap handler correctly reports the current ethread for queries via CPUID
- [ ] Intercept the setaffinity system call to bind threads to a particular ethread.
P.S. I modified your comment to put the output in ``` so that GitHub does not try to autolink to a bunch of unrelated issues / PRs.