1 From 5d45ee5fb7fd75c83fb5964140686465334c50d3 Mon Sep 17 00:00:00 2001
2 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
3 Date: Wed, 13 Feb 2019 17:14:42 +0100
4 Subject: ARM: 8840/1: use a raw_spinlock_t in unwind
6 [ Upstream commit 74ffe79ae538283bbf7c155e62339f1e5c87b55a ]
8 Mostly unwind is done with irqs enabled however SLUB may call it with
9 irqs disabled while creating a new SLUB cache.
11 I had system freeze while loading a module which called
12 kmem_cache_create() on init. That means SLUB's __slab_alloc() disabled
18 ->setup_object_debug()
22 ->save_stack_trace_tsk()
26 =>spin_lock_irqsave(&unwind_lock);
28 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
29 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
30 Signed-off-by: Sasha Levin <sashal@kernel.org>
32 arch/arm/kernel/unwind.c | 14 +++++++-------
33 1 file changed, 7 insertions(+), 7 deletions(-)
35 diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
36 index cbb85c5fabf9..5184fe85d167 100644
37 --- a/arch/arm/kernel/unwind.c
38 +++ b/arch/arm/kernel/unwind.c
39 @@ -93,7 +93,7 @@ extern const struct unwind_idx __start_unwind_idx[];
40 static const struct unwind_idx *__origin_unwind_idx;
41 extern const struct unwind_idx __stop_unwind_idx[];
43 -static DEFINE_SPINLOCK(unwind_lock);
44 +static DEFINE_RAW_SPINLOCK(unwind_lock);
45 static LIST_HEAD(unwind_tables);
47 /* Convert a prel31 symbol to an absolute address */
48 @@ -201,7 +201,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)
49 /* module unwind tables */
50 struct unwind_table *table;
52 - spin_lock_irqsave(&unwind_lock, flags);
53 + raw_spin_lock_irqsave(&unwind_lock, flags);
54 list_for_each_entry(table, &unwind_tables, list) {
55 if (addr >= table->begin_addr &&
56 addr < table->end_addr) {
57 @@ -213,7 +213,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)
61 - spin_unlock_irqrestore(&unwind_lock, flags);
62 + raw_spin_unlock_irqrestore(&unwind_lock, flags);
65 pr_debug("%s: idx = %p\n", __func__, idx);
66 @@ -530,9 +530,9 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size,
67 tab->begin_addr = text_addr;
68 tab->end_addr = text_addr + text_size;
70 - spin_lock_irqsave(&unwind_lock, flags);
71 + raw_spin_lock_irqsave(&unwind_lock, flags);
72 list_add_tail(&tab->list, &unwind_tables);
73 - spin_unlock_irqrestore(&unwind_lock, flags);
74 + raw_spin_unlock_irqrestore(&unwind_lock, flags);
78 @@ -544,9 +544,9 @@ void unwind_table_del(struct unwind_table *tab)
82 - spin_lock_irqsave(&unwind_lock, flags);
83 + raw_spin_lock_irqsave(&unwind_lock, flags);
85 - spin_unlock_irqrestore(&unwind_lock, flags);
86 + raw_spin_unlock_irqrestore(&unwind_lock, flags);