From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: Clarification on ARM V6 context switching code
Date: Thu, 2 Jun 2011 10:59:38 +0100 [thread overview]
Message-ID: <001501cc210b$c8ecc9e0$5ac65da0$@deacon@arm.com> (raw)
In-Reply-To: <20110602081105.GA651@T61>
Hi Linu,
> While trying to understand the v6 context switching code, found some
> disparity with the code and the architecture specification/TRM.
Ok.
> Here is my doubt,
>
> 1. According to the architecture spec(ARM DDI 0406B), while switching
> the ASID, the architecture expects the TTBR to contain ONLY global
> mappings except the below cases where we
> - switch to a reserved context ID
> - disable the non global mappings
Actually, on modern CPUs (Cortex-A15) we can't even use the reserved context
ID safely.
> as explained in section "Synchronization of changes of ASID and TTBR.
>
> In "cpu_v6_switch_mm" function in arch/arm/mm/proc-v6.S,
> we use TTBR0 during the switch which points to process page table
> having both global and non global entries. We neither switch to a
> reserved context ID nor disable non global mappings.
>
> This appears to be out of sync with the spec?
It is out of sync with the spec, but the spec is the v7 ARM ARM and covers the
case of speculating, out-of-order CPUs.
> If the above is true, how about using the reserved context id during
> the switch ?
I don't believe that this is necessary for any existing v6 cores. Since we are
only using global mappings during context-switch and we assume that no
speculation is taking place, then not using a reserved ASID should be fine.
Of course, if you're seeing issues on real hardware then this needs to be fixed!
> 2. In the same function, are we not missing a IMB sequence after
> writing to the context ID register as expected by the the ARM 11
> MPCore TRM(ARM DDI 0360F, section 3.4.25 ) ?
Since we don't use the user mappings during context-switch, I don't think an
instruction barrier is necessary for any existing v6 implementations.
> Please point out if i misunderstood the spec/TRM.
It looks like you've understood the specs, but Linux takes some shortcuts
because of the nature of real v6 hardware.
Will
prev parent reply other threads:[~2011-06-02 9:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 8:11 Clarification on ARM V6 context switching code Linu Cherian
2011-06-02 9:59 ` Will Deacon [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='001501cc210b$c8ecc9e0$5ac65da0$@deacon@arm.com' \
--to=will.deacon@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 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).