Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1874762pxb; Thu, 4 Nov 2021 09:56:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjAOpQkEdh5R4Su2rVlsaknBJRxqe4/YF0+1ZxYn9S4iacDM9ndz4oKdR2oFj/f9b2O+iT X-Received: by 2002:a05:6602:2dd5:: with SMTP id l21mr20793827iow.87.1636045016369; Thu, 04 Nov 2021 09:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636045016; cv=none; d=google.com; s=arc-20160816; b=mLapebBh2tZ+Mhe+Lio4EuZwpJeQIi/H14ijnesxUXe+SqQeJSmUcuAMyGy6jmHD6T V3yhUwahcbLBu8X5cN9mWmkrpVpyON3vl0Af9lzhXmf+xozYG83omiepGGJm2lSw5t8J QVtGw5WfLDnokv6EGMg9DUnocTNFG4oR+Ym/0RxQ4INtYC3lNQwil1T6Ci21pvC3kWHs VpfTwyviOYPzX2FpR0CeSCJogSjd0QDooHzmdk4qfrr+/SFwsMzGdKIstc8AXmP1WoPX UsIMGHoAfV8XYW0m4qpxldKqgf/272shNbzzeSdoGVw+6onFQOk/lCG+RFOWEtFRzFVM Wfzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ADHeUirb9kLgv1IoNjAxTNKBnfVWQdkrARuPBCg3D6A=; b=qfG0OiCZBS59/bg+t4uJQpHmGjNb0SNA635fVx1uNjY4a/LIzM4RiSMfDdW2S908Ur r+fa7z5E/rsmU5USkIupmbX5BWnhJlYhI58vAgdvS/PPVJFGa2XYw1wpS16s3DTGMNfm J8edtWHnemGc75i19JPe7l04OAEaPpmAd+tNqGffhIXkVobPZxTif0u1puUqHSCJBwjE QODI2CDINPpA5jYZNhsl3jYnKabS4XZBicYhn6JcOZ5PbLVVjmsal3YZrxLtdbmERhG9 YP7Vyhx9kL0qRXFfEAyHTc58rH5eghMoijTwRxlyh2eM2DT/tFD+vTR9sQS3WwiZTmho ++wQ== ARC-Authentication-Results: i=1; mx.google.com; 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si10520910iow.16.2021.11.04.09.56.42; Thu, 04 Nov 2021 09:56:56 -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; 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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbhKDQ5K (ORCPT + 99 others); Thu, 4 Nov 2021 12:57:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:58888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbhKDQ5F (ORCPT ); Thu, 4 Nov 2021 12:57:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AA27461183; Thu, 4 Nov 2021 16:54:25 +0000 (UTC) Date: Thu, 4 Nov 2021 16:54:22 +0000 From: Catalin Marinas To: Linus Torvalds Cc: Matthew Wilcox , Christoph Hellwig , linux-arch , Ira Weiny , Andrew Morton , Linux Kernel Mailing List , Thomas Gleixner Subject: Re: flush_dcache_page vs kunmap_local Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 04, 2021 at 08:30:55AM -0700, Linus Torvalds wrote: > On Thu, Nov 4, 2021 at 8:03 AM Matthew Wilcox wrote: > > Linus offers the opinion that kunmap calls should imply a > > flush_dcache_page(). Christoph added calls to flush_dcache_page() > > in commit 8dad53a11f8d. Was this "voodoo programming", or was there > > a real problem being addressed? > > I don't think anybody actually uses/cares about flush_dcache_page() at > all, and pretty much all uses are random and voodoo. We do. flush_dcache_page() is not just about virtual caches. On arm32/64 (and powerpc), even with PIPT-like caches, we use it to flag a page's D-cache as no longer clean. Subsequently in set_pte_at(), if the mapping is executable, we do the cache maintenance to ensure the I and D caches are coherent with each other. I wouldn't add this call to kmap/kunmap_local(), it would be a slight unnecessary overhead (we had a customer complaining about kmap_atomic() breaking write-streaming, I think the new kmap_local() solved this problem, if in the right context). -- Catalin