From: Dave Hansen <dave.hansen@intel.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: linux-sgx@vger.kernel.org,
Dave Hansen <dave.hansen@linux.intel.com>,
stable@vger.kernel.org, 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>,
Sean Christopherson <seanjc@google.com>,
Jethro Beekman <jethro@fortanix.com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] x86/sgx: Free backing memory after faulting the enclave page
Date: Mon, 28 Feb 2022 07:32:02 -0800 [thread overview]
Message-ID: <0e06910b-9313-94ae-11e3-10a2b14645f2@intel.com> (raw)
In-Reply-To: <YhzGS+x0eNoc3gyN@iki.fi>
On 2/28/22 04:55, Jarkko Sakkinen wrote:
> I thought that the formula is so simple that it does not matter if it is
> just in two sites open coded but I can wrap it too, if required, e.g.
>
> /*
> * Calculate byte offset of a PCMD struct associated to an enclave page.
> * PCMD's follow right after the EPC data in the backing storage. In
> * addition to the visible enclave pages, there's one extra page slot
> * for SECS, before PCMD data.
> */
> static pgoff_t *sgx_encl_page_index_to_pcmd_offset(struct sgx_encl *encl, unsigned long page_index)
> {
> return encl->size + PAGE_SIZE + page_index * sizeof(struct sgx_pcmd);
> }
Yes, it's required. Please wrap it.
There's also nothing wrong with spreading that calculation across
several lines. It may be arithmetically simple, but it's combining
three or four logical steps. There's no shame in separating and
commenting some of those separately.
next prev parent reply other threads:[~2022-02-28 15:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 12:03 [PATCH v4] x86/sgx: Free backing memory after faulting the enclave page Jarkko Sakkinen
2022-02-22 12:24 ` Jarkko Sakkinen
2022-02-24 17:14 ` Dave Hansen
2022-02-28 12:55 ` Jarkko Sakkinen
2022-02-28 15:32 ` Dave Hansen [this message]
2022-03-01 11:03 ` 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=0e06910b-9313-94ae-11e3-10a2b14645f2@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jarkko@kernel.org \
--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=stable@vger.kernel.org \
--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