Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp364025pxj; Thu, 17 Jun 2021 04:40:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgFteITJL9lGo1DJDwgc5wShhkpwJvshyVwu5WyyhzO9uGY5IEIkwdye6i+LIBDrAN2XjX X-Received: by 2002:a05:6602:54:: with SMTP id z20mr3473754ioz.25.1623930012457; Thu, 17 Jun 2021 04:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623930012; cv=none; d=google.com; s=arc-20160816; b=YrHOYb7NIOXMlu/0GcBuHYLMsmqpU7uGmzv9R8tqX8PfIyjd2NosPJNb/a7hz/J2xu qq1WmJq4DSnQrZprnZ3JIvu/SBsZd38kNMHGHuXP87ZZnnhBcSUganmAPcxukWMy8M1F u4hmrvhm7WRO5pV3w3A1H0egsjHbdmoPjmrXhF+Oo5Vv14zHo5liD9G9UFDpXJwsh4k8 OFe+ZOADmH5h13YVCjVXgcjkn44Bxi/adnhLY5puLtM2AF/emDyPdIARnq2OS8EWop1H fSKYbB/nM2RHphNoCgrMYxk2V2mipQwanJEFpOowMb1v6dG+a0QqVBYGbE21Jm9Qqcdw 4WKA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JXDXDLb/QIF75AJOX9ohvjSu+6uIrUNwcseh+WML+vw=; b=rDPrmPxaaymm1XxVUs9wCZhm8P5HaLYArNOMgxR/ZPoTpUzu4WiSVB6l4unKcGGbdG K+8ZjKkDDRGs4MUcRSAl+6bg4Hh4mhE+OKk+eHmiUzCC/9xKS4WsqnZbDLt4/ESqTlvG GsZQuQbOvHr0GsNkQv++sKSRSeOazZ82ouZyakOYvaVX8x8LyIXJUwn4SdyrEOYD3jdZ IvdAyYVEnHMZIUj0OX8VZRuzCFTJf2B3+1fcst267rSvFPy3S8TaVstD1Cr4ZMW4/pLI NHvfr0dimwou0nfZ0GwxMpT7tbLoN1gctM3oVdyjX0rXU7CDrzjf5KYvgxVQR1U6NnpD 9ARQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=DM0LmQMg; 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 q4si5789003jas.57.2021.06.17.04.40.00; Thu, 17 Jun 2021 04:40:12 -0700 (PDT) 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=DM0LmQMg; 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 S232552AbhFQLZb (ORCPT + 99 others); Thu, 17 Jun 2021 07:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232545AbhFQLZa (ORCPT ); Thu, 17 Jun 2021 07:25:30 -0400 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 889FBC061574 for ; Thu, 17 Jun 2021 04:23:22 -0700 (PDT) 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=JXDXDLb/QIF75AJOX9ohvjSu+6uIrUNwcseh+WML+vw=; b=DM0LmQMgaAJK5lRc4d2fK8U23 tmHTratjNX+m60IpRCKHGGrdqWzF9uDHt4aRdt6A9aBqKUXkldnAOsrmNonZacg58aKLcLAdwwnIS VQ8Og3KArTPSSYXvQC3+B1TVbxwT8FSGPd+XkEs7hYbE9/+I2aec7qh3JktHRNX6Dtam1Y8PqfJy8 QzxohAc2YiO9sZVgN/7pGGmJBbauEjUif6qJEZ37AdDOsXLzuPjIuvrtJ630vI+LwWI6KkSNPTaJh 5YkuuFUaSYjYjTkcQ+ghC/q+RtZ3XOYIhcCTB28TblZUEf9vbssjsYCKBFALJtARe985BMx92dZkQ gxvri/Fdg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45102) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltq76-00009r-Qg; Thu, 17 Jun 2021 12:23:12 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1ltq6z-0006xh-FC; Thu, 17 Jun 2021 12:23:05 +0100 Date: Thu, 17 Jun 2021 12:23:05 +0100 From: "Russell King (Oracle)" To: Mark Rutland Cc: Andy Lutomirski , x86@kernel.org, Dave Hansen , LKML , linux-mm@kvack.org, Andrew Morton , Mathieu Desnoyers , Nicholas Piggin , Peter Zijlstra , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 7/8] membarrier: Remove arm (32) support for SYNC_CORE Message-ID: <20210617112305.GK22278@shell.armlinux.org.uk> References: <2142129092ff9aa00e600c42a26c4015b7f5ceec.1623813516.git.luto@kernel.org> <20210617103524.GA82133@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210617103524.GA82133@C02TD0UTHF1T.local> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 11:40:46AM +0100, Mark Rutland wrote: > On Tue, Jun 15, 2021 at 08:21:12PM -0700, Andy Lutomirski wrote: > > On arm32, the only way to safely flush icache from usermode is to call > > cacheflush(2). This also handles any required pipeline flushes, so > > membarrier's SYNC_CORE feature is useless on arm. Remove it. > > Unfortunately, it's a bit more complicated than that, and these days > SYNC_CORE is equally necessary on arm as on arm64. This is something > that changed in the architecture over time, but since ARMv7 we generally > need both the cache maintenance *and* a context synchronization event > (the latter must occur on the CPU which will execute the instructions). > > If you look at the latest ARMv7-AR manual (ARM DDI 406C.d), section > A3.5.4 "Concurrent modification and execution of instructions" covers > this. That manual can be found at: > > https://developer.arm.com/documentation/ddi0406/latest/ Looking at that, sys_cacheflush() meets this. The manual details a series of cache maintenance calls in "step 1" that the modifying thread must issue - this is exactly what sys_cacheflush() does. The same is true for ARMv6, except the "ISB" terminology is replaced by a "PrefetchFlush" terminology. (I checked DDI0100I). "step 2" requires an ISB on the "other CPU" prior to executing that code. As I understand it, in ARMv7, userspace can issue an ISB itself. For ARMv6K, it doesn't have ISB, but instead has a CP15 instruction for this that isn't availble to userspace. This is where we come to the situation about ARM 11MPCore, and whether we continue to support it or not. So, I think we're completely fine with ARMv7 under 32-bit ARM kernels as userspace has everything that's required. ARMv6K is a different matter as we've already identified for several reasons. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!