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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 882DFC433E0 for ; Tue, 29 Dec 2020 10:46:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 523E7207D1 for ; Tue, 29 Dec 2020 10:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbgL2KqZ (ORCPT ); Tue, 29 Dec 2020 05:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgL2KqY (ORCPT ); Tue, 29 Dec 2020 05:46:24 -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 AF34AC0613D6; Tue, 29 Dec 2020 02:45:24 -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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=sLVNBE9zyTYAthGu+etXkcsigZHEGQY14KM0ZFpK8Ks=; b=tJaQAYl5MhdbAUuZxJUvvf/6+ BywodXRteRy+nLWoft6DR2sGfOQd59X3VyVctEs/Rk543wGE27d8KIDIUUR0xb+8RvBPpMiYhIDId DJ8WMXE8JC0hf+nwxMmqwnPnIJxDV8kCcVYgkaGgZhhR7Xr8rtxmCUd9ZlcHRQ0fE41y3kHGFk/Er FYf0bEjfmW+XNhRMgzohrDvoQ6tvTDgd6WDamHxjS+kacdfdJ0BSTHP7OGsoMMeb6Vep/oPnajfy0 VHk/AuhaYBOcU4MPbA0qP5KMj5Vve4exTpL6MvsJ6aA9/KqTn40See6T7YrHQAodGuT/ARJI2tV2c 9SFU4hWIg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44864) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuCUx-00052n-4L; Tue, 29 Dec 2020 10:45:03 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kuCUq-0001AR-Qf; Tue, 29 Dec 2020 10:44:56 +0000 Date: Tue, 29 Dec 2020 10:44:56 +0000 From: Russell King - ARM Linux admin To: Nicholas Piggin Cc: Andy Lutomirski , Arnd Bergmann , Benjamin Herrenschmidt , Catalin Marinas , Jann Horn , linux-arm-kernel , linux-kernel , linuxppc-dev , Mathieu Desnoyers , Michael Ellerman , paulmck , Paul Mackerras , Peter Zijlstra , stable , Will Deacon , x86 Subject: Re: [RFC please help] membarrier: Rewrite sync_core_before_usermode() Message-ID: <20201229104456.GK1551@shell.armlinux.org.uk> References: <20201228102537.GG1551@shell.armlinux.org.uk> <20201228190852.GI1551@shell.armlinux.org.uk> <1086654515.3607.1609187556216.JavaMail.zimbra@efficios.com> <1609200902.me5niwm2t6.astroid@bobo.none> <1609210162.4d8dqilke6.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1609210162.4d8dqilke6.astroid@bobo.none> 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 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. Sadly, because it's existed for 20+ years, and it has historically been sufficient for other purposes too, it has seen quite a bit of abuse despite its design purpose not changing - it's been used by graphics drivers for example. They quickly learnt the error of their ways with ARMv6+, since it does not do sufficient for their purposes given the cache architectures found there. Let's not go around redesigning this after twenty odd years, requiring a hell of a lot of pain to users. This interface is called by code generated by GCC, so to change it you're looking at patching GCC as well as the kernel, and you basically will make new programs incompatible with older kernels - very bad news for users. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!