arm linux page initialization

Oscar Salvador osalvador.vilardaga at gmail.com
Thu Oct 13 05:50:23 PDT 2016


Hi Rusell,

I'm sorry, next time I'll use the right list.

Thank you very much for replying all questions.

On Thu, 13 Oct 2016, Russell King - ARM Linux wrote:

> linux-arm is for user discussions...
> linux-arm-kernel is for kernel discussions, please use the correct list
> to reach your target audience.
>
> On Thu, Oct 13, 2016 at 01:09:08PM +0200, Oscar Salvador wrote:
>> Hi all, I have a question regarding page initialization on arm32 without
>> LPAE support enabled.
>>
>> I was trying to find the right pte of a kernel linear address (f.i
>> 0xc05518bc)
>> by walking the page tables starting with the pgd taken from TTBR1.
>>
>> I was using the functions:
>> pgd_offset_k
>> pud_offset
>> pmd_offset
>> pte_offset_kernel
>>
>> Since pte_offset_kernel should lead me to virtual address of the Linux
>> PTE version, I thougt I should be able to check the L_PTE_* bits.
>> But actually I realized that the pte given from pte_offset_kernel
>> didn't have such flags.
>
> You need to check for "bad" pgd/pud/pmd entries as you walk down, which
> will exclude things like sections.
>
>> By looking at the code from arch/arm/mm/mmu.c, I could see that, actually
>> (talking about a system with 1GB ram), during map_lowmem function,
>> memory (virtual) from 0xC0000000 to 0xef800000 is being put in sections
>> of 1MB and marked as a "PMD_TYPE_SECT | PMD_SECT_AP_WRITE",
>> then it does a flush_pmd_entry.
>>
>> So that means that the first level table for these addresses are pointing
>> directly to a Section, instead to point to a second level tables, right?
>
> Correct.  We map the kernel using sections not page tables, because it
> is much more efficient.
>
>> If that's true, I guess this memory don't have PTE's
>> (at least I didn't see that at boot time).
>> Given that, without pte's available for this range of memory,
>> we shoudln't be able to check for L_PTE_* flags here.
>>
>> Then, why do we have all these L_PTE_* flags?
>> Are not they being used to check for instance if the kernel code is
>> writeable or not (I think you can configure that).
>
> Just because the kernel is mapped with sections doesn't mean that we only
> use sections everywhere.  We use page tables for user mappings.
>
> -- 
> RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
> according to speedtest.net.
>



More information about the linux-arm mailing list