Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp992729ybl; Tue, 28 Jan 2020 16:26:01 -0800 (PST) X-Google-Smtp-Source: APXvYqy1NF6OiEaNbLDaS2Rr1Qhvipp1e/okEBsPndX2TNBUFbDoF82CNTfZexpBs7v9js3QVcdv X-Received: by 2002:aca:4c11:: with SMTP id z17mr4530092oia.104.1580257561679; Tue, 28 Jan 2020 16:26:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580257561; cv=none; d=google.com; s=arc-20160816; b=gbfFETncvabInVb8Q5p6WWw4qhoaGKAAklkQoWo6gWPgj36zVPYN1PmkgSJgxYMMu6 thbAA6El9j1vQBgaYlUjjmYiJTm55WFWbkB8lcenbEyxUkuMd+Pt15T7VS+dyneeNi9U MImjP0C6F2lfNLM94xTbTBJ0qcFy4hYuRBPnoFIoBul4yRHSvVGIcTHvwmL9Q0dSKrqC GOlH/1ZX11k31zwZjV9X3ECUCVko1kCdhnj8pNhf33EWqglr5zJJV95P+kVGkAk6URK5 yV18SKHKb6rYb5EG5c21a/yQ1ZGeBRGTJ60EnK3FR7eJxl8W1xNyJs4qcKNfQWfzE4y7 NSkg== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=S76747lBrI4yuCdNVC7l/zrn7Bh5HOmFiO+OEZzKzn0=; b=C0m9zJwioVmnyRa0wWNjDA9WRhqxEr8XUwHvQr5ZZchN+awNRICLtA811Sh8JL9XuR 5KB22a9TGJ1uC3ZiAUvwsttLbWfK8fHL4zGmPQ2yOmiF3DqPWOKIaPchTfMqFbNKSU4d upY7W/u7MXMiOjUBJ8nkoW0UA8olJGsG/iJrRSkWcPrua+pAV7cFSkBDni6S2XuEkA2o +4GWp1kNLYhZBADTpeHdPaliyZvDE8d4hmcZKphi8Ey7ofy/uKL2mvU7LaL+1vdWRN9X P7Da8EXbcthiGTZPKG9Iq2VNaUTwDAGQD4gB2O7ZaxYUXJl3qzCwtH/3R8aab3KBoCNB jMNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Jtv85/HY"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p71si218424oic.138.2020.01.28.16.25.33; Tue, 28 Jan 2020 16:26:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Jtv85/HY"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbgA2AWz (ORCPT + 99 others); Tue, 28 Jan 2020 19:22:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:54322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgA2AWz (ORCPT ); Tue, 28 Jan 2020 19:22:55 -0500 Received: from paulmck-ThinkPad-P72.home (unknown [199.201.64.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A3DB2173E; Wed, 29 Jan 2020 00:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580257374; bh=u6C1MVo9jXhGL921CEjIZKyAAcJehXxHmbS6eFZQhjc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Jtv85/HYFicY6gu9wWS4weM5U4KubO3bs8Ui+oJHlNwIx/Wv/y5B3rjinppTv4EoM kVvSHpsbX7j5VeVQCpDurg6i4hgXRVEKutrNnZSOh5b//MFbjaSYSGen0MO4Ui4dSH hF4CgyDJ4IZXA0mQHeOI2ZTxcYiAeiXXITeOokjw= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 0084C352273D; Tue, 28 Jan 2020 16:22:53 -0800 (PST) Date: Tue, 28 Jan 2020 16:22:53 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Marco Elver , Qian Cai , Will Deacon , Ingo Molnar , Linux Kernel Mailing List , kasan-dev Subject: Re: [PATCH] locking/osq_lock: fix a data race in osq_wait_next Message-ID: <20200129002253.GT2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200122165938.GA16974@willie-the-truck> <20200122223851.GA45602@google.com> <20200123093905.GU14914@hirez.programming.kicks-ass.net> <20200128165655.GM14914@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128165655.GM14914@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 28, 2020 at 05:56:55PM +0100, Peter Zijlstra wrote: > On Tue, Jan 28, 2020 at 12:46:26PM +0100, Marco Elver wrote: > > > > Marco, any thought on improving KCSAN for this to reduce the false > > > positives? > > > > Define 'false positive'. > > I'll use it where the code as written is correct while the tool > complains about it. I could be wrong, but I would guess that Marco is looking for something a little less subjective and a little more specific. ;-) > > From what I can tell, all 'false positives' that have come up are data > > races where the consequences on the behaviour of the code is > > inconsequential. In other words, all of them would require > > understanding of the intended logic of the code, and understanding if > > the worst possible outcome of a data race changes the behaviour of the > > code in such a way that we may end up with an erroneously behaving > > system. > > > > As I have said before, KCSAN (or any data race detector) by definition > > only works at the language level. Any semantic analysis, beyond simple > > rules (such as ignore same-value stores) and annotations, is simply > > impossible since the tool can't know about the logic that the > > programmer intended. > > > > That being said, if there are simple rules (like ignore same-value > > stores) or other minimal annotations that can help reduce such 'false > > positives', more than happy to add them. > > OK, so KCSAN knows about same-value-stores? If so, that ->cpu = > smp_processor_id() case really doesn't need annotation, right? If smp_processor_id() returns the value already stored in ->cpu, I believe that the default KCSAN setup refrains from complaining. Which reminds me, I need to disable this in my RCU runs. If I create a bug that causes me to unknowingly access something that is supposed to be CPU-private from the wrong CPU, I want to know about it. > > What to do about osq_lock here? If people agree that no further > > annotations are wanted, and the reasoning above concludes there are no > > bugs, we can blacklist the file. That would, however, miss new data > > races in future. > > I'm still hoping to convince you that the other case is one of those > 'simple-rules' too :-) On this I must defer to Marco. Thanx, Paul