Subject: Re: [PATCH] selftests/powerpc: Check FP/VEC on exception in TM

From: Cyril Bur <[email-masked]>
Date: Mon, 06 Nov 2017 10:33:06 +1100

On Fri, 2017-11-03 at 10:28 -0200, Gustavo Romero wrote:
> Hi Cyril!
> 
> On 01-11-2017 20:10, Cyril Bur wrote:
> > Thanks Gustavo,
> > 
> > I do have one more thought on an improvement for this test which is
> > that:
> > +	/* Counter for busy wait *
> > +	uint64_t counter = 0x1ff000000;
> > is a bit fragile, what we should do is have the test work out long it
> > should spin until it reliably gets a TM_CAUSE_FAC_UNAV failure and then
> > use that for these tests.
> > 
> > This will only become a problem if we were to change kernel heuristics
> > which is fine for now. I'll try to get that added soon but for now this
> > test has proven too useful to delay adding as is.
> 
> I see. Yup, 'counter' value was indeed determined experimentally under many
> different scenarios (VM and BM, different CPU loads, etc). At least if the
> heuristics changes hurting the test it will catch that pointing out that
> the expected failure did not happen, like:
> 
> Checking if FP/VEC registers are sane after a FP unavailable exception...
> If MSR.FP=0 MSR.VEC=0:
>     Expecting the transaction to fail, but it didn't
>     FP ok VEC ok
> ...
> 
> So it won't let the hurting change pass fine silently :-)
> 

Yeah, all for merging as is.

It would be nice so that when someone does  make a heuristic change
they don't also have to go fix tests - there is nothing more annoying
than a fragile test suite.

> 
> > > Signed-off-by: Gustavo Romero <[email-masked]>
> > > Signed-off-by: Breno Leitao <[email-masked]>
> > > Signed-off-by: Cyril Bur <[email-masked]>
> 
> Thanks a lot for reviewing it.
> 
> Cheers,
> Gustavo
>