Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1085377pxb; Sun, 10 Oct 2021 20:22:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoL1gFX08Z6p7gvZ9hfeUqPKbp+F5PhJ5uscrRKjkQJYzWwVZe9OCdHMu79zVlnhlRZV2K X-Received: by 2002:a17:906:1289:: with SMTP id k9mr23005767ejb.2.1633922563513; Sun, 10 Oct 2021 20:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633922563; cv=none; d=google.com; s=arc-20160816; b=Zrl/GTLgayeau6VaK7oz7xIcTysPM0pBQXjykBVUdjMr0T3H0bObxOr1u84U8EOhwv OXbIQhm7FWvOJHSflqW9PxtqqkZezqR7rjON9mmUOU9N542Bu2kqTQ4RdD3tm2PrNeOw JjNfD4jyVFTSK0pYF82xewBnCxxuCWMt9Gk2EvNcvg/1gnh+jkGLTGlm7mUxLnZH2L7m fBCy+vOrTOEk57idy8S9kL8+NIowFF+aMWm1DXWB5usVuEVhxBgZb+2zMiYguuGir89x NnlLkkkVVJJ1HbOfSSNMRjdNLuhLRF6CaNrT1p4GwLhH+NRdfm0DaKTYc4gwo+ywNPCl LPug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5tv84GQY+BXrm7Uh+yrBQDIxyhTf+S8jMuhW5BS2r+Y=; b=HRhP12HrGtieiJcTEzRXvV1e/6dTT+Y0YqaKlpfpjil58BqoSnUK+uUo8GauK0FXyB SUcuOpBlpBezYcqNZvfT1ye9zWQX0bclxgKZ9/aboD7vuSZypawOvFbnVu8mROEMC00k umCrxZQQ/hlj1ySvtxGBuQwpC/WPov/ioO+7mwganSFritb+U87kmQZiTueROO0wM2LY JgHw3nycW0/VrZhRwMYwKocX5teI4jNXnuAmtxyEIjZ+cFGEL1U3vUAZyVK1rwECOUDc k4m+xMdLcWA498oi+J0Ik79vnJvuFsSNKaoY5AaLzM6kPlQxOQhuw13kfVnRNMKcyQF0 YHgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=psYp9WB8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si9173094ejb.572.2021.10.10.20.22.20; Sun, 10 Oct 2021 20:22:43 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=psYp9WB8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233465AbhJKCvW (ORCPT + 99 others); Sun, 10 Oct 2021 22:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbhJKCvV (ORCPT ); Sun, 10 Oct 2021 22:51:21 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95202C061570 for ; Sun, 10 Oct 2021 19:49:22 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id bi9so1405195qkb.11 for ; Sun, 10 Oct 2021 19:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5tv84GQY+BXrm7Uh+yrBQDIxyhTf+S8jMuhW5BS2r+Y=; b=psYp9WB8j+BJKu/Mq8xIZp8jo2vSsNcINJMY6LA4KBKcreYo1R5B0zOPTJp4m3CB1v rxVByjRunV5irEZXgc0J4qsrCC6D+We7gUpRubFDb+eOAYs1hNEaW/VxlT8mnQWPhZKT xgmLm6hdcyVg2eJpZN66MmgfKEnvaSvTUzUBNEelYxHL8onYbg1mBefHGKk2tmP1CCfs GjK114XOAQGnrH0BzjL/46PFX5CK1USoFQiXuVwiavz3KXiu6fTx32Q2e9Ru8plh2Gu0 gvw5ZFroIO8z3aLgvYObpCpPI5qKOnTpTXw2nyLAnQL4i2i55CuqfNIyfgGQsHB9v1vH Cktw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5tv84GQY+BXrm7Uh+yrBQDIxyhTf+S8jMuhW5BS2r+Y=; b=MYYXa7QYGKAtaDZ1gxGA8xWO9aci2BRTayi2VH1Cj1n1IlfJqyZlIQd2irZfQuocB0 xxO0iGfrb8qQocJM/Xs1gg1hd1AwmLApYcdHMCX3yETt9flFVF1j7z89II2KWicFfezS 4h4krXjVLBMRK5DwQcu0JM5WInT3w/DcbVXqkmhw9VhUthYzATLLBUOENLo24eXdck1G wF8e7J291ebS0IggHG5r8RJuc3dDl1ybECmN/BjD8v/nCInA/J0tzslFh3YNx8n/1/S3 cIOOxaXPg66sfE2b/JuZ7DqjbiJ58PSvvfLYRmT1K4dc1mUwLEgBfH+7OUtnHTsBqLHo nCJQ== X-Gm-Message-State: AOAM53014AcczPgbJgi0JmcqdoXtCE+0GyCWmhmZoAvgoknkVVGfyuGo qhvI4w8zqUI1ErbZjb67OpiM0nNsoEcJ7AFoHYk= X-Received: by 2002:a37:8e44:: with SMTP id q65mr12640141qkd.372.1633920561774; Sun, 10 Oct 2021 19:49:21 -0700 (PDT) MIME-Version: 1.0 References: <1633673269-15048-1-git-send-email-huangzhaoyang@gmail.com> <20211008080113.GA441@willie-the-truck> In-Reply-To: From: Zhaoyang Huang Date: Mon, 11 Oct 2021 10:49:00 +0800 Message-ID: Subject: Re: [RFC PATCH] arch: ARM64: add isb before enable pan To: Catalin Marinas 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 8, 2021 at 5:07 PM Catalin Marinas wrote: > > 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. Changing the type to ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE doesn't work for this issue. > > -- > Catalin