From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: ira.weiny@intel.com, Sean Christopherson <seanjc@google.com>,
Jethro Beekman <jethro@fortanix.com>,
linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org
Subject: Re: [PATCH] x86: Remove unnecessary kmap() from sgx_ioc_enclave_init()
Date: Wed, 3 Feb 2021 00:43:50 +0200 [thread overview]
Message-ID: <YBnVprvgr1GMa3CJ@kernel.org> (raw)
In-Reply-To: <ba4adad5-754f-65b5-5dae-69dee6803a23@intel.com>
On Tue, Feb 02, 2021 at 10:55:36AM -0800, Dave Hansen wrote:
> On 2/1/21 5:37 PM, ira.weiny@intel.com wrote:
> > kmap is inefficient and we are trying to reduce the usage in the kernel.
> > There is no readily apparent reason why the initp_page page needs to be
> > allocated and kmap'ed() but sigstruct needs to be page aligned and token
> > 512 byte aligned.
>
> Hi Ira,
>
> It's a *relatively* recent guaranteed, but:
>
> https://www.kernel.org/doc/Documentation/core-api/memory-allocation.rst
>
> says:
>
> > The address of a chunk allocated with `kmalloc` is aligned to at least
> > ARCH_KMALLOC_MINALIGN bytes. For sizes which are a power of two, the
> > alignment is also guaranteed to be at least the respective size.
>
> So, if you allocate a page with kmalloc(), you get an aligned page. Yay!
And this what we do sgx_ioc_enclave_create() anyway, as I stated in my
earlier response. Better to use the same pattern everywhere consitently
when it makes sense.
/Jarkko
next prev parent reply other threads:[~2021-02-02 22:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 1:37 [PATCH] x86: Remove unnecessary kmap() from sgx_ioc_enclave_init() ira.weiny
2021-02-02 18:55 ` Dave Hansen
2021-02-02 22:43 ` Jarkko Sakkinen [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-29 0:14 ira.weiny
2021-01-29 17:37 ` Sean Christopherson
2021-02-01 8:48 ` Christoph Hellwig
2021-02-02 17:37 ` Jarkko Sakkinen
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=YBnVprvgr1GMa3CJ@kernel.org \
--to=jarkko@kernel.org \
--cc=dave.hansen@intel.com \
--cc=ira.weiny@intel.com \
--cc=jethro@fortanix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=seanjc@google.com \
/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).