Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp552894ybk; Fri, 15 May 2020 07:38:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNDTXJXPi5vQ6oNLlx72VV2qJya+3U5khVIuDeDk5rEzAMYL3mm1fRElCN07tqjZ55fQDi X-Received: by 2002:a17:906:c113:: with SMTP id do19mr3127084ejc.286.1589553524701; Fri, 15 May 2020 07:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589553524; cv=none; d=google.com; s=arc-20160816; b=DBVNJZQHLRjnCOdsEBwWWCfrwaXmHsRg13fMKn2AuM8vZxk2TKdzK5gIdW8Gni3nRW wjSJ1NCuxsOKXmGRrykdAQ3f3MbjFhjZV5rITn90ehoANi6lIDtu57+g7oYAnvTIkYNl DwY/2lVqAB34YYD9/li0AYgw9OOFs/5dgWx/JHOKk4EET+CCJKkHzn6DihS7/c5fZtoI GC0aQJj2qh1cfXD0Ftr8yVA7Re3hs2oJ4f2fwgMY01sxXHFKAM8Q9dq7ELv24yWUs+0V KI+miTJIh6pWdefinBeBTWa3fFfohF0OEGuZ/WCu4KNTidmDoZe8zyCh6+Xifwluo4Wh w7Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=HKx/QpgyxJ6c+gcZJNfN2/GfGMIbydRitmrecAV7LdM=; b=c0zb0xrdYt/mtC+csKSisaQxRrPXVBBolr/N1+8kPzq9wZjmnpeqgA3yNHAz6tFDfJ bDskyYy3GPDIFtLDkSWMpP8WbBow0n1pXSVSNY5xrsrNBXXAYCWGrgXqaSf0sGjOCaz1 pPTfWfczWMlbdrOpmrAS8rHcrbayN5elo7O1RsCyQTDiuHDHhLo5hy5eyuMzLpmVkQ6+ oWFVAQCNFB7wo93RPsOjH1cwuhrncaruyY3miPZX1BvpfwMBe+BayQMSjBaFl9vrTo3s mTSyFDCT0qHhh2pmJVRkP636yHu25xk5T/Y+ATEfiqoxvx2Scg9R2+GYiOvqPZtD4C5V Axtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=e40fHlJw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j14si798707ejk.164.2020.05.15.07.38.21; Fri, 15 May 2020 07:38:44 -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 header.i=@infradead.org header.s=bombadil.20170209 header.b=e40fHlJw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbgEOOg6 (ORCPT + 99 others); Fri, 15 May 2020 10:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726163AbgEOOg4 (ORCPT ); Fri, 15 May 2020 10:36:56 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D3CC05BD09; Fri, 15 May 2020 07:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=HKx/QpgyxJ6c+gcZJNfN2/GfGMIbydRitmrecAV7LdM=; b=e40fHlJwbNPK/oCRkiewUZHtoZ JJJ+t1x8X3QV2n0Lukko+n8nlbWQFaqkAm9bXmAn0LEAHvsYtXA/ED46Qkhd3Wo4dC3lj9Cdjnhn4 2GMxO3l2bcfk8hCFGEkyKo79dCHF0dW0wzug2S7fOVDqqdxBiNErPRWKoqoW7a+vMOTzwhiXqzxde yarxr8pniYHBW0nkAaHpSU30+qCnpw33gjGTv0zo9wd+L3+ubP8fVYYd3Mao0Mvo1SPygjDTG4M6W uLpEub5zhVYe+GOr38SOefuPOEjNKqgIjZD47gM0x/vngs4vSjlwFW8ylRDeR9zXZutwV9Xx9BczP T5GGltuQ==; Received: from [2001:4bb8:188:1506:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZbSC-0003n6-BC; Fri, 15 May 2020 14:36:49 +0000 From: Christoph Hellwig To: Andrew Morton , Arnd Bergmann , Roman Zippel Cc: Jessica Yu , Michal Simek , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linux-fsdevel@vger.kernel.org Subject: sort out the flush_icache_range mess v2 Date: Fri, 15 May 2020 16:36:17 +0200 Message-Id: <20200515143646.3857579-1-hch@lst.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, flush_icache_range is mostly used for kernel address, except for the following cases: - the nommu brk and mmap implementations, - the read_code helper that is only used for binfmt_flat, binfmt_elf_fdpic, and binfmt_aout including the broken ia32 compat version - binfmt_flat itself, none of which really are used by a typical MMU enabled kernel, as a.out can only be build for alpha and m68k to start with. But strangely enough commit ae92ef8a4424 ("PATCH] flush icache in correct context") added a "set_fs(KERNEL_DS)" around the flush_icache_range call in the module loader, because apparently m68k assumed user pointers. This series first cleans up the cacheflush implementations, largely by switching as much as possible to the asm-generic version after a few preparations, then moves the misnamed current flush_icache_user_range to a new name, to finally introduce a real flush_icache_user_range to be used for the above use cases to flush the instruction cache for a userspace address range. The last patch then drops the set_fs in the module code and moves it into the m68k implementation. A git tree is available here: git://git.infradead.org/users/hch/misc.git flush_icache_range.2 Gitweb: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/flush_icache_range.2 Changes since v1: - fix pmem.c compilation on some s390 configs - drop two patches picked up by the arch maintainers