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: <0e670f81-e252-2345-60cd-38dea0603021@intel.com>
Date:   Tue, 24 Nov 2020 08:58:01 +0100
From:   Björn Töpel <bjorn.topel@...el.com>
To:     Jakub Kicinski <kuba@...nel.org>,
        Björn Töpel <bjorn.topel@...il.com>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org,
        magnus.karlsson@...el.com, ast@...nel.org, daniel@...earbox.net,
        maciej.fijalkowski@...el.com, sridhar.samudrala@...el.com,
        jesse.brandeburg@...el.com, qi.z.zhang@...el.com,
        edumazet@...gle.com, jonathan.lemon@...il.com, maximmi@...dia.com
Subject: Re: [PATCH bpf-next v3 01/10] net: introduce preferred busy-polling

On 2020-11-24 01:04, Jakub Kicinski wrote:
> On Thu, 19 Nov 2020 09:30:15 +0100 Björn Töpel wrote:
>> +	/* The NAPI context has more processing work, but busy-polling
>> +	 * is preferred. Exit early.
>> +	 */
>> +	if (napi_prefer_busy_poll(n)) {
>> +		if (napi_complete_done(n, work)) {
>> +			/* If timeout is not set, we need to make sure
>> +			 * that the NAPI is re-scheduled.
>> +			 */
>> +			napi_schedule(n);
>> +		}
>> +		goto out_unlock;
>> +	}
> 
> Do we really need to go through napi_complete_done() here?
> 
> Isn't it sufficient to check:
> 
> 	if (napi_prefer_busy_poll(n) &&
> 	    hrtimer_active(&n->timer)) // not 100% sure this is the
> 	                               // right helper for the check
> 
> If timer is scheduled it will fire and worst case sirq will kick back
> in after timeout. napi_complete_done() should had been called by the
> driver already to schedule the timer. If the driver doesn't call
> napi_complete_done() we should not allow it to use busy_poll() anyway.
> 

No, it's not. For a heavy traffic load, the napi_complete_done() will
never be called by the driver. It'll just keep on spinning in the
ksoftirqd. This code is to force out of that loop, so we need to call
napi_complete_done() explicitly (which will set the timeout).

Without the explicit napi_complete_done(), the ksoftirqd will not stop,
and the busy-polling will never allow to enter.


Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ