Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3770881imm; Mon, 4 Jun 2018 09:00:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIwf3nbI4CRAdiuWbsI5Y63TvTcZa4eani6q7oe1qN7meUVjEftoMH8hpSHc0nmYaasn85B X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr21729122plb.30.1528128027631; Mon, 04 Jun 2018 09:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528128027; cv=none; d=google.com; s=arc-20160816; b=SQOmFX4fIzqico9KiZMOKMLO3ppoBjozAfoszwLYa99yBkDf6gvdKWU8/AuesZqo57 OOoyGvsSJJmYt3UJgH7nnJucypCI2F96IdU7u/gztPf3rNVKO0RftzjsDOmUnd4AWdFf Z1PYxZ2erBrhTJmpvCQ0faBfmIMUC/k9dlgTCwPVBtDpnSEnU7zOKuBZL4TAVcXOllJC RmNbkHu25/mJzCpUDXHUSETMgU9BrMUvkVQxalMMXxbA6bimB8vu/9j2BjxMrV8+64AV EQh3AdmZz8vdZQ5Ez4fmNDzoAmdrnsMAs0xaXbF2yLXJVTlLSYUIKIGtcJHuYLqwIRLh 8I+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=+0lK7E/A9D5x6r+I53JaIneSDwv0yAnXYR0ZJGRBQdg=; b=ksn+az1EalPU+Aat5AfoUnmFnHyWupolx+LSLuwwmDvrs7q28KA3f0WC3lieTpZKnl J2F9BUOu9OfKbvCCUgsalg+vxQpLY2GUZ40BkPth11RU8+nsG1tfOSZtnU+uK49e2aG4 BOxEH1ZF1ZtaeCaNITw45TfDXzvhnuiHatk6Wz1ysc2uvMsUJbVVg5LvTx6RgcFJYby6 pHbbJZdSsPS+kK/97cgbYe49ZELx5OFH6Ys2BfKV06kWm+83LSU0ilM8gUekxNo92q7O KkXRUT8FKJvcrGtmlvS4zinyD5jU8pJ7Jmn5TdGZzTlGAIzVh8ORVi27mojjDDbDhv/o glzg== 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 d5-v6si13289166plr.13.2018.06.04.09.00.13; Mon, 04 Jun 2018 09:00:27 -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 S1751566AbeFDP7w (ORCPT + 99 others); Mon, 4 Jun 2018 11:59:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51136 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbeFDP7t (ORCPT ); Mon, 4 Jun 2018 11:59:49 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w54FsirZ119856 for ; Mon, 4 Jun 2018 11:59:49 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jd867s6ej-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Jun 2018 11:59:49 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2018 11:59:47 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Jun 2018 11:59:43 -0400 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 w54FxgXK10027472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Jun 2018 15:59:42 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B857B206C; Mon, 4 Jun 2018 13:01:16 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C3FFB2068; Mon, 4 Jun 2018 13:01:16 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.206.241]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 4 Jun 2018 13:01:16 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id A9E3816C64D3; Mon, 4 Jun 2018 09:01:29 -0700 (PDT) Date: Mon, 4 Jun 2018 09:01:29 -0700 From: "Paul E. McKenney" To: Alan Stern Cc: Linus Torvalds , Linux Kernel Mailing List , linux-arch , andrea.parri@amarulasolutions.com, Will Deacon , Peter Zijlstra , Boqun Feng , Nick Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Ingo Molnar , Roman Pen Subject: Re: LKMM litmus test for Roman Penyaev's rcu-rr Reply-To: paulmck@linux.vnet.ibm.com References: <20180602144440.GI3593@linux.vnet.ibm.com> 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-cbid: 18060415-0064-0000-0000-0000031500CC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009128; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01042241; UDB=6.00533671; IPR=6.00821372; MB=3.00021460; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-04 15:59:47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060415-0065-0000-0000-0000397A0212 Message-Id: <20180604160129.GP3593@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-04_12:,, 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-1805220000 definitions=main-1806040186 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 10:17:47AM -0400, Alan Stern wrote: > On Sat, 2 Jun 2018, Paul E. McKenney wrote: > > > One crude but effective workaround is to replicate the code following the > > "if" statement into both legs of the "if" statement. This has the effect > > of extending the control dependency to cover all of the code that used to > > follow the "if" statement, leveraging herd's current limited knowledge of > > compiler optimization. This workaround would of course be hopeless for > > general Linux-kernel code, but should be at least semi-acceptable for the > > very small snippets of code that can be accommodated within litmus tests. > > > > Please see the litmus test shown below, which uses this workaround, > > allowing the smp_store_release() to be downgraded to WRITE_ONCE(). > > > > Given this workaround, crude though it might be, I believe that we can > > take a more measured approach to identifying a longer-term solution. > > > > Thoughts? > > Yes, this works, although it is clearly just a stopgap. And obviously > it can't be applied in situations where one of the legs of the "if" > statement contains a non-trivial branch. A non-trivial branch as in a goto? If so, that could be problematic depending on exactly what herd does in that case. > In the long run, I don't think this problem is solvable. At least, not > for all cases. It requires too much guesswork about what optimizations > a compiler might do. I agree that it cannot be perfect, but I bet that we can come extremely close. But yes, we need to think carefully about nested "if" statements at the very least. And there might well be some other way to get in trouble. ;-) Thanx, Paul