On Fri, 26 Jan 2001, Joe deBlaquiere wrote: > Ralf gently pointed out that there was the possibility of needing to > fault the page for *p, which couldn't occur with ints off. So here's an > updated version... I don't think you get a page fault that would lead to an inconsistent state. See below: > /* actually _do_ the exchange */ > save_and_cli(flags); > errno |= __get_user(tmp, p); You may get a page fault on accessing *p here. Not a problem. When we return to the faulting "lw" instruction, it will fetch the current value of *p whether it changed before or not. Also the TLB will get filled here if needed. > errno |= __put_user(arg2, p); You may get a page fault on accessing *p here. But since interrupts are disabled since getting back from the page fault at the above "lw" instruction, no context switch could have happened, so the page *p lies on is already swapped in. So the only reason of the fault might be write protection (read protection was already checked by the fault above). In this case we don't care if *p changed meanwhile as we won't write it anyway. TLB got already filled above so no TLB fault will happen. > restore_flags(flags); Remember we are running UP. If anyone sees any other page fault scenario I would be pleased to read it. Maciej -- + Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: macro@ds2.pg.gda.pl, PGP key available +