* [uml-devel] questions about mconsole driver and process address space
@ 2008-02-28 23:28 Weiming Liu
2008-03-07 17:27 ` Jeff Dike
0 siblings, 1 reply; 2+ messages in thread
From: Weiming Liu @ 2008-02-28 23:28 UTC (permalink / raw)
To: user-mode-linux-devel
[-- Attachment #1.1: Type: text/plain, Size: 1058 bytes --]
Hi. I am doing some experiment on mconsole driver. My wish is to create a
new user process from mconsole driver, modifying its address space, changing
its file mapping... Eventually may be I can migrate a process from host or
between UML instances. I am a newbie to both kernel and UML, and I have
several questions on implementation:
1. create a new process from a kernel thread. It seems that mconsole uses a
work queque, and requests are processed at kevents thread. Right now what I
am doing is, creating a new kernel thread and letting it call sys_ececve().
I then find its task_struct by looking for its name and its parent. It seems
stupid and maybe not correct. Is there any better way to do this?
2. I need to manipulate the process' address space (memory segments, file
mappings) like what flush_old_exec() and do_mmap() are doing. I cannot find
a way to call those functions since I am in a kernel thread, and it seems
too complicated by working directly on page tables and memory. How can this
be done in a convenient way?
Thanks,
Weiming Liu
[-- Attachment #1.2: Type: text/html, Size: 1090 bytes --]
[-- Attachment #2: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #3: Type: text/plain, Size: 194 bytes --]
_______________________________________________
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] 2+ messages in thread
* Re: [uml-devel] questions about mconsole driver and process address space
2008-02-28 23:28 [uml-devel] questions about mconsole driver and process address space Weiming Liu
@ 2008-03-07 17:27 ` Jeff Dike
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2008-03-07 17:27 UTC (permalink / raw)
To: Weiming Liu; +Cc: user-mode-linux-devel
On Thu, Feb 28, 2008 at 06:28:53PM -0500, Weiming Liu wrote:
> Hi. I am doing some experiment on mconsole driver. My wish is to create a
> new user process from mconsole driver, modifying its address space, changing
> its file mapping... Eventually may be I can migrate a process from host or
> between UML instances. I am a newbie to both kernel and UML, and I have
> several questions on implementation:
>
> 1. create a new process from a kernel thread. It seems that mconsole uses a
> work queque, and requests are processed at kevents thread. Right now what I
> am doing is, creating a new kernel thread and letting it call sys_ececve().
> I then find its task_struct by looking for its name and its parent. It seems
> stupid and maybe not correct. Is there any better way to do this?
Use a completion:
In the parent, do
DECLARE_COMPLETION(c)
kernel_thread()
wait_for_completion(&c)
child_task = my_task;
In the child, do
my_task = current;
complete(&c);
You'll also want to wrap a semaphore around the whole thing.
> 2. I need to manipulate the process' address space (memory segments, file
> mappings) like what flush_old_exec() and do_mmap() are doing. I cannot find
> a way to call those functions since I am in a kernel thread, and it seems
> too complicated by working directly on page tables and memory. How can this
> be done in a convenient way?
There are helpers for all these things.
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2008-03-07 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28 23:28 [uml-devel] questions about mconsole driver and process address space Weiming Liu
2008-03-07 17:27 ` Jeff Dike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox