ts-7000
[Top] [All Lists]

[ts-7000] Re: TS7500 - use of reservemem() function?

To:
Subject: [ts-7000] Re: TS7500 - use of reservemem() function?
From: "jesseoff" <>
Date: Mon, 26 Oct 2009 21:15:23 -0000

--- In  "naturalwatt" <> wrote:
>
> I think this is probably best addressed by TS support, but it's not actually 
> a problem as such, so I don't want to bother them needlessly.
> 
> The new TS7500 has an onboard red LED I want to use for diagnostic 
> signalling.  On the TS7250 this was fairly straightforward, using mmap() to 
> access an area of memory.
> 
> The TS7500 has sbus and accesses to it should be protected against 
> simultaneous access using supplied routines sub_lock() and sbus_unlock().  So 
> far so good; fairly rational.
> 
> However the sbu_lock() routine calls another routine, reservemem() which does 
> some fairly baroque things.  I can understand *what* it does, but cannot 
> fathom out why.

Let me explain.

If you acquire the SBUS lock and the executable and libraries you are running 
is loaded from SD card what I do in reservemem() is needed.  It is because 
Linux will demand-page in executables and libraries.  If you do not do 
something to defeat this (which reservemem() does) it is possible for you to 
cause a executable/library file page fault while you are holding the SBUS lock. 
 However, the SD card NBD process "sdctl" wants to acquire the SBUS lock too to 
satisfy the file backed page fault IO request.  This is a possible deadlock 
that can be avoided if all file backed pages are wired down (sdctl blocked 
waiting for sbuslock, user app blocked in a page fault holding the sbuslock).

The reservemem() call also has the beneficiary side effect of more predictable 
real-time behavior.


> 
> The code in question is in the file sbus.s and also in the ts7500ctl.c, in 
> the ts7500-linux area on the FTP site.
> 
> It appears to be making accesses to every page in a 32k block of data 
> allocated on the stack and every page in the current processes memory map.  
> One rationale for this might be to ensure that every page is in memory and 
> not paged out to disk, but it doesn't make sense on an embedded computer with 
> no swap disk.  In addition, the line of code that actually makes the memory 
> access is missing from sbus.c but present in ts7500ctl.c.  It goes through 
> all the motions of preparing to make all the memory accesses then fails to do 
> so.
> 

I will check on this.  This is incorrect if so.  

//Jesse Off



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU