--- 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/
|