lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200926122220.GA10735@lenoir>
Date:   Sat, 26 Sep 2020 14:22:20 +0200
From:   Frederic Weisbecker <frederic@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     qianjun.kernel@...il.com, peterz@...radead.org, will@...nel.org,
        luto@...nel.org, linux-kernel@...r.kernel.org,
        laoar.shao@...il.com, qais.yousef@....com, urezki@...il.com
Subject: Re: [PATCH V7 4/4] softirq: Allow early break the softirq processing
 loop

On Sat, Sep 26, 2020 at 12:42:25AM +0200, Thomas Gleixner wrote:
> On Fri, Sep 25 2020 at 02:42, Frederic Weisbecker wrote:
> 
> > On Thu, Sep 24, 2020 at 05:37:42PM +0200, Thomas Gleixner wrote:
> >> Subject: softirq; Prevent starvation of higher softirq vectors
> > [...]
> >> +	/*
> >> +	 * Word swap pending to move the not yet handled bits of the previous
> >> +	 * run first and then clear the duplicates in the newly raised ones.
> >> +	 */
> >> +	swahw32s(&cur_pending);
> >> +	pending = cur_pending & ~(cur_pending << SIRQ_PREV_SHIFT);
> >> +
> >>  	for_each_set_bit(vec_nr, &pending, NR_SOFTIRQS) {
> >>  		int prev_count;
> >>  
> >> +		vec_nr &= SIRQ_VECTOR_MASK;
> >
> > Shouldn't NR_SOFTIRQS above protect from that?
> 
> It does, but that's wrong. The bitmap size in that for_each() loop must
> obviously be SIRQ_PREV_SHIFT + NR_SOFTIRQS for this to work.

Ah! I see, I thought you were ignoring the high bits on
purpose, hence my questions after about pending.

> 
> >> +	} else {
> >> +		/*
> >> +		 * Retain the unprocessed bits and swap @cur_pending back
> >> +		 * into normal ordering
> >> +		 */
> >> +		cur_pending = (u32)pending;
> >> +		swahw32s(&cur_pending);
> >> +		/*
> >> +		 * If the previous bits are done move the low word of
> >> +		 * @pending into the high word so it's processed first.
> >> +		 */
> >> +		if (!(cur_pending & SIRQ_PREV_MASK))
> >> +			cur_pending <<= SIRQ_PREV_SHIFT;
> >
> > If the previous bits are done and there is no timeout, should
> > we consider to restart a loop?
> 
> We only enter this code path if there was a timeout. Otherwise pending
> would be 0.

Right with SIRQ_PREV_SHIFT + NR_SOFTIRQS now that whole makes sense!

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ