Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp377904rwb; Wed, 16 Nov 2022 01:51:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7k+7anBJmBshMk9cNWTb6i3ZASvvo8b/M71bNZp8H54FXlaEqPpftl/gbqhVSPxkEDcTOZ X-Received: by 2002:a17:907:cc9d:b0:7ac:ef6b:1ef4 with SMTP id up29-20020a170907cc9d00b007acef6b1ef4mr18078004ejc.104.1668592261963; Wed, 16 Nov 2022 01:51:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668592261; cv=none; d=google.com; s=arc-20160816; b=E/Vge56yZutEazsTzmAjLnbFjhw+kr8DfNByjOB9OAGM6AF0aM+e30f0vSJIsnKuxA ren8OrGdpjlygB5n0GhRAYPg19z/qjBvWRshVC378fPkA1ESAqZD3aT6XOZiwdAq2KCN GwWwo4HOwO5R1leBSoh73iRYq8Koq5YAGpL80REkr7sRjgz7+jC4bOMPbX63nW6JcewM mmtoM+0gNr3Xypqi2+ynjyqNBMXOvD3843W+JLYS/f24a5S7mYP5JG8HahRQhQZT9AAi 0wiSUU+mtbzYOhuWGx4IXA9w8He3vo1oEDes3ngNlA51YOu/8HZur5yQdMEc+7OGCK2L SlUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=1hgZL1jFDJCDIAIuorXnQRPUTazDX5V1btJm980zAMY=; b=gbjBDcqFwrL61JPQW9++GITWnAiNcGZkuN2Rr4YaSh/ylTpVcuzurI9KaauLUbvb0c l78ONeknC8H32koBpeqyj2ArSmiSxdS/bQaX9VevM63jJf2ElqKm5QpaJ6Kip+odQ/nI 3X8xzBoGFPpLU+ISvR+e1ojbphCg2mrbfCRFfUARN+aabH0DflDQHsMvyXk33XhU0lT6 2T07227yA3OpnFTw6I1Q5eU4Kw1WC7YI6pko0OlbEdDe01RE4QFpqw+yRVEOYsPglyUJ qTz2V3HE3Gzhh9pD0x8rWM6R4/ole2Iqp/nwjmxsKwLPyNALPIYheP1Q1whRravU8ocT udaQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt11-20020a1709072d8b00b007aa35038c6bsi13881948ejc.463.2022.11.16.01.50.38; Wed, 16 Nov 2022 01:51:01 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232798AbiKPJAs (ORCPT + 91 others); Wed, 16 Nov 2022 04:00:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232353AbiKPJAZ (ORCPT ); Wed, 16 Nov 2022 04:00:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 141581142; Wed, 16 Nov 2022 01:00:18 -0800 (PST) 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 A8F9B61AE9; Wed, 16 Nov 2022 09:00:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CDDDC433D6; Wed, 16 Nov 2022 09:00:15 +0000 (UTC) Date: Wed, 16 Nov 2022 09:00:12 +0000 From: Catalin Marinas To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, Suzuki K Poulose , James Morse , Jonathan Corbet , Mark Rutland , linux-doc@vger.kernel.org Subject: Re: [PATCH V2 2/2] arm64: errata: Workaround possible Cortex-A715 [ESR|FAR]_ELx corruption Message-ID: References: <20221113012645.190301-1-anshuman.khandual@arm.com> <20221113012645.190301-3-anshuman.khandual@arm.com> <438ddc78-ded6-d464-f917-6b8749626f16@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <438ddc78-ded6-d464-f917-6b8749626f16@arm.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 On Wed, Nov 16, 2022 at 10:12:34AM +0530, Anshuman Khandual wrote: > Planning to apply the following change after this patch. > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > index 6552947ca7fa..cd8d96e1fa1a 100644 > --- a/arch/arm64/mm/hugetlbpage.c > +++ b/arch/arm64/mm/hugetlbpage.c > @@ -562,14 +562,14 @@ bool __init arch_hugetlb_valid_size(unsigned long size) > > pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) > { > - if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198)) { > - pte_t pte = READ_ONCE(*ptep); > + if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198) && > + cpus_have_const_cap(ARM64_WORKAROUND_2645198)) { > /* > * Break-before-make (BBM) is required for all user space mappings > * when the permission changes from executable to non-executable > * in cases where cpu is affected with errata #2645198. > */ > - if (pte_user_exec(pte) && cpus_have_const_cap(ARM64_WORKAROUND_2645198)) > + if (pte_user_exec(READ_ONCE(*ptep))) > return huge_ptep_clear_flush(vma, addr, ptep); > } > return huge_ptep_get_and_clear(vma->vm_mm, addr, ptep); > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index c1fb0ce1473c..ec305ea3942c 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1705,14 +1705,14 @@ early_initcall(prevent_bootmem_remove_init); > > pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) > { > - if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198)) { > - pte_t pte = READ_ONCE(*ptep); > + if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198) && > + cpus_have_const_cap(ARM64_WORKAROUND_2645198)) { > /* > * Break-before-make (BBM) is required for all user space mappings > * when the permission changes from executable to non-executable > * in cases where cpu is affected with errata #2645198. > */ > - if (pte_user_exec(pte) && cpus_have_const_cap(ARM64_WORKAROUND_2645198)) > + if (pte_user_exec(READ_ONCE(*ptep))) > return ptep_clear_flush(vma, addr, ptep); > } > return ptep_get_and_clear(vma->vm_mm, addr, ptep); It looks fine to me. Thanks. -- Catalin