[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom [Oliver.J.Enders@aero.org] (fwd)



>From owner-rtl Mon May  7 16:20:14 2001
Received: from mhultra.aero.org (mhultra.aero.org [130.221.88.102])
	by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f47MKEJ16782
	for <rtl@fsmlabs.com>; Mon, 7 May 2001 16:20:14 -0600
Received: from ladir01.aero.org by mhultra.aero.org with ESMTP for rtl@fsmlabs.com; Mon, 7 May 2001 15:16:06 -0700
Subject: Re: [rtl] do_gettimeofday().
To: rtl@fsmlabs.com
From: Oliver.J.Enders@aero.org
Date: Mon, 7 May 2001 15:16:03 -0700
Message-Id: <OF92BE28D3.68C1072A-ON88256A45.00780215@aero.org>
X-MIMETrack: Serialize by Router on ladir01/AeroNet/Aerospace/US(Release 5.0.7 |March 21, 2001) at
 05/07/2001 03:16:06 PM
MIME-Version: 1.0
Content-type: text/plain; charset=us-ascii


Unless I am missing something, do_gettimeofday() sounds like a big, bloated
Linux system call to me.  Shouldn't be in real time to start with.  Why not
just get the time of day once in the init_module() (which is not real time
mode) and synchronize with a counter that you update constantly in a
periodic thread that you create at whatever rate you like.  When the
interrupt comes in, the ISR just looks at the value of the counter and
knows what time it is by differencing with the original time.  The rest is
just reformatting for printout.  I apologize if I answered the wrong
question.

Oliver





Karim Yaghmour <karym@opersys.com>@fsmlabs.com on 05/03/2001 11:04:09 AM

Please respond to rtl@fsmlabs.com

Sent by:  owner-rtl@fsmlabs.com


To:   rtl@fsmlabs.com
cc:   yodaiken@fsmlabs.com, tfolkers@hamms.as.arizona.edu
Subject:  Re: [rtl] do_gettimeofday().



Hello Thomas,

This is a known problem. If you want more information about it take a
look at this posting I did a while ago:
http://www.rtlinux.org/mailing_list/rtl.w5archive/0008/msg00239.html

One can't use use do_gettimeoday from real-time kernel modules because
it uses normal Linux locks to ensure exclusive access to xtime_lock.

Changing the Linux locks to real-time locks fixes the problem. This is
done in the LTT patch for RTAI and works great. It provides accurate
timing and enables hard-real-time tasks to access do_gettimeofday without
problems.

Cheers,

Karim

Thomas Folkers wrote:
>
> Victor,
>   How come I can't get the time of day from the kernel? If I use
> do_gettimeofday(), eventually the system will hang. It may not happen
> right away, but it will hang. I'm trying to time external events and
> record the exact time an interrupt comes in and the only way to compare
> that time to other events and to other systems is to have the exact
> system time. The clock_gettime() routine returns something close to
> the real system clock time, but then proceeds to gain time at the rate of
> 35,000 nsecs/sec. That's probably due to a miss calibration in the cpu HZ
> value. I have looked over the rtl_time.c file and can see where you
'sync'
> the CLOCK_REALTIME to the results of a do_gettimeofday() call, but then
> there doesn't seem to be any other 'tweeks' to the time to keep it in
> sync. So, while the clock_gettime() produces a nice monotonic clock, it
> bear little resemblance to actual time.
>   So, how do I get the time of day from the kernel?
>
> Thanks for you help,
> Tom
>
> --
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>     _/_/_/_/   _/_/    _/_/  _/_/_/_/_/  _/_/_/_/  Thomas W. Folkers
>    _/         _/ _/ _/  _/      _/      _/    _/  Telescope Operations
Mgr.
>   _/_/_/_/   _/   _/   _/      _/      _/    _/  Sub-Millimeter Telescope
>         _/  _/        _/      _/      _/    _/  Kitt Peak 12M Radio
Telescope
>        _/  _/        _/      _/      _/    _/  933 N. Cherry Ave. Rm. 486
> _/_/_/_/  _/        _/      _/      _/_/_/_/  Tucson, Arizona 85721
> -------------------------------------------  email:
tfolkers@as.arizona.edu
> ------------------------------------------  Voice: (520) 626-7837
> -- http://maisel.as.arizona.edu:8080/ ---  Fax:  621-5554  Pager:
446-0760
> -- http://kp12m.as.arizona.edu/      ---  Mobil: 909-1113  Home:
742-9279
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/

--
===================================================
                 Karim Yaghmour
               karym@opersys.com
      Embedded and Real-Time Linux Expert
===================================================


-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/