From: Dennis Zhou Date: Wed, 21 Jun 2017 17:52:46 +0000 (-0400) Subject: percpu: fix early calls for spinlock in pcpu_stats X-Git-Tag: v5.15~10970^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=303abfdf76ea41c228e8b3da73ed3807121a9ca6;p=platform%2Fkernel%2Flinux-starfive.git percpu: fix early calls for spinlock in pcpu_stats From 2c06e795162cb306c9707ec51d3e1deadb37f573 Mon Sep 17 00:00:00 2001 From: Dennis Zhou Date: Wed, 21 Jun 2017 10:17:09 -0700 Commit 30a5b5367ef9 ("percpu: expose statistics about percpu memory via debugfs") introduces percpu memory statistics. pcpu_stats_chunk_alloc takes the spin lock and disables/enables irqs on creation of a chunk. Irqs are not enabled when the first chunk is initialized and thus kernels are failing to boot with kernel debugging enabled. Fixed by changing _irq to _irqsave and _irqrestore. Fixes: 30a5b5367ef9 ("percpu: expose statistics about percpu memory via debugfs") Signed-off-by: Dennis Zhou Reported-by: Alexander Levin Signed-off-by: Tejun Heo --- diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index d030fce..cd2442e 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -116,13 +116,14 @@ static inline void pcpu_stats_area_dealloc(struct pcpu_chunk *chunk) */ static inline void pcpu_stats_chunk_alloc(void) { - spin_lock_irq(&pcpu_lock); + unsigned long flags; + spin_lock_irqsave(&pcpu_lock, flags); pcpu_stats.nr_chunks++; pcpu_stats.nr_max_chunks = max(pcpu_stats.nr_max_chunks, pcpu_stats.nr_chunks); - spin_unlock_irq(&pcpu_lock); + spin_unlock_irqrestore(&pcpu_lock, flags); } /* @@ -130,11 +131,12 @@ static inline void pcpu_stats_chunk_alloc(void) */ static inline void pcpu_stats_chunk_dealloc(void) { - spin_lock_irq(&pcpu_lock); + unsigned long flags; + spin_lock_irqsave(&pcpu_lock, flags); pcpu_stats.nr_chunks--; - spin_unlock_irq(&pcpu_lock); + spin_unlock_irqrestore(&pcpu_lock, flags); } #else