[RFC,00/12] Deal with TM on kernel entry and exit

Breno Leitao leitao at debian.org
Thu Jun 14 08:38:42 AEST 2018


Hi Cyril,

On 02/19/2018 09:22 PM, Cyril Bur wrote:
> This is very much a proof of concept and if it isn't clear from the
> commit names, still a work in progress.

> I believe I have something that works - all the powerpc selftests
> pass. I would like to get some eyes on it to a) see if I've missed
> anything big and b) some opinions on if it is looking like a net
> improvement.

I started to look at this patchset. The patchset apply cleanly on top of the
current kernel and I started to run some tests.

It seems there is a different behavior when there is a trap (as a illegal
instruction or a 'trap' instruction) inside the transaction.

In this case, the signal handler does not seem to be called, and and the task
segfaults. On current upstream, the signal handler is called and the program
can continue.

4.17 pristine
-------------
	$ ./illegal
	Failure

4.17 plus your patches
----------------------
	$ ./illegal
	[1]    2504 segmentation fault  ./illegal


Here is a minimal example that is able to recreate this behaviour:

	#include <stdio.h>
	#include <signal.h>
	
	int htm(){
		asm goto ("tbegin.  		\n\t"
			  "beq %l[failure]	\n\t"
			  "li 3, 3		\n\t"
			  "trap 		\n\t"
			  "tend. 		\n\t"
			  : : : : failure);
	
		return 0;
	failure:
		printf("Failure\n");
		return 1;
	}
	
	void signal_handler(int signo, siginfo_t *si, void *data) {
		// Do nothing
	}
	
	int main(){
		struct sigaction sa;
	        sa.sa_flags = SA_SIGINFO;
	        sa.sa_sigaction = signal_handler;
	
	        sigaction(SIGTRAP, &sa, NULL);
	        sigaction(SIGILL,  &sa, NULL);
	
		return htm();
	}


More information about the Linuxppc-dev mailing list