Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp932924ybk; Sun, 10 May 2020 00:57:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKFvhq+XOYCrZEjY6EL8+ugSyn859UenQaJzEATxU3WoFwxMMzItTb5eXlnnUb4SXflxI4N X-Received: by 2002:a05:6402:1596:: with SMTP id c22mr9158164edv.100.1589097428466; Sun, 10 May 2020 00:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589097428; cv=none; d=google.com; s=arc-20160816; b=clBM+rGJ9qRtApi9PSVjB7pqAlpBBJnAVb07NIROaQjFRlLwPG1VrBpv/rusmFDgxb t5c1+z70/8PgH+LkDKNcqGmXiFXX0m6mjQwva3D/d07eGQIqLNjVcI9UcmAEOg974KL5 vf1itglZYk83cSZNFpsYt/xcd/eXQ0H+tslAaGDgSay9isr4OkZQ42TxCtCD6/VDd6kG DBuLvMEJUG0X1FUyWPQ/HCKBqQH0fsMpxTsZpIncibDiFWwN3Ro1IAUU47kvXQyLJtF5 OueDqP/iFbZx9mMhAcJUxdukUycMg/qtasSwNUo4KUPzp3P45STKX1QQ6gh/huFGo3SJ uDuQ== 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=7/gXVwxfQCALl/htOL9nGBBdk9CR2DqbWyS3c9DzJzg=; b=ljieBK6yK3OQOSXQis0zOPly7S5KftFM4QMdEXANfe/IybaXHJXlKYZAPkjk416Y+v xBSdCBzr7OYEJJN6n5cPS6TRjM+vAEt3WRj3NZIjAiW9h5/E6yrT5EDtmons51eGVzqy iZF6lC3kDJSL5Bz9gu8qGvZHO8eBN0Cn9UQoXHT8Nyqy+WmZcokMj0jHaNZqE83BTs+x cNKs5cNPz1lWqjm0y5VtNKl6oc85IK7P0YMOs8iAX5Olk2Vt+As+W+H+tExHS01U6Jjf qeELWo6ebIE8eaTMsJLv9vixljHk78T99GzNnV8/WUU1/fRpZ1nKGk/MJf49JlYvaHVb NpzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=TvxbsuwU; 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 e5si3797896eje.518.2020.05.10.00.56.45; Sun, 10 May 2020 00:57:08 -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=TvxbsuwU; 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 S1728760AbgEJHzW (ORCPT + 99 others); Sun, 10 May 2020 03:55:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgEJHzU (ORCPT ); Sun, 10 May 2020 03:55:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE92FC061A0E; Sun, 10 May 2020 00:55:20 -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=7/gXVwxfQCALl/htOL9nGBBdk9CR2DqbWyS3c9DzJzg=; b=TvxbsuwUX/hm6+Z8fi/17h3sCr V6hTHGgSMnPIXClp9WBd4xHpkact4TdSPlY40kgpTlFrc4X0TcbVrodeZch2eF33X40QtPmPFET1U Tys5kVImtNbCnWZn12idX8lvZh32iDnfxIDeXhSFPGHn0PMIm30TD0pbjnUShEADOadDDfLCmcKnm wKfgOhNBY1n/ICaPIfQgdGgBtYZHWT6fzJbX2O0Ol1Icyt3JJoleMMbRsBA4C7Ht6DLkc7DlYLbcX cjmyou6JXKISuiamP88TvDgJ4S2xixwnMizgAVSPuwNbaVDo6GTG7tK/YFq90voaly/1rUW1zB1cS ecEzX6Qw==; Received: from [2001:4bb8:180:9d3f:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXgno-0007lE-9T; Sun, 10 May 2020 07:55:13 +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 Date: Sun, 10 May 2020 09:54:39 +0200 Message-Id: <20200510075510.987823-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 Gitweb: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/flush_icache_range