Received: by 10.223.185.116 with SMTP id b49csp40147wrg; Tue, 20 Feb 2018 15:28:03 -0800 (PST) X-Google-Smtp-Source: AH8x2262WUB8XPdBQZJFcAdJax8LelkEjZ/7at3WjtOO5K1MgpELUNujhpq6Ds4b0nFtt5KnMNdG X-Received: by 2002:a17:902:b904:: with SMTP id bf4-v6mr1146301plb.195.1519169283804; Tue, 20 Feb 2018 15:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519169283; cv=none; d=google.com; s=arc-20160816; b=JRxbD7sRjoai0mOvFFUO00D3Lti9Sn73SCR918H/f6siKWNfL7EyaP1CoVzcX8Nnrd pimWAn/4I7eJvQdilqpORqhBKXejaulKiV2EaLGiX4jKqYDZSfni5VT4cgEcbNQK3WyM q4uvpEIvbtTm4HlYaGVQmCc2xG/cJQAYIY4zFkGTa4kgg0YUfJIqa3IvW/NHSHZoKLOi lr3TKoH/l9acqqyC8+xjVx4mbLtehy+rOwvyrd01b1/VV0Q50mUOj0pMJkCom63cFWQe 7RXuNkSizvKWNFy+aAaLGR/paFOFZFjRT8lOgtjRYN7dbmp1uMbnQEO+1qUbheJP4txk hqRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=qRGeI7jAWS9il4LlPuYAb+fc+Foh4K0zGt9SMpwgks8=; b=eDIu6dEM0g3FsnHMakd8wEwTR+TOJ//msCAFeqB+5qcuRv7+QDrB/2vTppOzwHJyvc LYbYRtbnSenwl3I40wTC+ogf08U2F9+aRmBInZzZeee1WtkeHBEicfo+QJGr2lr9Jm7Z d4irzvFfJBv+cmPJTfxfyTxpnALB9p6sI6KuHrGXpeIVsXbrQgmym+iggmOXopOQO3Co gLo6qVLdEpU7P230VrxIim6FCrF+1vX8bFyQN6mn94mDjV/xqhIj3E1ZGmFThOSnCeZj GTbIi2rwC8+uqB9spMxZPZSDK6XbYu71uKQKNePKE0Y3mCGDbbv6ZTHqIvgnsUj9NlsG YR1w== 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 a80si2931557pfa.315.2018.02.20.15.27.49; Tue, 20 Feb 2018 15:28:03 -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; 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 S1752209AbeBTX0o (ORCPT + 99 others); Tue, 20 Feb 2018 18:26:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44972 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751925AbeBTXZE (ORCPT ); Tue, 20 Feb 2018 18:25:04 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1KNNdgX040629 for ; Tue, 20 Feb 2018 18:25:03 -0500 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0b-001b2d01.pphosted.com with ESMTP id 2g8vh7hjc8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Feb 2018 18:25:03 -0500 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Feb 2018 18:25:03 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 20 Feb 2018 18:24:59 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1KNOwA140108176; Tue, 20 Feb 2018 23:24:58 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26F1FB2054; Tue, 20 Feb 2018 19:27:17 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.85.154.79]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id E0D19B205A; Tue, 20 Feb 2018 19:27:16 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 3F47116C869B; Tue, 20 Feb 2018 15:25:21 -0800 (PST) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: mingo@kernel.org, stern@rowland.harvard.edu, parri.andrea@gmail.com, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, nborisov@suse.com, "Paul E. McKenney" Subject: [PATCH RFC tools/lkmm 10/12] tools/memory-model: Add a S lock-based external-view litmus test Date: Tue, 20 Feb 2018 15:25:10 -0800 X-Mailer: git-send-email 2.5.2 In-Reply-To: <20180220232405.GA19274@linux.vnet.ibm.com> References: <20180220232405.GA19274@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18022023-0044-0000-0000-000003E72FDE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008566; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00992685; UDB=6.00504342; IPR=6.00772031; MB=3.00019661; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-20 23:25:02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022023-0045-0000-0000-00000817350B Message-Id: <1519169112-20593-10-git-send-email-paulmck@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-20_09:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802200276 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Stern This commit adds a litmus test in which P0() and P1() form a lock-based S litmus test, with the addition of P2(), which observes P0()'s and P1()'s accesses with a full memory barrier but without the lock. This litmus test asks whether writes carried out by two different processes under the same lock will be seen in order by a third process not holding that lock. The answer to this question is "yes" for all architectures supporting the Linux kernel, but is "no" according to the current version of LKMM. A patch to LKMM is under development. Signed-off-by: Alan Stern Signed-off-by: Paul E. McKenney --- .../ISA2+pooncelock+pooncelock+pombonce.litmus | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tools/memory-model/litmus-tests/ISA2+pooncelock+pooncelock+pombonce.litmus diff --git a/tools/memory-model/litmus-tests/ISA2+pooncelock+pooncelock+pombonce.litmus b/tools/memory-model/litmus-tests/ISA2+pooncelock+pooncelock+pombonce.litmus new file mode 100644 index 000000000000..7a39a0aaa976 --- /dev/null +++ b/tools/memory-model/litmus-tests/ISA2+pooncelock+pooncelock+pombonce.litmus @@ -0,0 +1,41 @@ +C ISA2+pooncelock+pooncelock+pombonce.litmus + +(* + * Result: Sometimes + * + * This test shows that the ordering provided by a lock-protected S + * litmus test (P0() and P1()) are not visible to external process P2(). + * This is likely to change soon. + *) + +{} + +P0(int *x, int *y, spinlock_t *mylock) +{ + spin_lock(mylock); + WRITE_ONCE(*x, 1); + WRITE_ONCE(*y, 1); + spin_unlock(mylock); +} + +P1(int *y, int *z, spinlock_t *mylock) +{ + int r0; + + spin_lock(mylock); + r0 = READ_ONCE(*y); + WRITE_ONCE(*z, 1); + spin_unlock(mylock); +} + +P2(int *x, int *z) +{ + int r1; + int r2; + + r2 = READ_ONCE(*z); + smp_mb(); + r1 = READ_ONCE(*x); +} + +exists (1:r0=1 /\ 2:r2=1 /\ 2:r1=0) -- 2.5.2