From patchwork Tue Sep 26 12:55:01 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: 13399231 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 1F01AE7E631 for ; Tue, 26 Sep 2023 12:55:56 +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=f25GdgzSuN4C8CuSZsJ8eSZU9i8Cch3rC5VgE8l7vkU=; b=JYiP3Lf2IVoumA Ue+hKucRfZR6Fu+tXl2yNbRR5QpqCcxg+lei4L48eYUDj/+FkDI/9Pl7+FidkfZgVgTglFXjg7cAn POACznIO6wfdl2bbcRL0XfIH6l+NrHh+qKKs1sMcj8qGR3GP0VnyjRZaWG+a+GfczKJA+QGxyGFGu jg3bqeE0nHsjqqy0XOBz8TI+1JzqCjZuhR53xhivA74MG2Iwx2WkXER1NANDdUvzmiKN1ULeWRdvH 1sldGqUcJKPsYdkqCh/rp9IhIDWEaP4W/gGi2P5WQi65l1R8OCHnjh8jbDCxlyZUOjXTdlp27HEkA kyhf5FUxCRJik4bhFtPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ql7b7-00GPAX-2f; Tue, 26 Sep 2023 12:55:29 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ql7av-00GP7f-2R for linux-arm-kernel@lists.infradead.org; Tue, 26 Sep 2023 12:55:19 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695732914; 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=BBRIeUFuVF6Y+zx/7o6b0kuAGMX35N3Zaru0oBh/TdQ=; b=LC8GX/+r7+/GCWAuNowqMDfKFqsVLXKEpsRBZWGbD4Jgyi2HAhhpNzinpBtpeESy+vyuYI N9rH/mgoogMvppnduIWwMmEx40yxsvRFBGTuLstNo8ZfbLPgOmQsDr1T8a8ttRvMd1IH6+ 1iiEjiIgsOaP7S1Sjk1OMWoOa4AkdUfYCHKfn9HEBcBh7LiMSm73TV18dzX9UE2AA9ucix uvmd9cJUY8frNUmU85jlGLBRghhsCdkZ+ZhFM80/Fv9JBt53rJ5UUBRXfLXMZecxIg07dB KaExfrFRIc+MfCkN5KRxY3v/NnvZHT9Qp8Sxm0Uiga0rWQWomsuuQxIunDVtpw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695732914; 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=BBRIeUFuVF6Y+zx/7o6b0kuAGMX35N3Zaru0oBh/TdQ=; b=60uz9ayVTCsUBPzDH9m7ERZjXyDsDwoRIGFgqu34aJoNEVC1dTqmNm8YZohsWQBmXjt2WX NbbZ2s/vvmivAqCw== To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: ardb@kernel.org, tglx@linutronix.de, Sebastian Andrzej Siewior Subject: [PATCH v3 3/4] ARM: vfp: Use vfp_lock() in vfp_support_entry(). Date: Tue, 26 Sep 2023 14:55:01 +0200 Message-Id: <20230926125502.1127015-4-bigeasy@linutronix.de> In-Reply-To: <20230926125502.1127015-1-bigeasy@linutronix.de> References: <20230926125502.1127015-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230926_055517_932299_3073B715 X-CRM114-Status: UNSURE ( 9.28 ) 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. Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Ard Biesheuvel --- 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 3b9360bfc5081..9543f011d0edf 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; }