* [uml-devel] copy_from_user in SKAS mode
@ 2005-05-17 23:33 Young Koh
2005-05-18 1:18 ` Jeff Dike
0 siblings, 1 reply; 6+ messages in thread
From: Young Koh @ 2005-05-17 23:33 UTC (permalink / raw)
To: user-mode-linux-devel
Hi,
i'm trying to understand how copy_from_user (and copy_to_user) is
working in SKAS mode. i started from copy_from_user_skas, and followed
the functions. but i kinda got lost and couldn't get the intuition how
data are transferred to the UML kernel, which is a different process.
Could anyone explain how copy_from_user works in SKAS mode? i'd really
appreciate it. Thank you!
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id\x16344&opÌk
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] copy_from_user in SKAS mode
2005-05-17 23:33 [uml-devel] copy_from_user in SKAS mode Young Koh
@ 2005-05-18 1:18 ` Jeff Dike
2005-05-18 13:47 ` Young Koh
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Dike @ 2005-05-18 1:18 UTC (permalink / raw)
To: Young Koh; +Cc: user-mode-linux-devel
On Tue, May 17, 2005 at 07:33:26PM -0400, Young Koh wrote:
> i'm trying to understand how copy_from_user (and copy_to_user) is
> working in SKAS mode. i started from copy_from_user_skas, and followed
> the functions. but i kinda got lost and couldn't get the intuition how
> data are transferred to the UML kernel, which is a different process.
> Could anyone explain how copy_from_user works in SKAS mode? i'd really
> appreciate it. Thank you!
Since UML has no direct access to the process userspace (i.e. process
virtual addresses are meaningless in the kernel), it has to translate
them to physical addresses. So, each page containing a piece of the
incoming buffer is translated into a physical page, and the data copied
from there.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] copy_from_user in SKAS mode
2005-05-18 1:18 ` Jeff Dike
@ 2005-05-18 13:47 ` Young Koh
2005-05-18 15:08 ` Jeff Dike
0 siblings, 1 reply; 6+ messages in thread
From: Young Koh @ 2005-05-18 13:47 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel
> Since UML has no direct access to the process userspace (i.e. process
> virtual addresses are meaningless in the kernel), it has to translate
> them to physical addresses. So, each page containing a piece of the
> incoming buffer is translated into a physical page, and the data copied
> from there.
you mean "physical" to the UML kernel? Because the UML kernel cannot
know about the real physical pages in the host kernel, do you mean
the UML kernel finds out which its (virtual) address maps to the same
real physical page that the user process's address maps to? but the
UML kernel and the user process would have different mappings and
cannot know about each other (if so, its a protection violation
between processes) Could you explain a bit more? Thanks a lot!!!
-Young
>
> Jeff
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id\x16344&opÌk
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] copy_from_user in SKAS mode
2005-05-18 13:47 ` Young Koh
@ 2005-05-18 15:08 ` Jeff Dike
2005-05-18 22:34 ` Young Koh
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Dike @ 2005-05-18 15:08 UTC (permalink / raw)
To: Young Koh; +Cc: user-mode-linux-devel
On Wed, May 18, 2005 at 09:47:37AM -0400, Young Koh wrote:
> you mean "physical" to the UML kernel?
Yes. To the host, it's just normal process virtual memory, but to UML,
that's its physical memory.
> Because the UML kernel cannot
> know about the real physical pages in the host kernel, do you mean
> the UML kernel finds out which its (virtual) address maps to the same
> real physical page that the user process's address maps to? but the
> UML kernel and the user process would have different mappings and
> cannot know about each other (if so, its a protection violation
> between processes) Could you explain a bit more? Thanks a lot!!!
It's exactly the same as the host. There is physical memory mapped into
its address space, and pages from that area are allocated and mapped into
process address spaces as needed. In skas mode, UML has no direct access
to the process address spaces (like the x86 4G/4G split), so it has to
translate the process virtual address into a UML physical address, to which
it does have access, and can copy the data.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] copy_from_user in SKAS mode
2005-05-18 15:08 ` Jeff Dike
@ 2005-05-18 22:34 ` Young Koh
2005-05-19 13:41 ` Blaisorblade
0 siblings, 1 reply; 6+ messages in thread
From: Young Koh @ 2005-05-18 22:34 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel
Ok, let me have an example.
suppose a user argument has virtual address 0xa0, corresponding UML
physical address 0xb0, and real physical address 0x10. so, when the
user process tries to access 0xa0 for the first time, the UML kernel
should let host kernel know there will be 0xa0 -> 0x10 mapping. how
does the UML kernel make another process's address map to the same
physical page it has? and how does the UML kernel keep track of 0xa0
-> 0xb0 mapping? maybe the same page table mechanism as host Linux? (i
guess so, though)
Thanks a lot!
On 5/18/05, Jeff Dike <jdike@addtoit.com> wrote:
> On Wed, May 18, 2005 at 09:47:37AM -0400, Young Koh wrote:
> > you mean "physical" to the UML kernel?
>
> Yes. To the host, it's just normal process virtual memory, but to UML,
> that's its physical memory.
>
> > Because the UML kernel cannot
> > know about the real physical pages in the host kernel, do you mean
> > the UML kernel finds out which its (virtual) address maps to the same
> > real physical page that the user process's address maps to? but the
> > UML kernel and the user process would have different mappings and
> > cannot know about each other (if so, its a protection violation
> > between processes) Could you explain a bit more? Thanks a lot!!!
>
> It's exactly the same as the host. There is physical memory mapped into
> its address space, and pages from that area are allocated and mapped into
> process address spaces as needed. In skas mode, UML has no direct access
> to the process address spaces (like the x86 4G/4G split), so it has to
> translate the process virtual address into a UML physical address, to which
> it does have access, and can copy the data.
>
> Jeff
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id\x16344&opÌk
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [uml-devel] copy_from_user in SKAS mode
2005-05-18 22:34 ` Young Koh
@ 2005-05-19 13:41 ` Blaisorblade
0 siblings, 0 replies; 6+ messages in thread
From: Blaisorblade @ 2005-05-19 13:41 UTC (permalink / raw)
To: user-mode-linux-devel, Young Koh; +Cc: Jeff Dike
On Thursday 19 May 2005 00:34, Young Koh wrote:
> Ok, let me have an example.
>
> suppose a user argument has virtual address 0xa0, corresponding UML
> physical address 0xb0, and real physical address 0x10. so, when the
> user process tries to access 0xa0 for the first time, the UML kernel
> should let host kernel know there will be 0xa0 -> 0x10 mapping.
Yes, and we only need to know the 0xa0 -> 0xb0 mapping... We currently use a
2/3-level page table mechanism to do this lookup, to answer the latter
question, even if we could choice any lookup mechanism, even a hash table if
there were the need.
Also note that these numbers are unrealistic since we map one page (4k) at a
time.
> how
> does the UML kernel make another process's address map to the same
> physical page it has?
UML physical address are actually the offsets inside the memory backing file.
Then the guest has simply to execute an mmap from this file with the "Uml
physical address" as the offset; in TT mode it's done directly, in SKAS3 mode
this is done by writing a MM_MMAP request into host's /proc/mm, in SKAS0 this
is executed by the stub calling mmap() directly.
> and how does the UML kernel keep track of 0xa0
> -> 0xb0 mapping? maybe the same page table mechanism as host Linux? (i
> guess so, though)
--
Paolo Giarrusso, aka Blaisorblade
Skype user "PaoloGiarrusso"
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-05-19 13:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-17 23:33 [uml-devel] copy_from_user in SKAS mode Young Koh
2005-05-18 1:18 ` Jeff Dike
2005-05-18 13:47 ` Young Koh
2005-05-18 15:08 ` Jeff Dike
2005-05-18 22:34 ` Young Koh
2005-05-19 13:41 ` Blaisorblade
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.