Re: [PATCH v2 00/12] Refcounted interrupt disable and SpinLockIrq for rust (Part 1)
Boqun Feng <[email protected]> Wed, 3 Jun 2026 12:20:45 -0700
| Newsgroups | org.kernel.vger.linux-openrisc,org.kernel.vger.bpf,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-s390,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Wed, May 27, 2026 at 09:33:53AM -0700, Boqun Feng wrote: > On Wed, May 27, 2026 at 06:18:44PM +0200, Peter Zijlstra wrote: > > On Tue, May 26, 2026 at 08:21:36AM -0700, Boqun Feng wrote: > > > Hi Peter, > > > > > > This is a follow-up for Lyude's work [1]. After learning the current > > > preempt_count() usage and how ARM64 handle this, I came up with this > > > series that could resolve your feedback [2]. The basic idea is based on: > > > > > > 1) preempt_count() previously already masks our NEED_RESCHED bit, so the > > > effective bits is 31bits > > > 2) with a 64bit preempt count implementation (as in your PREEMPT_LONG > > > proposal), the effective bits that record "whether we CAN preempt or > > > not" still fit in 32bit (i.e. an int) > > > > > > as a result, I don't think we need to change the existing > > > preempt_count() API, but rather keep "32bit vs 64bit" as an > > > implementation detail. This saves us the need to change the printk code > > > for preempt_count(). > > > > > > > > v1: https://lore.kernel.org/rust-for-linux/[email protected]/ > > > > > > Changes since v1: > > > > > > * Rename PREEMPT_COUNT_64BIT to HAS_SEPARATE_PREEMPT_RESCHED_BITS per > > > Mark Rutland. > > > > Blergh, so I really don't like that new name. It isn't that > > PREEMPT_RESCHED is separate, it really is a 64bit preempt count. > > > > Shashiko has a few fits, but its mostly being stupid. Although I think > > it might be useful to perhaps put a WARN_ON_ONCE(in_nmi()) in > > local_interrupt_disable(). > > Yes, that's also what I'm thinking of, and also we need to check > local_softirq_pending() in local_interrupt_enable() I think, because now > HARDIRQ_DISABLE bits being non-zero means deferring softirq. (Shashiko > also reported this as well). > After some thoughts on this, I will postpone the idea of checking of local_softirq_pending() in local_interrupt_enable(), because that essientially makes every interrupt enabling a point to trigger softirq, and that's different from the current local_irq_{enable,restore}(). Regards, Boqun > > > > Anyway, I'll re-read things again tomorrow, but I suppose this will do. > > > > Thank you! > > Regards, > Boqun