-
Notifications
You must be signed in to change notification settings - Fork 0
End to End Examples
itayslepian edited this page Sep 1, 2022
·
8 revisions
EDM identifies a page-fault raised by app, to a new page (first access), and returns a new zero-page to app.
Address space registered to Userfaultfd - 0x1B58000 - 0x1F40000
#define PAGE_SIZE 4096
void simpleZeroPageTest() {
LOG(DEBUG) << "[Usercode] : User code main function start running" ;
char* area_1 = (char*) mmap( (void*)0x1D4C000, PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
area_1[0] = 'x';
LOG(DEBUG)<< "[Usercode] : area_1[0] " << area_1[0] ;
}
--------------------------------------------------------------------------
[Thu Sep 01 2022 12:53:54.156]:[Debug]-[EDM CLIENT] - INIT
[Thu Sep 01 2022 12:53:54.320]:[Debug]-[DMS] - DMS ready for serving requests
[Thu Sep 01 2022 12:53:54.321]:[Debug]-[Usercode] : User code main function start running
[Thu Sep 01 2022 12:53:54.321]:[Info]-
--------------START HADNLING PAGE FAULT--------------
[Thu Sep 01 2022 12:53:54.322]:[Info]-[DmHandler] - UFFD_EVENT_PAGEFAULT in address = 0x1d4c000
[Thu Sep 01 2022 12:53:54.322]:[Info]-[DmHandler] - send request for the page in address 0x1d4c000 from DMS
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[MpiClient] - send DmHandler's request for the page in address 0x1d4c000
[Thu Sep 01 2022 12:53:54.328]:[Info]-[DMS] - get request to send content of page in address: 0x1d4c000
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[DMS] - page accessed first time, set info - new_page
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[DMS] - SPT updated. Current state:
[Thu Sep 01 2022 12:53:54.328]:[Info]-DMS- Print SPT STATE
-----START SPT ----
address : 0x1d4c000 location : INSTANCE_0
------END SPT-----
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[DMS] - page in address: 0x1d4c000 sent to app
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[MpiClient] - get DMS's response for the page in address 0x1d4c000
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[MpiClient] - RequestPageFromDMS succeeded.
[Thu Sep 01 2022 12:53:54.328]:[Info]-[DmHandler] - received ack for page in address : 0x1d4c000 (first access)
[Thu Sep 01 2022 12:53:54.328]:[Info]-[DmHandler] - copying zero page to address : 0x1d4c000
[Thu Sep 01 2022 12:53:54.328]:[Info]-
--------------FINISH HADNLING PAGE FAULT--------------
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[Usercode] : area_1[0] x
[Thu Sep 01 2022 12:53:54.328]:[Debug]-[EDM CLIENT] - SHUTDOWN!
- As expected, mmap in user-code triggers a page-fault, then MpiClient sends a request for the page.
- When DMS detects this is a new page, it returns zero-page to client, and updates SPT.
- The moment Client gets back the page it continues execution, and eventually, as a validation step, it prints the modified byte - 'x'.