Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch/rv32i: Don't sort PMP regions when we configure the MPU #2021

Merged
merged 2 commits into from
Jul 20, 2020

Commits on Jul 17, 2020

  1. arch/rv32i: Don't hardcode the app region offset

    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    alistair23 committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    b28163c View commit details
    Browse the repository at this point in the history
  2. arch/rv32i: Don't sort PMP regions when we configure the MPU

    Previously we would sort the PMP regions everytime we configured the
    MPU. This was wasteful in terms of instructions but also wasted stack
    space, probably because we cloned the PMPConfig regions.
    
    This patch changes the sorting to only happen after a change is made to
    the regions. This should save the number of times we have to sort,
    remove sorting out of the critical path and saves a lot of stack space.
    
    See below for the stack changes:
    
        ### Release build ###
        ## Before this patch ##
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$15allocate_region17hb3b05a589563feedE
        0     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$24update_app_memory_region17hd6078caa7928d4d8E
        592     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$13configure_mpu17h5967285bd6ec5881E
    
        ## After this patch ##
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$15allocate_region17hb3b05a589563feedE
        16     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$24update_app_memory_region17hd6078caa7928d4d8E
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$13configure_mpu17h5967285bd6ec5881E
    
        ### Debug build ###
        ## Before this patch ##
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$15allocate_region17h272c094b5b64d63bE
        96     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$26allocate_app_memory_region17h56b3decc4c649f8cE
        32     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$24update_app_memory_region17h55a48db93ba6d713E
        592     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$13configure_mpu17h32d25c65ffe73910E
    
        ## After this patch ##
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$15allocate_region17h272c094b5b64d63bE
        96     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$26allocate_app_memory_region17h56b3decc4c649f8cE
        32     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$24update_app_memory_region17h55a48db93ba6d713E
        80     _ZN68_$LT$rv32i..pmp..PMPConfig$u20$as$u20$kernel..platform..mpu..MPU$GT$13configure_mpu17h32d25c65ffe73910E
    
    NOTE: All above numbers already include: tock#2020
    
    I haven't compared instruction diffs, but I'm assuming we reduce the
    number of instructions run on app swap as well.
    
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    alistair23 committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    bed1b92 View commit details
    Browse the repository at this point in the history