x86/sgx: Print EREMOVE return value in __sgx_sanitize_pages()
Jarkko Sakkinen
maintainerPATCH 1/1 x86/sgx: Print EREMOVE return value in __sgx_sanitize_pages()
In the 2nd run of __sgx_sanitize_pages() print the error message. All EREMOVE's should succeed. This will allow to provide some additional clues, if not.
Cc Paul Menzel <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Reinette Chatre <[email protected]>
Signed-off-by Jarkko Sakkinen <[email protected]>
--- arch/x86/kernel/cpu/sgx/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/sgx/main.c +6 -3
@@ -50,7 +50,7 @@ static LIST_HEAD(sgx_dirty_page_list);* from the input list, and made available for the page allocator. SECS pages * prepending their children in the input list are left intact. */ -static void __sgx_sanitize_pages (struct list_head *dirty_page_list) +static void __sgx_sanitize_pages (struct list_head *dirty_page_list,bool verbose) {struct sgx_epc_page *page;LIST_HEAD (dirty);
@@ -90,6 +90,9 @@ static void __sgx_sanitize_pages(struct list_head *dirty_page_list)list_del (&page->list);sgx_free_epc_page (page); }else { +if (verbose) +pr_err_ratelimited (EREMOVE_ERROR_MESSAGE , ret, ret); +/* The page is not yet clean - move to the dirty list. */ list_move_tail (&page->list, &dirty); }
@@ -394,8 +397,8 @@ static int ksgxd(void *p)* Sanitize pages in order to recover from kexec(). The 2nd pass is * required for SECS pages, whose child pages blocked EREMOVE. */ -__sgx_sanitize_pages (&sgx_dirty_page_list); -__sgx_sanitize_pages (&sgx_dirty_page_list); +__sgx_sanitize_pages (&sgx_dirty_page_list, false); +__sgx_sanitize_pages (&sgx_dirty_page_list, true);/* sanity check: */ WARN_ON (!list_empty (&sgx_dirty_page_list));
Signature · 1 line
2.37.1
Jarkko Sakkinen
maintainerQuoted 49 lines · Jarkko Sakkinen
In the 2nd run of
__sgx_sanitize_pages()print the error message. All EREMOVE's should succeed. This will allow to provide some additional clues, if not.Cc Paul Menzel <[email protected]>Cc Dave Hansen <[email protected]>Cc Reinette Chatre <[email protected]>Signed-off-by Jarkko Sakkinen <[email protected]>--- arch/x86/kernel/cpu/sgx/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)arch/x86/kernel/cpu/sgx/main.c +6
-3@@ -50,7 +50,7 @@ static LIST_HEAD(sgx_dirty_page_list);* from the input list, and made available for the page allocator. SECS pages * prepending their children in the input list are left intact. */ -static void __sgx_sanitize_pages (struct list_head *dirty_page_list) +static void __sgx_sanitize_pages (struct list_head *dirty_page_list,bool verbose) {struct sgx_epc_page *page;LIST_HEAD (dirty);@@ -90,6 +90,9 @@ static void __sgx_sanitize_pages(struct list_head *dirty_page_list)list_del (&page->list);sgx_free_epc_page (page); }else { +if (verbose) +pr_err_ratelimited (EREMOVE_ERROR_MESSAGE , ret, ret); +/* The page is not yet clean - move to the dirty list. */ list_move_tail (&page->list, &dirty); }@@ -394,8 +397,8 @@ static int ksgxd(void *p)* Sanitize pages in order to recover from kexec(). The 2nd pass is * required for SECS pages, whose child pages blocked EREMOVE. */ -__sgx_sanitize_pages (&sgx_dirty_page_list); -__sgx_sanitize_pages (&sgx_dirty_page_list); +__sgx_sanitize_pages (&sgx_dirty_page_list, false); +__sgx_sanitize_pages (&sgx_dirty_page_list, true);/* sanity check: */ WARN_ON (!list_empty (&sgx_dirty_page_list));Signature · 1 line
2.37.1
Should this also print the number of pages not eremoved?
That would render out the need for WARN_ON() at call site, and would provide more data.
BR, Jarkko