From patchwork Fri Jun 28 13:46:18 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: 13716166 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 1F000C3064D for ; Fri, 28 Jun 2024 13:47: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=R6zagUyiu6p1WAPSFjGIb1VsjXTve3s0N1GUFRou7gI=; b=NUWRffZwcdU65lzekvH5GTOnmu skrRHajj8AvR5XQI947KHIBC/jT0E3rraFdSp/9xV9w7byumkOvKHa2NkD13Md/nAr54gZQ3JQ+ag cUrsV90Uc/LhfLeZCdMbGlbrMdk+6AdvAj9UQIqwVvVjsAI02W5hHeQiAzW9aUYZQ9Ok5aXG/GX8L Ii0foGHnnPJLJDDdfSuZiVq+ODm/g6dyrG3ewy3OVbRH8oyYR4TPDXqbvaOXqk1i7qPkoMvT5UUlC f9xf8wmWZ0yN0jJgo6gQXIqdWR48/iXoP5EhWZAQ1mR9MynLfVn9B8cDVNcigF26ZAsAUN/mQlpaW pYBWQPFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNBwR-0000000DrRJ-3CNk; Fri, 28 Jun 2024 13:47:07 +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 1sNBwG-0000000DrNn-2e2Z for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 13:46:59 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1719582415; 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=R6zagUyiu6p1WAPSFjGIb1VsjXTve3s0N1GUFRou7gI=; b=gesk+2hoLvaS2wwRFf+Vv4TxBaIKyZ3rTdDXo2JTtSp8+24Q0VNdw/u75c00ZcPcWs4iL2 wt1xNjtMaxnM6L3cjZszvIMuphAJYMAvfYodKbdvKLFs7mtOlh6D42Ut1WeGFqz7TYtQUe YiVvdcMFe4G+1HSqDXhwm9+92OzTxjCuiT0uGpi93v2BRSIiwwq9Gku6uGBvlcneMh4AVY Sb5v61w2vaB+qykkcFnKP61I3T4PkUQWip1HcrEcIkLlVkrFua5w3k2QobMTONclnXwAG6 vLBk4WxzlDtSsQ8rs1bNAZ8RBiMU5D2x7l8PjrMyo6E1eOMB3DoLIniZ3veqwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1719582415; 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=R6zagUyiu6p1WAPSFjGIb1VsjXTve3s0N1GUFRou7gI=; b=rmYyJHIWSdLtiCLpIEBMQKFVcC6W7tTq0OhCJR/3SHtWNsop2YFkdE71O86+Ta8/ssWOtu ndQEj6gmoBebG7CQ== To: linux-arm-kernel@lists.infradead.org Cc: Arnd Bergmann , Russell King , Thomas Gleixner , Sebastian Andrzej Siewior , Ard Biesheuvel Subject: [PATCH v5 3/4] ARM: vfp: Use vfp_lock() in vfp_support_entry(). Date: Fri, 28 Jun 2024 15:46:18 +0200 Message-ID: <20240628134648.1852041-4-bigeasy@linutronix.de> In-Reply-To: <20240628134648.1852041-1-bigeasy@linutronix.de> References: <20240628134648.1852041-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_064656_837194_0EC29324 X-CRM114-Status: UNSURE ( 9.90 ) 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; }