Skip to contentSkip to conversation

VC exceptions

DISCUSSION Kevin D. Kissell 2 participants 2 messages Apr 30, 2000 – May 1, 2000 MIPS

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · Ralf Baechle
Quoted 8 lines · Kevin D. Kissell

It's a thing that can happen whenever caches are virtually indexed (for speed) but physically tagged (for correctness), and caches get large enough for the algorithm to be wrong once in a while. They can be avoided with a little thought and overhead in the assignment of physical pages to virtual addresses. Gimme a day or so to look at the code, and I'll propose a fix for Linux...

Sadly, I've been handed a more urgent (and more to the point, paid) assignment, and won't be able to do anything about this a quickly as I would like. I note that you've posted a patch, Ralf, so one can hope that it will deal with Florian's problem.

Quoted 4 lines

Apropriate placement of mappings in the address space isn't always possible. MAP_FIXED is one example. Aliases in the page cache are harder to handle. If one of the page cache mappings is writable then readers may even observe stale data or in worst case stale data being written to disk.

mmap() is allowed to fail. I would think that, if someone tries to force an unsafe mapping, one should give them EINVAL if one doesn't want to deal with the special case otherwise, or create a copy-on-write clone in a safe physical page if one wants to be extra-specially nice...

Kevin K.

#1 lore raw
Quoted 9 lines · Kevin D. Kissell
Quoted 4 lines

Apropriate placement of mappings in the address space isn't always possible. MAP_FIXED is one example. Aliases in the page cache are harder to handle. If one of the page cache mappings is writable then readers may even observe stale data or in worst case stale data being written to disk.

mmap() is allowed to fail. I would think that, if someone tries to force an unsafe mapping, one should give them EINVAL if one doesn't want to deal with the special case otherwise, or create a copy-on-write clone in a safe physical page if one wants to be extra-specially nice...

I'm only worried because I don't know how much software such a change would break.

IRIX uses something they call page ownership switching. Essentially they ensure that only mappings of one colour are accessible at any time. Accessing a page's mapping of a different colour will make the mm flush caches, make the old colour inaccessible and the new colour accessible in the page tables. That requires a reverse mapping of physical to virtual addresses, something that Linus so far has always refused to accept.

Ralf