diff options
author | Dennis Zhou <dennisz@fb.com> | 2017-06-21 13:52:46 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2017-06-21 13:53:52 -0400 |
commit | 303abfdf76ea41c228e8b3da73ed3807121a9ca6 (patch) | |
tree | 9f860486a6b1c8f234dc8c871dfc788491f467c1 | |
parent | 11df02bf9bc1f6fd8416d22c08275e31f8c4f30d (diff) |
percpu: fix early calls for spinlock in pcpu_stats
From 2c06e795162cb306c9707ec51d3e1deadb37f573 Mon Sep 17 00:00:00 2001
From: Dennis Zhou <dennisz@fb.com>
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 <dennisz@fb.com>
Reported-by: Alexander Levin <alexander.levin@verizon.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | mm/percpu-internal.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index d030fce745a2..cd2442e13d8f 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) | |||
116 | */ | 116 | */ |
117 | static inline void pcpu_stats_chunk_alloc(void) | 117 | static inline void pcpu_stats_chunk_alloc(void) |
118 | { | 118 | { |
119 | spin_lock_irq(&pcpu_lock); | 119 | unsigned long flags; |
120 | spin_lock_irqsave(&pcpu_lock, flags); | ||
120 | 121 | ||
121 | pcpu_stats.nr_chunks++; | 122 | pcpu_stats.nr_chunks++; |
122 | pcpu_stats.nr_max_chunks = | 123 | pcpu_stats.nr_max_chunks = |
123 | max(pcpu_stats.nr_max_chunks, pcpu_stats.nr_chunks); | 124 | max(pcpu_stats.nr_max_chunks, pcpu_stats.nr_chunks); |
124 | 125 | ||
125 | spin_unlock_irq(&pcpu_lock); | 126 | spin_unlock_irqrestore(&pcpu_lock, flags); |
126 | } | 127 | } |
127 | 128 | ||
128 | /* | 129 | /* |
@@ -130,11 +131,12 @@ static inline void pcpu_stats_chunk_alloc(void) | |||
130 | */ | 131 | */ |
131 | static inline void pcpu_stats_chunk_dealloc(void) | 132 | static inline void pcpu_stats_chunk_dealloc(void) |
132 | { | 133 | { |
133 | spin_lock_irq(&pcpu_lock); | 134 | unsigned long flags; |
135 | spin_lock_irqsave(&pcpu_lock, flags); | ||
134 | 136 | ||
135 | pcpu_stats.nr_chunks--; | 137 | pcpu_stats.nr_chunks--; |
136 | 138 | ||
137 | spin_unlock_irq(&pcpu_lock); | 139 | spin_unlock_irqrestore(&pcpu_lock, flags); |
138 | } | 140 | } |
139 | 141 | ||
140 | #else | 142 | #else |