Skip to content
Snippets Groups Projects
  • Michael Ellerman's avatar
    aac55d75
    powerpc/mm/hash64: Fix subpage protection with 4K HPTE config · aac55d75
    Michael Ellerman authored
    
    With Linux page size of 64K and hardware only supporting 4K HPTE, if we
    use subpage protection, we always fail for the subpage 0 as shown
    below (using the selftest subpage_prot test):
    
      520175565:  (4520111850): Failed at 0x3fffad4b0000 (p=13,sp=0,w=0), want=fault, got=pass !
      4520890210: (4520826495): Failed at 0x3fffad5b0000 (p=29,sp=0,w=0), want=fault, got=pass !
      4521574251: (4521510536): Failed at 0x3fffad6b0000 (p=45,sp=0,w=0), want=fault, got=pass !
      4522258324: (4522194609): Failed at 0x3fffad7b0000 (p=61,sp=0,w=0), want=fault, got=pass !
    
    This is because hash preload wrongly inserts the HPTE entry for subpage
    0 without looking at the subpage protection information.
    
    Fix it by teaching should_hash_preload() not to preload if we have
    subpage protection configured for that range.
    
    It appears this has been broken since it was introduced in 2008.
    
    Fixes: fa28237c ("[POWERPC] Provide a way to protect 4k subpages when using 64k pages")
    Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    [mpe: Rework into should_hash_preload() to avoid build fails w/SLICES=n]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    aac55d75
    History
    powerpc/mm/hash64: Fix subpage protection with 4K HPTE config
    Michael Ellerman authored
    
    With Linux page size of 64K and hardware only supporting 4K HPTE, if we
    use subpage protection, we always fail for the subpage 0 as shown
    below (using the selftest subpage_prot test):
    
      520175565:  (4520111850): Failed at 0x3fffad4b0000 (p=13,sp=0,w=0), want=fault, got=pass !
      4520890210: (4520826495): Failed at 0x3fffad5b0000 (p=29,sp=0,w=0), want=fault, got=pass !
      4521574251: (4521510536): Failed at 0x3fffad6b0000 (p=45,sp=0,w=0), want=fault, got=pass !
      4522258324: (4522194609): Failed at 0x3fffad7b0000 (p=61,sp=0,w=0), want=fault, got=pass !
    
    This is because hash preload wrongly inserts the HPTE entry for subpage
    0 without looking at the subpage protection information.
    
    Fix it by teaching should_hash_preload() not to preload if we have
    subpage protection configured for that range.
    
    It appears this has been broken since it was introduced in 2008.
    
    Fixes: fa28237c ("[POWERPC] Provide a way to protect 4k subpages when using 64k pages")
    Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    [mpe: Rework into should_hash_preload() to avoid build fails w/SLICES=n]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
hash_utils_64.c 44.75 KiB