Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08  8:44 Martin Ostermann
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Ostermann @ 1996-10-08  8:44 UTC (permalink / raw)


Hmm, I'm afraid this is going to be the runnig gag of this list ...

The following patch is still missing in Colgate:

--- ../../util-linux-2.5/sys-utils/clock.c	Tue Oct  8 09:09:54 1996
+++ clock.c	Tue Oct  8 09:13:32 1996
@@ -142,7 +142,11 @@
 
 #define VERSION "1.4.3axp"
 
+#ifdef __alpha__ 
+#define USE_DEV_PORT
+#else
 #undef USE_DEV_PORT
+#endif
 
 #ifdef USE_DEV_PORT
 # include <asm/fcntl.h>
@@ -297,7 +301,7 @@
   save_control = cmos_read (11);   /* tell the clock it's being set */
   cmos_write (11, (save_control | 0x80));
   save_freq_select = cmos_read (10);       /* stop and reset prescaler */
-  cmos_write (10, (save_freq_select | clockport));
+  cmos_write (10, (save_freq_select | 0x70));
 
   cmos_write (0, tm->tm_sec);
   cmos_write (2, tm->tm_min);

BTW, is there any good reason not to use /dev/port on other machines?

Martin

-- 
Martin Ostermann                | mailto:ost@comnets.rwth-aachen.de
Communication Networks          | http://www.comnets.rwth-aachen.de/~ost
Aachen University of Technology | phoneto:++49/241/807917
Germany                         | faxto:++49/241/8890378

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08 15:11 David Mosberger-Tang
  1996-10-08 18:16 ` Linux-2.0.22 and Linux-2.1.2 Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: David Mosberger-Tang @ 1996-10-08 15:11 UTC (permalink / raw)


>>>>> On 08 Oct 1996 10:44:14 +0200, Martin Ostermann <ost@comnets.rwth-aachen.de> said:

  Martin> Hmm, I'm afraid this is going to be the runnig gag of this
  Martin> list ...  The following patch is still missing in Colgate:

I don't think that patch is correct.  While I don't have the cmos
datasheet, somebody else (I believe it was Miquel) pointed out that
the 0x70 value that your patch changes is simply a bitmask that is
unrelated to the port address.  Also, not all Alpha platforms need to
use the dev port.  With the dev port, you loose atomicity of the
update, which in my opinion is a nice feature to have.

Are you saying the existing clock doesn't work at all for the Jensen?
I know Miquel was working on a modified clock utility that uses
/dev/rtc.  I'm not sure what solution is better (/dev/port or
/dev/rtc) but maybe the Jensen folks could get together and present a
coherent solution?

	--david

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Linux-2.0.22 and Linux-2.1.2
  1996-10-08 15:11 redhat-4.0: /sbin/clock for the Jensen (again) David Mosberger-Tang
@ 1996-10-08 18:16 ` Linus Torvalds
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Torvalds @ 1996-10-08 18:16 UTC (permalink / raw)


I made both a new 2.0.x and a 2.1.x release, and they are available on the
usual sites. The 2.0.x is mainly a few driver updates, but also has the pty
bug-fix that people in the 2.1.x tree have already been testing out. 

2.1.2 is the much more interestign one, at least as far as I'm concerned. 
This release does:

 - goodbye old inefficient "verify_area()", hello run-time exceptions.

Essentially, the old "verify_area()" was a very straightforward system that
checked that any pointer given to the kernel was valid. It verified that the
area was mapped, and returned either 0 or -EFAULT depending on that. It was
reliable, boringly so. 

However, "verify_area()" did have a few problems. Notably: it was slow.  Not
"horribly and inexplicably slow", but it was simply called a lot, and it had
to do a lot of checks. End result: it shows up on kernel profiles pretty
well. 

Now, I tried to optimize it, but it was basically pretty optimized already.
It used avl trees to find the memory areas, and it was just plain a good
implementation. But the bad thing about it all was that it never found any
errors. The things it checks against are things that never happen for normal
programs, and as such it is very irritating to see it taking up almost 20% of
the kernel time under some circumstances. 

Now, "verify_area()" had another more subtle problem, and that was the fact
that the memory mapping that it checked could _change_ after it had been
checked when people used kernel threads (another thread did a mmap or a
munmap). That wasn't originally a problem, as Linux didn't have threads
originally, but it's been nagging me for the last year or two. 

So... Enter the all-new-and-improved Linux-2.1.2. It gets rid of
"verify_area()" altogether. Or rather, the function still exists, but it
doesn't really do much any more. In fact, it does just about the same thing
that it did in Linux-0.01: it only tests that the pointer is in user space
(and it does _not_ check whether the area it points to is actually mapped). 

Voila, instant speedup: the function that used to take 20% of kernel time
under some circumstances is now a inline function that expands to just a few
assembly instructions. 

The downside? Bad programs who mess with the kernel. They pass invalid
addresses to system calls, and nothing checks it any more. Bummer. But don't
despair: we do actually have something that checks the invalid addresses. 
And what's nice about it is that it's actually built-in in the CPU hardware.
The paging unit. 

Anyway, Linux-2.1.2 now uses exceptions to trap bad system call buffers.  The
new scheme is a bit more complex to actually use, but it's a _lot_ faster,
and it actually works correctly in the presense of kernel threads (the old
one worked fine too usually, but it _could_ make mistakes, and making
mistakes isn't really acceptable when the whole and only idea of the function
is to verify that no mistakes happen in the first place). 

However, I didn't have the stamina to add the extra exception handling to all
of the system calls, so Linux-2.1.2 is a work in progress in that sense. 
It's not hard to add the necessary "exception()/end_exception()" pairs, but
it _is_ tedious, and it does require some care (to make sure everything is
"rolled back" correctly when an exception happens). So I'll be doing that
over a period of kernels, but I wanted to make the basic stuff available now. 

In addition to the exception stuff, 2.1.2 also does:
 - updates some alpha handling. This should contain all the important things
   from the axp-diffs that David M-T has been making. 
 - alpha and x86 system call entry optimizations. I now get less than 1us
   system call latencies on my ev5/333 according to lmbench. 
 - various minor changes ("a" -> "an" fixes etc)

David: don't expect all of your patches to be in. I didn't actually use much
more than you machine check patches as-is: everything else is essentially
re-done the way I perferred it.

		Linus

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08 20:08 Martin Ostermann
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Ostermann @ 1996-10-08 20:08 UTC (permalink / raw)


David Mosberger-Tang <davidm@AZStarNet.COM> writes:
> >>>>> On 08 Oct 1996 10:44:14 +0200, Martin Ostermann <ost@comnets.rwth-aachen.de> said:
> 
>   Martin> Hmm, I'm afraid this is going to be the runnig gag of this
>   Martin> list ...  The following patch is still missing in Colgate:
> 
> I don't think that patch is correct.  While I don't have the cmos
> datasheet, somebody else (I believe it was Miquel) pointed out that
> the 0x70 value that your patch changes is simply a bitmask that is
> unrelated to the port address.  

Yes, exactly! Please look at the patch again:

-  cmos_write (10, (save_freq_select | clockport));
+  cmos_write (10, (save_freq_select | 0x70));

Its changing it back to 0x70! Actually I believed it was you who
erroneously changed it to clockport, after I pointed out a different
line; I never made that change, and only detected it when Miquel had
problems with the patch from azstartnet.

> Also, not all Alpha platforms need to
> use the dev port.  With the dev port, you loose atomicity of the
> update, which in my opinion is a nice feature to have.

Ok, I see. When I patched clock the first time, USE_DEV_PORT was
standard on the Alpha platform. The comments suggested, that it was
needed on non EV4 machines.

> Are you saying the existing clock doesn't work at all for the Jensen?

Yes. I think I know what the problem is: (clock.c)

#ifdef USE_DEV_PORT
# include <asm/fcntl.h>
#else
# include <asm/io.h>
#endif

Because of <asm/io.h>, the kernel i/o functions get used instead of
the ones in glibc. Thus it only works on the i/o-architecture it was
compiled on (or similar ones). But even if I compile it on my Jensen,
it doesn't work. I need USE_DEV_PORT. I am going to take a look at it.

> I know Miquel was working on a modified clock utility that uses
> /dev/rtc.  I'm not sure what solution is better (/dev/port or
> /dev/rtc) but maybe the Jensen folks could get together and present a
> coherent solution?

Miquel didn't mail his patches, so I don't know how it's
working. I recall, he also had problems with interrupts. 
IMHO, using a kernel device would probably be the best solution, indeed.

I see if I can clock working with glibc's i/o functions. Should be no
problem. 

Martin

-- 
Martin Ostermann                | mailto:ost@comnets.rwth-aachen.de
Communication Networks          | http://www.comnets.rwth-aachen.de/~ost
Aachen University of Technology | phoneto:++49/241/807917
Germany                         | faxto:++49/241/8890378

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08 20:34 David Mosberger
  0 siblings, 0 replies; 7+ messages in thread
From: David Mosberger @ 1996-10-08 20:34 UTC (permalink / raw)


Martin> David Mosberger-Tang <davidm@AZStarNet.COM> writes:
 Martin> > >>>>> On 08 Oct 1996 10:44:14 +0200, Martin Ostermann <ost@comnets.rwth-aachen.de> said:

 Martin> Hmm, I'm afraid this is going to be the runnig gag of this
 Martin> list ...  The following patch is still missing in Colgate:
 
 David> I don't think that patch is correct.  While I don't have the cmos
 David> datasheet, somebody else (I believe it was Miquel) pointed out that
 David> the 0x70 value that your patch changes is simply a bitmask that is
 David> unrelated to the port address.  

 Martin> Yes, exactly! Please look at the patch again:

 Martin> -  cmos_write (10, (save_freq_select | clockport));
 Martin> +  cmos_write (10, (save_freq_select | 0x70));

Duh, I looked at your patch, went to my sources, saw that all is fine
and then concluded that your patch must be backwards.  Sorry about
that.  Hmmh, maybe my patch on azstarnet doesn't have this fix in.
I'll double check.

 David> Are you saying the existing clock doesn't work at all for the Jensen?

 Martin> Yes. I think I know what the problem is: (clock.c)

 Martin> #ifdef USE_DEV_PORT
 Martin> # include <asm/fcntl.h>
 Martin> #else
 Martin> # include <asm/io.h>
 Martin> #endif

 Martin> Because of <asm/io.h>, the kernel i/o functions get used instead of
 Martin> the ones in glibc. Thus it only works on the i/o-architecture it was
 Martin> compiled on (or similar ones). But even if I compile it on my Jensen,
 Martin> it doesn't work. I need USE_DEV_PORT. I am going to take a look at it.

I don't think that's true.  Even with <asm/io.h>, you should get the
library versions.  But it would be cleaner to include <sys/io.h> for
glibc.

 Martin> Miquel didn't mail his patches, so I don't know how it's
 Martin> working. I recall, he also had problems with interrupts. 
 Martin> IMHO, using a kernel device would probably be the best solution,
 Martin> indeed.

The axp-diffs have some patches to rtc.c that are supposed to fix this
problem.  But I haven't heard from Miquel in a while, so I'm not sure
whether it's all working.

 Martin> I see if I can clock working with glibc's i/o functions. Should be no
 Martin> problem. 

It should work, I agree.  If not, maybe there is a bug in the glibc
functions in which case a fix is definitively needed.

	--david

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08 21:37 Martin Ostermann
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Ostermann @ 1996-10-08 21:37 UTC (permalink / raw)


David  Mosberger <davidm@AZStarNet.com> writes:
>  Martin> Because of <asm/io.h>, the kernel i/o functions get used instead of
>  Martin> the ones in glibc. Thus it only works on the i/o-architecture it was
>  Martin> compiled on (or similar ones). But even if I compile it on my Jensen,
>  Martin> it doesn't work. I need USE_DEV_PORT. I am going to take a look at it.
> 
> I don't think that's true.  Even with <asm/io.h>, you should get the
> library versions.  But it would be cleaner to include <sys/io.h> for
> glibc.

It was/is partially true: Only <asm/jensen.h> lacked the following
#ifdef __KERNEL__ :

--- jensen.h.org	Tue Nov  7 08:18:36 1995
+++ jensen.h	Tue Oct  8 22:51:59 1996
@@ -95,6 +95,7 @@
 		set_hae(addr);
 }
 
+#ifdef __KERNEL__
 /*
  * IO functions
  *
@@ -258,6 +259,8 @@
 
 #define outb(x, port) \
 (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+
+#endif /* __KERNEL__ */
 
 /*
  * The Alpha Jensen hardware for some rather strange reason puts

But your right, at least some routines were taken from libc, because
otherwise it would work.

> The axp-diffs have some patches to rtc.c that are supposed to fix this
> problem.  But I haven't heard from Miquel in a while, so I'm not sure
> whether it's all working.
> 
>  Martin> I see if I can clock working with glibc's i/o functions. Should be no
>  Martin> problem. 
> 
> It should work, I agree.  If not, maybe there is a bug in the glibc
> functions in which case a fix is definitively needed.

I looked at it: It's the Jensen's concept of "local" i/o
addresses. These are: (from <asm/jensen.h>)

#define __is_local(addr) ( \
/* keyboard */	(addr == 0x60 || addr == 0x64) || \
/* RTC */	(addr == 0x170 || addr == 0x171) || \
/* mb COM2 */	(addr >= 0x2f8 && addr <= 0x2ff) || \
/* mb LPT1 */	(addr >= 0x3bc && addr <= 0x3be) || \
/* mb COM2 */	(addr >= 0x3f8 && addr <= 0x3ff))

Glibc doesn't know about this, and I think it shouldn't, because this
would require runtime checking. Since anything but the RTC is kernel
controlled anyhow, I'd guess we ought to go for /dev/rtc, too.

But the short term solution is /dev/port, of cause.

Martin

-- 
Martin Ostermann                | mailto:ost@comnets.rwth-aachen.de
Communication Networks          | http://www.comnets.rwth-aachen.de/~ost
Aachen University of Technology | phoneto:++49/241/807917
Germany                         | faxto:++49/241/8890378

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: redhat-4.0: /sbin/clock for the Jensen (again)
@ 1996-10-08 21:37 Martin Ostermann
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Ostermann @ 1996-10-08 21:37 UTC (permalink / raw)


David  Mosberger <davidm@AZStarNet.com> writes:
>  Martin> Because of <asm/io.h>, the kernel i/o functions get used instead of
>  Martin> the ones in glibc. Thus it only works on the i/o-architecture it was
>  Martin> compiled on (or similar ones). But even if I compile it on my Jensen,
>  Martin> it doesn't work. I need USE_DEV_PORT. I am going to take a look at it.
> 
> I don't think that's true.  Even with <asm/io.h>, you should get the
> library versions.  But it would be cleaner to include <sys/io.h> for
> glibc.

It was/is partially true: Only <asm/jensen.h> lacked the following
#ifdef __KERNEL__ :

--- jensen.h.org	Tue Nov  7 08:18:36 1995
+++ jensen.h	Tue Oct  8 22:51:59 1996
@@ -95,6 +95,7 @@
 		set_hae(addr);
 }
 
+#ifdef __KERNEL__
 /*
  * IO functions
  *
@@ -258,6 +259,8 @@
 
 #define outb(x, port) \
 (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+
+#endif /* __KERNEL__ */
 
 /*
  * The Alpha Jensen hardware for some rather strange reason puts

But your right, at least some routines were taken from libc, because
otherwise it would work.

> The axp-diffs have some patches to rtc.c that are supposed to fix this
> problem.  But I haven't heard from Miquel in a while, so I'm not sure
> whether it's all working.
> 
>  Martin> I see if I can clock working with glibc's i/o functions. Should be no
>  Martin> problem. 
> 
> It should work, I agree.  If not, maybe there is a bug in the glibc
> functions in which case a fix is definitively needed.

I looked at it: It's the Jensen's concept of "local" i/o
addresses. These are: (from <asm/jensen.h>)

#define __is_local(addr) ( \
/* keyboard */	(addr == 0x60 || addr == 0x64) || \
/* RTC */	(addr == 0x170 || addr == 0x171) || \
/* mb COM2 */	(addr >= 0x2f8 && addr <= 0x2ff) || \
/* mb LPT1 */	(addr >= 0x3bc && addr <= 0x3be) || \
/* mb COM2 */	(addr >= 0x3f8 && addr <= 0x3ff))

Glibc doesn't know about this, and I think it shouldn't, because this
would require runtime checking. Since anything but the RTC is kernel
controlled anyhow, I'd guess we ought to go for /dev/rtc, too.

But the short term solution is /dev/port, of cause.

Martin

-- 
Martin Ostermann                | mailto:ost@comnets.rwth-aachen.de
Communication Networks          | http://www.comnets.rwth-aachen.de/~ost
Aachen University of Technology | phoneto:++49/241/807917
Germany                         | faxto:++49/241/8890378

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-10-08 21:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-10-08 15:11 redhat-4.0: /sbin/clock for the Jensen (again) David Mosberger-Tang
1996-10-08 18:16 ` Linux-2.0.22 and Linux-2.1.2 Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
1996-10-08 21:37 redhat-4.0: /sbin/clock for the Jensen (again) Martin Ostermann
1996-10-08 21:37 Martin Ostermann
1996-10-08 20:34 David Mosberger
1996-10-08 20:08 Martin Ostermann
1996-10-08  8:44 Martin Ostermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox