Skip to content

Commit b12eb27

Browse files
npigginmpe
authored andcommitted
powerpc/64s: make linear_map_hash_lock a raw spinlock
This lock is taken while the raw kfence_freelist_lock is held, so it must also be a raw spinlock, as reported by lockdep when raw lock nesting checking is enabled. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 35159b5 commit b12eb27

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
19811981
}
19821982

19831983
#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
1984-
static DEFINE_SPINLOCK(linear_map_hash_lock);
1984+
static DEFINE_RAW_SPINLOCK(linear_map_hash_lock);
19851985

19861986
static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
19871987
{
@@ -2005,10 +2005,10 @@ static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
20052005
mmu_linear_psize, mmu_kernel_ssize);
20062006

20072007
BUG_ON (ret < 0);
2008-
spin_lock(&linear_map_hash_lock);
2008+
raw_spin_lock(&linear_map_hash_lock);
20092009
BUG_ON(linear_map_hash_slots[lmi] & 0x80);
20102010
linear_map_hash_slots[lmi] = ret | 0x80;
2011-
spin_unlock(&linear_map_hash_lock);
2011+
raw_spin_unlock(&linear_map_hash_lock);
20122012
}
20132013

20142014
static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
@@ -2018,14 +2018,14 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
20182018
unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize);
20192019

20202020
hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
2021-
spin_lock(&linear_map_hash_lock);
2021+
raw_spin_lock(&linear_map_hash_lock);
20222022
if (!(linear_map_hash_slots[lmi] & 0x80)) {
2023-
spin_unlock(&linear_map_hash_lock);
2023+
raw_spin_unlock(&linear_map_hash_lock);
20242024
return;
20252025
}
20262026
hidx = linear_map_hash_slots[lmi] & 0x7f;
20272027
linear_map_hash_slots[lmi] = 0;
2028-
spin_unlock(&linear_map_hash_lock);
2028+
raw_spin_unlock(&linear_map_hash_lock);
20292029
if (hidx & _PTEIDX_SECONDARY)
20302030
hash = ~hash;
20312031
slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;

0 commit comments

Comments
 (0)