[PATCH v4 11/13] task_isolation: net: don't flush backlog on CPUs running isolated tasks

Marcelo Tosatti mtosatti at redhat.com
Fri Jan 22 09:13:20 EST 2021


On Thu, Oct 01, 2020 at 04:47:31PM +0200, Frederic Weisbecker wrote:
> On Wed, Jul 22, 2020 at 02:58:24PM +0000, Alex Belits wrote:
> > From: Yuri Norov <ynorov at marvell.com>
> > 

> > so we don't need to flush it.
> 
> What guarantees that we have no backlog on it?

>From Paolo's work to use lockless reading of 
per-CPU skb lists

https://www.spinics.net/lists/netdev/msg682693.html

It also exposed skb queue length to userspace

https://www.spinics.net/lists/netdev/msg684939.html

But if i remember correctly waiting for a RCU grace
period was also necessary to ensure no backlog !?! 

Paolo would you please remind us what was the sequence of steps?
(and then also, for the userspace isolation interface, where 
the application informs the kernel that its entering isolated
mode, is just confirming the queues have zero length is
sufficient?).

TIA!

> 
> > Currently flush_all_backlogs()
> > enqueues corresponding work on all CPUs including ones that run
> > isolated tasks. It leads to breaking task isolation for nothing.
> > 
> > In this patch, backlog flushing is enqueued only on non-isolated CPUs.
> > 
> > Signed-off-by: Yuri Norov <ynorov at marvell.com>
> > [abelits at marvell.com: use safe task_isolation_on_cpu() implementation]
> > Signed-off-by: Alex Belits <abelits at marvell.com>
> > ---
> >  net/core/dev.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 90b59fc50dc9..83a282f7453d 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -74,6 +74,7 @@
> >  #include <linux/cpu.h>
> >  #include <linux/types.h>
> >  #include <linux/kernel.h>
> > +#include <linux/isolation.h>
> >  #include <linux/hash.h>
> >  #include <linux/slab.h>
> >  #include <linux/sched.h>
> > @@ -5624,9 +5625,13 @@ static void flush_all_backlogs(void)
> >  
> >  	get_online_cpus();
> >  
> > -	for_each_online_cpu(cpu)
> > +	smp_rmb();
> 
> What is it ordering?
> 
> > +	for_each_online_cpu(cpu) {
> > +		if (task_isolation_on_cpu(cpu))
> > +			continue;
> >  		queue_work_on(cpu, system_highpri_wq,
> >  			      per_cpu_ptr(&flush_works, cpu));
> > +	}
> >  
> >  	for_each_online_cpu(cpu)
> >  		flush_work(per_cpu_ptr(&flush_works, cpu));
> 
> Thanks.




More information about the linux-arm-kernel mailing list