[RFC PATCH 11/11] selftests/powerpc: Adapt the test

Breno Leitao leitao at debian.org
Tue Oct 2 03:50:57 AEST 2018


Hi Mikey,

On 09/28/2018 02:25 AM, Michael Neuling wrote:
>> Perfect, and if the transaction fail, the CPU will rollback the changes and
>> restore the checkpoint registers (replacing the r3 that contains the pid
>> value), thus, it will be like "getpid" system call didn't execute.
> 
> No.  If we are suspended, then we go back right after the sc. We don't get
> rolled back till the tresume.

Yes, but the test code (below) just run tresume after 'sc'. i.e, the syscall
will execute, but there is a tresume just after the syscall, which will cause
the transaction to rollback and jump to "1:" label, which will replace r3.
with -1.

So, the difference now (with this patchset) is that we are calling
treclaim/trecheckpoint in kernel space, which will doom the transaction. It
was not being done before, thus, the test was passing and it is not anymore.

Anyway,  the other way to check for it is calling 'blr' just after 'sc' (
before 'tresume.'), and then tresume after checking if pid == getpid().

If you prefer this method, I can implement it.

>> For this test specifically, it assumes the syscall didn't execute if the
>> transaction failed. Take a look:
>>
>> 	FUNC_START(getppid_tm_suspended)
>> 		tbegin.
>> 		beq 1f
>> 		li      r0, __NR_getppid
>> 		tsuspend.
>> 		sc
>> 		tresume.
>> 		tend.
>> 		blr
>> 	1:
>> 		li      r3, -1
>> 		blr
>>

Thank you!


More information about the Linuxppc-dev mailing list