From nobody Mon Aug 24 05:25:26 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289EE14A60F for ; Fri, 21 Aug 2026 02:52:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787280779; cv=none; b=pk/MCEGYvWvxO0gZ0GyglXVPj/pwP2msBM1JwiCB1mZ17CZ1Xnx5zXMVuJBV1XMpxJxUaFZDCHGKY79wt661q+ILQwhNZrUhp0p7v7nSN11YhxerHkBLRtBorH3QJnyTVJvhN63gPFQ+nQZG1z6vVN/pMPJT5EClGQrp9S7WuGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787280779; c=relaxed/simple; bh=CoECN4MPNyuHtWH6bbFgaE1SXRzPEZ6i48MGExc/BuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fXCcx1mWFi6S5RCQuKoxv0PmMc2ZXeLjuZKuHEeQCtKyb9rQ/T5TkQMVoyPVDuWipoT1oinR3VpNnJbgvenXYCrHgxECJEEwWUaqErF2NxDdGE5WvB6Yg6zGAwpy23sCVRcRVa7UN0D8HTyE1LqXornW5S8ybMNApBbi8U3iMBA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=Ym1jZNNj; arc=none smtp.client-ip=117.135.210.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="Ym1jZNNj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=LF xUkhg9QJ7xUqbUrqBmljBaBafloBC1VvvbvT0bbkw=; b=Ym1jZNNjpfz1CC24Yw XbGwzU99iwTEfvQj7vqmqtKcbxZi/noWWnwUcAl3GIJhrm0WZZwQtUtkRqz5UOKt iddNif3LbkRimCRcUeD2Be+MMeJkO6Yx3t2ZkSOoAV0jxBtKacBCxAE8e6N0h9Iu tETef2yMrq9iysjVnBBR12chY= Received: from fedora (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgD3Py9WvYdqaYjMNQ--.27755S2; Fri, 21 Aug 2026 10:52:07 +0800 (CST) From: Ju Nan To: tglx@kernel.org Cc: alexandre.torgue@foss.st.com, junan76@163.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, mcoquelin.stm32@gmail.com, radu@rendec.net Subject: [PATCH v3] irqchip/stm32mp-exti: fix the unit of the hwspinlock timeout Date: Fri, 21 Aug 2026 10:47:57 +0800 Message-ID: <20260821024756.24927-2-junan76@163.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <87cxvdkhmn.ffs@fw13> References: <87cxvdkhmn.ffs@fw13> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgD3Py9WvYdqaYjMNQ--.27755S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7KF4fXFyxCFWfKw4DWr4UArb_yoW8ur1UpF Z5t3s0yrs5Wa4jya1DtF4DWry5Cw47t3ySgFWUXa1FvFn8W395J3WIq39FqF12gF4xGF9F gF4fXFy5Ca4DA3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pEJ5rnUUUUU= X-CM-SenderInfo: pmxqt0ixw6il2tof0z/xtbC9RkCs2qHvVn0OwAA3b Content-Type: text/plain; charset="utf-8" HWSPNLCK_TIMEOUT is passed to hwspin_lock_timeout_in_atomic(), whose timeout argument is in milliseconds, not microseconds: atomic_delay +=3D HWSPINLOCK_RETRY_DELAY_US; if (atomic_delay > to * 1000) return -ETIMEDOUT; So stm32mp_exti_set_type() asks for a 1 second timeout where the comment next to the macro says it wants 1 millisecond. The semaphore is polled with udelay() from a section that holds chip_data->rlock, a raw_spinlock_t, so preemption stays disabled for the whole wait on every configuration, PREEMPT_RT included. The hwspinlock core documents this explicitly: If the mode is HWLOCK_IN_ATOMIC (called from an atomic context) the timeout is handled with busy-waiting delays, hence shall not exceed few msecs. Fixes: 5257169ade8c ("irqchip/stm32-exti: Use the hwspin_lock_timeout_in_at= omic() API") Reviewed-by: Radu Rendec Signed-off-by: Ju Nan Reviewed-by: Antonio Borneo --- changelog: v3: redefine the timeout macro with time unit on it v2: add "Fixes" tag suggested by Radu Rendec v1: https://lore.kernel.org/all/20260805032139.35420-2-junan76@163.com/ --- drivers/irqchip/irq-stm32mp-exti.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-stm32mp-exti.c b/drivers/irqchip/irq-stm32= mp-exti.c index a24f4f1a4..ce4e03ee1 100644 --- a/drivers/irqchip/irq-stm32mp-exti.c +++ b/drivers/irqchip/irq-stm32mp-exti.c @@ -23,7 +23,7 @@ =20 #define IRQS_PER_BANK 32 =20 -#define HWSPNLCK_TIMEOUT 1000 /* usec */ +#define HWSPNLCK_TIMEOUT_MS 1 =20 #define EXTI_EnCIDCFGR(n) (0x180 + (n) * 4) #define EXTI_HWCFGR1 0x3f0 @@ -377,7 +377,7 @@ static int stm32mp_exti_set_type(struct irq_data *d, un= signed int type) raw_spin_lock(&chip_data->rlock); =20 if (hwlock) { - err =3D hwspin_lock_timeout_in_atomic(hwlock, HWSPNLCK_TIMEOUT); + err =3D hwspin_lock_timeout_in_atomic(hwlock, HWSPNLCK_TIMEOUT_MS); if (err) { pr_err("%s can't get hwspinlock (%d)\n", __func__, err); goto unlock; --=20 2.55.0