Some questions about pager

Adam Lackorzynski adam at os.inf.tu-dresden.de
Wed Nov 24 14:29:33 CET 2010


On Mon Nov 22, 2010 at 15:53:12 +0100, BERTRAND Joel wrote:
> Adam Lackorzynski a écrit :
> >
> >On Thu Nov 18, 2010 at 19:04:15 +0100, BERTRAND Joel wrote:
> >>	I have check in http://hg.l4ka.org/l4ka-pistachio-ref/l4-x2.pdf,
> >>and I think that mapitem makes sense.
> >>
> >>	When a pagefault occurs, I obtain :
> >>
> >>vms$pagefault(addr:47fe8, s:2000) [priv=4]
> >>memsection 46000 47fff
> >>1 0
> >>V=46000 P=9c000
> >>s0: got msg from 0x0000003a00000001, (0xffffffffc170,
> >>0x0000000000000001, 0x0000000000989680)
> >>s0: got msg from 0x0000003a00000001, (0xffffffffffa0,
> >>0x000000000009c0d7, 0x0000000000000000)
> >>s0: allocate_page (tid: 0x3a00000001, addr: 9c000, log2size: 13)
> >>%MEM-I-ACCMAP, accepting mapping
> >>%MEM-I-ACCMAP, virtual  $0000000000046000 - $0000000000047FFF
> >>%MEM-I-ACCMAP, physical $000000000009C000 - $000000000009DFFF
> >>After vms$sigma0_map
> >>
> >>	Thus, virtual region 46000-47FFF is mapped in 9C000-9DFFF memory
> >>(and mapping is accepted). Mapitem seems to be required.
> >
> >3 parties are involved. The faulting program, roottask, and sigma0.
> >As far as I (quickly) read the code: roottask is requesting sigma0 to
> >map memory to 46000 within its own virtual address space. Is this memory
> >accessible by roottask, i.e. can roottask read/write from/to 46000? This
> >is required so that roottask can map it further to other tasks. Also
> >'virt' seems to be the fpage for the faulting task but is also used for
> >the sigma0 call, i.e. the memory is mapped there in roottask. Might this
> >clash with the roottask virtual memory?
> 
> 	Thanks for your answer. I think I have found one of my problem, but
> I don't have a running pager. My mistake should be between physical
> and virtual addresses.
> 
> 	I suppose that faulty address in pagefault protocol is a virtual
> address. A thread tries to access to a unmapped memory.

Yes, the fault address is virtual.
 
> 	In this pagefault function, I have to find a free memory page.
> Thus, my function looks for small aligned page that contains
> requested address. It looks for a free physical page, and sends a
> mapitem message to faulty thread. My new code is available at:
> 
> http://www.freevms.net/gitweb/?p=FreeVMS.git;a=blob;f=sources/freevms/vm/vm_pagefault.c
> 
> 	I understand why faulty task sends a pagefault signal. I think my
> mapitem answer is correct. But I don't understand how assign
> physical page to virtual one.

Actually, there aren't any physical addresses really. What's special is
that sigma0 has identity mappings (only) and thus for sigma0 a virtual
address is same as the corresponding physical address. The same is
usually true for the roottask. Now if the app page-faults, the roottask
gets this page-fault and needs to send some reasonable mapping back so
that the app can continue. For that to work, roottask needs to have that
memory available in its task. This mapping basically says map the memory
at virtual address soandso in my task to that app at virtual address
soandso there. Consequently you need a representation of all the client
memory in your roottask, i.e. when you get a page-fault from a client
you look up this address in some data structure to find the virtual
address in roottask and map it to the app. Initially roottask is getting
this memory from sigma0.


Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list