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

Boqun Feng <[email protected]>
Newsgroups gmane.linux.kernel.rust,gmane.linux.kernel
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 02:42:18PM +0200, Heiko Carstens wrote:
> On Mon, Aug 03, 2026 at 01:40:32PM +0200, Peter Zijlstra wrote:
> > On Fri, Jul 31, 2026 at 01:30:13PM -0700, Boqun Feng wrote:
> > 
> > > @@ -26,25 +23,25 @@
> > >   */
> > >  static __always_inline int preempt_count(void)
> > >  {
> > > -	unsigned long lc_preempt, count;
> > > +	unsigned long lc_preempt;
> > > +	int count;
> > >  
> > > -	BUILD_BUG_ON(sizeof_field(struct lowcore, preempt_count) != sizeof(int));
> > > -	lc_preempt = offsetof(struct lowcore, preempt_count);
> > > +	lc_preempt = offsetof(struct lowcore, preempt.count);
> > >  	/* READ_ONCE(get_lowcore()->preempt_count) & ~PREEMPT_NEED_RESCHED */
> > 
> > If I'm not mistaken, this comment is no longer accurate, since
> > NEED_RESCHED lives in the high word and you're only loading the low
> > word.
> 
> True. Something like
> 
>   	/* READ_ONCE(get_lowcore()->preempt.count) (without PREEMPT_NEED_RESCHED) */
> 
> might be better.
> 

Thanks, I will update it.

Regards,
Boqun

> > >  	asm_inline(
> > > -		ALTERNATIVE("llgt	%[count],%[offzero](%%r0)\n",
> > > -			    "llgt	%[count],%[offalt](%%r0)\n",
> > > +		ALTERNATIVE("ly		%[count],%[offzero](%%r0)\n",
> > > +			    "ly		%[count],%[offalt](%%r0)\n",
> > >  			    ALT_FEATURE(MFEATURE_LOWCORE))
> > >  		: [count] "=d" (count)
> > >  		: [offzero] "i" (lc_preempt),
> > >  		  [offalt] "i" (lc_preempt + LOWCORE_ALT_ADDRESS),
> > > -		  "m" (((struct lowcore *)0)->preempt_count));
> > > +		  "m" (((struct lowcore *)0)->preempt.count));
> > >  	return count;
> > >  }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.