Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1230382ybi; Fri, 21 Jun 2019 16:56:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxF9UGeOTsyJpqpTGRgI5Qfjrq784lRua57DuT5o6bddZ7kuc+gv6jGDj3wLnVGRHOczZan X-Received: by 2002:a17:902:26c:: with SMTP id 99mr138161622plc.215.1561161374214; Fri, 21 Jun 2019 16:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561161374; cv=none; d=google.com; s=arc-20160816; b=pjrKOyJRh+7XYBvZGvttQLyO24mlE/KCWKKtcTGW8prxJbDCL1A/XKfkXZcm8FqPIl 1btywf6SRk27iYsMD7KGD6KsHKkC3svodi+icq+vSqkv08TJLiwLt/iUO0NSGKPAr/ka heFiCM3wU260KeFCWwEANR1OfR21b1SX07surUtRoGJRL8gqjzlAZbOAZcWX42xkkV1B yoIOnJkFu+g5uC/pvqg4r8zTeLsn98mkd5Q+CPsB5pPv8kAIqOnOwFVbCYuMlmQ3e019 B1XmY1wS19nLrkN6Yc2zzKUP/yamv4Xni2gmjY00ZXNHB2mXCHg5/BL+W8j2MSuPsQpF iDeg== 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; bh=8JRNCDq/BMQ4lAdR1U/Bq8hLL0HL0HY6NMtYzWXK8YE=; b=qiY06p2yEfkNoa4/TADhWUOvXGsalbscDuq5sJ8Kv25k5ILxsLXHMkVmeAvUb4MKd3 0ghWMiocAdOXU7HIudSqjfMg8ErmPvivwGUodyZhzm0Z+JVZKoY02EMPjgfXLKVFhK2H axRf7+zQtuJlp1mN3J7PBex3+CBlDPzktq+ZwoRWuy9+9xSsmZ16eERfOLjoqaw8/+TG 6bxt/ZMAc1LUfOCZF905AchePNy19ReZJ1dXzLfrn7Z3HnwpLz9xQOl1Wt0tRoEbMlh5 9a6rQfizS8VHCiHTN0RfMyDGd81FHzMIWvG1Sw2ehO97M6BqeGwDaLFvJH0Cs4vt4BId PwDg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v85si1603799pgb.263.2019.06.21.16.55.59; Fri, 21 Jun 2019 16:56:14 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726194AbfFUXzZ (ORCPT + 99 others); Fri, 21 Jun 2019 19:55:25 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48776 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfFUXzY (ORCPT ); Fri, 21 Jun 2019 19:55:24 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5LNpkXB089236; Fri, 21 Jun 2019 19:54:40 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t94whgmbg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2019 19:54:40 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x5LNqFEX093738; Fri, 21 Jun 2019 19:54:40 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t94whgmb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2019 19:54:40 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x5LNj2XO007339; Fri, 21 Jun 2019 23:54:39 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01dal.us.ibm.com with ESMTP id 2t8hrnygx3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jun 2019 23:54:39 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5LNscP339846354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jun 2019 23:54:38 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B414B205F; Fri, 21 Jun 2019 23:54:38 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D356B2064; Fri, 21 Jun 2019 23:54:38 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.26]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 21 Jun 2019 23:54:38 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id A736816C2FA6; Fri, 21 Jun 2019 16:54:39 -0700 (PDT) Date: Fri, 21 Jun 2019 16:54:39 -0700 From: "Paul E. McKenney" To: Alan Stern Cc: Andrea Parri , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon , Herbert Xu , Kernel development list Subject: Re: [PATCH 3/3] tools: memory-model: Improve data-race detection Message-ID: <20190621235439.GJ26519@linux.ibm.com> Reply-To: paulmck@linux.ibm.com References: <20190621084129.GA6827@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-21_16:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906210182 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 10:25:23AM -0400, Alan Stern wrote: > On Fri, 21 Jun 2019, Andrea Parri wrote: > > > On Thu, Jun 20, 2019 at 11:55:58AM -0400, Alan Stern wrote: > > > Herbert Xu recently reported a problem concerning RCU and compiler > > > barriers. In the course of discussing the problem, he put forth a > > > litmus test which illustrated a serious defect in the Linux Kernel > > > Memory Model's data-race-detection code. > > > > > > The defect was that the LKMM assumed visibility and executes-before > > > ordering of plain accesses had to be mediated by marked accesses. In > > > Herbert's litmus test this wasn't so, and the LKMM claimed the litmus > > > test was allowed and contained a data race although neither is true. > > > > > > In fact, plain accesses can be ordered by fences even in the absence > > > of marked accesses. In most cases this doesn't matter, because most > > > fences only order accesses within a single thread. But the rcu-fence > > > relation is different; it can order (and induce visibility between) > > > accesses in different threads -- events which otherwise might be > > > concurrent. This makes it relevant to data-race detection. > > > > > > This patch makes two changes to the memory model to incorporate the > > > new insight: > > > > > > If a store is separated by a fence from another access, > > > the store is necessarily visible to the other access (as > > > reflected in the ww-vis and wr-vis relations). Similarly, > > > if a load is separated by a fence from another access then > > > the load necessarily executes before the other access (as > > > reflected in the rw-xbstar relation). > > > > > > If a store is separated by a strong fence from a marked access > > > then it is necessarily visible to any access that executes > > > after the marked access (as reflected in the ww-vis and wr-vis > > > relations). > > > > > > With these changes, the LKMM gives the desired result for Herbert's > > > litmus test and other related ones. > > > > > > Signed-off-by: Alan Stern > > > Reported-by: Herbert Xu > > > > For the entire series: > > > > Acked-by: Andrea Parri > > > > Two nits, but up to Paul AFAIAC: > > > > - This is a first time for "tools: memory-model:" in Subject; we were > > kind of converging to "tools/memory-model:"... > > Yeah, sure. That's the sort of detail I have a hard time remembering. > > > - The report preceded the patch; we might as well reflect this in the > > order of the tags. > > Either way is okay with me. I applied Andrea's acks and edited as called out above, thank you both! Thanx, Paul