[Tfug] Locking from user-land

Bexley Hall bexley401 at yahoo.com
Mon Jan 12 12:51:06 MST 2009


Hi, John,

--- On Mon, 1/12/09, John Gruenenfelder <johng at as.arizona.edu> wrote:

> >> Is there any way I can *effectively* wire down (even for
> >> a short -- but *guaranteed* -- period of time) a small
> >> amount of physical memory from user-land?
> >
> >Sure, and I think this all even works on x86. mem=(real minus
> >what you want), the top "what you want" is yours to do with as
> >you please. That's the kernel command line mem=.  Otherwise, I
> >believe no.  And keep
> 
> Are you sure it's that simple?  Certainly, memory the
> OS doesn't know about is free for any use you can imagine,
> but how to actually access it, especially from userspace?
> It seems the MMU might complain.  And even if it didn't,
> you'd still need root priviledges to actually access it.

Yes.
 
> >in mind that atomic operations, outside of kernel space,
> >might not be possible depending on the architecture.
> 
> Yes, I think for Bexley's purpose some sort of kernel
> interaction is pretty much mandatory if he wants memory/time
> access with guaranteed characteristics.  I suppose you could
> write a small and simple kernel module to do exactly this for
> the purpose of kernel->userspace transfers.  But Bexley
> mentioned doing this from userspace alone... probably not.

Well, I *could* see a scenario:
- wait for the jiffy
- cause the page(s) you need to be mapped
- do what you need to do *before* the next context switch

However, this still has lots of assumptions:
- if you need more than a single page, you are at the mercy
  of the machine's current RAM configuration and kernel size
- waiting for the jiffy is a problem in itself  :>
- making sure the page(s) are mapped in some fixed time
- hoping there is no other event that preempts!

> Perhaps one of the realtime kernel extensions?  I don't
> know what sort of guarantees they give with regards to 
> memory transfers in a specified time frame.

<frown>  I think I'm screwed if I take this approach.  :<
I'll have to find another option.

Thx,
--don


      




More information about the tfug mailing list