Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp444539iog; Mon, 13 Jun 2022 06:07:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOaN3+K0bV7sZE4osqM3w2RLV6oGgz+vdKSYmjx4B9WwapIxPcrhUwJYgSjAYiQcJwLCWo X-Received: by 2002:a17:907:9496:b0:711:f459:664 with SMTP id dm22-20020a170907949600b00711f4590664mr24035843ejc.704.1655125656146; Mon, 13 Jun 2022 06:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125656; cv=none; d=google.com; s=arc-20160816; b=pDz/I2VZw3RZyo/djbEL2vcu6/HckHJn6SWqONV9pfzEvAk0+Th/DZSXY45k+/Xy6v 1jfBxYX+ROT3GTNbbABlKdozxUNWTObpaL5jaX9YNevz+Ms9/j5/1yMwHrfU4TZSllq5 Ilj5pkDbv+D6ecSLsap+qdwqTs/cZ49A7a2GlS9IWvFp7HIei1y845AOf5RZD/MD3HNx Li5n5g0U/ywaJJKOBAWCq6WCoDLA07m7el0SwZfa/wXFE7C+6E3UAJ3EQKGL7j2Y32SG ACcGRhBebeyxLKc3exXLCOFS0DOBToFWnmBIT/9DPKtvPh0QYA2Dwhvb5h/OQa0nd+4l tvJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+X3+Yo/li1FL7yDSgOaP+2Z3onsEU4Gqw0+V5kRBOgE=; b=orTbE/dRfbGbmckFjdQnMmxx5c5prm5Hpy63ficIyDhMfyeGa2NLM1wWgjieCRpQha Xi7iExLuGKZFjnDNjhESJnTbgwfrvtgf5OdMtGsecZI+10AhPPX6yEleytVTL3uHyk+2 bTJvCoYwAnQWKcxIrjz5iN5vh02nRuR6AxfXDArXQkxKYwLBIO1G8UBpSfAGpGdUryIN 4Co+GbZ6Muz5x0D/YUJU0XR3jroIg/sHaIMNg7oAFnj5XdoC1VYpkpVijkLfpjLZsvyV Nj73HkBdnJNZyPoP8d6qc30t2GCpT5gJK9sIFLPFGHHx0H4Yas4jmp4I8e/iX4WfsFh0 E7AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xjhm4z2P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170906414400b006e88579e94fsi7000359ejk.798.2022.06.13.06.07.10; Mon, 13 Jun 2022 06:07:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xjhm4z2P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353173AbiFMLXJ (ORCPT + 99 others); Mon, 13 Jun 2022 07:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353711AbiFMLQP (ORCPT ); Mon, 13 Jun 2022 07:16:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01CBF13E0B; Mon, 13 Jun 2022 03:39:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 95A7060F9A; Mon, 13 Jun 2022 10:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81038C34114; Mon, 13 Jun 2022 10:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116769; bh=TQKI0+2Q4AOCk0WBEz8z1ZdDhJQFWxYdz9HhUNCDDyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xjhm4z2PPWWrWY2k0qxDQXCZUbz7fXm9gA0Hj5lywMXUALVROP6m7rcOeNaVD5o1k 8Bi3z3qtAID7OB/+5sluRj//PWmdlLTEGkuPHt35O4b9chCenj5saZk4R17atDsnwl qBQiIZnLsBUOI3SoIYTwBemXQAKu0nWoXyI5TxRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Muchun Song , Dan Williams , Christoph Hellwig , Alistair Popple , Al Viro , Hugh Dickins , Jan Kara , "Kirill A. Shutemov" , Matthew Wilcox , Ralph Campbell , Ross Zwisler , Xiongchun Duan , Xiyu Yang , Yang Shi , Andrew Morton , Sasha Levin Subject: [PATCH 5.4 178/411] dax: fix cache flush on PMD-mapped pages Date: Mon, 13 Jun 2022 12:07:31 +0200 Message-Id: <20220613094933.995887877@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Muchun Song [ Upstream commit e583b5c472bd23d450e06f148dc1f37be74f7666 ] The flush_cache_page() only remove a PAGE_SIZE sized range from the cache. However, it does not cover the full pages in a THP except a head page. Replace it with flush_cache_range() to fix this issue. This is just a documentation issue with the respect to properly documenting the expected usage of cache flushing before modifying the pmd. However, in practice this is not a problem due to the fact that DAX is not available on architectures with virtually indexed caches per: commit d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Link: https://lkml.kernel.org/r/20220403053957.10770-3-songmuchun@bytedance.com Fixes: f729c8c9b24f ("dax: wrprotect pmd_t in dax_mapping_entry_mkclean") Signed-off-by: Muchun Song Reviewed-by: Dan Williams Reviewed-by: Christoph Hellwig Cc: Alistair Popple Cc: Al Viro Cc: Hugh Dickins Cc: Jan Kara Cc: "Kirill A. Shutemov" Cc: Matthew Wilcox Cc: Ralph Campbell Cc: Ross Zwisler Cc: Xiongchun Duan Cc: Xiyu Yang Cc: Yang Shi Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- fs/dax.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 12953e892bb2..bcb7c6b43fb2 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -819,7 +819,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index, if (!pmd_dirty(*pmdp) && !pmd_write(*pmdp)) goto unlock_pmd; - flush_cache_page(vma, address, pfn); + flush_cache_range(vma, address, + address + HPAGE_PMD_SIZE); pmd = pmdp_invalidate(vma, address, pmdp); pmd = pmd_wrprotect(pmd); pmd = pmd_mkclean(pmd); -- 2.35.1