linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm: Fix memory attribute inconsistencies when using fixmap
Date: Wed, 22 Mar 2017 09:46:28 +0000	[thread overview]
Message-ID: <1490175988.2890.1.camel@linaro.org> (raw)
In-Reply-To: <CAKv+Gu82PsyyC=fQHxUn5mrCdmQvhwK+DK342-vv8y53mLcpng@mail.gmail.com>

On Tue, 2017-03-21 at 19:00 +0000, Ard Biesheuvel wrote:
> On 21 March 2017 at 17:36, Jon Medhurst (Tixy) <tixy@linaro.org> wrote:
> > On Tue, 2017-03-21 at 17:30 +0000, Jon Medhurst wrote:
> > > To cope with the variety in ARM architectures and configurations, the
> > > pagetable attributes for kernel memory are generated at runtime to match
> > > the system the kernel finds itself on. This calculated value is stored
> > > in pgprot_kernel.
> > > 
> > > However, when early fixmap support was added for arm (commit
> > > a5f4c561b3b1) the attributes used for mappings were hard coded because
> > > pgprot_kernel is not set up early enough. Unfortunately, when fixmap is
> > > used after early boot this means the memory being mapped can have
> > > different attributes to existing mappings, potentially leading to
> > > unpredictable behaviour. A specific problem also exists due to the hard
> > > coded values not include the 'shareable' attribute which means on
> > > systems where this matters (e.g. those with multiple CPU clusters) the
> > > cache contents for a memory location can become inconsistent between
> > > CPUs.
> > > 
> > > To resolve these issues we change fixmap to use the same memory
> > > attributes (from pgprot_kernel) that the rest of the kernel uses. To
> > > enable this we need to refactor the initialisation code so
> > > build_mem_type_table is called early enough. Note, that relies on early
> > > param parsing for memory type overrides passed via the kernel command
> > > line, so we need to make sure this call is still after
> > > parse_early_params().
> > > 
> > > Fixes: a5f4c561b3b1 ("ARM: 8415/1: early fixmap support for earlycon")
> > > Cc: stable at vger.kernel.org # v4.3+
> > 
> > Sorry, this should have...
> > Signed-off-by: Jon Medhurst <tixy@linaro.org>
> > 
> 
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> UEFI boot and earlycon both still work for me, so
> 
> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> It looks like nommu should be unaffected, but it is worth giving it a
> spin as well

I did build test a couple of nommu platforms. I'll try and work out how
to get Linux on the only nommu hardware I have (ARM's MPS2) but if that
kernel doesn't work before my applying my changes I'm not going to
debug, I've opened enough cans of worms for now.

-- 
Tixy

  reply	other threads:[~2017-03-22  9:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 17:30 [PATCH v2] arm: Fix memory attribute inconsistencies when using fixmap Jon Medhurst
2017-03-21 17:36 ` Jon Medhurst (Tixy)
2017-03-21 19:00   ` Ard Biesheuvel
2017-03-22  9:46     ` Jon Medhurst (Tixy) [this message]
2017-03-22 12:13       ` Ard Biesheuvel
2017-03-22 12:18         ` Russell King - ARM Linux
2017-03-22 15:26         ` Jon Medhurst (Tixy)
2017-03-24 20:17           ` afzal mohammed
2017-03-27  7:29             ` Ard Biesheuvel
2017-03-27  8:53               ` Jon Medhurst (Tixy)
2017-04-03 17:18     ` Ard Biesheuvel
2017-04-03 20:00       ` Russell King - ARM Linux

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=1490175988.2890.1.camel@linaro.org \
    --to=tixy@linaro.org \
    --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).