From patchwork Mon Jul 1 10:56:55 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: 13717904 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 DCA52C30659 for ; Mon, 1 Jul 2024 11:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u7q2gwGmp9PLpG/AVWR2W/15Jj9bUM2hgcZVmvsL1Ro=; b=IVNKrC7o7RaqW/K+bgjpCUzSej lPREpW2bTDHuaI+itX5WItyUatr5roQUhdOIW+si/KBgP5e9kS5RypjZcooCPm+LPzjDTUWwki5jh /wtBMeFAbkcp2z5YFQOi8NYq3FVKiFa1PrO20ni5DQBA7chIpjf1S72Tkj+I1EApv4pMxF9VLwj1K yup65cTjHsYzMhhZTD2vNysfo5B92KWnbaDd3oV0gftevV+a0ZgDXaBND5PF3ihY7VyU0Js1TfJd6 +6H2+WsYnATnrdTKYz2G7jm1CMYkWiMA5H+W0GP5pZ7WKdgZuCSlXIqnDiUZz/I2BNB+wRYvBhXTR 9gvmMjow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOEpN-00000002pkM-0DIY; Mon, 01 Jul 2024 11:04:09 +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 1sOEon-00000002pYZ-15vp for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2024 11:03:39 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1719831811; 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=u7q2gwGmp9PLpG/AVWR2W/15Jj9bUM2hgcZVmvsL1Ro=; b=D7zrgBGJbI0nmVJr0i5WJ1fEknlzJAt3egiEIFdjKxyEHrPr+HHCSKsvjhWp7yWNsNDMup m2qPxJWwRgGvdbALZykLUvfw+FLnBeLgz1eBxHDz2zr1YsaRNaLWcmupaYq5bEnG4Ww66W VpY6vTadSmf70ep3+pSsULL0u0wDlDO5QhEQk+rn/yLJDX2t2WBG4vBTG4uXe0yIfOUkN2 Sk3DFDNOS1JgjmfaDilya1ib8DXJd0g5r2Mf7FE1qDd2OTKef+ib+J/qpmmOO8rTzEd8Yo yDOD2mxWFdfULGRyysauDk1VK598fkYkLAUChkGZB732zVcJwYFT8gonyYaxWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1719831811; 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=u7q2gwGmp9PLpG/AVWR2W/15Jj9bUM2hgcZVmvsL1Ro=; b=qJJcXpaK2b8tvCMglzhXkvy6/HkvtXPgQMpYXKw0qSGOkkmexJaPz6QBHccB088+ichKO8 uAPN6wGzh3xlD0Cw== To: linux-arm-kernel@lists.infradead.org Cc: Arnd Bergmann , Russell King , Thomas Gleixner , Sebastian Andrzej Siewior , Ard Biesheuvel Subject: [PATCH v6 3/4] ARM: vfp: Use vfp_state_hold() in vfp_support_entry(). Date: Mon, 1 Jul 2024 12:56:55 +0200 Message-ID: <20240701110317.99631-4-bigeasy@linutronix.de> In-Reply-To: <20240701110317.99631-1-bigeasy@linutronix.de> References: <20240701110317.99631-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_040333_480163_CFA44D6A X-CRM114-Status: UNSURE ( 9.96 ) 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_state_hold() 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 1726db0500760..28dafae7758b8 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_state_hold(); 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_state_release(); return -ENOEXEC; } fpexc |= FPEXC_DEX; @@ -797,7 +797,7 @@ bounce: regs->ARM_pc += 4; VFP_bounce(trigger, fpexc, regs); } - local_bh_enable(); + vfp_state_release(); return 0; }