From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6F3DF241103; Tue, 20 May 2025 13:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747749366; cv=none; b=N/JLXmVBjywtKc+lBsgDEhi3TQmC2V8Gg9xcAxU4sLaFNAh8pDrQNDQgx4ZPvC+x/zyWbd6haOyvvB0BOvhNhdrB0njCI378Np1otI2V2ocyyOcuygCTOrUVpM9Wf63wC7kMpQ/AsHYaLiScZBMKCWHRRzTfbx2Iuy0sAR53Mbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747749366; c=relaxed/simple; bh=c1drMYl5u3iRrHYc2N4n1/XA9ZBKHaaDCeTty0sHUMI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EtdgUb24Rb+j0kAqT2xF0Y1xruwJkWIOtKgpcpvTG18rJadHUbWfWIRtNxKSfbQiY4JkzKmsr7lcPfAzSL29EUc8EfU6mo8u8ArMUWOILZMx0pPYk4B1ER/26HEJzcl1aCmSOApd13aSm70cKwqkGCexJwp1EZJ2LP4iCFDmhck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KbvhDywi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KbvhDywi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01B82C4CEE9; Tue, 20 May 2025 13:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747749366; bh=c1drMYl5u3iRrHYc2N4n1/XA9ZBKHaaDCeTty0sHUMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbvhDywil1u2BTJSmfbKlbKVxu8WnAcvDwOIC4G1TS8F18A7PGkLgbBbk0MHwoQAm EJv6liy/ikjvHJKLMT/kUe8hzFUsAkZB4sVi5BAatpetvF/HVqDrRnRwGuARc31KYH EBG/zEs7LChZe0ojjjuiZgCcTEsSnwdjQ8D+j9cE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sebastian Andrzej Siewior , Thomas Gleixner , Sasha Levin Subject: [PATCH 6.1 21/97] clocksource/i8253: Use raw_spinlock_irqsave() in clockevent_i8253_disable() Date: Tue, 20 May 2025 15:49:46 +0200 Message-ID: <20250520125801.499336099@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250520125800.653047540@linuxfoundation.org> References: <20250520125800.653047540@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior [ Upstream commit 94cff94634e506a4a44684bee1875d2dbf782722 ] On x86 during boot, clockevent_i8253_disable() can be invoked via x86_late_time_init -> hpet_time_init() -> pit_timer_init() which happens with enabled interrupts. If some of the old i8253 hardware is actually used then lockdep will notice that i8253_lock is used in hard interrupt context. This causes lockdep to complain because it observed the lock being acquired with interrupts enabled and in hard interrupt context. Make clockevent_i8253_disable() acquire the lock with raw_spinlock_irqsave() to cure this. [ tglx: Massage change log and use guard() ] Fixes: c8c4076723dac ("x86/timer: Skip PIT initialization on modern chipsets") Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20250404133116.p-XRWJXf@linutronix.de Signed-off-by: Sasha Levin --- drivers/clocksource/i8253.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c index 39f7c2d736d16..b603c25f3dfaa 100644 --- a/drivers/clocksource/i8253.c +++ b/drivers/clocksource/i8253.c @@ -103,7 +103,7 @@ int __init clocksource_i8253_init(void) #ifdef CONFIG_CLKEVT_I8253 void clockevent_i8253_disable(void) { - raw_spin_lock(&i8253_lock); + guard(raw_spinlock_irqsave)(&i8253_lock); /* * Writing the MODE register should stop the counter, according to @@ -132,8 +132,6 @@ void clockevent_i8253_disable(void) outb_p(0, PIT_CH0); outb_p(0x30, PIT_MODE); - - raw_spin_unlock(&i8253_lock); } static int pit_shutdown(struct clock_event_device *evt) -- 2.39.5