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=-11.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 81466C07E99 for ; Mon, 12 Jul 2021 06:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FADD610A6 for ; Mon, 12 Jul 2021 06:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbhGLGNy (ORCPT ); Mon, 12 Jul 2021 02:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbhGLGNx (ORCPT ); Mon, 12 Jul 2021 02:13:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98353C0613DD; Sun, 11 Jul 2021 23:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=1YkOQcBdgxi62ZhLA0NtO1y6SKPDgvnlI06PbOB4DUw=; b=cj+KTjXg8AMbD8rtYBj+8r7Cxt BIPIRTp20D9LAr4qWIr6U0JC/xVHlXyiIcTpi382wli87gwzL3Ky+H3KogILv29OKGQofxk4HKyqR AiEUkF3fz0flDZ/xb4lpGW1WDvCD6qxQc+HkKDLMWs17uNkI25ouMldR4GbfUgdqhRyD1eO7ejeUK aRa9JYOKdeAzKqSD8RqQQWjuHagl0GUOGEO14F0eiDyAnchuvTZcMJ5utjbxVMfjBg0n7t7VaNAiA Q5H0LUAnMpixjTv1WRiUcuxUg02RkZHPFt7pajAXdDqcjOppur2vp3jUMn2VfXHojK49J5ypV42jW 60ew9ukQ==; Received: from [2001:4bb8:184:8b7c:bd9:61b8:39ba:d78a] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2p8D-00GwBl-3g; Mon, 12 Jul 2021 06:09:34 +0000 From: Christoph Hellwig To: Linus Torvalds , Andrew Morton , "James E.J. Bottomley" Cc: Russell King , Guo Ren , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , Helge Deller , Yoshinori Sato , Rich Felker , Geoff Levand , Paul Cercueil , Ulf Hansson , Alex Shi , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org Subject: flush_kernel_dcache_page fixes and removal Date: Mon, 12 Jul 2021 08:09:22 +0200 Message-Id: <20210712060928.4161649-1-hch@lst.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Hi all, while looking to convert the block layer away from kmap_atomic towards kmap_local_page and prefeably the helpers that abstract it away I noticed that a few block drivers directly or implicitly call flush_kernel_dcache_page before kunmapping a page that has been written to. flush_kernel_dcache_page is documented to to be used in such cases, but flush_dcache_page is actually required when the page could be in the page cache and mapped to userspace, which is pretty much always the case when kmapping an arbitrary page. Unfortunately the documentation doesn't exactly make that clear, which lead to this misused. And it turns out that only the copy_strings / copy_string_kernel in the exec code were actually correct users of flush_kernel_dcache_page, which is why I think we should just remove it and eat the very minor overhead in exec rather than confusing poor driver writers. Diffstat: Documentation/core-api/cachetlb.rst | 86 +++++++---------- Documentation/translations/zh_CN/core-api/cachetlb.rst | 9 - arch/arm/include/asm/cacheflush.h | 4 arch/arm/mm/flush.c | 33 ------ arch/arm/mm/nommu.c | 6 - arch/csky/abiv1/cacheflush.c | 11 -- arch/csky/abiv1/inc/abi/cacheflush.h | 4 arch/mips/include/asm/cacheflush.h | 8 - arch/nds32/include/asm/cacheflush.h | 3 arch/nds32/mm/cacheflush.c | 9 - arch/parisc/include/asm/cacheflush.h | 8 - arch/parisc/kernel/cache.c | 3 arch/sh/include/asm/cacheflush.h | 8 - block/blk-map.c | 2 drivers/block/ps3disk.c | 2 drivers/mmc/host/jz4740_mmc.c | 4 drivers/mmc/host/mmc_spi.c | 2 drivers/scsi/aacraid/aachba.c | 1 fs/exec.c | 6 - include/linux/highmem.h | 5 lib/scatterlist.c | 5 tools/testing/scatterlist/linux/mm.h | 1 22 files changed, 55 insertions(+), 165 deletions(-) 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=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 5DAA9C07E9B for ; Mon, 12 Jul 2021 06:11:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3350A6101E for ; Mon, 12 Jul 2021 06:11:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3350A6101E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fzCAf7p6MZAJfULAImitnTOSVKZu+woTMjXtNcg6Siw=; b=Hg7sq5MdqGPYiU L1mPTC6ul41enfKU85HqVwEWFPPqETPFmrohBIsV+hVnL6E/e0Gwq+81oHMkfF98tKeAWfWGQes7/ W7/VwIZvLuvxrf/b3oSofRHLj9H13vABMOdFFXhhRVcqB+WwpRWN94uzTEtr9pU5TO2TEkLKyVs5q 2811rNo5gBI5M+wu7H6e2Zo7MXPWaoq16Iat8DWo7e3Kh052Zp0h6BMVx99kU6mxhXsulGriSDNz4 MH+pXE1q7Luj3rK+MU0zOUGRNqDgbaDvXBBRfRy1i/W2/Je+egDouVWJonKEE3dgI2/3xO81ZBdcC SnaV9F7RaeL7rVrCw3vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2p8V-005xsa-Ao; Mon, 12 Jul 2021 06:09:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2p8T-005xsL-GV for linux-arm-kernel@bombadil.infradead.org; Mon, 12 Jul 2021 06:09:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=1YkOQcBdgxi62ZhLA0NtO1y6SKPDgvnlI06PbOB4DUw=; b=cj+KTjXg8AMbD8rtYBj+8r7Cxt BIPIRTp20D9LAr4qWIr6U0JC/xVHlXyiIcTpi382wli87gwzL3Ky+H3KogILv29OKGQofxk4HKyqR AiEUkF3fz0flDZ/xb4lpGW1WDvCD6qxQc+HkKDLMWs17uNkI25ouMldR4GbfUgdqhRyD1eO7ejeUK aRa9JYOKdeAzKqSD8RqQQWjuHagl0GUOGEO14F0eiDyAnchuvTZcMJ5utjbxVMfjBg0n7t7VaNAiA Q5H0LUAnMpixjTv1WRiUcuxUg02RkZHPFt7pajAXdDqcjOppur2vp3jUMn2VfXHojK49J5ypV42jW 60ew9ukQ==; Received: from [2001:4bb8:184:8b7c:bd9:61b8:39ba:d78a] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2p8D-00GwBl-3g; Mon, 12 Jul 2021 06:09:34 +0000 From: Christoph Hellwig To: Linus Torvalds , Andrew Morton , "James E.J. Bottomley" Cc: Russell King , Guo Ren , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , Helge Deller , Yoshinori Sato , Rich Felker , Geoff Levand , Paul Cercueil , Ulf Hansson , Alex Shi , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org Subject: flush_kernel_dcache_page fixes and removal Date: Mon, 12 Jul 2021 08:09:22 +0200 Message-Id: <20210712060928.4161649-1-hch@lst.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, while looking to convert the block layer away from kmap_atomic towards kmap_local_page and prefeably the helpers that abstract it away I noticed that a few block drivers directly or implicitly call flush_kernel_dcache_page before kunmapping a page that has been written to. flush_kernel_dcache_page is documented to to be used in such cases, but flush_dcache_page is actually required when the page could be in the page cache and mapped to userspace, which is pretty much always the case when kmapping an arbitrary page. Unfortunately the documentation doesn't exactly make that clear, which lead to this misused. And it turns out that only the copy_strings / copy_string_kernel in the exec code were actually correct users of flush_kernel_dcache_page, which is why I think we should just remove it and eat the very minor overhead in exec rather than confusing poor driver writers. Diffstat: Documentation/core-api/cachetlb.rst | 86 +++++++---------- Documentation/translations/zh_CN/core-api/cachetlb.rst | 9 - arch/arm/include/asm/cacheflush.h | 4 arch/arm/mm/flush.c | 33 ------ arch/arm/mm/nommu.c | 6 - arch/csky/abiv1/cacheflush.c | 11 -- arch/csky/abiv1/inc/abi/cacheflush.h | 4 arch/mips/include/asm/cacheflush.h | 8 - arch/nds32/include/asm/cacheflush.h | 3 arch/nds32/mm/cacheflush.c | 9 - arch/parisc/include/asm/cacheflush.h | 8 - arch/parisc/kernel/cache.c | 3 arch/sh/include/asm/cacheflush.h | 8 - block/blk-map.c | 2 drivers/block/ps3disk.c | 2 drivers/mmc/host/jz4740_mmc.c | 4 drivers/mmc/host/mmc_spi.c | 2 drivers/scsi/aacraid/aachba.c | 1 fs/exec.c | 6 - include/linux/highmem.h | 5 lib/scatterlist.c | 5 tools/testing/scatterlist/linux/mm.h | 1 22 files changed, 55 insertions(+), 165 deletions(-) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel