Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2163670pxb; Fri, 8 Oct 2021 02:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS/BWhpiYsojuy8LK9uBiweny3Q/CDwsq6eHD9SFjwM4PEFGQ1iCe9Xr/l3D5RwLJMGR98 X-Received: by 2002:a17:902:64d6:b0:13e:a59e:332c with SMTP id y22-20020a17090264d600b0013ea59e332cmr8265945pli.30.1633684114616; Fri, 08 Oct 2021 02:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633684114; cv=none; d=google.com; s=arc-20160816; b=bI1+ANNq+ZKidX9pl38BY+D+2tmq5J6JLZ2L+D9y8DgBZLaJKT9BcsMCePI298ImEW ngS0oqa3bniyXpNdGYRUce5sPcrnTlwy8salsionaiy3sP9MLmGazWK4g3tECqkhmbwK hQXs5CXoHVbGGswiYnsQ82XJiH5L3/eHue3mMynKL6v13w3P7DpeO4LP2S16oEv8TByM ocyuKx/af2IwE2GmgMcukBmsS0OVRRax2a3JLqJEiyyCOiJRpuOEfxMz00lds1JP2D4T BiMm71uzpN070a6aX0+vC6ymneLRBrgWypKKXfjEpXO5fmFnFABoXdDj/KVigbJ7jNEs blNQ== 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=IYmibc9jwjK7Jb15PxqkXKiLVacVynDgfjlC9MBNgA0=; b=wRsgt4HWZEyYIFH8KBSsdb9ieRvMj/GEJCbONrqNU+6J5IKVcFG1o2bhIPwOpJ/lFE Cg1sOuPpW7p5OqoS91lVBp4+VuWInu2BRM55QsilXesPQRtmO9lF4vLo8OTHjUZmOpZY pzQ/3GPFU7GQqDv49RdK3VwroKlvzWGqCs4Dyq9YXlGoe78LTPeDbqTNZvhl+zUCLVI5 1Szde0UFSirq4kXAj4vDuqOIjiPsmsoku5MkZx0jfcCnPLP/7G/TPO2kaf/sk/ZnrMwq wStlcgUN9Bf6mVXqiTW+Rnt4EgHmmQ4H5dIKcsNxtMOPEkGhqIaxoQPTN9GUEyM2qGXR qnVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n65si31983857pfd.158.2021.10.08.02.08.20; Fri, 08 Oct 2021 02:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232902AbhJHJJX (ORCPT + 99 others); Fri, 8 Oct 2021 05:09:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbhJHJJW (ORCPT ); Fri, 8 Oct 2021 05:09:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A7B860F6E; Fri, 8 Oct 2021 09:07:25 +0000 (UTC) Date: Fri, 8 Oct 2021 10:07:22 +0100 From: Catalin Marinas To: Zhaoyang Huang Cc: Will Deacon , Mark Rutland , Suzuki K Poulose , Ionela Voinescu , Quentin Perret , Vladimir Murzin , linux-arm-kernel@lists.infradead.org, Zhaoyang Huang , LKML , Ke Wang , ping.zhou1@unisoc.com Subject: Re: [RFC PATCH] arch: ARM64: add isb before enable pan Message-ID: References: <1633673269-15048-1-git-send-email-huangzhaoyang@gmail.com> <20211008080113.GA441@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2021 at 04:55:05PM +0800, Zhaoyang Huang wrote: > On Fri, Oct 8, 2021 at 4:45 PM Catalin Marinas wrote: > > On Fri, Oct 08, 2021 at 04:34:12PM +0800, Zhaoyang Huang wrote: > > > On Fri, Oct 8, 2021 at 4:01 PM Will Deacon wrote: > > > > On Fri, Oct 08, 2021 at 02:07:49PM +0800, Huangzhaoyang wrote: > > > > > From: Zhaoyang Huang > > > > > > > > > > set_pstate_pan failure is observed in an ARM64 system occasionaly on a reboot > > > > > test, which can be work around by a msleep on the sw context. We assume > > > > > suspicious on disorder of previous instr of disabling SW_PAN and add an isb here. > > > > > > > > > > PS: > > > > > The bootup test failed with a invalid TTBR1_EL1 that equals 0x34000000, which is > > > > > alike racing between on chip PAN and SW_PAN. > > > > > > > > Sorry, but I'm struggling to understand the problem here. Please could you > > > > explain it in more detail? > > > > > > > > - Why does a TTBR1_EL1 value of `0x34000000` indicate a race? > > > > - Can you explain the race that you think might be occurring? > > > > - Why does an ISB prevent the race? > > > Please find panic logs[1], related codes[2], sample of debug patch[3] > > > below. TTBR1_EL1 equals 0x34000000 when panic and can NOT be captured > > > by the debug patch during retest (all entrances that msr ttbr1_el1 are > > > under watch) which should work. Adding ISB here to prevent race on > > > TTBR1 from previous access of sysregs which can affect the msr > > > result(the test is still ongoing). Could the race be > > > ARM64_HAS_PAN(automated by core) and SW_PAN. > > > > Can you please change the ARM64_HAS_PAN type to > > ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE? I wonder whether > > system_uses_ttbr0_pan() changes its output when all CPUs had been > > brought up and system_uses_hw_pan() returns true. > > ok, thanks. We will try. Is it a workaround for known defect? No, other than the potential kernel bug you reported. -- Catalin