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.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 5F24CC12002 for ; Mon, 19 Jul 2021 16:12:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4700561453 for ; Mon, 19 Jul 2021 16:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348608AbhGSPbT (ORCPT ); Mon, 19 Jul 2021 11:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348511AbhGSPYx (ORCPT ); Mon, 19 Jul 2021 11:24:53 -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 A601CC08E88C; Mon, 19 Jul 2021 08:15:39 -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=DEv5AMPYTsRvufOgvEX+iyR62xQvFefugMO+OsVkHzc=; b=DdKXacyQxn7Hz8fN7PJPr6m9x d4hT/T0CJ5vKsm+NrCyfhhcEa16qr7fh5ZmNRudBMiNsh2jWmw+8ed7lCBIMi/jmkxYayCvxuuGFK 4hGzvSFep0kUFA1ZNBEEQeCQdSfzUhQ6zgFkq82drCAMx1t9UybqRKDrNW6URJC1JvCwW0DMXWT0J m8V5Vgh2JPge/tTVm8IONzCUUTFB5PbqFmG7VItuZoc2Wg8A7OONJFrHCYD+gnCyml/DiKV1jbrlh EcOJfYmvL8Ub22suPEmn9SZalhR+cT/W6dvmJJoHr8kHoEp/k9Sarl2dHD3wp1WISKxfd40O6Ylfs YGaL+yUww==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:46332) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5VPo-00054L-KD; Mon, 19 Jul 2021 16:42:44 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1m5VPi-00066F-Ex; Mon, 19 Jul 2021 16:42:38 +0100 Date: Mon, 19 Jul 2021 16:42:38 +0100 From: "Russell King (Oracle)" To: Herbert Xu Cc: hch@lst.de, torvalds@linux-foundation.org, akpm@linux-foundation.org, James.Bottomley@hansenpartnership.com, guoren@kernel.org, tsbogend@alpha.franken.de, nickhu@andestech.com, green.hu@gmail.com, deanbo422@gmail.com, deller@gmx.de, ysato@users.sourceforge.jp, dalias@libc.org, geoff@infradead.org, paul@crapouillou.net, ulf.hansson@linaro.org, alexs@kernel.org, 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: Re: flush_kernel_dcache_page fixes and removal Message-ID: <20210719154238.GS22278@shell.armlinux.org.uk> References: <20210713084648.GF22278@shell.armlinux.org.uk> <20210719053851.GA16780@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210719053851.GA16780@gondor.apana.org.au> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Mon, Jul 19, 2021 at 01:38:51PM +0800, Herbert Xu wrote: > Russell King Oracle wrote: > > > > I think you need to be careful - I seem to have a recollection that the > > reason we ended up with flush_kernel_dcache_page() was the need to avoid > > the taking of the mmap lock for 32-bit ARM VIVT based CPUs in > > flush_dcache_page(). 32-bit ARM flush_dcache_page() can block. > > > > If you're sure that all these changes you're making do not end up > > calling flush_dcache_page() from a path where we are atomic, then fine. > > The Crypto API has been calling flush_dcache_page from softirq > context since before the advent of git (see crypto/scatterwalk.c > from the initial import). So if 32-bit ARM blocks on it then this > has been broken for almost 20 years. I think what's confusing me is the naming of flush_dcache_mmap_lock(). The mmap lock is a read-write semaphore (see linux/mmap-lock.h), and is even called "mmap_lock" in mm_struct, but this has nothing to do with flush_dcache_mmap_lock(). So no, flush_dcache_mmap_lock() doesn't block as I first thought, and therefore flush_dcache_page() doesn't block either. Sorry for the noise. However, I now seem to remember some discussion in the past when I was trying to get people to use flush_dcache_page() to solve the coherency problems when block drivers were doing PIO to page cache pages. I seem to remember there being objections to it, which is one of the reasons we ended up with a lighter weight flush_kernel_dcache_page(). But shrug, dim and distant memories. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! 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=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 49031C636C9 for ; Mon, 19 Jul 2021 15:46:57 +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 2058F61244 for ; Mon, 19 Jul 2021 15:46:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2058F61244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9psHadJRiGeC3DUQNvFGsVu2DXzT4K1++ZM/4DqbEok=; b=XBdZSMtcScxOXS 3LJLv8RUtpcjKaMuP5Obttani6VVwAqdsiekg+Qn7BOgq3E1efCaA0XlVcrDHcCP0319qvBskZnow xGi5ducxdkhe3wmzFy6/mhCxUr9uu3TYf0oHei1L2QeaBKPJon3hA7yncLgKkeAevXuAdvQB6Ocnp lN+/8OEP6cg1O3DrLQscloABxzxmaDihPfsYr5trwJvIROcPwpxJPpwXBJC6NMQbcpzJky5qxbQWw qbrKNh8zrDjVMNXD1LIWYB8Rifp3WXU/DiZE9GFbO2BTh8qzwNKdWX0xTy3hZjRbE6G8HxaXAtRwy 7VkRsLmWh2CEpRGNqivg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5VRv-00ABve-Cg; Mon, 19 Jul 2021 15:44:56 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5VQC-00AB2X-QM for linux-arm-kernel@lists.infradead.org; Mon, 19 Jul 2021 15:43:10 +0000 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=DEv5AMPYTsRvufOgvEX+iyR62xQvFefugMO+OsVkHzc=; b=DdKXacyQxn7Hz8fN7PJPr6m9x d4hT/T0CJ5vKsm+NrCyfhhcEa16qr7fh5ZmNRudBMiNsh2jWmw+8ed7lCBIMi/jmkxYayCvxuuGFK 4hGzvSFep0kUFA1ZNBEEQeCQdSfzUhQ6zgFkq82drCAMx1t9UybqRKDrNW6URJC1JvCwW0DMXWT0J m8V5Vgh2JPge/tTVm8IONzCUUTFB5PbqFmG7VItuZoc2Wg8A7OONJFrHCYD+gnCyml/DiKV1jbrlh EcOJfYmvL8Ub22suPEmn9SZalhR+cT/W6dvmJJoHr8kHoEp/k9Sarl2dHD3wp1WISKxfd40O6Ylfs YGaL+yUww==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:46332) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5VPo-00054L-KD; Mon, 19 Jul 2021 16:42:44 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1m5VPi-00066F-Ex; Mon, 19 Jul 2021 16:42:38 +0100 Date: Mon, 19 Jul 2021 16:42:38 +0100 From: "Russell King (Oracle)" To: Herbert Xu Cc: hch@lst.de, torvalds@linux-foundation.org, akpm@linux-foundation.org, James.Bottomley@hansenpartnership.com, guoren@kernel.org, tsbogend@alpha.franken.de, nickhu@andestech.com, green.hu@gmail.com, deanbo422@gmail.com, deller@gmx.de, ysato@users.sourceforge.jp, dalias@libc.org, geoff@infradead.org, paul@crapouillou.net, ulf.hansson@linaro.org, alexs@kernel.org, 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: Re: flush_kernel_dcache_page fixes and removal Message-ID: <20210719154238.GS22278@shell.armlinux.org.uk> References: <20210713084648.GF22278@shell.armlinux.org.uk> <20210719053851.GA16780@gondor.apana.org.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210719053851.GA16780@gondor.apana.org.au> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210719_084308_940166_D71F34E2 X-CRM114-Status: GOOD ( 18.95 ) 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 On Mon, Jul 19, 2021 at 01:38:51PM +0800, Herbert Xu wrote: > Russell King Oracle wrote: > > > > I think you need to be careful - I seem to have a recollection that the > > reason we ended up with flush_kernel_dcache_page() was the need to avoid > > the taking of the mmap lock for 32-bit ARM VIVT based CPUs in > > flush_dcache_page(). 32-bit ARM flush_dcache_page() can block. > > > > If you're sure that all these changes you're making do not end up > > calling flush_dcache_page() from a path where we are atomic, then fine. > > The Crypto API has been calling flush_dcache_page from softirq > context since before the advent of git (see crypto/scatterwalk.c > from the initial import). So if 32-bit ARM blocks on it then this > has been broken for almost 20 years. I think what's confusing me is the naming of flush_dcache_mmap_lock(). The mmap lock is a read-write semaphore (see linux/mmap-lock.h), and is even called "mmap_lock" in mm_struct, but this has nothing to do with flush_dcache_mmap_lock(). So no, flush_dcache_mmap_lock() doesn't block as I first thought, and therefore flush_dcache_page() doesn't block either. Sorry for the noise. However, I now seem to remember some discussion in the past when I was trying to get people to use flush_dcache_page() to solve the coherency problems when block drivers were doing PIO to page cache pages. I seem to remember there being objections to it, which is one of the reasons we ended up with a lighter weight flush_kernel_dcache_page(). But shrug, dim and distant memories. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel