From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7A95C77257 for ; Thu, 12 Jul 2018 17:26:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FB3D20839 for ; Thu, 12 Jul 2018 17:26:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FB3D20839 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732532AbeGLRgz (ORCPT ); Thu, 12 Jul 2018 13:36:55 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33560 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726596AbeGLRgz (ORCPT ); Thu, 12 Jul 2018 13:36:55 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6CHOHVw050790 for ; Thu, 12 Jul 2018 13:26:24 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2k69psma1b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jul 2018 13:26:23 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Jul 2018 13:26:22 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 12 Jul 2018 13:26:19 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6CHQIsL7340498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Jul 2018 17:26:18 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60FEAB2065; Thu, 12 Jul 2018 13:26:16 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41572B205F; Thu, 12 Jul 2018 13:26:16 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.159]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 12 Jul 2018 13:26:16 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id C0A2516C2E9F; Thu, 12 Jul 2018 10:28:38 -0700 (PDT) Date: Thu, 12 Jul 2018 10:28:38 -0700 From: "Paul E. McKenney" To: Alan Stern Cc: Peter Zijlstra , Andrea Parri , Will Deacon , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Kernel development list , Linus Torvalds Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire Reply-To: paulmck@linux.vnet.ibm.com References: <20180712134821.GT2494@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.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18071217-2213-0000-0000-000002C9D837 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009358; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01060354; UDB=6.00544280; IPR=6.00838272; MB=3.00022118; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-12 17:26:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071217-2214-0000-0000-00005ACF6711 Message-Id: <20180712172838.GU3593@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-12_07:,, 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=897 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807120184 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 01:04:27PM -0400, Alan Stern wrote: > On Thu, 12 Jul 2018, Peter Zijlstra wrote: > > > > But again, these are stuble patterns, and my guess is that several/ > > > most kernel developers really won't care about such guarantees (and > > > if some will do, they'll have the tools to figure out what they can > > > actually rely on ...) > > > > Yes it is subtle, yes most people won't care, however the problem is > > that it is subtly the wrong way around. People expect causality, this is > > a human failing perhaps, but that's how it is. > > > > And I strongly feel we should have our locks be such that they don't > > subtly break things. > > > > Take for instance the pattern where RCU relies on RCsc locks, this is an > > entirely simple and straight forward use of locks, yet completely fails > > on this subtle point. > > Do you happen to remember exactly where in the kernel source this > occurs? Look for the uses of raw_spin_lock_irq_rcu_node() and friends in kernel/rcu and include/linux/*rcu*, along with the explanation in Documentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.html I must confess that I am not following exactly what Peter is calling out as the failure. My best guess is that he is leading up to his call for RCsc locks, but I might have missed a turn. But Peter did supply raw_spin_lock_irq_rcu_node(), which is a marked improvement over the earlier open-coding of smp_mb__after_unlock_lock() after each and every acquisition of the rcu_node structure's ->lock, so overall I cannot complain. ;-) Thanx, Paul