Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10448189pxu; Wed, 30 Dec 2020 03:02:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3FJmTeAq1oGJLDHug1xtzLwRJWzR85P4FgwKdOZYa0VdDbcIcORXfK8lhEV3lxVhnBo1h X-Received: by 2002:a17:906:fb1a:: with SMTP id lz26mr48838847ejb.194.1609326164342; Wed, 30 Dec 2020 03:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609326164; cv=none; d=google.com; s=arc-20160816; b=tD2+TVYBG0qAm7OoZQApNrvY5A3U2SKHtrFS1RiNFzqpu2qcqvLTfKRTrs7oEkEc8I 1QLvoLRGP+ldR+EqMftKS0Yyfem7KxBfwhq0YWA6njCbgX7le6ID8rz2CnA6pWpu61Qm 4e5wyFP658Dw8MokjvsmOq2P1qYdgOMRTyxV8yX/kBx5eUg2mQMeBcGwHOkFpzvMsW6V YswKiElrTMDcmhd7CSKXFKNwhNsCK1VsxHqf0rUygtZSkbxlvstqAarb2NFQgmBC3X1s Adjo+JfepbuzYOBleqTGCVr/f1vQoVpHy9sHXrvN+7kHfjht9Ui39TD/zleoUA5FHnJu 1mNA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hT6meR7oLJ3QCZauwMdEleF46LZvd7h7X5Tjnd6x4Qw=; b=NalCS4mJv352ND9BqEcBd0+JAdNzHLT7SBg4sGW6qjDNdxsPfDJCliKeq4wxmlLLy5 EackHh+iM85n92EqG+sPSOliaFqDMR6eY3CtYU65Q5GpjnKG6UoNEuHpJv0+avRWdajl 4/9OYkFXmyR03sd8XTrUYP6bL68d84otxxeQWL55JNk+8b4b0Rlc1OUo1IQ1wY0vcGWN w0hLQUqoLEr9+wGsclm1fnCIrRdUg1wLDSO/6rFmMcrcgUePN1FKN2BYW5A602+TiIAU 4axMCHEkKjpNFy/fr7hpWgr7dOJq4R3nDRK3sf/y5CIUT3NniN+YAh709S2rNCqaQA0x WWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Hykl2u0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si18933452edr.186.2020.12.30.03.02.20; Wed, 30 Dec 2020 03:02:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Hykl2u0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgL3LAE (ORCPT + 99 others); Wed, 30 Dec 2020 06:00:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgL3LAE (ORCPT ); Wed, 30 Dec 2020 06:00:04 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0197C061799; Wed, 30 Dec 2020 02:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hT6meR7oLJ3QCZauwMdEleF46LZvd7h7X5Tjnd6x4Qw=; b=Hykl2u0iY2soETjdsm8W1fkAT t1VW8LTnQe9fnmia93AoHZA8QuMrh0DEZmxjhj3gaa9mGnMbw6Lk5hoE8+k5mvta5w7BUoy3nJelO 7K0/cfgmQE4kGhWwcdp0Qva9Ckjsio9BfWpTnTHJ/zGNyBIpldEu/TtCrQShCcuqX6DCFASfZWYnS 0pwJtkDIOd4tSCPOE70uPvCOqwwNmKTVx4Judpkml4jQSMBiKFQaq7ws0zitiXiKsxB04/tSn6iKu wsTEyhYWff7TyaoR2/kpxMPSPaCXaB42Ebv+YcP2JyrmxjW3eveajDG8qnndOmc+0mRsbE3vytQMy j1mpPJKxA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44904) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuZBq-0005e6-5q; Wed, 30 Dec 2020 10:58:50 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kuZBn-00028I-Qn; Wed, 30 Dec 2020 10:58:47 +0000 Date: Wed, 30 Dec 2020 10:58:47 +0000 From: Russell King - ARM Linux admin To: Nicholas Piggin Cc: linuxppc-dev , Catalin Marinas , paulmck , Arnd Bergmann , Jann Horn , Peter Zijlstra , Benjamin Herrenschmidt , x86 , linux-kernel , stable , Mathieu Desnoyers , Andy Lutomirski , Michael Ellerman , Paul Mackerras , Will Deacon , linux-arm-kernel Subject: Re: [RFC please help] membarrier: Rewrite sync_core_before_usermode() Message-ID: <20201230105847.GQ1551@shell.armlinux.org.uk> References: <20201228190852.GI1551@shell.armlinux.org.uk> <1086654515.3607.1609187556216.JavaMail.zimbra@efficios.com> <1609200902.me5niwm2t6.astroid@bobo.none> <1609210162.4d8dqilke6.astroid@bobo.none> <20201229104456.GK1551@shell.armlinux.org.uk> <1609290821.wrfh89v23a.astroid@bobo.none> <20201230100028.GP1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201230100028.GP1551@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 30, 2020 at 10:00:28AM +0000, Russell King - ARM Linux admin wrote: > On Wed, Dec 30, 2020 at 12:33:02PM +1000, Nicholas Piggin wrote: > > Excerpts from Russell King - ARM Linux admin's message of December 29, 2020 8:44 pm: > > > On Tue, Dec 29, 2020 at 01:09:12PM +1000, Nicholas Piggin wrote: > > >> I think it should certainly be documented in terms of what guarantees > > >> it provides to application, _not_ the kinds of instructions it may or > > >> may not induce the core to execute. And if existing API can't be > > >> re-documented sanely, then deprecatd and new ones added that DTRT. > > >> Possibly under a new system call, if arch's like ARM want a range > > >> flush and we don't want to expand the multiplexing behaviour of > > >> membarrier even more (sigh). > > > > > > The 32-bit ARM sys_cacheflush() is there only to support self-modifying > > > code, and takes whatever actions are necessary to support that. > > > Exactly what actions it takes are cache implementation specific, and > > > should be of no concern to the caller, but the underlying thing is... > > > it's to support self-modifying code. > > > > Caveat > > cacheflush() should not be used in programs intended to be portable. > > On Linux, this call first appeared on the MIPS architecture, but nowa‐ > > days, Linux provides a cacheflush() system call on some other architec‐ > > tures, but with different arguments. > > > > What a disaster. Another badly designed interface, although it didn't > > originate in Linux it sounds like we weren't to be outdone so > > we messed it up even worse. > > > > flushing caches is neither necessary nor sufficient for code modification > > on many processors. Maybe some old MIPS specific private thing was fine, > > but certainly before it grew to other architectures, somebody should > > have thought for more than 2 minutes about it. Sigh. > > WARNING: You are bordering on being objectionable and offensive with > that comment. > > The ARM interface was designed by me back in the very early days of > Linux, probably while you were still in dypers, based on what was > known at the time. Back in the early 2000s, ideas such as relaxed > memory ordering were not known. All there was was one level of > harvard cache. Sorry, I got that slightly wrong. Its origins on ARM were from 12 Dec 1998: http://www.armlinux.org.uk/developer/patches/viewpatch.php?id=88/1 by Philip Blundell, and first appeared in the ARM pre-patch-2.1.131-19981214-1.gz. It was subsequently documented in the kernel sources by me in July 2001 in ARM patch-2.4.6-rmk2.gz. It has a slightly different signature: the third argument on ARM is a flags argument, whereas the MIPS code, it is some undocumented "cache" parameter. Whether the ARM version pre or post dates the MIPS code, I couldn't say. Whether it was ultimately taken from the MIPS implementation, again, I couldn't say. However, please stop insulting your fellow developers ability to think. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!