Coder Social home page Coder Social logo

Turn off EPC paging about linux-sgx-driver HOT 6 CLOSED

intel avatar intel commented on August 29, 2024
Turn off EPC paging

from linux-sgx-driver.

Comments (6)

sergeay avatar sergeay commented on August 29, 2024

The EPC area contains both your data (the buffer but also others such as stack, global variables your binary code...). When the size of your "working set" passes the 96MB limit (and not 128MB since 32MB are reserved), then the sub system (the driver) is starting to swap. This is not a "nice to have" feature but a necessary feature in order to have your running environment up and running. If swapping was disabled, either the allocation or your buffer access would fail and your program would crash / exit much before.

from linux-sgx-driver.

az-hasan avatar az-hasan commented on August 29, 2024

Got it. I did notice the drop between 90-100MB - the 32 MB reserved explains it.
So the pages of the EPC are managed by the Linux memory management subsystem, and if I want to ensure that for the entire run of the program, the EPC pages are not swapped out, I need to turn off the Linux swap feature (with the risk of program crashing + not being able to load an Enclave bigger than the EPC). I don't have to worry about any SGX settings.

Thank you for the clear explanation.

from linux-sgx-driver.

sergeay avatar sergeay commented on August 29, 2024

This is almost true:

So the pages of the EPC are managed by the Linux memory management subsystem
Not exactly but managed by the SGX driver.
...I need to turn off the Linux swap feature...
No, this will not help and I did not know that such an option exists. You could cripple the driver code. As you said you would expose yourself to crashes

from linux-sgx-driver.

az-hasan avatar az-hasan commented on August 29, 2024

Ok, so the EPC pages are managed by the SGX driver, not the Linux memory management subsystem. And modifying the driver code is not trivial, and there are no settings I can change anywhere to prevent paging out of the EPC pages?

from linux-sgx-driver.

sergeay avatar sergeay commented on August 29, 2024

At your own risk...
You probably can comment out the kernel swapper thread creation.
Easy to find, the main method is: ksgxswapd.
Your system will probably become unstable.

from linux-sgx-driver.

rriley avatar rriley commented on August 29, 2024

Hi, I'm working with the original question asker. In our case, we're doing some performance testing and want to make sure that our tests are not triggering swapping without us realizing it. The thought with turning it off was that we'd rather have the enclave crash due to running out of memory. (Because then we know we screwed up and should lower our memory usage.)

Thanks for your feedback and help!

from linux-sgx-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.