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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37D6EC43334 for ; Mon, 27 Jun 2022 11:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238431AbiF0LyP (ORCPT ); Mon, 27 Jun 2022 07:54:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238690AbiF0Lw3 (ORCPT ); Mon, 27 Jun 2022 07:52:29 -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 8805BB49B; Mon, 27 Jun 2022 04:45:10 -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 E610E6125A; Mon, 27 Jun 2022 11:45:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0670DC3411D; Mon, 27 Jun 2022 11:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330309; bh=0/smJ2Sa+Gz1IrVE/v9XQNQbsuEP/ZS/Wm98OhSZgv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4+6vM/E/Ua/8K47JLWLHWDCjPPLTyotz+stZCWdhPgyPX8Ztik06M+LDMOgJc+mP Ambnb6iznq8TzCoF8SnRKfTP3E8Mlmn7MbkLYCqiUqj3gLMUIrZvxmpDqsQ5bNcVkk meysV+VcIyCRjHhF0Jf9UtoOGadF+zrKzEGyYTV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller Subject: [PATCH 5.18 154/181] parisc: Fix flush_anon_page on PA8800/PA8900 Date: Mon, 27 Jun 2022 13:22:07 +0200 Message-Id: <20220627111949.148453471@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: John David Anglin commit e9ed22e6e5010997a2f922eef61ca797d0a2a246 upstream. Anonymous pages are allocated with the shared mappings colouring, SHM_COLOUR. Since the alias boundary on machines with PA8800 and PA8900 processors is unknown, flush_user_cache_page() might not flush all mappings of a shared anonymous page. Flushing the whole data cache flushes all mappings. This won't fix all coherency issues with shared mappings but it seems to work well in practice. I haven't seen any random memory faults in almost a month on a rp3440 running as a debian buildd machine. There is a small preformance hit. Signed-off-by: John David Anglin Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.18+ Signed-off-by: Greg Kroah-Hartman --- arch/parisc/kernel/cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -722,7 +722,10 @@ void flush_anon_page(struct vm_area_stru return; if (parisc_requires_coherency()) { - flush_user_cache_page(vma, vmaddr); + if (vma->vm_flags & VM_SHARED) + flush_data_cache(); + else + flush_user_cache_page(vma, vmaddr); return; }