[Skiboot] [PATCH] Add in new OPAL call to flush the L2 and L3 caches.

Oliver oohall at gmail.com
Fri Nov 9 15:00:31 AEDT 2018


On Fri, Nov 9, 2018 at 1:44 PM Rashmica Gupta <rashmica.g at gmail.com> wrote:
>
> On Mon, 2018-11-05 at 12:57 +1100, Oliver wrote:
> > >
>
> ...
>
> > On Mon, Oct 29, 2018 at 5:19 PM Rashmica Gupta <rashmica.g at gmail.com>
> > wrote:
> >
> > As a final comment, it seems like we might be better off making this
> > a
> > multi-pass thing. Currently we walk the list of CPUs once and wait
> > for
> > the purge to finish on each before continuing. Since we don't really
> > have a good error handling story (I guess you fall back to doing a
> > dcbf loop in linux?) it might make sense to do something like:
> >
> > for_each_cpu()
> >    start_l2_purge()
> > for_each_cpu()
> >    wait_for_l2_purge()
> > for_each_cpu()
> >    start_l3_purge()
> > for_each_cpu()
> >    wait_for_l3_purge()
> >
> > and bail out if we hit an error at any point. As a general rule we
> > want OPAL calls to be handled in microseconds so since opal runs in
> > real mode with interrupts disabled. I'm not sure how fast a purge is,
> > but if it's a significant fraction of the 2 millisecond timeout
> > window
> > then we might end up in OPAL for dozens for milliseconds in the worst
> > case. This might just be micro-optimising though since I expect this
> > is only going to be called once in a blue moon, but it's something to
> > consider.
> >
>
> Good point... Even implemented as you suggested, i've seen it take 5-
> 6ms for the whole call... Perhaps I should split it up into 2 opal
> calls: start_l2_l3_cache_purge() and poll_l2_l3_cache_purge()?
>
> Or maybe with the format you suggested, start_cache_purge(pir,
> cache_mask) and poll_cache_purge(pir, cache_mask).

An async completion might make more sense here. They're a little
convoluted but the basic process is:

1) pass an async_token (magic number) in the OPAL call
2) schedule a timer inside of OPAL to check on the async job
3) return from the opal call with OPAL_ASYNC_COMPLETION
4) check on the purge state in the timer's callback function
5) when the async job is done, return use opal_msg() to send an
OPAL_MSG_ASYNC_COMP message.

The calling thread in linux can sleep while waiting for the async
completion message. If you want an example have a look at
core/i2c.c:opal_i2c_request() in skiboot and the
drivers/i2c/busses/i2c-opal.c in linux.

> > > _______________________________________________
> > > Skiboot mailing list
> > > Skiboot at lists.ozlabs.org
> > > https://lists.ozlabs.org/listinfo/skiboot
>


More information about the Skiboot mailing list