Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1529656

Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section
Date 2016-11-24 20:50 +0100
Message-ID <sH8bU-76f-19@gated-at.bofh.it> (permalink)
References (6 earlier) <sH2Jb-3tF-11@gated-at.bofh.it> <sH3lU-3ZG-29@gated-at.bofh.it> <sH3lU-3ZG-27@gated-at.bofh.it> <sH8bU-76f-21@gated-at.bofh.it> <sH8bU-76f-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 24 November 2016 at 19:26, Robert Richter <robert.richter@cavium.com> wrote:
> Ard,
>
>> > >> On 24 November 2016 at 13:51, Robert Richter <robert.richter@cavium.com> wrote:
>> > >> > On 24.11.16 13:44:31, Ard Biesheuvel wrote:
>
>> > >> Regions containing firmware tables are owned by the firmware, and it
>> > >> is the firmware that tells us which memory attributes we are allowed
>> > >> to use. If those attributes include WB, it is perfectly legal to use a
>> > >> cacheable mapping. That does *not* mean they should be covered by the
>> > >> linear mapping. The linear mapping is read-write-non-exec, for
>> > >> instance, and we may prefer to use a read-only mapping and/or
>> > >> executable mapping.
>> > >
>> > > Ok, I am going to fix try_ram_remap().
>
> I revisited the code and it is working well already since:
>
>  e7cd190385d1 arm64: mark reserved memblock regions explicitly in iomem
>
> Now, try_ram_remap() is only called if the region to be mapped is
> entirely in IORESOURCE_SYSTEM_RAM. This is only true for normal mem
> ranges and not NOMAP mem. region_intersects() then returns
> REGION_INTERSECTS and calls try_ram_remap(). For the NOMAP memory case
> REGION_DISJOINT would be returned and thus arch_memremap_wb() being
> called directly. Before the e7cd190385d1 change try_ram_remap() was
> called also for nomap regions.
>
> So we can leave memremap() as it is and just apply this patch
> unmodified. What do you think?

I agree. The pfn_valid() check in try_ram_remap() is still appropriate
simply because the PageHighmem check requires a valid struct page. But
if we don't enter that code path anymore for NOMAP regions, I think
we're ok.

> Please ack.
>

I still don't fully understand how it is guaranteed that *all* memory
(i.e., all regions for which memblock_is_memory() returns true) is
covered by a struct page, but marked as reserved. Are we relying on
the fact that NOMAP memory is also memblock_reserve()'d?

> I am going to prepare the pfn_is_ram() change in addition to this
> patch, but that should not be required for this fix to work correcly.
>

I don't think you need to bother with page_is_ram() then. The only
place we use it is in devmem_is_allowed(), and there it makes sense to
allow NOMAP regions to be accessed (provided that you think /dev/mem
is a good idea in the first place).

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire  section Will Deacon <will.deacon@arm.com> - 2016-11-17 15:40 +0100
  Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-20 18:10 +0100
    Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-23 22:30 +0100
      Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-24 14:50 +0100
        Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-24 15:00 +0100
          Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-24 15:40 +0100
            Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-24 20:50 +0100
              Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-25 13:30 +0100
                Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-25 18:10 +0100

csiph-web