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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78515C433EF for ; Thu, 21 Oct 2021 13:45:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C10361130 for ; Thu, 21 Oct 2021 13:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbhJUNsG (ORCPT ); Thu, 21 Oct 2021 09:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231431AbhJUNsE (ORCPT ); Thu, 21 Oct 2021 09:48:04 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DCC2C061348 for ; Thu, 21 Oct 2021 06:45:48 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id ls14-20020a17090b350e00b001a00e2251c8so579928pjb.4 for ; Thu, 21 Oct 2021 06:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4YhQIiG/VVRYQyoXQKHZiWpfOu0OLjbGvCY/d59nFU=; b=HlmJX7TRx4UG0ncPN6Qe3EXnk2ZF9DqLFJphH7uq5N7ZIMVDkvlFe3OwfVkzv+jOUX nEDYcNKn4FiMGpSyH9MwVHOjHjmj/xJwjp42QY85oyBxzOp3Lfi+oyWc4CCwbsr/h1VR ZZ5f7OSp4EysK8w2Ca20O+4hNrZOXf2w4wqak+Z1N/vLht/egXfxz5WzI9ZalH/lUvC+ nTVD9dOb5T+i2eO4DGb3yPVbHOT2JcUv4xEZ/LSjuG+2BUNPjSk4+GZK6l+QMLfHUw7D agQLiL+7qyQzFutls43OjUocmcdw64gKS0AWCnKD47K7Pp7YDIOW73Lxd6Kl0f+KTK+C UJ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C4YhQIiG/VVRYQyoXQKHZiWpfOu0OLjbGvCY/d59nFU=; b=qZjsqoFxIHCSiszQochZs0V4ROd1Que2FJoLXu2fc+DvDtfemoNeYiJqLMmOKTTlyU eMyPiO6D12PIYNTWV5xcpsquB66KpQsoNaC8YHHC6FTEaIxJbiROrttbNfrEDgSw/x5N MiI9Krv3ZDJFkzpEx3yc3Kk1Yp6oC+qipLm06LKYPhGdstlLheeLz05ZWAQZJes9cS9u jY9V2rQBMELWe3+38fD+/7qnwgDQFTKDsijfc6Zho9JJqE7PCIbwKmf2frJmeCR4Pt2T t3+j1Sjp5D/0ROd/F2Bkk/uJieXk3c5BX+SpwsL64d9GhNraTKeHDshUblqaT6+UQdFz Dnmw== X-Gm-Message-State: AOAM533sQszuitaeoieEl7SvYgmYarUcemruc+H1NDVlwdkgFbTRs5Qk r+RHFMazcxAUsreh69xgXxMm/Q== X-Google-Smtp-Source: ABdhPJwvwIGLuEN95nh+Hdt3OX1LVT7d/V/k3x5/tuTpUkDCBpOM1BJzR/hzpYqZkA7GOoyte5YkgA== X-Received: by 2002:a17:902:b213:b0:13e:cd44:b4b5 with SMTP id t19-20020a170902b21300b0013ecd44b4b5mr5250651plr.18.1634823948002; Thu, 21 Oct 2021 06:45:48 -0700 (PDT) Received: from localhost ([103.127.241.129]) by smtp.gmail.com with ESMTPSA id g16sm1370633pfv.192.2021.10.21.06.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 06:45:47 -0700 (PDT) From: Leo Yan To: Catalin Marinas , Will Deacon , Mark Rutland , Kees Cook , Ard Biesheuvel , Sami Tolvanen , Nicholas Piggin , James Morse , Marc Zyngier , Joey Gouly , Peter Collingbourne , Vincenzo Frascino , "Peter Zijlstra (Intel)" , Stephane Eranian , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [RFCv1 2/4] arm64: entry: Always apply workaround for contextidr_el1 Date: Thu, 21 Oct 2021 21:45:28 +0800 Message-Id: <20211021134530.206216-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021134530.206216-1-leo.yan@linaro.org> References: <20211021134530.206216-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After introducing static key as the switch for tracing PID into contextidr_el1, the kernel can dynamically turn on the static key to use PID tracing to contextidr_el1. This means even the config CONFIG_PID_IN_CONTEXTIDR is not selected, the kernel still can use contextidr_el1. When erratum 84571 is detected, the workaround should be always applied on contextidr_el1, particularly if the static key is enabled dynamically. This patch would introduce minor overload by one extra instruction for accessing system register contextidr_el1 and it only impacts platform which erratum 84571. So it's expected to not cause any significant regression. Signed-off-by: Leo Yan --- arch/arm64/kernel/entry.S | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index bc6d5a970a13..c41a4cfff527 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -356,12 +356,8 @@ alternative_else_nop_endif #ifdef CONFIG_ARM64_ERRATUM_845719 alternative_if ARM64_WORKAROUND_845719 -#ifdef CONFIG_PID_IN_CONTEXTIDR mrs x29, contextidr_el1 msr contextidr_el1, x29 -#else - msr contextidr_el1, xzr -#endif alternative_else_nop_endif #endif 3: -- 2.25.1 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AB7CC433EF for ; Thu, 21 Oct 2021 13:47:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF4A560F59 for ; Thu, 21 Oct 2021 13:47:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF4A560F59 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LwAU3e81Tdm7JwNPlUG7s5v0aemH255wQovxugGPnAM=; b=4MeTZoBN0wsH0z gAYIWzU6a8oGUsLwsEotfYFevCRhvodmwMHNUIfCQkyOTHOUuVi1S82p04O5nnJ3WqjOsni2JlLp4 dWPuuTcFXOi5OJcBkR7HI7Y/pqszf+Vriir92vJZgHKMt2+rp/3eqfn8D8A2dTdHsYRvagI1fxyM7 cCl80ErgnycIolYdItzfOOw5FfqZYFUonrp4gYFbcPAUMpXVub/5/s4it0aOs5c0OMidqyd9wDyTT IQSbzxqM1nPORQgviG5h7XoVSP2QWMF/xTSD4suScEWT61K5hwGconwg4XV7dBy9X920yLAbPgsKy itxQHOk6VHLDgNbUG5sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdYOZ-007geZ-5t; Thu, 21 Oct 2021 13:46:11 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdYOC-007gXW-Ky for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 13:45:50 +0000 Received: by mail-pl1-x630.google.com with SMTP id i5so445171pla.5 for ; Thu, 21 Oct 2021 06:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4YhQIiG/VVRYQyoXQKHZiWpfOu0OLjbGvCY/d59nFU=; b=HlmJX7TRx4UG0ncPN6Qe3EXnk2ZF9DqLFJphH7uq5N7ZIMVDkvlFe3OwfVkzv+jOUX nEDYcNKn4FiMGpSyH9MwVHOjHjmj/xJwjp42QY85oyBxzOp3Lfi+oyWc4CCwbsr/h1VR ZZ5f7OSp4EysK8w2Ca20O+4hNrZOXf2w4wqak+Z1N/vLht/egXfxz5WzI9ZalH/lUvC+ nTVD9dOb5T+i2eO4DGb3yPVbHOT2JcUv4xEZ/LSjuG+2BUNPjSk4+GZK6l+QMLfHUw7D agQLiL+7qyQzFutls43OjUocmcdw64gKS0AWCnKD47K7Pp7YDIOW73Lxd6Kl0f+KTK+C UJ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C4YhQIiG/VVRYQyoXQKHZiWpfOu0OLjbGvCY/d59nFU=; b=qDZZkyt12IW2umw+JvyWtp3Qn7HSG12ohjW37M1w/CyLFd7ovm026BeCEjI950DZ+l 9JzzhQLbmckx9bJVhzZ6emOneE1tzFWOEJIlrguGGUvnMAJ+jU/vSlwtROp9jOalN6MB ekH7qS9vigCdHUfcF+q4Zb937biGCmQDF/aAmYVc1+vfdRMbtG307OV0hf1bNb8ZrMmy ZovmIybdNZLhDS8SauW1fmDtrkmRUUxWlJDOPjUlboDJ+0EW6OkVPHsKyKyRpKf3HNdi stSYtOyA3qrViMbt9aSR0XGeX/wMcXluC6UEowdI5mX9dTxS7Xvv3LzJRT5sVG5k9Lv+ +aKw== X-Gm-Message-State: AOAM532pMM3x2gHHF7qaN5nBKhjK413zpAmK7dhUc0mJeAqCYCZhhDiX C7jnnP/gx1vUxW812aYLE6Ok8w== X-Google-Smtp-Source: ABdhPJwvwIGLuEN95nh+Hdt3OX1LVT7d/V/k3x5/tuTpUkDCBpOM1BJzR/hzpYqZkA7GOoyte5YkgA== X-Received: by 2002:a17:902:b213:b0:13e:cd44:b4b5 with SMTP id t19-20020a170902b21300b0013ecd44b4b5mr5250651plr.18.1634823948002; Thu, 21 Oct 2021 06:45:48 -0700 (PDT) Received: from localhost ([103.127.241.129]) by smtp.gmail.com with ESMTPSA id g16sm1370633pfv.192.2021.10.21.06.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 06:45:47 -0700 (PDT) From: Leo Yan To: Catalin Marinas , Will Deacon , Mark Rutland , Kees Cook , Ard Biesheuvel , Sami Tolvanen , Nicholas Piggin , James Morse , Marc Zyngier , Joey Gouly , Peter Collingbourne , Vincenzo Frascino , "Peter Zijlstra (Intel)" , Stephane Eranian , James Clark , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [RFCv1 2/4] arm64: entry: Always apply workaround for contextidr_el1 Date: Thu, 21 Oct 2021 21:45:28 +0800 Message-Id: <20211021134530.206216-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021134530.206216-1-leo.yan@linaro.org> References: <20211021134530.206216-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211021_064548_751173_659CE77E X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After introducing static key as the switch for tracing PID into contextidr_el1, the kernel can dynamically turn on the static key to use PID tracing to contextidr_el1. This means even the config CONFIG_PID_IN_CONTEXTIDR is not selected, the kernel still can use contextidr_el1. When erratum 84571 is detected, the workaround should be always applied on contextidr_el1, particularly if the static key is enabled dynamically. This patch would introduce minor overload by one extra instruction for accessing system register contextidr_el1 and it only impacts platform which erratum 84571. So it's expected to not cause any significant regression. Signed-off-by: Leo Yan --- arch/arm64/kernel/entry.S | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index bc6d5a970a13..c41a4cfff527 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -356,12 +356,8 @@ alternative_else_nop_endif #ifdef CONFIG_ARM64_ERRATUM_845719 alternative_if ARM64_WORKAROUND_845719 -#ifdef CONFIG_PID_IN_CONTEXTIDR mrs x29, contextidr_el1 msr contextidr_el1, x29 -#else - msr contextidr_el1, xzr -#endif alternative_else_nop_endif #endif 3: -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel