Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2188287iof; Tue, 7 Jun 2022 22:36:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzczr5FXPF+zxACGa4Sw/bFQ2k0uDa5xYXiPoV3rUzs/w5zpiG31mN4rTDw1CiLJBpfEwNk X-Received: by 2002:a17:902:6b03:b0:161:51d6:61b with SMTP id o3-20020a1709026b0300b0016151d6061bmr32718867plk.23.1654666577732; Tue, 07 Jun 2022 22:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666577; cv=none; d=google.com; s=arc-20160816; b=0DOlfo7nbNjntOMGajIzXg3qQnm32UhyrrdFEfX39gzFJlNlVPnDt+xjuxRR2NYr/6 /IaU4fMl7YirSIURJAtLgw6ggI8hWaFrxIK3YqCOkGnTnQoBtRwOOj4N4bsKPkUt2gkX 0E9xvg1gYvuh7wTWI4qCXITACavXAayRmJL5TTk6zmMQ0z6x4NjKxJGDpAcNWSjArZ2Y wRyKFbZhhv1YeHg+MQM8LMYBOvwWoXELkBryC7gpNiJeQ+w792u9owUMfYeR3UjwUt4R 16eMxdd3zflR6r+cJiOD4kjjuD1yDDNNEfet8XPQw7Bz3kYtmJ15zT56qU4LfMnhe/4W h0ig== 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=AWG10MA3HC7ZLINHhJogEm0YM51WmEgWJXTXc+GLero=; b=BNghdXnRBHDj9T7u72wIvDx35LFAnB2Yl0kku99Rp4S+2P2KBDgij8K3oWu33hllXp auKxBNecm+g/M+QmrmPdHl6ntGs9wUfGanrtk6AgN3RgrAzcix5Y2hr+Tb+c1ELUXxDs tyXEvZR8gP3is0p6T6izb1AC8cS7ZNE5mCl+pVM1cou4bJb5ZjQpSkKzqjJRDalKbqrv sBr1MqsminXj9qhaFfl8fjH4w1XyWVwRSv0VJdXuY8bVGQIlkOfGgMF/5cwUm73EGP9j o19ZXkrWeJUdWeOLWWalDH+kGOd0pphf2aWemdpbHU2mvjSl2iCdIF455ZuH+CtSBpMv 4xXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qfAVRpYM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a20-20020a621a14000000b0051917bfe743si25047320pfa.25.2022.06.07.22.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:36:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qfAVRpYM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70CED4137D7; Tue, 7 Jun 2022 22:13:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388238AbiFHAbu (ORCPT + 99 others); Tue, 7 Jun 2022 20:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384068AbiFGVyF (ORCPT ); Tue, 7 Jun 2022 17:54:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A4C2CE39; Tue, 7 Jun 2022 12:12:55 -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 ams.source.kernel.org (Postfix) with ESMTPS id 41F6EB8237B; Tue, 7 Jun 2022 19:12:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A6FFC385A2; Tue, 7 Jun 2022 19:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629172; bh=JJiCAItPsiIhZ0ufXHRzNVfB2dTaHiFbMBt2M7To9DY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qfAVRpYMvPshDAfX/bq6sWIFpN/U2ohRJysBfddYLwIaqF+Guom/w6wxGaafau6yU pTeJ8wSewUZwTxn0fkO5iTRywU5tMFxDZxmwb69rkWG3jPmqI3W1KzBR7jV2XJPkn6 LKioskGrZwuXlV3+3v5dNVC0bBbUM8Qr8sdnAEQs= 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.18 596/879] dax: fix cache flush on PMD-mapped pages Date: Tue, 7 Jun 2022 19:01:54 +0200 Message-Id: <20220607165020.152020197@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 67a08a32fccb..a372304c9695 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -845,7 +845,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