Skip to content
  • Martin Schwidefsky's avatar
    [S390] fix recursive locking on page_table_lock · 50aa98ba
    Martin Schwidefsky authored
    
    
    Suzuki Poulose reported the following recursive locking bug on s390:
    
    Here is the stack trace : (see Appendix I for more info)
    
      [<0000000000406ed6>] _spin_lock+0x52/0x94
      [<0000000000103bde>] crst_table_free+0x14e/0x1a4
      [<00000000001ba684>] __pmd_alloc+0x114/0x1ec
      [<00000000001be8d0>] handle_mm_fault+0x2cc/0xb80
      [<0000000000407d62>] do_dat_exception+0x2b6/0x3a0
      [<0000000000114f8c>] sysc_return+0x0/0x8
      [<00000200001642b2>] 0x200001642b2
    
    The page_table_lock is already acquired in __pmd_alloc (mm/memory.c) and
    it tries to populate the pud/pgd with a new pmd allocated. If another
    thread populates it before we get a chance, we free the pmd using
    pmd_free().
    
    On s390x, pmd_free(even pud_free ) is #defined to crst_table_free(),
    which acquires the page_table_lock to protect the crst_table index updates.
    
    Hence this ends up in a recursive locking of the page_table_lock.
    
    The solution suggested by Dave Hansen is to use a new spin lock in the mmu
    context to protect the access to the crst_list and the pgtable_list.
    
    Reported-by: default avatarSuzuki Poulose <suzuki@in.ibm.com>
    Cc: Dave Hansen <dave@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    50aa98ba