Linux-Development-Sys Digest #111, Volume #8 Wed, 30 Aug 00 06:13:15 EDT
Contents:
Re: spin locks (Karl Heyes)
Re: copy_from_user from inside spinlock (Karl Heyes)
Re: Using block devices from user space. (Karl Heyes)
System calls on a specific cpu? (jd)
Where to get sources of linux external commands (Mobius)
Linux Performance Monitoring (David Doubrava)
Re: System calls on a specific cpu? (Tim Roberts)
Implementing a protocol over UDP ([EMAIL PROTECTED])
Re: Linux Performance Monitoring (Christopher Browne)
Re: Implementing a protocol over UDP ("Z")
Re: spin locks (Josef Moellers)
Re: System calls on a specific cpu? (Josef Moellers)
Re: Where to get sources of linux external commands (Josef Moellers)
Re: Linux Performance Monitoring (Josef Moellers)
Re: System calls on a specific cpu? (Josef Moellers)
linker cannot find library (Benny Li)
Re: Linux Performance Monitoring (Kevin Lacquement)
Re: linker cannot find library ("Z")
Re: Resolution of select timeout (Andi Kleen)
system without graphic HW ("Christian Hoefer (EED)")
open a file in kernel space (Thomas Schwere)
can't get POSIX timer working ("Kah Wai")
----------------------------------------------------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: spin locks
Date: Wed, 30 Aug 2000 02:17:27 +0000
In article <[EMAIL PROTECTED]>, Josef Moellers
<[EMAIL PROTECTED]> wrote:
> Karl Heyes wrote:
>
......
>
>
>> look in linux/Documentation/spinlocks.txt. It's definitely a kernel th=
> ing
>> though, if that is what you are wanting.
>
> I beg to differ. A slightly different implementation may allow spinlocks to
> be used in user land:
> . > do {
> result=3Dget_spinlock(); if (result !=3D GOT_SPINLOCK)
> yield(); /* Voluntarily give up CPU */
> } until (result =3D=3D GOT_SPINLOCK);
>
> You can use it on shared memory segments and it will also work on
> uniprocessors. The disadvantages are that you will not have an idle CPU, so
> you might need to get that other fan. Also, people will complain about a 100%
> busy CPU. If yield() pushes the current process on the end of the run queue,
> you will not have a large performance impact.
>
Yes you can do a busy loop in user space, but you have to question why you are
doing it. You only want to do it if you know that the critical section will be
very short, so short in fact that it won't be worth going to sleep. On a
uniprocessor you will want to yeild() straight away and let whatever is in
there get out.
karl
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: copy_from_user from inside spinlock
Date: Wed, 30 Aug 2000 02:20:39 +0000
In article <8o6u8m$rdr$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
> Hi,
> can I use copy_from_user from inside a spinlock?
>
> regards jeseem
>
yes, it's an interrupt context you can't.
karl
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: Using block devices from user space.
Date: Wed, 30 Aug 2000 02:27:56 +0000
In article <[EMAIL PROTECTED]>, liran
<[EMAIL PROTECTED]> wrote:
> Hi, I am writing a storage manager in user space, I need to manage several
> disks , the question is it possible to make I/O on a block device from user
> space without using the buffer cache or at least with guarantee that the
> buffer cache will always go down staight to the physical device.
>
check out raw devices, or use fsync/fdatasync. The general opinion is don't
to raw IO unless you can't avoid it. This was the big database issue for a
while unable to use raw partitiions. Raw is daft in my opinion!!. help the OS
read/write the data, don't try to by-pass it
karl.
------------------------------
From: jd <[EMAIL PROTECTED]>
Subject: System calls on a specific cpu?
Date: Tue, 29 Aug 2000 22:51:23 -0400
I'm having some issues with my time stamp counters not being
synchronized across my 2 cpus. I've played around with adding an offset
in the gettimeofday code, but later expirementing revealed that the two
TSC's aren't incrementing at the same rate. Both processors are 550's
and the difference in rates is small, but over time, the TSC difference
grows.
So, the solution that comes to mind is to do all gettimeofday calls on
the same processor. Is there a way to do this? I was thinking of
preventing the kernel from being rescheduled to another CPU. Would this
work? And if so, where do I start?
Thanks,
-jd
------------------------------
From: Mobius <[EMAIL PROTECTED]>
Subject: Where to get sources of linux external commands
Date: Wed, 30 Aug 2000 12:12:34 +0800
I have plan to modify some external commands(like passwd, chown...).
I found sources of kernel, utility... But can't found what's I
need. thx for any help!
--
++++++++++++++++++++++++++++++ Mobius +++++
------------------------------
From: David Doubrava <[EMAIL PROTECTED]>
Subject: Linux Performance Monitoring
Date: Wed, 30 Aug 2000 06:27:02 +0200
SGkgQWxsLA0KICAgIEkgcG9zdGVkIHRvIEludGVybmV0IGh0dHA6Ly93d3cudm9sbnkuY3ov
bGludXhfbW9uaXRvciBpbmZvcm1hdGlvbg0KYWJvdXQgbXkgZGV2ZWxvcG1lbnQgb2YgTGlu
dXggUGVyZm9ybWFuY2UgbW9uaXRvcmluZyB0b29scy4NCg0KICAgIEkgYW0gd2FpdGluZyBm
b3IgeW91ciBmZWVkYmFjay4NCg0KICAgIERhdmUNCg==
------------------------------
From: Tim Roberts <[EMAIL PROTECTED]>
Subject: Re: System calls on a specific cpu?
Date: Tue, 29 Aug 2000 22:27:01 -0700
jd <[EMAIL PROTECTED]> wrote:
>
>I'm having some issues with my time stamp counters not being
>synchronized across my 2 cpus. I've played around with adding an offset
>in the gettimeofday code, but later expirementing revealed that the two
>TSC's aren't incrementing at the same rate. Both processors are 550's
>and the difference in rates is small, but over time, the TSC difference
>grows.
How can this possibly be the case? All CPUs share the same clock signal.
In order for that to happen, some piece of hardware would have to interrupt
the clock signal to one CPU, but not the other.
Can you tell us some more detail? For example, how far off are they when
you start, and how far off do they get? How does your experiment work --
how did you determine that the time stamps differed?
I did the exact same experiment on a Windows NT system. I found that the
two time-stamp counters were between 15 and 20 cycles apart, but that
number stayed constant over time.
If the effect you're seeing is really happening, there is a somewhat icky
alternative. The time-stamp counter is a writable register. You could,
conceivably, force the two counters into alignment.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
------------------------------
From: [EMAIL PROTECTED]
Subject: Implementing a protocol over UDP
Date: Wed, 30 Aug 2000 05:22:10 GMT
Hello,
Is there any way to implement a new protocol in linux over the already
exisiting protocol stack, specifically over UDP.
Also this protocol should be added as a module so it can be added &
removed dynamically.
Thanx
madhura
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Christopher Browne)
Subject: Re: Linux Performance Monitoring
Reply-To: [EMAIL PROTECTED]
Date: Wed, 30 Aug 2000 05:30:22 GMT
Centuries ago, Nostradamus foresaw a time when David Doubrava would say:
>SGkgQWxsLA0KICAgIEkgcG9zdGVkIHRvIEludGVybmV0IGh0dHA6Ly93d3cudm9sbnkuY3ov
>bGludXhfbW9uaXRvciBpbmZvcm1hdGlvbg0KYWJvdXQgbXkgZGV2ZWxvcG1lbnQgb2YgTGlu
>dXggUGVyZm9ybWFuY2UgbW9uaXRvcmluZyB0b29scy4NCg0KICAgIEkgYW0gd2FpdGluZyBm
>b3IgeW91ciBmZWVkYmFjay4NCg0KICAgIERhdmUNCg==
Did you consider posting a text message? They are usually more
readable.
Could your news client be suffering from some misconfiguration,
maybehaps?
--
[EMAIL PROTECTED] - <http://www.ntlug.org/~cbbrowne/>
"MICROS~1: The People who Brought the Y2K Bug into Software Titling"
-- [EMAIL PROTECTED]
------------------------------
From: "Z" <[EMAIL PROTECTED]>
Subject: Re: Implementing a protocol over UDP
Date: Wed, 30 Aug 2000 08:07:44 +0100
Once upon a while [EMAIL PROTECTED] wrote:
> Hello,
> Is there any way to implement a new protocol in linux over the already
> exisiting protocol stack, specifically over UDP.
> Also this protocol should be added as a module so it can be added &
> removed dynamically.
>
> Thanx
> madhura
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Every socket/datagram program implements a _protocol_ over
the TCP/IP stack!
You simply write a user space program and use the socket
calls of the system.
Z
--
LISP is worth learning for the profound enlightenment experience you
will have when you finally get it; that experience will make you a
better programmer for the rest of your days. Eric S. Raymond
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: spin locks
Date: Wed, 30 Aug 2000 08:55:41 +0200
Karl Heyes wrote:
> =
> In article <[EMAIL PROTECTED]>, Josef Moellers
> <[EMAIL PROTECTED]> wrote:
> > Karl Heyes wrote:
> > I beg to differ. A slightly different implementation may allow spinlo=
cks to
> > be used in user land:
> > . > do {
> > result=3D3Dget_spinlock(); if (result !=3D3D GOT_SPINLOCK)
> > yield(); /* Voluntarily give up CPU */
> > } until (result =3D3D=3D3D GOT_SPINLOCK);
> >
> > You can use it on shared memory segments and it will also work on
> > uniprocessors. The disadvantages are that you will not have an idle C=
PU, so
> > you might need to get that other fan. Also, people will complain abou=
t a 100%
> > busy CPU. If yield() pushes the current process on the end of the run=
queue,
> > you will not have a large performance impact.
> >
> =
> Yes you can do a busy loop in user space, but you have to question why =
you are
> doing it. You only want to do it if you know that the critical section=
will be
> very short, so short in fact that it won't be worth going to sleep. O=
n a
> uniprocessor you will want to yeild() straight away and let whatever i=
s in
> there get out.
You don't want to yield() if you can get the spinlock. Somehow the
formatting of my code got mixed up. If I don't get the spinlock, then I
yield(), otherwise I break out of the loop, get on with the job and
release the lock.
Of course. You have to check whether the overhead of using a semaphore
function (semget(2), semctl(2), and semop(2)) is in an acceptable
relation to the duration of the critical section and the actions
therein. But it's the same in the kernel: if the critical section is too
long or you run the risk of switching context inside, you might just as
well go to sleep() rather than use spinlocks.
If there were only one solution for every problem, we'd all be using
Microsoft products and VisualBasic.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: System calls on a specific cpu?
Date: Wed, 30 Aug 2000 09:02:07 +0200
Tim Roberts wrote:
> =
> jd <[EMAIL PROTECTED]> wrote:
> >
> >I'm having some issues with my time stamp counters not being
> >synchronized across my 2 cpus. I've played around with adding an offs=
et
> >in the gettimeofday code, but later expirementing revealed that the tw=
o
> >TSC's aren't incrementing at the same rate. Both processors are 550's=
> >and the difference in rates is small, but over time, the TSC differenc=
e
> >grows.
> =
[ ... ]
> I did the exact same experiment on a Windows NT system. I found that t=
he
> two time-stamp counters were between 15 and 20 cycles apart, but that
> number stayed constant over time.
We've seen this problem under Linux on an 8-way with (an older version
of) Phoenix BIOS.
The TSC register values differ by the equivalent of several
microseconds.
The newer kernels have a patch to correct for this and we seem to have
lost this problem with some more recent versions of the BIOS, but we've
seen it (Sorry, I don't have the exact details, I just wrote the test
program).
> =
> If the effect you're seeing is really happening, there is a somewhat ic=
ky
> alternative. The time-stamp counter is a writable register. You could=
,
> conceivably, force the two counters into alignment.
Beware: Intel says that although the TSC register will be present in
future processor generations, it explicitly states that the ability to
write it (=3D=3D reset it to 0) may not!
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Where to get sources of linux external commands
Date: Wed, 30 Aug 2000 09:06:18 +0200
Mobius wrote:
> =
> I have plan to modify some external commands(like passwd, chown...).
> I found sources of kernel, utility... But can't found what's I
> need. thx for any help!
You should first need to find out where the command resides:
locate passwd
Then you must find out which package contains the command:
rpm -qf /usr/bin/passwd
You can then query the package information to find out what the source
RPM is:
rpm -qi shadow
Then you should install the appropriate source rpm
rpm -i shadow-19990827-22.src.rpm
and unpack the tarball in /usr/src/.../SOURCES
Please note that the above is just an example, the exact names may
differ on your system.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Linux Performance Monitoring
Date: Wed, 30 Aug 2000 09:08:16 +0200
Christopher Browne wrote:
> =
> Centuries ago, Nostradamus foresaw a time when David Doubrava would say=
:
> >SGkgQWxsLA0KICAgIEkgcG9zdGVkIHRvIEludGVybmV0IGh0dHA6Ly93d3cudm9sbnkuY3=
ov
> >bGludXhfbW9uaXRvciBpbmZvcm1hdGlvbg0KYWJvdXQgbXkgZGV2ZWxvcG1lbnQgb2YgTG=
lu
> >dXggUGVyZm9ybWFuY2UgbW9uaXRvcmluZyB0b29scy4NCg0KICAgIEkgYW0gd2FpdGluZy=
Bm
> >b3IgeW91ciBmZWVkYmFjay4NCg0KICAgIERhdmUNCg=3D=3D
> =
> Did you consider posting a text message? They are usually more
> readable.
> =
> Could your news client be suffering from some misconfiguration,
> maybehaps?
Hmm, looks more like _your_ news client has some problems:
> Hi All,
> I posted to Internet http://www.volny.cz/linux_monitor information
> about my development of Linux Performance monitoring tools.
> =
> I am waiting for your feedback.
> =
> Dave
Looks pretty close to a text message ... or a _very_ cleverly disguised
non-text message
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
------------------------------
From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: System calls on a specific cpu?
Date: Wed, 30 Aug 2000 09:22:45 +0200
Josef Moellers wrote:
> =
> The TSC register values differ by the equivalent of several
> microseconds.
Oops, this should have been milliseconds!
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
------------------------------
From: Benny Li <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: linker cannot find library
Date: Wed, 30 Aug 2000 07:46:12 GMT
hi,
I've been trying to link a program with the XPM library, so i do:
g++ -lXpm my_program.cc
However, it says it cannot open -lXpm: No such file or directory
I looked at /etc/ld.so.conf, and there is /usr/X11R6/lib (of course,
libXpm.so is there). What is wrong with this?
PS: it can link libraries in /usr/lib, however, even without an
entry of /usr/lib in /etc/ld.so.conf
thanks,
ben
------------------------------
From: Kevin Lacquement <[EMAIL PROTECTED]>
Subject: Re: Linux Performance Monitoring
Date: Wed, 30 Aug 2000 07:47:40 GMT
Josef Moellers wrote:
>
> Christopher Browne wrote:
<SNIP>
> > Did you consider posting a text message? They are usually more
> > readable.
> >
> > Could your news client be suffering from some misconfiguration,
> > maybehaps?
Nope, the OP's client is misconfigured; yours just translated the code.
>From the OPs headers:
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: base64
So the post hit the 'net using base64 encoding, which is usually used
for binary attachments. I beleive that the proper way to post text is
quoted-printable, which is what you're using, or unencoded, as
Christopher is using. This is, however, just from memory; the RFCs
and/or experts should be consulted for a better answer.
Cheers,
Kevin
------------------------------
From: "Z" <[EMAIL PROTECTED]>
Subject: Re: linker cannot find library
Date: Wed, 30 Aug 2000 10:53:16 +0100
Once upon a while Benny Li <[EMAIL PROTECTED]> wrote:
> hi,
>
> I've been trying to link a program with the XPM library, so i do:
>
> g++ -lXpm my_program.cc
>
>
> However, it says it cannot open -lXpm: No such file or directory
>
> I looked at /etc/ld.so.conf, and there is /usr/X11R6/lib (of course,
> libXpm.so is there). What is wrong with this?
>
> PS: it can link libraries in /usr/lib, however, even without an
> entry of /usr/lib in /etc/ld.so.conf
>
> thanks,
> ben
>
At compile time ld.so is not used it is only used for linking
when a program is ran that needs a dynamic library (.so).
You perhaps want to use the -L option to specify paths which
should be searched for libs.
g++ my_program.cc -o myprog -L/usr/X11R6/lib -L/extra/path -lXpm -lother
Hoipe this helps
Z
--
LISP is worth learning for the profound enlightenment experience you
will have when you finally get it; that experience will make you a
better programmer for the rest of your days. Eric S. Raymond
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Resolution of select timeout
Date: 30 Aug 2000 10:49:48 +0200
Peter Mueller <[EMAIL PROTECTED]> writes:
> Hi,
>
> I use select to get notefied of some timeouts. I found that the
> resolution of
> the timeout time is 10 milli seconds. Is my measurement true? If yes,
> can I
> change this anywhere (e.g. in the kernel) and how? Any experience with
> this?
You can recompile the kernel with a higher HZ constant, e.g. set to 1024.
Then it would be ~1ms.
-Andi
------------------------------
From: "Christian Hoefer (EED)" <[EMAIL PROTECTED]>
Subject: system without graphic HW
Date: Wed, 30 Aug 2000 11:26:35 +0200
hi,
I'd like to run a linux box without a graphics adaptor. what code must i
remove/modify to disable the local console. I plan to add a two line LCD
display and few keys for locale admistration later. but normaly
admistration is done by ssh connections.
And, is there a way to capture boot messages and store them once the
first file system is mounted.
/christian
------------------------------
Date: Wed, 30 Aug 2000 11:27:19 +0200
From: Thomas Schwere <[EMAIL PROTECTED]>
Subject: open a file in kernel space
Hi there
How can I open a file and read from it in kernel space?
Thanks,
Thomas
--
//\\\\
| ~ ~ |
( O O )
___________________________________oOOo______( )_____oOOo_______
Thomas Schwere Phone: +41 1 445 16 61
Supercomputing Systems AG Fax: +41 1 445 16 10
Technoparkstrasse 1 Url: www.scs.ch
CH-8005 Zurich Email: [EMAIL PROTECTED]
Switzerland
Oooo
_________________________________________oooO______( )_________
( ) ) /
\ ( (_/
\_)
------------------------------
From: "Kah Wai" <[EMAIL PROTECTED]>
Subject: can't get POSIX timer working
Date: Wed, 30 Aug 2000 17:43:33 +0800
Hi all,
I'm rather new with linux programming and I needed multiple timers for my
project.
I decided to use the POSIX 1.0003b timer patch, but without success. The
patching did not produce any error and the kernel seems to compile ok. I
tried to verify with the original test program provided and it didn't return
any timer expired messages. Doing a sysconf, shows that the
_SC_LINUX_COUNTER_HZ does not exist. I'm not sure if this is the problem,
btw I'm tried on 2 platforms 200MMX and a PIII.
Has anyone tried this before? I'm running out of hair soon, thanks in
advance.
Kah Wai
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************