All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] SKAS: Why pass mm vs. current?
@ 2003-09-05  2:06 stevegt
  2003-09-05 20:12 ` Jeff Dike
  0 siblings, 1 reply; 7+ messages in thread
From: stevegt @ 2003-09-05  2:06 UTC (permalink / raw)
  To: user-mode-linux-devel

Hi All & Jeff,

I'm working on a modified SKAS patch to allow running SKAS mode guests
on openMosix hosts (don't get excited -- no guest process migration,
just SKAS).   I have a question about why the skas patch passes mm down
through the do_mmap* call tree.  Why not just use current->mm when
needed, the way the original kernel does?  Or, if there's a context
issue, then why not pass all of current as a task_struct pointer,
instead of just current->mm?  That would seem to be a lot more flexible.
I know I'm missing something, I'm just not sure what yet.

Here's why I ask -- the process of merging the openMosix and SKAS
patches looks relatively straightforward; these are the only overt
conflicts (openMosix is "-", SKAS is "+"):

____________________________________________________________________________
arch/i386/kernel/sys_i386.c.rej
____________________________________________________________________________
***************
*** 59,67 ****
                        goto out;
        }
  
-       down_write(&current->mm->mmap_sem);
-       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
-       up_write(&current->mm->mmap_sem);
  
        if (file)
                fput(file);
--- 59,67 ----
                        goto out;
        }
  
+       down_write(&mm->mmap_sem);
+       error = do_mmap_pgoff(mm, file, addr, len, prot, flags, pgoff);
+       up_write(&mm->mmap_sem);
  
        if (file)
                fput(file);
____________________________________________________________________________
mm/mmap.c.rej
____________________________________________________________________________
***************
*** 390,399 ****
        return 0;
  }
  
- unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
-       unsigned long prot, unsigned long flags, unsigned long pgoff)
  {
-       struct mm_struct * mm = current->mm;
        struct vm_area_struct * vma, * prev;
        unsigned int vm_flags;
        int correct_wcount = 0;
--- 390,400 ----
        return 0;
  }
  
+ unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file, 
+                           unsigned long addr, unsigned long len,
+                           unsigned long prot, unsigned long flags, 
+                           unsigned long pgoff)
  {
        struct vm_area_struct * vma, * prev;
        unsigned int vm_flags;
        int correct_wcount = 0;
____________________________________________________________________________


The less-overt conflict comes from the fact that SKAS assumes that mm is
passed down through the call tree, but openMosix assumes that current is
still correct down deeper, in do_mmap_pgoff and do_mmap_pgoff_down, and
it uses it.  Neither the original kernel nor SKAS use current that deep,
so the SKAS patch doesn't need it or pass it.  

In other words, SKAS only passes mm, but openMosix needs all of current.

The simple thing for me to do might be to pass current down through the
do_mmap* call tree, rather than mm, and get mm from that when needed.  I
just don't know whether that's necessary, or whether it might introduce
other problems, since I don't see why mm was passed in the first place.
Can anyone tell me what I'm missing?

Steve
-- 
Stephen G. Traugott  (KG6HDQ)
UNIX/Linux Infrastructure Architect, TerraLuna Aerospace LLC
stevegt@TerraLuna.Org 
http://www.stevegt.com -- http://Infrastructures.Org 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05  2:06 [uml-devel] SKAS: Why pass mm vs. current? stevegt
@ 2003-09-05 20:12 ` Jeff Dike
  2003-09-05 21:08   ` stevegt
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Dike @ 2003-09-05 20:12 UTC (permalink / raw)
  To: stevegt; +Cc: user-mode-linux-devel

stevegt@TerraLuna.Org said:
> I have a question about why the skas patch passes mm down through the
> do_mmap* call tree.  Why not just use current->mm when needed, the way
> the original kernel does?  Or, if there's a context issue, then why
> not pass all of current as a task_struct pointer, instead of just
> current->mm?

Because the only thing needed is the mm.  I don't like passing a lot of 
information through an interface when only one piece of it is actually needed.

				Jeff



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05 20:12 ` Jeff Dike
@ 2003-09-05 21:08   ` stevegt
  2003-09-05 21:28     ` Bryan O'Sullivan
  0 siblings, 1 reply; 7+ messages in thread
From: stevegt @ 2003-09-05 21:08 UTC (permalink / raw)
  To: Jeff Dike; +Cc: user-mode-linux-devel

On Fri, Sep 05, 2003 at 04:12:50PM -0400, Jeff Dike wrote:
> stevegt@TerraLuna.Org said:
> > I have a question about why the skas patch passes mm down through the
> > do_mmap* call tree.  Why not just use current->mm when needed, the way
> > the original kernel does?  Or, if there's a context issue, then why
> > not pass all of current as a task_struct pointer, instead of just
> > current->mm?
> 
> Because the only thing needed is the mm.  I don't like passing a lot of 
> information through an interface when only one piece of it is actually needed.

Makes sense.  

But why not get mm from current when needed deeper down, rather than
pass it in the first place?  That would avoid having to change the
interface.  I'm happy to put that patch together, if you don't see
anything wrong with the idea.

Steve
-- 
Steve Traugott  (KG6HDQ)
Speaker Coordinator, Silicon Valley Linux Users Group
http://www.svlug.org
--
UNIX/Linux Infrastructure Architect, TerraLuna LLC
stevegt@TerraLuna.Org   
http://www.stevegt.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05 21:08   ` stevegt
@ 2003-09-05 21:28     ` Bryan O'Sullivan
  2003-09-05 21:47       ` stevegt
  0 siblings, 1 reply; 7+ messages in thread
From: Bryan O'Sullivan @ 2003-09-05 21:28 UTC (permalink / raw)
  To: stevegt; +Cc: user-mode-linux-devel

On Fri, 2003-09-05 at 14:08, stevegt@TerraLuna.Org wrote:

> But why not get mm from current when needed deeper down, rather than
> pass it in the first place?  That would avoid having to change the
> interface.

That's what the 2.6 host-skas patch already does.  Remember, the
host-skas3 patch is a quickish hack to get the needed functionality, not
an interface change frozen in stone.

	<b



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05 21:28     ` Bryan O'Sullivan
@ 2003-09-05 21:47       ` stevegt
  2003-09-05 21:53         ` Bryan O'Sullivan
  0 siblings, 1 reply; 7+ messages in thread
From: stevegt @ 2003-09-05 21:47 UTC (permalink / raw)
  To: Bryan O'Sullivan; +Cc: user-mode-linux-devel

On Fri, Sep 05, 2003 at 02:28:01PM -0700, Bryan O'Sullivan wrote:
> On Fri, 2003-09-05 at 14:08, stevegt@TerraLuna.Org wrote:
> 
> > But why not get mm from current when needed deeper down, rather than
> > pass it in the first place?  That would avoid having to change the
> > interface.
> 
> That's what the 2.6 host-skas patch already does.  Remember, the
> host-skas3 patch is a quickish hack to get the needed functionality, not
> an interface change frozen in stone.

So that sounds like it answers one of my first questions -- there's
actually no special context that needs to be preserved down through the
call stack, so neither mm nor current need to be explicitly passed at
all?  I.E.  the global current is still current all the way down?  I was
beginning to suspect that there was something about UML's interaction
with the host that made current not be valid deeper down.

If I fix this by creating a new patch, can we post it as skas3.1 or
something?  It looks like it would satisfy a lot of people's problem
with the interface change on 2.4 kernels.

Steve
-- 
Steve Traugott  (KG6HDQ)
Speaker Coordinator, Silicon Valley Linux Users Group
http://www.svlug.org
--
UNIX/Linux Infrastructure Architect, TerraLuna LLC
stevegt@TerraLuna.Org   
http://www.stevegt.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05 21:47       ` stevegt
@ 2003-09-05 21:53         ` Bryan O'Sullivan
  2003-09-08 22:51           ` Adam Heath
  0 siblings, 1 reply; 7+ messages in thread
From: Bryan O'Sullivan @ 2003-09-05 21:53 UTC (permalink / raw)
  To: stevegt; +Cc: user-mode-linux-devel

On Fri, 2003-09-05 at 14:47, stevegt@TerraLuna.Org wrote:

> So that sounds like it answers one of my first questions -- there's
> actually no special context that needs to be preserved down through the
> call stack, so neither mm nor current need to be explicitly passed at
> all?

Um, of course mm needs passing in some form or another.

The whole point of the skas patches is to let a single process execute
with multiple different mm_structs, switching back and forth between
them under the control of the master process.

In order to do this, the host process has to have some way of telling
the slave which mm_struct to use.  Look at the changes to ptrace.c in
the patch and you'll see what's going on at the top level.  Everything
else kind of follows from that.

> If I fix this by creating a new patch, can we post it as skas3.1 or
> something?

SuSE already has a modified skas patch that fixes the interface breakage
in 2.4.  The 2.6 patch doesn't break any interfaces.  Jeff is likely to
have time to make a clean interface very soon.

Ergo, there's nothing much to be done.

	<b



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

* Re: [uml-devel] SKAS: Why pass mm vs. current?
  2003-09-05 21:53         ` Bryan O'Sullivan
@ 2003-09-08 22:51           ` Adam Heath
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Heath @ 2003-09-08 22:51 UTC (permalink / raw)
  To: Bryan O'Sullivan; +Cc: stevegt, user-mode-linux-devel

On 5 Sep 2003, Bryan O'Sullivan wrote:

> The whole point of the skas patches is to let a single process execute
> with multiple different mm_structs, switching back and forth between
> them under the control of the master process.

No.  The skas patch does *2* things.

One: Let a single process switch mm_structs.
Two: modify ptrace to do mappings on another process

The former is not really needed, and is just a bonus.  It makes the host's
process table less crowded.  It's not needed to do real a
separate-kernel-address-space.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2003-09-09  3:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-05  2:06 [uml-devel] SKAS: Why pass mm vs. current? stevegt
2003-09-05 20:12 ` Jeff Dike
2003-09-05 21:08   ` stevegt
2003-09-05 21:28     ` Bryan O'Sullivan
2003-09-05 21:47       ` stevegt
2003-09-05 21:53         ` Bryan O'Sullivan
2003-09-08 22:51           ` Adam Heath

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.