Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2172431iof; Tue, 7 Jun 2022 22:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4mBKZ2LpPNbVaZAkbSCw8vmI5kgHZfeK/7wnirA9a0/shSR/C+StsMWYjv+DwZwbl6Hon X-Received: by 2002:a17:90b:1e46:b0:1e6:826e:73ea with SMTP id pi6-20020a17090b1e4600b001e6826e73eamr35281661pjb.68.1654664874358; Tue, 07 Jun 2022 22:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664874; cv=none; d=google.com; s=arc-20160816; b=rZmGUJw0MneTB0Abi2wO4Bs4/QASuwoRB7PQ9xIlnp60P/B1wCxD8WcktGbxEbwopv U8FuVh//uWDAYiztZ8a7f1RjLBF+yC8m7pxz0+tW0hUtx2A1lZO6UENZlVdv12pkrblB roB/TKkmORivFCPvmVAj7GIWyH8nu4rny1+1JuwPqWfqU2JdKXsSblHJeJ9UmtPWrmZQ 6DPWzkblBTEhk4WWHscKU/eeHUmFQOMQJlgH8bMw10BKtt1Zq1lh/IvDjkW35KX1vnZz yftJDUXkh/OOpSZNQgZps9DK8xa0jFVJx7GeVIvZvoOJ93Y+7Xc18Ta0c6BkFxtwP6Px a+2A== 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=540/V2uhj5FRu3Riqu++si1wZSSkJND4bDASgzJEVNY=; b=rErCActa92lC1Rn1+mvvIzIVLo5kPE7GrYdcsEI1IILa5QUmDvlrPDP7D6SfSy4V8l uuua5gA/4n+fMpIg7/62NqMXOHnZMiuKt7kSIpU3+ngyX9kVRgGp3f/GvOwWbe1K/scI Wbx0cLd96MYhWxecDxtK4bc2f863pPTZkE/J3G8mvb87qEWbu+8s0t4QUxepL0PLkTRU VyLkE+hkhuFeTiDGsnvXFMgClq7J6NeTdnCPovrq/Z96Vyd52hwRXTLl3ICvyHo1qQ9d Drp7nZOYhTlPpHDL3nwz0/ossoJ8Ysq/wg/3GNunqCEuSRpBotokdfjgcf036tULrbh6 /uMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LuFNdH21; 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 nv11-20020a17090b1b4b00b001df3d491cb1si39685988pjb.161.2022.06.07.22.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:07:54 -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=LuFNdH21; 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 6091CAF313; Tue, 7 Jun 2022 21:35:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350393AbiFGSA6 (ORCPT + 99 others); Tue, 7 Jun 2022 14:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348505AbiFGRk7 (ORCPT ); Tue, 7 Jun 2022 13:40:59 -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 73DF31203D0; Tue, 7 Jun 2022 10:34:19 -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 712F66146F; Tue, 7 Jun 2022 17:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53325C385A5; Tue, 7 Jun 2022 17:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623205; bh=JCm1b5N3/b9pAm8ZufeikkbDqu9hOtf7zipRZfAqLTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LuFNdH21E/m1FQFE9IHlzPz0yKCRToqu2wkx3bfd3j2OGZi39OyPTEqw81Hr0Yqae CvBk0AFzrBksSLVSsl8DaQ/XG6xOyhb4eOO0zay0/esumJv7pVNWKBBSVwhp+SIgmz GVMtyY7Gd3eZ6BY5GpJwdhffyHHtIco7Hui3/Qtk= 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.10 292/452] dax: fix cache flush on PMD-mapped pages Date: Tue, 7 Jun 2022 19:02:29 +0200 Message-Id: <20220607164917.253007588@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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 d5d7b9393bca..3e7e9a57fd28 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -846,7 +846,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