From: Jarkko Sakkinen <jarkko@kernel.org>
To: ira.weiny@intel.com
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Sean Christopherson <seanjc@google.com>,
Jethro Beekman <jethro@fortanix.com>,
Dave Hansen <dave.hansen@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/sgx: Remove unnecessary kmap() from sgx_ioc_enclave_init()
Date: Fri, 26 Mar 2021 21:45:24 +0200 [thread overview]
Message-ID: <YF451PGNd8x/i56z@kernel.org> (raw)
In-Reply-To: <20210324182246.2484875-1-ira.weiny@intel.com>
On Wed, Mar 24, 2021 at 11:22:46AM -0700, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> kmap is inefficient and is being replaced by kmap_local_page(), if
> possible.
Nit: just saying that something is inefficient is not enough. Always
should have something to back it up.
> That said, there is no readily apparent reason why initp_page needs to
> be allocated and kmap'ed() except that 'sigstruct' needs to be page
> aligned and 'token' 512 byte aligned.
>
> Rather than change this kmap() to kmap_local_page() use kmalloc()
> instead because kmalloc() can gives this alignment when allocating
> PAGE_SIZE bytes.
>
> Remove the alloc_page()/kmap() and replace with kmalloc(PAGE_SIZE, ...)
> to get a page aligned kernel address.
>
> In addition add a comment to document the alignment requirements so that
> others don't attempt to 'fix' this again.
I'm a bit confused based on this commit message. Why is kmap_local_page()
better, and why kmalloc() is the ultimate choice of all three options?
>
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Jethro Beekman <jethro@fortanix.com>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
/Jarkko
prev parent reply other threads:[~2021-03-26 19:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 18:22 [PATCH] x86/sgx: Remove unnecessary kmap() from sgx_ioc_enclave_init() ira.weiny
2021-03-25 9:07 ` [tip: x86/sgx] " tip-bot2 for Ira Weiny
2021-03-26 19:45 ` 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=YF451PGNd8x/i56z@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jethro@fortanix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.