From: Jeff Dike <jdike@addtoit.com>
To: Weiming Liu <runemass.cse@gmail.com>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] questions about mconsole driver and process address space
Date: Fri, 7 Mar 2008 12:27:19 -0500 [thread overview]
Message-ID: <20080307172719.GF9139@c2.user-mode-linux.org> (raw)
In-Reply-To: <88e04e60802281528j302b61bbv2780c23f2614e8cd@mail.gmail.com>
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
prev parent reply other threads:[~2008-03-07 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080307172719.GF9139@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=runemass.cse@gmail.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox