On Thu, Jan 20, 2005 at 19:57:43 +0000, girish shilamkar wrote: > >So my question is: why did this ever work? My theory is that the > >process' page tables are still in the MMU when the driver is called, >so > >the virtual address space is technically still valid, even if the kernel > >won't admit it. Am I right? If so, are the page tables not flushed No. It's worse than that. They are actualy still installed. Since kernel is mapped in all page tables ever created, it simply uses the one that happens to be in use. > >because it would affect performance? Is there a way I can manual >flush Yes. Interrupts would be unusably slow if they should switch page tables. > >the page tables in my driver in order to find all the places in my >code > >where user virtual addresses are used? No, but see the previous post about sparse. > user space virtual address are always valid even in kernel e.g > sys_read( char * _user buff, pos, count); requires to access user > buffer to perform read. No, they are not. It depends on the architecture. On i386 in recent kernels they happen to be valid. On other architectures and other kernel versions they might or might not be. Eg. user-mode-linux has two modes (skas and tt) and they are only valid in the later. > if page tables r flushed then all info about valid pages will be > lost.and again accessin those pages will cause lots of page faults. I believe flushing is done automaticaly when you switch the tables. You don't want to switch page tables though. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature