tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: percpu_foreach() does not execute remotely



> Date: Mon, 27 Jan 2020 18:36:17 -0800
> From: Jason Thorpe <thorpej%me.com@localhost>
> 
> So, percpu_foreach() is pretty handy for enumerating data that's
> managed on a per-cpu basis.  But there's a problem ... it does not
> actually execute the callback on the remote CPU, instead getting a
> pointer to the remote data and accessing it directly.
> 
> Does this seem like a problem to anyone else?  I think we need to at
> least provide a variant that is safe to use with xcalls (I can see
> an argument for having the current version that does not rely on
> xcalls).

Why not just use xc_broadcast?  Does a cross-calling version of
percpu_foreach really help simplify much or clarify anything?

I count at most two lines of code that it would save (and actually
only one of them is technically needed because you could safely use
percpu_getptr_remote in this context):

	xc_wait(xc_broadcast(0, foo_xc, percpu, NULL));

foo_xc(void *vpercpu, void *vcookie)
{
	struct percpu *percpu = vpercpu;
	struct foo_cpu *foo = percpu_getref(percpu);	// ---

	...
	percpu_putref(percpu);				// ---
}


Home | Main Index | Thread Index | Old Index