Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3659003imm; Mon, 4 Jun 2018 07:18:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLbNSS6JvOBwmN2AmMhz7UQuxkGGUXRPfjDa7ZUgyBKbH3OxbCTARMFpm8rdzNF7akaKada X-Received: by 2002:a62:84e:: with SMTP id c75-v6mr17849453pfd.35.1528121911593; Mon, 04 Jun 2018 07:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528121911; cv=none; d=google.com; s=arc-20160816; b=CF3E9dqAlP3Z61Uh1CifUCNnKxDdQNwt6XWynt/4C20A+CvkUNDr6bCyRkKRejv8uy D//Vc+C9zKl5lKSmAjFyQ5PHsEZuS1Zs4Cfc33pFce2n682P1oBAay6LA5iiOworQltH DvQfuAdb0EU1R22GeN83ygd1txauVMUZvUfdT1hCyVL3JGrCLvs6TvX9UGnjD0DSeKws tvFZjhzUfjDWbGwnFppZcH9y55Pl4hx9U0SLJIdPCour0w4qAESpQLwq1q5MAuf0InUN XfJ3bmuE2SELkOb0dfc/M3eL44s5F0LZdCJLwR/kyL0q9wMOhs5FegKz4ckSl5nN2eLq nA4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=Scz5qOOk3i1uUfigil6bO32iGYg79OMosmI0eAJAIF4=; b=sB62YmGSjq0Xhti7dNmLRBRwt8nibvEQU/w/bbVq+1V5pnHLVdFFZVH/9JzgXw5fA4 4QxmoqsvJ80w0p51bJ21Zk/p/PsBcKUM4fOXjkmtGsQwoO2HOt7lh3k8a2Bj0ADl9H7b 5wMJoNJ1OtIg+aiA/vLlzAx7O8VQA1cSpcmUBa84ulb+97UZ97qFVwVPKUssfvCops2m EC/VI/e6dXeEQwM1IQ/rvDnucRzYWV3XqDyd5M/6zPuf/I02CpJAY5Aq8nWwqnEU2uk4 UCxXo2qyQSIGdNv9skir7XojS+h+NHd7zYR3Bnife+pBbP2zhY/YuclwrfiMg/7itw+o d76g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i74-v6si2396805pgc.188.2018.06.04.07.18.16; Mon, 04 Jun 2018 07:18:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753884AbeFDORx (ORCPT + 99 others); Mon, 4 Jun 2018 10:17:53 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:57632 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753669AbeFDORs (ORCPT ); Mon, 4 Jun 2018 10:17:48 -0400 Received: (qmail 1973 invoked by uid 2102); 4 Jun 2018 10:17:47 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 4 Jun 2018 10:17:47 -0400 Date: Mon, 4 Jun 2018 10:17:47 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Paul E. McKenney" cc: Linus Torvalds , Linux Kernel Mailing List , linux-arch , , 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 In-Reply-To: <20180602144440.GI3593@linux.vnet.ibm.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Alan