From: Thomas Gleixner <tglx@linutronix.de>
To: Fernando Fernandez Mancera <ffmancera@riseup.net>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: dwmw@amazon.co.uk, mhkelley@outlook.com, mingo@kernel.org,
Fernando Fernandez Mancera <ffmancera@riseup.net>
Subject: Re: [PATCH v2] x86/i8253: fix possible deadlock when turning off the PIT
Date: Thu, 27 Mar 2025 18:15:05 +0100 [thread overview]
Message-ID: <87ecyixuna.ffs@tglx> (raw)
In-Reply-To: <20250327152258.3097-1-ffmancera@riseup.net>
On Thu, Mar 27 2025 at 16:22, Fernando Fernandez Mancera wrote:
> As the PIT could be disabled during the init, it can possibly cause a
> deadlock. hpet_time_init()->pit_timer_init() is called without IRQ off.
> It assumes that clockevent_i8253_disable() is IRQ-safe, which it isn't.
It assumes nothing and all the missing interrupt disable is causing is a
lockdep false positive.
Lockdep complains correctly due to the observed contexts, but in reality
there is no possible deadlock at all. Definitely not the one your
subject line is claiming to be possible.
At the point where pit_timer_init() is invoked there is no other usage
of 8253_lock possible because the system is still in the very early boot
stage.
So disabling interrupt here just prevents lockdep triggering a false
positive and not more.
Please analyze problems properly instead of assuming that the lockdep
splat is the ultimate truth.
> bool __init pit_timer_init(void)
> {
> + unsigned long flags;
> +
> if (!use_pit()) {
> /*
> * Don't just ignore the PIT. Ensure it's stopped, because
> * VMMs otherwise steal CPU time just to pointlessly waggle
> * the (masked) IRQ.
> */
> + local_irq_save(flags);
Why save()? You just established that interrupts are enabled here, so
this really wants to be:
scoped_guard(irq)()
clockevent_i8253_disable();
return false;
Thanks,
tglx
next prev parent reply other threads:[~2025-03-27 17:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 15:22 [PATCH v2] x86/i8253: fix possible deadlock when turning off the PIT Fernando Fernandez Mancera
2025-03-27 16:43 ` David Woodhouse
2025-03-27 17:15 ` Thomas Gleixner [this message]
2025-03-27 19:54 ` Fernando Fernandez Mancera
2025-03-27 21:17 ` Thomas Gleixner
2025-03-27 21:27 ` Ingo Molnar
2025-03-27 21:36 ` Fernando F. Mancera
2025-03-27 22:52 ` Thomas Gleixner
2025-03-27 23:15 ` Fernando F. Mancera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ecyixuna.ffs@tglx \
--to=tglx@linutronix.de \
--cc=dwmw@amazon.co.uk \
--cc=ffmancera@riseup.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mhkelley@outlook.com \
--cc=mingo@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox