Skip to contentSkip to conversation

Guest OS without paging

DISCUSSION Ivan Kelly 3 participants 12 messages Nov 7, 2005 – Nov 9, 2005

lore
Share & tools
lore

Ivan Kelly

author
#0 lore raw

Hi,
Is it possible to have xen run a guest OS that doesn't use paging. Can I present just a continuous block of memory, that just represents the real memory available to the domain, to the guest, and not the expanded amount that paging would allow, so that in the guest I dont have to worry about maintaining a page table and such.
Best regards
Ivan Kelly

#1 lore raw
Quoted 5 lines

Is it possible to have xen run a guest OS that doesn't use paging. Can I present just a continuous block of memory, that just represents the real memory available to the domain, to the guest, and not the expanded amount that paging would allow, so that in the guest I dont have to worry about maintaining a page table and such.

Well... the guest OS has to run in protected mode, so there has to be a page table somewhere... But you don't have to do anything fancy with it.

Is this for a custom guest? The domain builder will give you a set of bootstrap pagetables - this might even be enough for your if your guest OS has tiny memory requirements. If you need more, your guest should probably build one pagetable at startup that maps all of the available memory, then use that table for everything.

Does that answer your question?

Cheers,
Mark

author
#2 lore raw
Quoted 5 lines

Is this for a custom guest? The domain builder will give you a set of bootstrap pagetables - this might even be enough for your if your guest OS has tiny memory requirements. If you need more, your guest should probably build one pagetable at startup that maps all of the available memory, then use that table for everything.

im porting minix, so the custom guest will be that. Im having to create a new builder for it, because it's a.out format and only compiles with amsterdam compiler kit. porting to gcc would be quite a big job. the kernel image itself is also a strange format, not just a.out, but multiple a.out processes concatenated together. For these reasons i decided a new builder was needed. could I get the builder to map all the available memory into the bootstrap pagetables?
Regards
Ivan Kelly

#3 lore raw

A minix version which support paging is out there. www.minix-vmd.org

Best wishes,

Gabriel Gonzalez.

Quoted 20 lines · Ivan Kelly
Quoted 5 lines

Is this for a custom guest? The domain builder will give you a set of bootstrap pagetables - this might even be enough for your if your guest OS has tiny memory requirements. If you need more, your guest should probably build one pagetable at startup that maps all of the available memory, then use that table for everything.

im porting minix, so the custom guest will be that. Im having to create a new builder for it, because it's a.out format and only compiles with amsterdam compiler kit. porting to gcc would be quite a big job. the kernel image itself is also a strange format, not just a.out, but multiple a.out processes concatenated together. For these reasons i decided a new builder was needed. could I get the builder to map all the available memory into the bootstrap pagetables?
Regards
Ivan Kelly

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Ivan Kelly
Quoted 1 line

im porting minix, so the custom guest will be that.

Ah, cool! It'd be nice to have Minix running.

Quoted 7 lines

Im having to create a
new builder for it, because it's a.out format and only compiles with amsterdam compiler kit. porting to gcc would be quite a big job. the kernel image itself is also a strange format, not just a.out, but multiple a.out processes concatenated together. For these reasons i decided a new builder was needed. could I get the builder to map all the available memory into the bootstrap pagetables?

IMO, if you really need a Minix-specific builder, you might as well have it set up the page tables for you too. This will probably make life simpler for development, in any case.

Cheers,
Mark

author
#5 lore raw
Quoted 3 lines

IMO, if you really need a Minix-specific builder, you might as well have it set up the page tables for you too. This will probably make life simpler for development, in any case.

ok, so in this scenario, id have to create a page table with a 1-1 mapping of page frames to page table entries in the builder? would I still need to put code in the minix kernel itself to handle page faults, or is it possible to have all pages loaded from start of day, but calling something in the builder? Regards
Ivan

#6 lore raw
Quoted 6 lines
Quoted 3 lines

IMO, if you really need a Minix-specific builder, you might as well have it set up the page tables for you too. This will probably make life simpler for development, in any case.

ok, so in this scenario, id have to create a page table with a 1-1 mapping of page frames to page table entries in the builder?

That would give you a flat linear memory space, enabling you to largely ignore the fact that paging is active...

Quoted 4 lines

would I still need to
put code in the minix kernel itself to handle page faults, or is it possible to have all pages loaded from start of day, but calling something in the builder?

I guess I'm not clear what memory model you need for Minix, can you clarify? What version of Minix is this? Does it really not do any virtual memory of its own? Does it do any tricks at all (demand paging? page sharing?), or does it run unpaged or something else?

Domains get a hard allocation of real memory, so when the pages get populated is entirely up to the guest; Xen won't interfere.

If you essentially want to pretend you've got a flat, unpaged address space then you should be able to just be able to build a set of page tables (for instance in your custom builder) and then pretend they're not there. Just remember that you can't use the very top part of the address space because Xen will be mapped there.

If Minix actually expects to use page tables for something then you'll have to do more work in the memory management department to make it work under Xen...

HTH,
Mark

author
#7 lore raw
Quoted 4 lines · Mark Williamson

I guess I'm not clear what memory model you need for Minix, can you clarify? What version of Minix is this? Does it really not do any virtual memory of its own? Does it do any tricks at all (demand paging? page sharing?), or does it run unpaged or something else?

well, minix uses segmentation but doesn't use paging at all, because it's build to be portable and not all processers have a mmu unit(i think the arm doesn't and such). Im using minix 3.

Quoted 3 lines

Domains get a hard allocation of real memory, so when the pages get populated is entirely up to the guest; Xen won't interfere.

What about page faults? Will I have to have to write code to handle these, or can I assume that since im only ever using memory thats alreayd mapped, page faults wont occur?

Quoted 6 lines

If you essentially want to pretend you've got a flat, unpaged address space then you should be able to just be able to build a set of page tables (for instance in your custom builder) and then pretend they're not there. Just remember that you can't use the very top part of the address space because Xen will be mapped there.

Thats exactly what I want. Does the 64M address space need to have entries in my page table or can i just make my guest's pagetable from 64M-xxM. Also, is there are any pages allocated in this 64M address space, will they my allocated from the domains pool of page frames, or from dom0's? Best regards
Ivan

#8 lore raw
Quoted 8 lines
Quoted 4 lines

I guess I'm not clear what memory model you need for Minix, can you clarify? What version of Minix is this? Does it really not do any virtual memory of its own? Does it do any tricks at all (demand paging? page sharing?), or does it run unpaged or something else?

well, minix uses segmentation but doesn't use paging at all, because it's build to be portable and not all processers have a mmu unit(i think the arm doesn't and such). Im using minix 3.

OK, I thought it might be something like that; it does, after all, date back to the days of the XT, etc.

Quoted 6 lines
Quoted 2 lines

Domains get a hard allocation of real memory, so when the pages get populated is entirely up to the guest; Xen won't interfere.

What about page faults? Will I have to have to write code to handle these, or can I assume that since im only ever using memory thats alreayd mapped, page faults wont occur?

If your builder correctly sets up the page table to map all your memory and you never access memory that's not mapped, you'll never get a page fault. "Correctly" here assmes "writable where appropriate" and "NX not set, where appropriate", otherwise you'll get protection violations.

Quoted 4 lines

Thats exactly what I want. Does the 64M address space need to have entries in my page table or can i just make my guest's pagetable from 64M-xxM. Also, is there are any pages allocated in this 64M address space, will they my allocated from the domains pool of page frames, or from dom0's?

Xen wants to be in the top of your address space... For Linux, BSD, etc. this is above where the kernel is mapped (for this reason, the upper limit of the kernel VA space is reduced for the native ports of these OSes). I've no idea what Minix does here. Any pages allocated in that space belong to Xen, not to dom0 or your domain - you never get access to them anyhow. You don't need to care about them...

IIRC, Xen will stick its own entries into the top part of your page table:
just don't use the top part of the VA space and Xen should take care of itself.

Cheers,
Mark

#9 lore raw
In reply to Ivan Kelly
Quoted 3 lines

well, minix uses segmentation but doesn't use paging at all, because it's build to be portable and not all processers have a mmu unit(i think the arm doesn't and such). Im using minix 3.

Out of interest, what exactly does it do with segmentation? Most CPUs don't have segmentation hardware at all... I can imagine ways they might have overlaid it on the flat memory model without affective other ports though... Task isolation? Kernel / user protection?

Cheers,
Mark

Quoted 24 lines
Quoted 2 lines

Domains get a hard allocation of real memory, so when the pages get populated is entirely up to the guest; Xen won't interfere.

What about page faults? Will I have to have to write code to handle these, or can I assume that since im only ever using memory thats alreayd mapped, page faults wont occur?

Quoted 5 lines

If you essentially want to pretend you've got a flat, unpaged address space then you should be able to just be able to build a set of page tables (for instance in your custom builder) and then pretend they're not there. Just remember that you can't use the very top part of the address space because Xen will be mapped there.

Thats exactly what I want. Does the 64M address space need to have entries in my page table or can i just make my guest's pagetable from 64M-xxM. Also, is there are any pages allocated in this 64M address space, will they my allocated from the domains pool of page frames, or from dom0's? Best regards
Ivan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#10 lore raw
Quoted 4 lines · Mark Williamson

Out of interest, what exactly does it do with segmentation? Most CPUs don't have segmentation hardware at all... I can imagine ways they might have overlaid it on the flat memory model without affective other ports though... Task isolation? Kernel / user protection?

I haven't looked too deeply into the segmentation, but it's using a GDT so it is doing something with it. I'll update you when i find out more. Regards
Ivan

#11 lore raw
Quoted 2 lines

I haven't looked too deeply into the segmentation, but it's using a GDT so it is doing something with it. I'll update you when i find out more.

x86 forces you to set up segmentation whether you actually want to use it or not... It may not be doing anything with it - people who want to ignore segmentation happily create a 0-4Gig segment, then pretend they have a flat (or paged) memory model. Crazy crazy architecture ;-)

Cheers,
Mark