From: Jarkko Sakkinen <jarkko@kernel.org>
To: linux-sgx@vger.kernel.org
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/sgx: Print EREMOVE return value in __sgx_sanitize_pages()
Date: Thu, 25 Aug 2022 08:37:43 +0300 [thread overview]
Message-ID: <YwcKpzJMGVet0epv@kernel.org> (raw)
In-Reply-To: <20220825051827.246698-1-jarkko@kernel.org>
On Thu, Aug 25, 2022 at 08:18:27AM +0300, Jarkko Sakkinen wrote:
> 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 <pmenzel@molgen.mpg.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Reinette Chatre <reinette.chatre@intel.com>
> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
> ---
> arch/x86/kernel/cpu/sgx/main.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> index 515e2a5f25bb..33354921c59f 100644
> --- a/arch/x86/kernel/cpu/sgx/main.c
> +++ b/arch/x86/kernel/cpu/sgx/main.c
> @@ -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));
> --
> 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
prev parent reply other threads:[~2022-08-25 5:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 5:18 [PATCH] x86/sgx: Print EREMOVE return value in __sgx_sanitize_pages() Jarkko Sakkinen
2022-08-25 5:37 ` Jarkko Sakkinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YwcKpzJMGVet0epv@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).