* [PATCH 0/1] Fix context imbalance warning @ 2020-04-15 18:49 Jules Irenge 2020-04-15 18:49 ` [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() Jules Irenge 0 siblings, 1 reply; 3+ messages in thread From: Jules Irenge @ 2020-04-15 18:49 UTC (permalink / raw) To: linux-kernel; +Cc: boqun.feng Hi, This patch adds an annotations to clear_tasks_mm_cpumask(), the function registers a warning of context imbalance when built with Sparse tool. The adds fix the warning. I also tested it and I think it is working fine. I will appreciate any comment if possible. Jules Irenge (1): cpu: Add annotation inside clear_tasks_mm_cpumask() kernel/cpu.c | 1 + 1 file changed, 1 insertion(+) -- 2.24.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() 2020-04-15 18:49 [PATCH 0/1] Fix context imbalance warning Jules Irenge @ 2020-04-15 18:49 ` Jules Irenge 2020-04-15 22:25 ` Peter Zijlstra 0 siblings, 1 reply; 3+ messages in thread From: Jules Irenge @ 2020-04-15 18:49 UTC (permalink / raw) To: linux-kernel Cc: boqun.feng, Thomas Gleixner, Jiri Kosina, Peter Zijlstra, Josh Poimboeuf, Ingo Molnar, Qian Cai, Eiichi Tsukata, Pavankumar Kondeti, Arnd Bergmann, Tyler Hicks Sparse reports a warning warning: context imbalance in clear_tasks_mm_cpumask() - different lock contexts for basic block The root cause is the missing annotation inside clear_tasks_mm_cpumask() Add the missing __acquire(&t->alloc_lock) annotation. Signed-off-by: Jules Irenge <jbi.octave@gmail.com> --- kernel/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 9c706af713fb..d8c452a8dd09 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -834,6 +834,7 @@ void clear_tasks_mm_cpumask(int cpu) t = find_lock_task_mm(p); if (!t) continue; + __acquire(&t->alloc_lock); cpumask_clear_cpu(cpu, mm_cpumask(t->mm)); task_unlock(t); } -- 2.24.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() 2020-04-15 18:49 ` [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() Jules Irenge @ 2020-04-15 22:25 ` Peter Zijlstra 0 siblings, 0 replies; 3+ messages in thread From: Peter Zijlstra @ 2020-04-15 22:25 UTC (permalink / raw) To: Jules Irenge Cc: linux-kernel, boqun.feng, Thomas Gleixner, Jiri Kosina, Josh Poimboeuf, Ingo Molnar, Qian Cai, Eiichi Tsukata, Pavankumar Kondeti, Arnd Bergmann, Tyler Hicks On Wed, Apr 15, 2020 at 07:49:37PM +0100, Jules Irenge wrote: > Sparse reports a warning > > warning: context imbalance in clear_tasks_mm_cpumask() - different lock contexts for basic block Does this sparse crap actually ever catch a real problem, or does it only result in horrible code like this? > The root cause is the missing annotation inside clear_tasks_mm_cpumask() > > Add the missing __acquire(&t->alloc_lock) annotation. That's just wrong; the actual cause is find_lock_task_mm() not being annotated, and the reason for that is because __cond_lock() is a horrible piece of crap. Barring any evidence that these annotations actually help anybody, can't we just remove it all instead of making an ever bigger mess of things? > Signed-off-by: Jules Irenge <jbi.octave@gmail.com> > --- > kernel/cpu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index 9c706af713fb..d8c452a8dd09 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -834,6 +834,7 @@ void clear_tasks_mm_cpumask(int cpu) > t = find_lock_task_mm(p); > if (!t) > continue; > + __acquire(&t->alloc_lock); > cpumask_clear_cpu(cpu, mm_cpumask(t->mm)); > task_unlock(t); > } > -- > 2.24.1 > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-15 22:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-15 18:49 [PATCH 0/1] Fix context imbalance warning Jules Irenge 2020-04-15 18:49 ` [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() Jules Irenge 2020-04-15 22:25 ` Peter Zijlstra
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).