public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Linux 0.01 disk lockup
@ 2001-09-27 13:34 Mikulas Patocka
  2001-09-27 13:47 ` Arnaldo Carvalho de Melo
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Mikulas Patocka @ 2001-09-27 13:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

Hi.

Linux 0.01 has a bug in disk request sorting - when interrupt happens
while sorting is active, the interrupt routine won't clear do_hd - thus
the disk will stay locked up forever. 

Function add_request also lacks memory barriers - the compiler could
reorder writes to variable sorting and writes to request queue - producing
race conditions. Because gcc 1.40 does not have __asm__("":::"memory"), I
had to use dummy function call as a memory barrier. 

The following patch fixes both issues.

Mikulas

diff -u -r linux-orig/kernel/hd.c linux/kernel/hd.c
--- linux-orig/kernel/hd.c	Tue Sep 17 17:05:21 1991
+++ linux/kernel/hd.c	Thu Sep 27 15:14:38 2001
@@ -55,9 +55,9 @@
 ((s1)->head<(s2)->head || (s1)->head==(s2)->head && \
 ((s1)->sector<(s2)->sector))))
 
-static struct hd_request * this_request = NULL;
+struct hd_request * this_request = NULL;
 
-static int sorting=0;
+int sorting=0;
 
 static void do_request(void);
 static void reset_controller(void);
@@ -293,8 +293,10 @@
 {
 	int i,r;
 
-	if (sorting)
+	if (sorting) {
+		do_hd=NULL;
 		return;
+	}
 	if (!this_request) {
 		do_hd=NULL;
 		return;
@@ -319,6 +321,8 @@
 		panic("unknown hd-command");
 }
 
+void barrier();
+
 /*
  * add-request adds a request to the linked list.
  * It sets the 'sorting'-variable when doing something
@@ -338,6 +342,7 @@
  * disabling interrupts.
  */
 	sorting=1;
+	barrier();
 	if (!(tmp=this_request))
 		this_request=req;
 	else {
@@ -354,15 +359,19 @@
 			tmp->next=req;
 		}
 	}
+	barrier();
 	sorting=0;
+	barrier();
 /*
  * NOTE! As a result of sorting, the interrupts may have died down,
  * as they aren't redone due to locking with sorting=1. They might
  * also never have started, if this is the first request in the queue,
  * so we restart them if necessary.
  */
-	if (!do_hd)
+	if (!do_hd) {
+		barrier();
 		do_request();
+	}
 }
 
 void rw_abs_hd(int rw,unsigned int nr,unsigned int sec,unsigned int head,
diff -u -r linux-orig/kernel/system_call.s linux/kernel/system_call.s
--- linux-orig/kernel/system_call.s	Tue Sep 17 17:50:52 1991
+++ linux/kernel/system_call.s	Thu Sep 27 14:59:37 2001
@@ -47,7 +47,7 @@
 
 nr_system_calls = 67
 
-.globl _system_call,_sys_fork,_timer_interrupt,_hd_interrupt,_sys_execve
+.globl _system_call,_sys_fork,_timer_interrupt,_hd_interrupt,_sys_execve,_barrier
 
 .align 2
 bad_sys_call:
@@ -186,6 +186,9 @@
 	call _copy_process
 	addl $20,%esp
 1:	ret
+
+_barrier:
+	ret
 
 _hd_interrupt:
 	pushl %eax


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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 13:34 [PATCH] Linux 0.01 disk lockup Mikulas Patocka
@ 2001-09-27 13:47 ` Arnaldo Carvalho de Melo
  2001-09-27 20:02   ` Paul Gortmaker
  2001-09-27 15:12 ` Richard Gooch
  2001-09-27 15:27 ` Linus Torvalds
  2 siblings, 1 reply; 15+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-09-27 13:47 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel, torvalds

Em Thu, Sep 27, 2001 at 03:34:11PM +0200, Mikulas Patocka escreveu:
> Linux 0.01 has a bug in disk request sorting - when interrupt happens
> while sorting is active, the interrupt routine won't clear do_hd - thus
> the disk will stay locked up forever. 
> 
> Function add_request also lacks memory barriers - the compiler could
> reorder writes to variable sorting and writes to request queue - producing
> race conditions. Because gcc 1.40 does not have __asm__("":::"memory"), I
> had to use dummy function call as a memory barrier. 
> 
> The following patch fixes both issues.

Fantastic! who is the maintainer for the 0.x kernel series these days? I
thought that 2.0 was Dave W., 2.2 was Alan, 2.4 Linus, so now we have to
find people for 1.2 and finally get 1.2.14 released, man, how I wanted one
with the dynamic PPP code in back in those days... 8)

- Arnaldo

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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 13:34 [PATCH] Linux 0.01 disk lockup Mikulas Patocka
  2001-09-27 13:47 ` Arnaldo Carvalho de Melo
@ 2001-09-27 15:12 ` Richard Gooch
  2001-09-27 15:18   ` Roeland Th. Jansen
  2001-09-27 16:07   ` Mikulas Patocka
  2001-09-27 15:27 ` Linus Torvalds
  2 siblings, 2 replies; 15+ messages in thread
From: Richard Gooch @ 2001-09-27 15:12 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel, torvalds

Mikulas Patocka writes:
> Linux 0.01 has a bug in disk request sorting - when interrupt
> happens while sorting is active, the interrupt routine won't clear
> do_hd - thus the disk will stay locked up forever.

Er, why bother to fix bugs in such an ancient kernel, rather than
upgrading to a more modern kernel (like 0.98:-)? It's like finding a
bug in 2.3.30 and fixing it rather than grabbing 2.4.10 and seeing if
the problem persists.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 15:12 ` Richard Gooch
@ 2001-09-27 15:18   ` Roeland Th. Jansen
  2001-09-27 15:20     ` Richard Gooch
  2001-09-27 16:07   ` Mikulas Patocka
  1 sibling, 1 reply; 15+ messages in thread
From: Roeland Th. Jansen @ 2001-09-27 15:18 UTC (permalink / raw)
  To: Richard Gooch; +Cc: Mikulas Patocka, linux-kernel, torvalds

On Thu, Sep 27, 2001 at 09:12:56AM -0600, Richard Gooch wrote:
> Er, why bother to fix bugs in such an ancient kernel, rather than
> upgrading to a more modern kernel (like 0.98:-)? It's like finding a
> bug in 2.3.30 and fixing it rather than grabbing 2.4.10 and seeing if
> the problem persists.


I actually am waiting until 2.4.10 features are backported to 0.01 :-)

-- 
Grobbebol's Home                      |  Don't give in to spammers.   -o)
http://www.xs4all.nl/~bengel          | Use your real e-mail address   /\
Linux 2.4.10 (apic) SMP 466MHz/768 MB |        on Usenet.             _\_v  

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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 15:18   ` Roeland Th. Jansen
@ 2001-09-27 15:20     ` Richard Gooch
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Gooch @ 2001-09-27 15:20 UTC (permalink / raw)
  To: Roeland Th. Jansen; +Cc: linux-kernel

Roeland Th. Jansen writes:
> On Thu, Sep 27, 2001 at 09:12:56AM -0600, Richard Gooch wrote:
> > Er, why bother to fix bugs in such an ancient kernel, rather than
> > upgrading to a more modern kernel (like 0.98:-)? It's like finding a
> > bug in 2.3.30 and fixing it rather than grabbing 2.4.10 and seeing if
> > the problem persists.
> 
> I actually am waiting until 2.4.10 features are backported to 0.01 :-)

Hey, yeah! Like devfs :->

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 13:34 [PATCH] Linux 0.01 disk lockup Mikulas Patocka
  2001-09-27 13:47 ` Arnaldo Carvalho de Melo
  2001-09-27 15:12 ` Richard Gooch
@ 2001-09-27 15:27 ` Linus Torvalds
  2001-09-27 16:08   ` Mikulas Patocka
  2 siblings, 1 reply; 15+ messages in thread
From: Linus Torvalds @ 2001-09-27 15:27 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel


On Thu, 27 Sep 2001, Mikulas Patocka wrote:
>
> Linux 0.01 has a bug in disk request sorting - when interrupt happens
> while sorting is active, the interrupt routine won't clear do_hd - thus
> the disk will stay locked up forever.

Ehh..

Mikulas, do you want to be the official maintainer for the 0.01.xxx
series?

Note that much of the maintenance work is probably just to reproduce and
make all the user-level etc infrastructure available..

		Linus


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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 15:12 ` Richard Gooch
  2001-09-27 15:18   ` Roeland Th. Jansen
@ 2001-09-27 16:07   ` Mikulas Patocka
  1 sibling, 0 replies; 15+ messages in thread
From: Mikulas Patocka @ 2001-09-27 16:07 UTC (permalink / raw)
  To: Richard Gooch; +Cc: linux-kernel, torvalds

> > Linux 0.01 has a bug in disk request sorting - when interrupt
> > happens while sorting is active, the interrupt routine won't clear
> > do_hd - thus the disk will stay locked up forever.
> 
> Er, why bother to fix bugs in such an ancient kernel, rather than
> upgrading to a more modern kernel (like 0.98:-)? It's like finding a
> bug in 2.3.30 and fixing it rather than grabbing 2.4.10 and seeing if
> the problem persists.

Well - why not? The disk interrupt locking algorithm in 0.01 is beautiful
(except for the bug - but it can be fixed). It's something you don't see
in 2.4.10 with __cli, __sti, __save_flags, __restore_flags everywhere. So
why not to post a bug report and patch for 10th anniversary of Linux?

Mikulas





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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 15:27 ` Linus Torvalds
@ 2001-09-27 16:08   ` Mikulas Patocka
  2001-09-29 21:16     ` [PATCH] Linux 0.01 disk lockup - read the old (1991) archives Rob Landley
  0 siblings, 1 reply; 15+ messages in thread
From: Mikulas Patocka @ 2001-09-27 16:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

> > Linux 0.01 has a bug in disk request sorting - when interrupt happens
> > while sorting is active, the interrupt routine won't clear do_hd - thus
> > the disk will stay locked up forever.
> 
> Ehh..
> 
> Mikulas, do you want to be the official maintainer for the 0.01.xxx
> series?
> 
> Note that much of the maintenance work is probably just to reproduce and
> make all the user-level etc infrastructure available..

It would be cool to have linux-0.01 distribution. I started to use linux
in 2.0 times, so I'm probably not the right person to maintain it. I don't
even know where to get programs for it and I doubt it would work on my 4G
disk.

Mikulas





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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 13:47 ` Arnaldo Carvalho de Melo
@ 2001-09-27 20:02   ` Paul Gortmaker
  2001-09-27 21:18     ` Aaron Tiensivu
  0 siblings, 1 reply; 15+ messages in thread
From: Paul Gortmaker @ 2001-09-27 20:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel

Arnaldo Carvalho de Melo wrote:

> Fantastic! who is the maintainer for the 0.x kernel series these days? I
> thought that 2.0 was Dave W., 2.2 was Alan, 2.4 Linus, so now we have to
> find people for 1.2 and finally get 1.2.14 released, man, how I wanted one
> with the dynamic PPP code in back in those days... 8)

Well, IIRC, Alan and DaveM were essentially 1.2.x maintainers with various
-ac and "ISS" patches (bonus points if you can remember what ISS stood for).
I've probably got some of those 1.2.13 patches around somewhere...

As for 1.0.9, at one point some years ago I had updated it (cf. linux-lite)
to compile with "new" gcc-2.7.2  when RAM was major $$$ - I don't imagine
it has been touched since.  

$ ls -l date
-rwxr-xr-x   1 root     root        13624 Sep  4  1992 date
$ ldd ./date
        /lib/libc.so.4 (4.0)
$ ./date
Thu Sep 27 15:58:19 EDT 2001
$ 

Wheee!  :)   Now if I just had a Decwriter for a serial console...

Paul.


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

* Re: [PATCH] Linux 0.01 disk lockup
  2001-09-27 20:02   ` Paul Gortmaker
@ 2001-09-27 21:18     ` Aaron Tiensivu
  0 siblings, 0 replies; 15+ messages in thread
From: Aaron Tiensivu @ 2001-09-27 21:18 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linux-kernel

> Well, IIRC, Alan and DaveM were essentially 1.2.x maintainers with various
> -ac and "ISS" patches (bonus points if you can remember what ISS stood
for).
> I've probably got some of those 1.2.13 patches around somewhere...

Internet Shit Slinger if I remember right. :)
There was also 1.2.14-LMP, the Linux Maintenance Project.. it even had a
mailing list.




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

* Re: [PATCH] Linux 0.01 disk lockup - read the old (1991) archives.
  2001-09-27 16:08   ` Mikulas Patocka
@ 2001-09-29 21:16     ` Rob Landley
  2001-09-30 12:29       ` Alan Cox
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Landley @ 2001-09-29 21:16 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel

On Thursday 27 September 2001 12:08, Mikulas Patocka wrote:
> > > Linux 0.01 has a bug in disk request sorting - when interrupt happens
> > > while sorting is active, the interrupt routine won't clear do_hd - thus
> > > the disk will stay locked up forever.
> >
> > Ehh..
> >
> > Mikulas, do you want to be the official maintainer for the 0.01.xxx
> > series?
> >
> > Note that much of the maintenance work is probably just to reproduce and
> > make all the user-level etc infrastructure available..
>
> It would be cool to have linux-0.01 distribution. I started to use linux
> in 2.0 times, so I'm probably not the right person to maintain it. I don't
> even know where to get programs for it and I doubt it would work on my 4G
> disk.
>
> Mikulas

You might want to read the mailing list entries from 1991 and early 1992:

http://www.kclug.org/old_archives/linux-activists/

I've put together a summary of some of the more interesting early posts from 
1991 and early 1992 for the computer history book I'm writing...

http://penguicon.sourceforge.net/comphist/1991.html

http://penguicon.sourceforge.net/comphist/1992.html

Rob

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

* Re: [PATCH] Linux 0.01 disk lockup - read the old (1991) archives.
  2001-09-29 21:16     ` [PATCH] Linux 0.01 disk lockup - read the old (1991) archives Rob Landley
@ 2001-09-30 12:29       ` Alan Cox
  2001-10-01 14:08         ` Rob Landley
  0 siblings, 1 reply; 15+ messages in thread
From: Alan Cox @ 2001-09-30 12:29 UTC (permalink / raw)
  To: landley; +Cc: Mikulas Patocka, linux-kernel

> You might want to read the mailing list entries from 1991 and early 1992:
> 
> http://www.kclug.org/old_archives/linux-activists/

The late 1993->95 list is archived at 

http://www.linux.org.uk/Old-LK/Old-linux-kernel

I don't currently know if the rest of 1992->late 1993 exists

Alan

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

* Re: [PATCH] Linux 0.01 disk lockup - read the old (1991) archives.
  2001-09-30 12:29       ` Alan Cox
@ 2001-10-01 14:08         ` Rob Landley
  2001-10-01 18:36           ` Virtual terminal support Rok Pergarec
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Landley @ 2001-10-01 14:08 UTC (permalink / raw)
  To: Alan Cox, landley; +Cc: Mikulas Patocka, linux-kernel

On Sunday 30 September 2001 08:29, Alan Cox wrote:
> > You might want to read the mailing list entries from 1991 and early 1992:
> >
> > http://www.kclug.org/old_archives/linux-activists/
>
> The late 1993->95 list is archived at
>
> http://www.linux.org.uk/Old-LK/Old-linux-kernel
>
> I don't currently know if the rest of 1992->late 1993 exists
>
> Alan

The kclug archives claim to run until the second week of october 1993.  I 
just haven't sorted through them that far yet.

http://www.kclug.org/old_archives/linux-activists/

Please don't beat on them TOO hard, I think they're on an ISDN line or 
something...

(The reason for limiting the search to mid 1992 is that by they they were 
already up to 0.95, so 0.01 was no longer relevant...)

Rob

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

* Virtual terminal support
  2001-10-01 14:08         ` Rob Landley
@ 2001-10-01 18:36           ` Rok Pergarec
  2001-10-01 19:22             ` James Simmons
  0 siblings, 1 reply; 15+ messages in thread
From: Rok Pergarec @ 2001-10-01 18:36 UTC (permalink / raw)
  To: linux-kernel

Hi!

This is propably not so important but anyway. I think that the kernel
should not complain about "unable to open an initial console" when
"Virtual terminal" support is disabled in the kernel.

bye



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

* Re: Virtual terminal support
  2001-10-01 18:36           ` Virtual terminal support Rok Pergarec
@ 2001-10-01 19:22             ` James Simmons
  0 siblings, 0 replies; 15+ messages in thread
From: James Simmons @ 2001-10-01 19:22 UTC (permalink / raw)
  To: Rok Pergarec; +Cc: linux-kernel


> This is propably not so important but anyway. I think that the kernel
> should not complain about "unable to open an initial console" when
> "Virtual terminal" support is disabled in the kernel.

You do need stdin, stdout, and stderr which is related to /dev/console at
boot up. See main.c for what I mean. So you need some kind of console
built in. Try serial console and you need to tell your kernel you are
using serial console. See linux/Documentation/serialconsole.txt


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

end of thread, other threads:[~2001-10-01 19:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-27 13:34 [PATCH] Linux 0.01 disk lockup Mikulas Patocka
2001-09-27 13:47 ` Arnaldo Carvalho de Melo
2001-09-27 20:02   ` Paul Gortmaker
2001-09-27 21:18     ` Aaron Tiensivu
2001-09-27 15:12 ` Richard Gooch
2001-09-27 15:18   ` Roeland Th. Jansen
2001-09-27 15:20     ` Richard Gooch
2001-09-27 16:07   ` Mikulas Patocka
2001-09-27 15:27 ` Linus Torvalds
2001-09-27 16:08   ` Mikulas Patocka
2001-09-29 21:16     ` [PATCH] Linux 0.01 disk lockup - read the old (1991) archives Rob Landley
2001-09-30 12:29       ` Alan Cox
2001-10-01 14:08         ` Rob Landley
2001-10-01 18:36           ` Virtual terminal support Rok Pergarec
2001-10-01 19:22             ` James Simmons

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