Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp618288ybl; Tue, 28 Jan 2020 08:58:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzDtBtH1tGSj1fXgM+OkmHzL+GqiWJ+Pt/fNxH19rg6oM4JZwLd3+K6NLbFSQWPozpeaqRt X-Received: by 2002:aca:48d6:: with SMTP id v205mr3400950oia.10.1580230701027; Tue, 28 Jan 2020 08:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580230701; cv=none; d=google.com; s=arc-20160816; b=sY4+yuj0D9cqb0f/AG7ezskX+HGDSNOel+PnzbpGKAyyw3sOuJI4g6No0/HDoFRac0 JSOGQUmzy9uZu0YP2Pzk9BJGD+4Pb+keCN8Ssoi5xMzbiO1gE7YHg2JYl9p3MtAz0clM LjRQwMH6XxoEMDaRMGEaScXX8shYdKvKOS4YPXE8aJCRBnggH3IABDU662zFlh8Qxnv7 +VLln/lpanOahEcRhJlP6ju/hPG9SNp6vSjDxfas2APILemdWnP2pz1JCe895joY1Gw1 rxQxgTQJolKYRV7U5NU5UWY8G+S9/+19alsvSSv5Tcb52ksv78MjJDq2vdWo7tcY/xEy nSFw== 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=xqLkdksTAn4mILhz/FZa+hmKnpwus5eIvV60Ofg9aS8=; b=ilfz1EZFtL57coawPws3tQpyFf4m7Uy+Gc/CvQhffYBZeooeqaMI8kCaf4krvU/z4h SnrOdhsp1uDcdxiGiv4WIOQQ5J5ajJ38ec4E7Cj2O5THd9QoQz2K0NmsarjE0+4KNNy4 o8rUTzKC3ejJjNjW7uq5H6lWEYRq+wTGFQZNTqX6Tv7Biz13+t8ojt4RX+YEQDZbpVHi /okcWRVZ7T5O/s+tikbNh3DiBetj1+mao8bYjNQZkCfLB7sZUTXzJ4sr6gmoVHTRe4yn 3GbsBOGVvYxwAjabo8iN8apqTRy/n28BhyLiS8t82DVfn5mW5YlbELJJBtL8PTvvTZYb XFZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NUg4BVZs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24si1112314otk.239.2020.01.28.08.58.08; Tue, 28 Jan 2020 08:58:21 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NUg4BVZs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726747AbgA1Q5C (ORCPT + 99 others); Tue, 28 Jan 2020 11:57:02 -0500 Received: from merlin.infradead.org ([205.233.59.134]:42418 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgA1Q5B (ORCPT ); Tue, 28 Jan 2020 11:57:01 -0500 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xqLkdksTAn4mILhz/FZa+hmKnpwus5eIvV60Ofg9aS8=; b=NUg4BVZsRLcDW8vceLF6gpUIi K1OUx/lu58nbCdAQAShaQzFYekDOd4diN9PmDPkPrmB0fAnagGqVimOATQD1esrt8wVO0qIpGIxkk QZ6MR3liE953VMAIR/pKag6xTBer8R80wNDA3ZzRkUExDI+rs0cTw+Z/t5eZEHUCcwFY/xgHl60Cn GSuv8er4ATv3T3gdEPLpExZ/0cy3i13pM7vk/z5x4w+bVCSktJlH0XMhXAMu/dIuRKrGkMpG0EDWG n5a+MwKIXIlgZdzYn7IOvDqJ9e8eLAtXUUh8RV0v27SLIFGL+YAZmAQF6uk8SxFZKhjXzDl+lTIrr Pdh+cnCVw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwUAa-0001KE-Ju; Tue, 28 Jan 2020 16:56:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 96E16302524; Tue, 28 Jan 2020 17:55:12 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0CBB3201F06F7; Tue, 28 Jan 2020 17:56:55 +0100 (CET) Date: Tue, 28 Jan 2020 17:56:55 +0100 From: Peter Zijlstra To: Marco Elver Cc: Qian Cai , Will Deacon , Ingo Molnar , Linux Kernel Mailing List , "paul E. McKenney" , kasan-dev Subject: Re: [PATCH] locking/osq_lock: fix a data race in osq_wait_next Message-ID: <20200128165655.GM14914@hirez.programming.kicks-ass.net> References: <20200122165938.GA16974@willie-the-truck> <20200122223851.GA45602@google.com> <20200123093905.GU14914@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. > 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? > 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 :-)