From patchwork Sat Jun 18 15:14:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 12886426 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 5942AC43334 for ; Sat, 18 Jun 2022 15:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235217AbiFRPOs (ORCPT ); Sat, 18 Jun 2022 11:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234440AbiFRPOs (ORCPT ); Sat, 18 Jun 2022 11:14:48 -0400 Received: from cmx-torrgo002.bell.net (mta-tor-005.bell.net [209.71.212.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 283F212D for ; Sat, 18 Jun 2022 08:14:47 -0700 (PDT) X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [64.229.209.22] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 62A8B9F2010E0250 X-CM-Envelope: MS4xfL61viGjL26CUWXlFUvhFq8YEGLphK20CsnzV1Xobr+46QC8XNXdSR9j0qd5DvaQmoRV5RSt9df8a7FFnBeOflctXik2m9yovdDiTCgch8E+R7eMgzQi pQBWlnbZiPFgG1bzQQbVheR1Liv4eZgzug+OcCHRsqPgT3zINbhU6GJuVyJwzMTSZiUvhLNCCCrcYj/uhxFDJGG/I8BdqDiLsfrHhOG0ubdH8bBKM3tU2u72 LB1sfhBL0dO53AwnIaRUh8nVsa7mFZfGiYir1mLBoc7Yd5r9M4tJ5XXC7GUWqlMbVAFY2gsme/kNTcJqyKuk1WV+IyGw6nNfti67gp/M5juzRqaKzNaoS1s9 XjXDfoHzbRzlE9QglIekhBR38jOPyCgsimlzVdwvouzgJd3SdkVnf5KYowH933CLBm5PW9vpbKbEnO+ByXGpGKKKoKO2YcxKlvIKvlP9RpzdT0800JlaDrz+ Lt5pdhoY7V74ahriZEHPDvgn2JaUkRc11QIfNfXsdOxr89BoRXlzzfCa95mguq0OZUv7z867/8iEH69zepZOBrDQPzYPcJoJ0EV/BJI+ezJzQRAzoeu8q1f4 ebB1ADCzXNbinD13ZMddtF+FoFquIgstdQ8zjRh/N0D/zg== X-CM-Analysis: v=2.4 cv=XfXqcK15 c=1 sm=1 tr=0 ts=62adebda a=PzUcMIm+zPr1bDMlhKZIxQ==:117 a=PzUcMIm+zPr1bDMlhKZIxQ==:17 a=JPEYwPQDsx4A:10 a=FBHGMhGWAAAA:8 a=Y8A-Gqv_znHeydJyftMA:9 a=CjuIK1q_8ugA:10 a=hcHyN332xRUVqRWC6PsA:9 a=FfaGCDsud1wA:10 a=9gvnlMMaQFpL9xblJ6ne:22 Received: from mx3210.localdomain (64.229.209.22) by cmx-torrgo002.bell.net (5.8.807) (authenticated as dave.anglin@bell.net) id 62A8B9F2010E0250; Sat, 18 Jun 2022 11:14:34 -0400 Received: by mx3210.localdomain (Postfix, from userid 1000) id 3CC9F220115; Sat, 18 Jun 2022 15:14:34 +0000 (UTC) Date: Sat, 18 Jun 2022 15:14:34 +0000 From: John David Anglin To: linux-parisc@vger.kernel.org Cc: Helge Deller , Deller , James Bottomley Subject: [PATCH] parisc: Fix flush_anon_page on PA8800/PA8900 Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org 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 diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 0fd04073d4b6..a20c1c47b780 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -722,7 +722,10 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned lon 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; }