Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp753410ybz; Wed, 15 Apr 2020 18:12:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKz8uokmixE8AS7kgp/I34D7s6scVpRcr6sjo3qY47CqkYnycX2GerZk+6ajJYp4VMIlrEl X-Received: by 2002:a17:906:cd1:: with SMTP id l17mr7217738ejh.319.1586999562698; Wed, 15 Apr 2020 18:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586999562; cv=none; d=google.com; s=arc-20160816; b=jzp17+Gth77ib4FytzsBEY4nqKQ1rQldLvvIDJsEkYLmdlZiC/6W2F1igLZGFIMn55 uv9xsYyaZqKq8T4Gjgta5HzjgSCol1Wpu+G3ZXX7vN8/2zkAn+6AeiSbIbmwKPSvajPL 0Pc4cOAHsGCW6O1NdAH6b5D+LTKsH6dTR4JT4THOUDP61xSUHTEIBoKsvchFnrNlyior QTudXtlcvS/PPY79iHEy4nVL8Q+hNx9sy1zYa3+urQvQ1t49pov1zNGctaxDzVlVbVI5 yE6UIb3ApOujIAy17y2eibxTorefvSEYQqehWueVmqO0r7PdZqBeJBV5Pa88n6keiGq/ 8xTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b9F4BdIxe6qjhLUpVkXmq95ni4gC5HWLpSiA/A8w8L4=; b=ONKdVAHUJaZxkKIahfu7CIH/csGz4PKy8qKp1wpO3VZLbMBj8uub3+2w6phVyT2fbD xVWjGvdzb25m+i0osNZE3M7gHk/LAdxNlBRkdnxSc4x5lQpDMNBmUfuldxPAb4IbhfWV OdU8UNbgOc+75NcZK5CKpw/3zmIO36gmL7qL35TjY1bPXquPeez1TAchnFRekGETjEpy tBTa4E6xOUf1KLPdr+lPRp9LaRSxKd0P+9JPuHLLV9s1l8cjo1C23arSI4ocp8yYMYiV mn/hoRfaqyO1lV+up2El+YtGWImjz6AzSknIFJTMNNJgzE5AdPTULvIZPUF1pS66+50L QAnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=2zIRqCMn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si11486786edf.315.2020.04.15.18.12.16; Wed, 15 Apr 2020 18:12:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=2zIRqCMn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732008AbgDOW0U (ORCPT + 99 others); Wed, 15 Apr 2020 18:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731967AbgDOW0P (ORCPT ); Wed, 15 Apr 2020 18:26:15 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57785C061A0C for ; Wed, 15 Apr 2020 15:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=b9F4BdIxe6qjhLUpVkXmq95ni4gC5HWLpSiA/A8w8L4=; b=2zIRqCMnzqAW2UBfRln+N04zcU HMSK+FUQfTLziLe+Dd7z2SKH3jhxN4EFGOgp5+xKNMOgCEOnvwzZgDeivYkPoYfRYeA6MKR/BwKaX NdwmTb2Ee0Hp5eVKVEae6/Q5ahTjAcYp7l6sA47xSLGQe2dJITJawF9FIeVHpVvNj/SoWXgDBn0QQ +0JXJi0KibH876hpeFmDgDAEx1S94/ciSE/ZTsiTMjvDNT3GSco2q8zFu0TaNkAuxRkF92rkIjaqe /dkXUW2vl6Cni4Qau1u3Jtg/ND8Hub9/h+etECL0Sze82MQFYMSnz2oMnsuzRyggw9a3tOG8K5B8r rah6DDnA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOqTb-0001Pu-0K; Wed, 15 Apr 2020 22:25:47 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 6ED46981086; Thu, 16 Apr 2020 00:25:45 +0200 (CEST) Date: Thu, 16 Apr 2020 00:25:45 +0200 From: Peter Zijlstra To: Jules Irenge Cc: linux-kernel@vger.kernel.org, boqun.feng@gmail.com, Thomas Gleixner , Jiri Kosina , Josh Poimboeuf , Ingo Molnar , Qian Cai , Eiichi Tsukata , Pavankumar Kondeti , Arnd Bergmann , Tyler Hicks Subject: Re: [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() Message-ID: <20200415222545.GN2483@worktop.programming.kicks-ass.net> References: <20200415184937.32373-1-jbi.octave@gmail.com> <20200415184937.32373-2-jbi.octave@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200415184937.32373-2-jbi.octave@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >