From patchwork Wed Jun 28 08:05:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13295331 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 71053EB64DA for ; Wed, 28 Jun 2023 08:06:25 +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=KBx4vln1Zx2+m6wmDxqsC6vkdKfwjTRBp/F0zqjOe3s=; b=Fq43K3dFcG6nxf 0EGKnKD5+xF0vG8nMgBMIDkbZyeyGMxtE+8hF7rjFjcbY97ouvVQrgja9PawDqeFiSslKdXtzj9gk bgxLutYPnjE0/ST04yPx44qC7eYvOPmugN3nKb/RaJfzLGDdHiw/wQld26Dn2NDZ2UiEofw1lS2QA 7ChOV/V7z6TiyF8F+cTikC2dS/lOG9fV5u9Vi+MgoJVH2fQxZITRHIWavhM9tEj7QlMgAM4brO+mx bnn6ubBjZ4cDoiTV2rr8XcddEFoveLr3SLkjRDi3ntX5ATxD0ORQANeYKhtDcwnrcESSlj+jmANkg yL0PgdMD5EN7dfWagfyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEQBY-00F7ay-2D; Wed, 28 Jun 2023 08:05:56 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEQBG-00F7XL-1t for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 08:05:40 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687939533; 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=BcJGY1eymCInEWmIxxrDiwHtGGU+rmcWb/xiv15li7U=; b=2MPTk4IxfeCUbiQL46csR4g4DNbcDgIQhH1Ak8gupuivZ9WMcaSUeCRJhrMROaKQSL7smO TUfTPIzdw+DXXRv4yG88qPcEyi8kG74jj2J2BWqFnkVpuMV2UxXY15q0L3tn3mb8ZD5bG5 osZQX/3A7pUQJwp95RqbQYaLxy4HENzw1iGxyMkQTMpLIEG7zMqxZnoPu5XAUZymBD3h0L 1Q7j5dQZy9huD16VbbtRL1y9aJwZWdV0zZiJrCRY1pITP7bN3LG0WIuaUh0MErb8Tg+ZBa /Ps4H30EhJyo7jxh1bpWdZteHYlcTx9gU/LfrfY/tBcmQunRugcN+B6JbEkObw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687939533; 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=BcJGY1eymCInEWmIxxrDiwHtGGU+rmcWb/xiv15li7U=; b=ytfkwPcnWdJuXzegrCdgDWSM8c5biIxpS7orqyynCk/Q9sbJg6iZihuIzDrGoq/WlRanX1 15FtxNRPojTdsyBA== To: linux-arm-kernel@lists.infradead.org Cc: Russell King , Ard Biesheuvel , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH v2 3/4] ARM: vfp: Use vfp_lock() in vfp_support_entry(). Date: Wed, 28 Jun 2023 10:05:15 +0200 Message-Id: <20230628080516.798032-4-bigeasy@linutronix.de> In-Reply-To: <20230628080516.798032-1-bigeasy@linutronix.de> References: <20230628080516.798032-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_010538_764144_1A999326 X-CRM114-Status: GOOD ( 10.37 ) 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. 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 524aec81134ba..17e1c200a2305 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -707,7 +707,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); /* @@ -786,7 +786,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; @@ -796,7 +796,7 @@ bounce: regs->ARM_pc += 4; VFP_bounce(trigger, fpexc, regs); } - local_bh_enable(); + vfp_unlock(); return 0; }