share a bug: remember flush your TLB when writing page table

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
miaowei
Member
Member
Posts: 84
Joined: Wed Dec 18, 2013 9:10 am

share a bug: remember flush your TLB when writing page table

Post by miaowei »

I know many people will ignore this post when they see the title, because they know it. But I still post here, because i hope to help some one like me.
I have wasted over a week on a bug due to this.(Don't laugh at me)
At first, i thought bochs is not that clever to emulate TLB, but it does.
And I didn't pay much attention to TLB(I believe it's transparent), this is another cause .
and I also want to share my happiness with you now ^.^
(Beijing night 8:38)
cds84
Posts: 14
Joined: Thu Jan 13, 2011 7:20 am

Re: share a bug: remember flush your TLB when writing page t

Post by cds84 »

Yup...

And after flushing the TLB, depending on the architecture, you may also need to invalidate the data-cache, instruction cache, and branch predictor.
Maybe even flush the pipeline!
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: share a bug: remember flush your TLB when writing page t

Post by Brendan »

Hi,
miaowei wrote: I have wasted over a week on a bug due to this.(Don't laugh at me)
TLB invalidation bugs are nearly always "Heisenbugs" - random/confusing symptoms that are different on different hardware and disappear or change when you try to investigate; where it's painfully difficult to figure out the actual cause.

One week to find a bug like this isn't unusual at all.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply