This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4376: 16MB super section and 64KB large page support

Part Number: AM4376

Tool/software: Linux

For AM4376 arm cortex-A based MPU, it seems the hardware support page/region size of 16MB, 1MB, 64KB and 4KB virtual to physical address translation. 

It seems this Linux only supports the 1MB (1st level) and 4KB (2nd level)  page table. 

Please enable the the 16MB ( supersection) , and 64KB (large page) in address translation. At least for the ioremap function(s).

  • Hi Lawrence,

    Could you specify which Linux release you are using?



    BR
    Tsvetolin Shulev

  • For the Ioremap of 16MB region, just need to apply the following patch.

    Index: arch/arm/mm/ioremap.c
    ===================================================================
    --- arch/arm/mm/ioremap.c (revision 625)
    +++ arch/arm/mm/ioremap.c (working copy)
    @@ -316,6 +316,9 @@
    !((paddr | size | addr) & ~SUPERSECTION_MASK)) {
    area->flags |= VM_ARM_SECTION_MAPPING;
    err = remap_area_supersections(addr, pfn, size, type);
    + } else if ((cpu_architecture() == CPU_ARCH_ARMv7) && !((paddr | size | addr) & ~SUPERSECTION_MASK)) {
    + area->flags |= VM_ARM_SECTION_MAPPING;
    + err = remap_area_supersections(addr, pfn, size, type);
    } else if (!((paddr | size | addr) & ~PMD_MASK)) {
    area->flags |= VM_ARM_SECTION_MAPPING;
    err = remap_area_sections(addr, pfn, size, type);

    I am looking for how to setup 2nd level page table for 64KB pte size.

  • Hi Lawrence,

    The question you are asking will require some research, I will need to discuss with the TI developers to see if changing the page size is possible . The SDK kernel and the testing that TI performs for a release relies for the most part on the taking what the Linux community has provided for setting up the core architecture of the processor.

    Could you please provide a reason and any supporting data on why changing the page size is required by your application?

    Best Regards,
    Schuyler
  • As an embedded system, we have FPGA and few other devices that are connected on GPMC which is 16MB and 64KB memory mapped.

    Application processes actively read/write to these FPGAs and devices.

  • Hi,

    The development is asking why does the page size matter? After an ioremap a virtual address which is contiguous irrespective of PAGE_SIZE or ioremap size is obtained. The MMU takes care of mapping and it is transparent to the virtual address whether the underlying PAGE_SIZE is 4K or 64K.

    Best Regards,
    Schuyler
  • Performance matter. The lesser TLB miss, the better for an overload embedded system.

  • Hi,

    The RT wiki describes a memory lockdown API.
    wiki.linuxfoundation.org/.../memory

    The code below is from the wiki above. Doesn't this API call lock the memory down and prevent TLB misses? Does this work for your application?

    /* Lock memory */
    if(mlockall(MCL_CURRENT|MCL_FUTURE) == -1) {
    printf("mlockall failed: %m\n");
    exit(-2);
    }

    Best Regards,
    Schuyler
  • Not, this is not what I am looking for. This memory locking API is for a system which has swap device, that is like having a partition of hard drive configured as swap space, and do not allow some thread's program and/or data swap out to disk. 

    In most of the embedded system, there is no swap device configured anyway. Every thread's program, data, and stack are already loaded in and run from memory (i.e. DDR).

    Besides, I am talking about configuring the ARM MMU to map a device's IO space (i.e. memory mapped) with fewer page table entries (i.e. PTEs) ,  so it will have a lesser TLB miss.

    The Translation Lookaside Buffer inside ARM can only store up to  32 PTEs in micro TLB, and  2-way associated 2x32 or 2x64 PTEs in main TLB, depending on hardware implementation. 

    Clearly, if my program is randomly accessing the FPGA which is ioremapped to  64K  memory window  (i.e. 16 PTEs with 4K window each), it will trigger lots of TLB misses. 

    Base on what I understand, a PTE which can be found in micro TLB takes lesser than few clock cycle to do the translation. If this translation misses, ARM cpu will try to find the PTE in main TLB, it will take around 10 to 20 clock cycles. If the main TLB still misses, it will trigger a page walk to find that PTE in main memory, which usually takes 100+ clock cycles. And these 100+ clock cycles are wasted time because the entire CPU is halted to wait for the page translation.

    So if a 64Kbyte window can be covered by a single 64K PTE will reduce the TLB misses and the performance of the real-time system will be improved.

  • Hi,

    I will need to research this again further internally. This area may not be an area that TI contributes in, I will check that also. Have you tried asking this question on the ARM Linux list?

    linux-arm-kernel@lists.infradead.org

    Best Regards,
    Schuyler
  • Thank you for the reply. 

    No,  I have not asked this question to the ARM Linux.

    I consider we are just the end-user of the TI Linux, not part of the open source Linux development committee. 

    My impression is that TI Linux is part of Linux development committee, and actively involving Linux technology.

    Cheers,

    Lawrence

  • Hi Lawrence,

    We think this is a question you will have to ask the ARM Linux community. While TI is a part of the Linux community TI is only contributing code that enables the switch fabric and peripheral drivers of the SOCs that TI sells. The code that enables the ARM architecture TI inherits when developing the Linux SOC drivers. The code you are interested in is not something TI developed and therefore not really able to support.

    The next step for the solution you are seeking would be to ask the community if this page size change is a feature that could be added. A contributor will still have to do the work and one that is familiar with how the ARM Linux code sets up the code for page sizes.

    The mailing list to start with is this:

    linux-arm-kernel@lists.infradead.org

    Best Regards,
    Schuyler