From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-sgx@vger.kernel.org, Paul Menzel <pmenzel@molgen.mpg.de>,
Haitao Huang <haitao.huang@linux.intel.com>,
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 v3] x86/sgx: Do not consider unsanitized pages an error
Date: Thu, 25 Aug 2022 22:22:14 +0300 [thread overview]
Message-ID: <YwfL5oZ8pjWmten0@kernel.org> (raw)
In-Reply-To: <88d0f48a-d845-b0ca-b34d-5e22ae82b047@intel.com>
On Thu, Aug 25, 2022 at 11:51:18AM -0700, Dave Hansen wrote:
> On 8/25/22 01:08, Jarkko Sakkinen wrote:
> > + /* Can happen, when the initialization is retracted: */
> > + if (verbose && dirty_count > 0)
> > + pr_info("%d unsanitized pages\n", dirty_count);
> > }
> >
> > static bool sgx_reclaimer_age(struct sgx_epc_page *epc_page)
> > @@ -394,11 +403,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);
> > -
> > - /* sanity check: */
> > - WARN_ON(!list_empty(&sgx_dirty_page_list));
> > + __sgx_sanitize_pages(&sgx_dirty_page_list, false);
> > + __sgx_sanitize_pages(&sgx_dirty_page_list, true);
>
> This is backwards, IMNHO.
>
> Make __sgx_sanitize_pages() return the number of pages that it leaves
> dirty.
>
> __sgx_sanitize_pages(&sgx_dirty_page_list)
> left_dirty = __sgx_sanitize_pages(&sgx_dirty_page_list);
> if (left_dirty)
> pr_warn(...);
I like this and my patch has already the counter in place
so why not.
> That rids us of the mystery true/false and puts the pr_warn() in a place
> that makes logical sense. Then, let's either *not* do the
>
> pr_err_ratelimited(EREMOVE_ERROR_MESSAGE, ret, ret);
>
> at all, or make it an unconditional pr_warn_ratelimited(). They're not
> going to be common and multiple messages are virtually worthless anyway.
>
> I actually think a common tracepoint, or out-of-line ENCLS/ENCLU
> functions that can be easily ftraced are a much better idea than a
> one-off pr_whatever().
I like the tracepoint idea more than out-of-line ENCLS/ENCLU
because out-of-line is more "intrusive" change to the code
semantics than a tracepoint.
BR, Jarkko
prev parent reply other threads:[~2022-08-25 19:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 8:08 [PATCH v3] x86/sgx: Do not consider unsanitized pages an error Jarkko Sakkinen
2022-08-25 14:07 ` Dave Hansen
2022-08-25 18:27 ` Jarkko Sakkinen
2022-08-25 18:38 ` Dave Hansen
2022-08-25 19:15 ` Jarkko Sakkinen
2022-08-25 14:57 ` Haitao Huang
2022-08-25 18:40 ` Jarkko Sakkinen
2022-08-25 18:51 ` Dave Hansen
2022-08-25 19:22 ` 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=YwfL5oZ8pjWmten0@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@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