From patchwork Fri Mar 15 14:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13593579 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B6FF1C54E58 for ; Fri, 15 Mar 2024 14:52:51 +0000 (UTC) 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=A/X8cqj84JToCSVuiURxqm3WkdB4TxZN3i6hNfQ9TGY=; b=sgkToEA1VNQLKF aNJ8K70UgeTELCz9s9DMUlKDDrQMBGHzPe27PufW8N+wh5OItpqND10rCjnOL2lKuEWEbXN+ddGn7 gar2pc5R8uIm5x//kfsjNitT7XvfyDXLAszOX5V9BO86vNeSjGUHxnVhPl2OFfdH5b/j9wRGuOC9k ZRVVDxhaGoZbIhwoA+brk/nVTkCOZatQXbDwn7yCoIx3AmRS6IArfI+lE+8rvYpiIgj43Y0ObK2xy 8weINGnb6z57rgAVCL75Z4m5LlacvrBxNscTI/+//gVetRIJhMTQZ46jIKmjwp2hBwiFVZU0B8uxa 04+GNaVrcIyazZ8P1XpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rl8vI-00000000Z43-2lPz; Fri, 15 Mar 2024 14:52:40 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rl8v0-00000000YxH-3IWN for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2024 14:52:35 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1710514339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=98gtkEVWAonVmsxkQx/Dz5eOFvA6kRM0iPjA0WUFmf0=; b=mdNMjUfEi/5XKtOvZLs80ss5FpeiCdYiaoICY1c1vIh1qRVvRRsLl0WSK1Df00rkMGUKDP MWa6uLrYxJFhvBzeBQAl03IQ/YkqM6QHyyeiSTob0XKc+BpSNYeh0kAc0/xDWo95mXv0UP jL0tuwxZJm9GJ7W5oRcVgZbqA22LMrihMNnT+i+jAQhRU9+QgNf2ErbaJ2rGdPUFN1d9af mRvE+tPSzSZ8iPkxmeaiECFNOzS3CwSDj5H4xWlloQrVatu+u16dUQpwVvnjiws1mKCa5g i98C6QIJqk6zickAzmiUVFsvhSSVtrGgxbfH5wj/s89MG2V5ZUjIGyn9x5fhdw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1710514339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=98gtkEVWAonVmsxkQx/Dz5eOFvA6kRM0iPjA0WUFmf0=; b=udrODnSr5w3KYrYvwfh7ZGKWHOeNg4EzHh5E8r4Mr1DQ7ccYonlFPSOE7kjUdFAwrdUgon di9sMrhi1Uy5c/Bw== To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: ardb@kernel.org, tglx@linutronix.de, Sebastian Andrzej Siewior Subject: [PATCH v4 3/4] ARM: vfp: Use vfp_lock() in vfp_support_entry(). Date: Fri, 15 Mar 2024 15:51:02 +0100 Message-ID: <20240315145208.3598288-4-bigeasy@linutronix.de> In-Reply-To: <20240315145208.3598288-1-bigeasy@linutronix.de> References: <20240315145208.3598288-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240315_075223_017397_B50CE083 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org vfp_entry() is invoked from exception handler and is fully preemptible. It uses local_bh_disable() to remain uninterrupted while checking the VFP state. This is not working on PREEMPT_RT because local_bh_disable() synchronizes the relevant section but the context remains fully preemptible. Use vfp_lock() for uninterrupted access. Reviewed-by: Ard Biesheuvel Signed-off-by: Sebastian Andrzej Siewior --- arch/arm/vfp/vfpmodule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 49ccd205ad780..6ebd5d4b8fa29 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -708,7 +708,7 @@ static int vfp_support_entry(struct pt_regs *regs, u32 trigger) if (!user_mode(regs)) return vfp_kmode_exception(regs, trigger); - local_bh_disable(); + vfp_lock(); fpexc = fmrx(FPEXC); /* @@ -787,7 +787,7 @@ static int vfp_support_entry(struct pt_regs *regs, u32 trigger) if (!(fpscr & FPSCR_IXE)) { if (!(fpscr & FPSCR_LENGTH_MASK)) { pr_debug("not VFP\n"); - local_bh_enable(); + vfp_unlock(); return -ENOEXEC; } fpexc |= FPEXC_DEX; @@ -797,7 +797,7 @@ bounce: regs->ARM_pc += 4; VFP_bounce(trigger, fpexc, regs); } - local_bh_enable(); + vfp_unlock(); return 0; }