From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (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 994F123BD05 for ; Wed, 5 Aug 2026 03:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785900179; cv=none; b=grBdQ1AW+SD1Q5jFW00yuJ68cUAdgg4q+73wdJbNUl9tuN+3+JT1QKotEhkdFIZtZe2e3FPdf1M7dASm2dQPSbzpBoKMJb3uL3CXgq390LxcFOrR8fi6wF0WbnJsp2JQhdDJwqoEcMST088Ea7DOO2up25W+tp8rRSz1Qy4kBvQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785900179; c=relaxed/simple; bh=4IPIw8MPB8KGAk9Myvc3Gr9oeruqiSoUTmlJ2WJQfzw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HB3/VsaDX92D2d3lr+H0Yet+wzs8EGaw0XtLjwkvz+UezICi9m1PbBYAwm1o51PuPXRmU1v+COuRs+V9SRe7PzP482uwKTs6iA8nWe12TkiWsJg8efBZVrIutR1EJlJZIUZiHEXMTAkmbvGGPZDq/HdLFC5UEfd6axBPUoEAhNY= 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=eLWIHhE2; arc=none smtp.client-ip=117.135.210.3 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="eLWIHhE2" 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=el 3n5V7iPOoYu1CRUdT4wfLV7ObCCa5EITz8RK4IuNc=; b=eLWIHhE2IYh1TUsJnc +1lRyzilQEozJtFQ6HeGDC1R5LnIKq4on8q9nJhHm8+YuxmKoqPSml/ib8/1o6rT zB6hrmyhQPBBn2zs77gw6v7LITjG4eH18L1H3fK75wlrj3L8mRrUx1N5m1ln7l5S YPtIX13Dqsn3XmoBXBCJybeZs= Received: from fedora (unknown []) by gzsmtp2 (Coremail) with SMTP id PSgvCgAHXvRrrHJqald+Jw--.17167S2; Wed, 05 Aug 2026 11:22:21 +0800 (CST) From: Ju Nan To: tglx@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, junan76@163.com Cc: linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH] irqchip/stm32mp-exti: fix the unit of the hwspinlock timeout Date: Wed, 5 Aug 2026 11:21:40 +0800 Message-ID: <20260805032139.35420-2-junan76@163.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:PSgvCgAHXvRrrHJqald+Jw--.17167S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7KF4fXFyxCFWfKw4DWr4UArb_yoW8Ar1rpF W5t3sYywn3Wayaya1kAFs0gFy5Ca17J3yftFWDXa4jvwn8Wa1kJF10q3yUZF9rXrs5J3sF gFsYga45Cas8u3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pE1vVZUUUUU= X-CM-SenderInfo: pmxqt0ixw6il2tof0z/xtbC0w19L2pyrG1kTwAA3+ HWSPNLCK_TIMEOUT is passed to hwspin_lock_timeout_in_atomic(), whose timeout argument is in milliseconds, not microseconds: atomic_delay += 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. Pass the value the comment always described. The core retries every HWSPINLOCK_RETRY_DELAY_US (100 us), so the semaphore is still polled ten times before giving up, which is far longer than any plausible hold time on the coprocessor side. A timeout is reported with pr_err() and fails the trigger type configuration, so shortening it degrades gracefully. Signed-off-by: Ju Nan --- drivers/irqchip/irq-stm32mp-exti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-stm32mp-exti.c b/drivers/irqchip/irq-stm32mp-exti.c index a24f4f1a4..f5f0109bf 100644 --- a/drivers/irqchip/irq-stm32mp-exti.c +++ b/drivers/irqchip/irq-stm32mp-exti.c @@ -23,7 +23,7 @@ #define IRQS_PER_BANK 32 -#define HWSPNLCK_TIMEOUT 1000 /* usec */ +#define HWSPNLCK_TIMEOUT 1 /* msec */ #define EXTI_EnCIDCFGR(n) (0x180 + (n) * 4) #define EXTI_HWCFGR1 0x3f0 -- 2.55.0