From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] arm64: mm: Support Common Not Private translations
Date: Tue, 10 Oct 2017 16:19:23 +0100 [thread overview]
Message-ID: <59DCE4FB.6070106@arm.com> (raw)
In-Reply-To: <ace7be76-c6fa-e217-f3c0-5e6dd42f5255@arm.com>
Hi Vladimir,
On 10/10/17 13:50, Vladimir Murzin wrote:
> On 09/10/17 17:48, James Morse wrote:
>> On 09/10/17 16:23, Catalin Marinas wrote:
>>> On Mon, Oct 09, 2017 at 01:55:32PM +0100, Vladimir Murzin wrote:
>>>> This patch adds support for Common Not Private translations on
>>>> different exceptions levels:
>>
>>>> (2) For EL1 we postpone setting CNP till all cpus are up and rely on
>>>> cpufeature framework to 1) patch the code which is sensitive to
>>>> CNP and 2) update TTBR1_EL1 with CNP bit set. The only case where
>>>> TTBR1_EL1 can be reprogrammed is hibirnation, so the code there is
>>>> changed to save raw TTBR1_EL1 and blindly restore it on resume.
>>
>>> Even if you do this when all the CPUs are up, that's not always true.
>>> Starting with maxcpus=1 allows something like systemd to bring up new
>>> CPUs once user space starts.
>>
>> For secondary CPUs cpu_enable_cnp() will be called to set CNP on TTBR1_EL1. But
>> what about cpuidle? This also resets the TTBR1_EL1 value.
>
> Good point! I've missed it because reset happens via __enable_mmu, which has
> no idea about CnP.
>
> Would something like below be sufficient?
>
>
> diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
> index 1e3be90..03a02c4 100644
> --- a/arch/arm64/kernel/suspend.c
> +++ b/arch/arm64/kernel/suspend.c
> @@ -46,6 +46,10 @@ void notrace __cpu_suspend_exit(void)
> */
> cpu_uninstall_idmap();
>
> +#ifdef CONFIG_ARM64_CNP
> + /* Restore CnP bit in TTBR1_EL1 */
> + cpu_replace_ttbr1(swapper_pg_dir);
> +#endif
> /*
> * PSTATE was not saved over suspend/resume, re-enable any detected
> * features that might not have been set correctly.
>
This re-install -> uninstalls the idmap, and if we don't actually have CNP
support, it wouldn't have changed anything. How about:
> if (cpus_have_const_cap(ARM64_HAS_CNP)
> cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
We could look at having a combined helper that is called with the idmap
installed and does the uninstall.
hibernate uses these cpu_suspend helpers to save/restore the CPU registers, so
if we fix cpu-idle, you don't need the hibernate hunk anymore.
Thanks,
James
next prev parent reply other threads:[~2017-10-10 15:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 12:55 [PATCH 0/3] Support Common Not Private translations Vladimir Murzin
2017-10-09 12:55 ` [PATCH 1/3] arm64: mm: " Vladimir Murzin
2017-10-09 15:23 ` Catalin Marinas
2017-10-09 16:48 ` James Morse
2017-10-10 12:50 ` Vladimir Murzin
2017-10-10 15:19 ` James Morse [this message]
2017-10-10 12:50 ` Vladimir Murzin
2017-10-10 15:19 ` James Morse
2017-10-11 8:49 ` Vladimir Murzin
2017-10-09 12:55 ` [PATCH 2/3] arm64: KVM: " Vladimir Murzin
2017-10-09 12:55 ` [PATCH 3/3] arm64: Introduce command line parameter to disable CNP Vladimir Murzin
2017-10-10 14:36 ` Julien Thierry
2017-10-11 8:47 ` Vladimir Murzin
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=59DCE4FB.6070106@arm.com \
--to=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.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.