diff mbox series

[3/3] arm: use a raw_spinlock_t in unwind

Message ID 20181207102749.15205-4-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show
Series arm: covert a few spinlock_t locks to raw_spinlock_t | expand

Commit Message

Sebastian Andrzej Siewior Dec. 7, 2018, 10:27 a.m. UTC
Mostly unwind is done with irqs enabled however SLUB may call it with
irqs disabled while creating a new SLUB cache.

I had system freeze while loading a module which called
kmem_cache_create() on init. That means SLUB's __slab_alloc() disabled
interrupts and then

->new_slab_objects()
 ->new_slab()
  ->setup_object()
   ->setup_object_debug()
    ->init_tracking()
     ->set_track()
      ->save_stack_trace()
       ->save_stack_trace_tsk()
        ->walk_stackframe()
         ->unwind_frame()
          ->unwind_find_idx()
           =>spin_lock_irqsave(&unwind_lock);

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/kernel/unwind.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Sebastian Andrzej Siewior Feb. 13, 2019, 8:46 a.m. UTC | #1
On 2018-12-07 11:27:49 [+0100], To linux-arm-kernel@lists.infradead.org wrote:
> Mostly unwind is done with irqs enabled however SLUB may call it with
> irqs disabled while creating a new SLUB cache.
> 
> I had system freeze while loading a module which called
> kmem_cache_create() on init. That means SLUB's __slab_alloc() disabled
> interrupts and then
> 
> ->new_slab_objects()
>  ->new_slab()
>   ->setup_object()
>    ->setup_object_debug()
>     ->init_tracking()
>      ->set_track()
>       ->save_stack_trace()
>        ->save_stack_trace_tsk()
>         ->walk_stackframe()
>          ->unwind_frame()
>           ->unwind_find_idx()
>            =>spin_lock_irqsave(&unwind_lock);
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

ping

Sebastian
Arnd Bergmann Feb. 13, 2019, 3:14 p.m. UTC | #2
On Wed, Feb 13, 2019 at 9:46 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> On 2018-12-07 11:27:49 [+0100], To linux-arm-kernel@lists.infradead.org wrote:
> > Mostly unwind is done with irqs enabled however SLUB may call it with
> > irqs disabled while creating a new SLUB cache.
> >
> > I had system freeze while loading a module which called
> > kmem_cache_create() on init. That means SLUB's __slab_alloc() disabled
> > interrupts and then
> >
> > ->new_slab_objects()
> >  ->new_slab()
> >   ->setup_object()
> >    ->setup_object_debug()
> >     ->init_tracking()
> >      ->set_track()
> >       ->save_stack_trace()
> >        ->save_stack_trace_tsk()
> >         ->walk_stackframe()
> >          ->unwind_frame()
> >           ->unwind_find_idx()
> >            =>spin_lock_irqsave(&unwind_lock);
> >
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> ping

Patches 2/3 and 3/3 look good to me. Can you add them to
https://www.arm.linux.org.uk/developer/patches/ ?

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Are there any other ARM specific RT patches that are not yet picked up?

        Arnd
Sebastian Andrzej Siewior Feb. 13, 2019, 3:57 p.m. UTC | #3
On 2019-02-13 16:14:18 [+0100], Arnd Bergmann wrote:
> Patches 2/3 and 3/3 look good to me. Can you add them to
> https://www.arm.linux.org.uk/developer/patches/ ?
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Will do, thanks.

> Are there any other ARM specific RT patches that are not yet picked up?

No, not at the moment.

>         Arnd

Sebastian
diff mbox series

Patch

diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 0bee233fef9a3..314cfb232a635 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -93,7 +93,7 @@  extern const struct unwind_idx __start_unwind_idx[];
 static const struct unwind_idx *__origin_unwind_idx;
 extern const struct unwind_idx __stop_unwind_idx[];
 
-static DEFINE_SPINLOCK(unwind_lock);
+static DEFINE_RAW_SPINLOCK(unwind_lock);
 static LIST_HEAD(unwind_tables);
 
 /* Convert a prel31 symbol to an absolute address */
@@ -201,7 +201,7 @@  static const struct unwind_idx *unwind_find_idx(unsigned long addr)
 		/* module unwind tables */
 		struct unwind_table *table;
 
-		spin_lock_irqsave(&unwind_lock, flags);
+		raw_spin_lock_irqsave(&unwind_lock, flags);
 		list_for_each_entry(table, &unwind_tables, list) {
 			if (addr >= table->begin_addr &&
 			    addr < table->end_addr) {
@@ -213,7 +213,7 @@  static const struct unwind_idx *unwind_find_idx(unsigned long addr)
 				break;
 			}
 		}
-		spin_unlock_irqrestore(&unwind_lock, flags);
+		raw_spin_unlock_irqrestore(&unwind_lock, flags);
 	}
 
 	pr_debug("%s: idx = %p\n", __func__, idx);
@@ -529,9 +529,9 @@  struct unwind_table *unwind_table_add(unsigned long start, unsigned long size,
 	tab->begin_addr = text_addr;
 	tab->end_addr = text_addr + text_size;
 
-	spin_lock_irqsave(&unwind_lock, flags);
+	raw_spin_lock_irqsave(&unwind_lock, flags);
 	list_add_tail(&tab->list, &unwind_tables);
-	spin_unlock_irqrestore(&unwind_lock, flags);
+	raw_spin_unlock_irqrestore(&unwind_lock, flags);
 
 	return tab;
 }
@@ -543,9 +543,9 @@  void unwind_table_del(struct unwind_table *tab)
 	if (!tab)
 		return;
 
-	spin_lock_irqsave(&unwind_lock, flags);
+	raw_spin_lock_irqsave(&unwind_lock, flags);
 	list_del(&tab->list);
-	spin_unlock_irqrestore(&unwind_lock, flags);
+	raw_spin_unlock_irqrestore(&unwind_lock, flags);
 
 	kfree(tab);
 }