Re: [PATCH v2 12/12] s390/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS

Boqun Feng <[email protected]> Thu, 28 May 2026 07:41:24 -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 Thu, May 28, 2026 at 12:53:25PM +0200, Peter Zijlstra wrote:
> On Tue, May 26, 2026 at 08:21:48AM -0700, Boqun Feng wrote:
> > From: Heiko Carstens <[email protected]>
> > 
> > Convert s390's preempt_count to 64 bit, and change the preempt
> > primitives accordingly.
> > 
> > Signed-off-by: Heiko Carstens <[email protected]>
> > Signed-off-by: Boqun Feng <[email protected]>
> > Link: https://patch.msgid.link/[email protected]
> > ---
> >  arch/s390/Kconfig               |  1 +
> >  arch/s390/include/asm/lowcore.h | 13 +++++++----
> >  arch/s390/include/asm/preempt.h | 41 +++++++++++++++------------------
> >  3 files changed, 29 insertions(+), 26 deletions(-)
> > 
> > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> > index ecbcbb781e40..cbbca82f8443 100644
> > --- a/arch/s390/Kconfig
> > +++ b/arch/s390/Kconfig
> > @@ -276,6 +276,7 @@ config S390
> >  	select PCI_MSI			if PCI
> >  	select PCI_MSI_ARCH_FALLBACKS	if PCI_MSI
> >  	select PCI_QUIRKS		if PCI
> > +	select HAS_SEPARATE_PREEMPT_RESCHED_BITS
> >  	select SPARSE_IRQ
> >  	select SWIOTLB
> >  	select SYSCTL_EXCEPTION_TRACE
> > diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
> > index 50ffe75adeb4..0974ab278169 100644
> > --- a/arch/s390/include/asm/lowcore.h
> > +++ b/arch/s390/include/asm/lowcore.h
> > @@ -160,10 +160,15 @@ struct lowcore {
> >  	/* SMP info area */
> >  	__u32	cpu_nr;				/* 0x03a0 */
> >  	__u32	softirq_pending;		/* 0x03a4 */
> > -	__s32	preempt_count;			/* 0x03a8 */
> > -	__u32	spinlock_lockval;		/* 0x03ac */
> > -	__u32	spinlock_index;			/* 0x03b0 */
> > -	__u8	pad_0x03b4[0x03b8-0x03b4];	/* 0x03b4 */
> > +	union {
> > +		struct {
> > +			__u32	need_resched;	/* 0x03a8 */
> > +			__u32	count;		/* 0x03ac */
> > +		} preempt;
> > +		__u64	preempt_count;		/* 0x03a8 */
> > +	};
> 
> I'm a little confused by this union; afaict it isn't actually used.

(TIL: s390 is big endian)

In preempt_count() the union is used for reading the lower 32bits in an
asm block.

Regards,
Boqun