Volatile pointers of PTE

25 views
Skip to first unread message

Sanguk Park

unread,
Jan 2, 2020, 3:53:10 AM1/2/20
to Hafnium
Hello,
Currently every access of PTE is done by non-volatile pointers in mm.c. However, I think they should be volatile to prevent compiler's optimization (or, use WRITE_ONCE-like macros in Linux.)

What do you think of this?

Andrew Scull

unread,
Jan 2, 2020, 6:26:17 AM1/2/20
to Sanguk Park, Hafnium
This is an area that I have been wondering about.

After updating the tables, there is an invalidation of the TLB. That includes a data barrier to ensure the CPU has completed the writes to the table and the barrier is `__asm__ volatile` to ensure the compiler doesn't move things after the barrier. The point of invalidation is the point at which we say that the tables are in their final state so it doesn't seem to matter exactly the order that writes happen within the existing constraints?

I've also wondered about the need for cache maintenance. We currently don't flush the tables or mark them as uncached memory but we haven't run into any issues with it yet. That would suggest the MMU is also using the cache however I haven't confirmed this yet in the documentation so any pointers on that would be appreciated.

Thanks
Andrew

--
You received this message because you are subscribed to the Google Groups "Hafnium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hafnium-discu...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hafnium-discuss/a1ee591c-3a4c-4586-b0c5-0080a27fa4a2%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages