|
From: Peter B. <be...@vn...> - 2013-07-15 17:03:49
|
On Mon, 2013-07-15 at 09:16 -0700, Carl E. Love wrote: > Remember, this patch was for the proposal to just replace the tbegin > with a branch to execute the failure path for the TM. The tbegin and > tend instructions would not actually get executed. Thus we would need > to go find the address for the failure handler and can not get it from > the TM registers. For Julian's proposal (1), I do not think we should replace the tbegin. with a branch. Instead, we should implement the tbegin. instruction, but in a way that it always returns failure. Since the hw tbegin. initializes TFHAR to CIA+4, you don't need to branch anywhere, just set cr0 to 0x2, and initialize the HTM SPRs like you are currently doing and then continue on to the next instruction. Nothing more is needed. > > Remember that tbegin. initializes the TFHAR to CIA+4, so you > > just have to set failure_tgt to the address of nextInstr. > > If we execute the tbegin, which is not done according to proposal 1. Julian's proposal (1) at a high level is just to make the transaction begin instruction fail so that we always execute the failure path. That doesn't mean we have to replace it with a branch. As I said above and I thought was clear from some of my earlier posts, we should implement a simple tbegin. instruction and execute it. > > Your comment is correct, but you are incorrectly clearing cr0, > > which signifies the tbegin. succeeded. You need to initialize > > it to 0x2. > > Well we are trying to make it execute the failure path, that was the > first proposal, so yes we do need to clear it. No. To execute the failure path, you need to set cr0 to 0x2 to signify a transaction begin failure. If clearing cr0 makes you execute the failure path, then you have a bug somewhere else you need to track down. Probably it is due to you (incorrectly) grabbing the "failure address" from the branch and the compiler has changed the "beq <failure_path>" with a "bne <success_path>". So what you think is the address of the failure handler is really the address of the success handler. In that case, clearing cr0 would make you execute the failure path, but that is just two bugs causing you to accidentally doing the right thing. I will say this more more time so we're all on the same page. For Julian's (1) proposal, we (Power) should implement and execute a tbegin. instruction. It should do: 1) set cr0 to 0x2 2) Initialize TFHAR to CIA+4 3) Initialize TEXASR 4) Initialize TFIAR (probably to CIA, ie, the address of tbegin.) 5) Continue executing at the next instruction. There really isn't anything more it needs to do. Peter |