Thursday, April 30, 2009

MIPS N32 firefox in acid3 test

My quest for MIPS N32 firefox could finally come to an end, since I just got it scores the same as X86 firefox.

Remember I said it would encounter bus error on a few websites in my last related post. But I didn't plan to look into this issue before dealing with cache aliasing problem.

However, since Rayson Ho helped me to locate the exact cause of this issue, I decided to finish it first.

The problem is caused by unaligned access of ldc1/sdc1 instruction. These two instructions' operand must be 8 bytes aligned. But when crashing, the operand is only 4 bytes aligned.

After some discussion and experimenting, I found a workaround for sina.com.cn crashing problem. Yeah, a padding pointer sounds scary and fragile, but it did work. Before posting any comment to this, please make sure you have read all the emails in that thread.

Then Fai Wong reported to me that it still crash in acid3 test. So I took another look. This time the problem happened in a different location, and it is harder to solve. Because the object in question sometimes is 8 bytes aligned, but sometimes it is only 4 bytes aligned, which does not make any sense, since the object contains double variable. So, either way, the double variable just can't get aligned in both case. I thought of kernel exception handler. I did come up with a patch and it worked! But since Ralf refused to accept it, I had to move on. And I found the reason is because of the way the memory is allocated - placement new. Thanks to LI Daobing for telling me this. And this is what the final patch looks like.

Labels: , , ,

Tuesday, April 14, 2009

Ftrace is working now on my loongson box

http://www.linux-mips.org/archives/linux-mips/2009-04/msg00112.html

So I confirmed that this MIPS ftrace support is really working. Thanks to Wu Zhangjin (吴章金). However, I have no interest in finding out what kind of difference between my loongson2f patch and wu's caused wu's ftrace patch does not work on top of my loongson 2f patch. What I would like to see now is to get loongson2f patch merged into mainline.

Plus, I wish I could make loongson linux to be able to use 4k page(Now, loongson could only use 16k page in order to avoid d-cache aliasing). I have already started working on it now. Even if it turns out that I can't, I could tell others what I have done in order to achieve this goal. And by that time, I would've got a much deeper understanding of Linux's memory management subsystem.

Labels: ,