Re: Instant reboots with CPUTYPE=pentium-m

2005-01-07 Thread Jon Noack
Bartosz Fabianowski wrote:
 I use the athlon-xp switch on 3 boxes with no problems all of them
 running 5.3

 What CFLAGS are you using? I have CFLAGS=-O -pipe in my make.conf. Maybe
 you have optimization turned off and that's making a difference?

I reported the problem with the athlon-xp.  My /etc/make.conf looks like
the following (when I wish to kill the loader and experience instant
reboots, that is ;-):

CPUTYPE?= athlon-xp
CFLAGS= -O -pipe
COPTFLAGS= -O -pipe

Note that I only see the problem when building the loader as part of a
buildworld.  Compiling just the boot stuff in /usr/src/sys/boot/ (i.e.,
without a bootstrapped gcc) results in a loader that works fine.  Thus, I
think defining CPUTYPE results in a gcc that produces a bad loader.

Jon

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Instant reboots with CPUTYPE=pentium-m

2005-01-07 Thread Derkjan de Haan
- Original Message - 
From: Jon Noack [EMAIL PROTECTED]
To: Bartosz Fabianowski [EMAIL PROTECTED]
Cc: Chris [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 7:35 PM
Subject: Re: Instant reboots with CPUTYPE=pentium-m


Bartosz Fabianowski wrote:
I use the athlon-xp switch on 3 boxes with no problems all of them
running 5.3
What CFLAGS are you using? I have CFLAGS=-O -pipe in my make.conf. Maybe
you have optimization turned off and that's making a difference?
I reported the problem with the athlon-xp.  My /etc/make.conf looks like
the following (when I wish to kill the loader and experience instant
reboots, that is ;-):
CPUTYPE?= athlon-xp
CFLAGS= -O -pipe
COPTFLAGS= -O -pipe
Note that I only see the problem when building the loader as part of a
buildworld.  Compiling just the boot stuff in /usr/src/sys/boot/ (i.e.,
without a bootstrapped gcc) results in a loader that works fine.  Thus, I
think defining CPUTYPE results in a gcc that produces a bad loader.
Mentioning athlon-xp sparked my interest... One of my systems is unstable 
under load when compiled with CPUTYPE?= athlon-xp, but not with i686. This 
typically manifests itself as segmentation faults or ICE errors at random 
places during compile jobs. The bootloader seems always fine however.

regards,
Derkjan
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Instant reboots with CPUTYPE=pentium-m

2005-01-07 Thread Bartosz Fabianowski
Note that I only see the problem when building the loader as part of a
buildworld.  Compiling just the boot stuff in /usr/src/sys/boot/ (i.e.,
without a bootstrapped gcc) results in a loader that works fine.
Curious. Either what you are seeing is a different problem then or it 
somehow shows in a different way than on my system. I would be very 
interested in investigating this further.

To find the root of the cause, I guess it would be best to compare the 
.s files generated for the loader when a) compiling it as part of the 
world and b) compiling it on its own. In both cases,  CPUTYPE=athlon-xp 
should be set, of course. Also, you should be using the exact same GCC 
to eliminate the possibility that different GCC binaries behave in 
different ways.

I am not sure how much space this would take, but if you have the space, 
it would be great if you could do a full buildworld with -save-temps and 
then a separate build of the loader, with -save-temps again. For me, one 
of the offending files is:

/usr/obj/usr/src/sys/boot/i386/loader/bcache.s
You could try diffing that file and if it shows no differences, all the 
other .s files in that directory. Some file must change when the loader 
breaks / unbreaks after all.

If you can send me the diffs, I will be glad to look into it.
- Bartosz
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Instant reboots with CPUTYPE=pentium-m

2005-01-06 Thread Chris
I use the athlon-xp switch on 3 boxes with no problems all of them running 5.3


On Wed, 05 Jan 2005 22:00:04 +0100, Bartosz Fabianowski
[EMAIL PROTECTED] wrote:
 Hi list,
 
 I am still having the problems with instant reboots that I reported [1]
 a couple of weeks ago. I have a bit more info now and hope that someone
 can lead me in the right direction.
 
 The problem is that setting CPUTYPE=pentium-m in make.conf leads to a
 corrupt boot loader and a corrupt kernel being generated. This setting
 for the CPUTYPE has been available on -STABLE since 16th December, when
 revision 1.40.2.1 of bsd.cpu.mk was committed. I have traced the start
 of my problems to that exact commit (the commiter is CC'd).
 
 On -current, the setting has been available for a longer time and has
 led to the same problems for some people. Also, it seems that not only
 pentium-m is broken, but athlon-xp as well. The end of a thread on the
 -current mailing list discussing this issue is in [2]. Unfortunately, it
 provides no insight as to where the problem lies.
 
 It seems to me that every other part of the world, including GCC itself,
 is built correctly when CPUTYPE is set to pentium-m. The issue only
 affects the boot loader and the kernel for some reason.
 
 When I changed the CPUTYPE from pentium-m down to pentium3 (essentially
 just disabling SSE2) and recompiled the boot loader, I instantly got a
 working loader again. I have attached a diff of the .s files generated
 for the loader with CPUTYPE=pentium3 and CPUTYPE=pentium-m. I do not see
 any real changes except for the use of xmm registers when
 CPUTYPE=pentium-m is set.
 
 Does anybody have an idea how to debug this further? I am totally out of
 ideas and really do not know where to continue looking. I have some time
 on my hands to go searching for the bug - all I need is some direction.
 
 - Bartosz
 
 [1]
 http://lists.freebsd.org/pipermail/freebsd-stable/2004-December/010594.html
 [2]
 http://lists.freebsd.org/pipermail/freebsd-current/2004-November/042127.html
 
 
 diff -u loader_dir_p3/bcache.s loader_dir_pm/bcache.s
 --- loader_dir_p3/bcache.s  Wed Jan  5 21:56:29 2005
 +++ loader_dir_pm/bcache.s  Wed Jan  5 21:56:29 2005
 @@ -684,7 +684,7 @@
pushl   %edi
pushl   %esi
pushl   %ebx
 -   subl$36, %esp
 +   subl$28, %esp
movl12(%ebp), %ebx
movl16(%ebp), %esi
leal-16(%ebp), %eax
 @@ -692,21 +692,19 @@
calltime
movl$0, -20(%ebp)
movlbcache_ctl, %eax
 -   movl12(%eax), %eax
 -   movl%eax, -24(%ebp)
 +   movd12(%eax), %xmm0
movl$1, %ecx
cmplbcache_nblks, %ecx
jae .L99
 -   movlbcache_ctl, %eax
 -   movl%eax, -36(%ebp)
 -   movl%eax, -28(%ebp)
 -   movlbcache_nblks, %eax
 -   movl%eax, -32(%ebp)
 +   movd%eax, %xmm1
 +   movl%eax, -24(%ebp)
 +   movlbcache_nblks, %edi
 +   movl%edi, -28(%ebp)
.p2align 4,,15
 .L103:
movl%ecx, %eax
sall$4, %eax
 -   movl-36(%ebp), %edi
 +   movd%xmm1, %edi
movl4(%eax,%edi), %edx
xorl%esi, %edx
movl(%eax,%edi), %eax
 @@ -717,18 +715,17 @@
jmp .L99
.p2align 4,,7
 .L101:
 -   movl-28(%ebp), %edx
 +   movl-24(%ebp), %edx
movl%ecx, %eax
sall$4, %eax
 -   movl-24(%ebp), %edi
 +   movd%xmm0, %edi
cmpl%edi, 12(%eax,%edx)
jge .L100
 -   movl12(%eax,%edx), %eax
 -   movl%eax, -24(%ebp)
 +   movd12(%eax,%edx), %xmm0
movl%ecx, -20(%ebp)
 .L100:
incl%ecx
 -   cmpl-32(%ebp), %ecx
 +   cmpl-28(%ebp), %ecx
jb  .L103
 .L99:
movlbcache_blksize, %eax
 @@ -753,7 +750,7 @@
movl%eax, bcache_bcount
movlbcache_ctl, %eax
movl%edx, 12(%ecx,%eax)
 -   addl$36, %esp
 +   addl$28, %esp
popl%ebx
popl%esi
popl%edi
 diff -u loader_dir_p3/interp_backslash.s loader_dir_pm/interp_backslash.s
 --- loader_dir_p3/interp_backslash.sWed Jan  5 21:56:29 2005
 +++ loader_dir_pm/interp_backslash.sWed Jan  5 21:56:29 2005
 @@ -12,7 +12,7 @@
pushl   %edi
pushl   %esi
pushl   %ebx
 -   subl$32, %esp
 +   subl$28, %esp
movl8(%ebp), %ebx
movl$0, %edi
movl$0, %esi
 @@ -211,39 +211,39 @@
subl$55, %eax
sall$6, %eax
 .L31:
 -   movl%eax, -24(%ebp)
 +   movd%eax, %xmm0
movsbl  1(%ebx),%eax
leal-48(%eax), %edx
 -   movl%edx, -40(%ebp)
 -   movl-24(%ebp), %edx
 +   movl%edx, -36(%ebp)
 +   movd%xmm0, %edx
leal-384(%edx,%eax,8), %eax
 -   cmpl$9, -40(%ebp)
 +   cmpl$9, -36(%ebp)
jbe 

Re: Instant reboots with CPUTYPE=pentium-m

2005-01-06 Thread Bartosz Fabianowski
I use the athlon-xp switch on 3 boxes with no problems all of them running 5.3
What CFLAGS are you using? I have CFLAGS=-O -pipe in my make.conf. Maybe 
you have optimization turned off and that's making a difference?

- Bartosz
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Instant reboots with CPUTYPE=pentium-m

2005-01-06 Thread Bartosz Fabianowski
Replying to myself, I have found the problem and filed a but report:
http://www.freebsd.org/cgi/query-pr.cgi?pr=75898
Thanks for all the help everybody,
- Bartosz
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Instant reboots with CPUTYPE=pentium-m

2005-01-05 Thread Bartosz Fabianowski
Hi list,
I am still having the problems with instant reboots that I reported [1] 
a couple of weeks ago. I have a bit more info now and hope that someone 
can lead me in the right direction.

The problem is that setting CPUTYPE=pentium-m in make.conf leads to a 
corrupt boot loader and a corrupt kernel being generated. This setting 
for the CPUTYPE has been available on -STABLE since 16th December, when 
revision 1.40.2.1 of bsd.cpu.mk was committed. I have traced the start 
of my problems to that exact commit (the commiter is CC'd).

On -current, the setting has been available for a longer time and has 
led to the same problems for some people. Also, it seems that not only 
pentium-m is broken, but athlon-xp as well. The end of a thread on the 
-current mailing list discussing this issue is in [2]. Unfortunately, it 
provides no insight as to where the problem lies.

It seems to me that every other part of the world, including GCC itself, 
is built correctly when CPUTYPE is set to pentium-m. The issue only 
affects the boot loader and the kernel for some reason.

When I changed the CPUTYPE from pentium-m down to pentium3 (essentially 
just disabling SSE2) and recompiled the boot loader, I instantly got a 
working loader again. I have attached a diff of the .s files generated 
for the loader with CPUTYPE=pentium3 and CPUTYPE=pentium-m. I do not see 
any real changes except for the use of xmm registers when 
CPUTYPE=pentium-m is set.

Does anybody have an idea how to debug this further? I am totally out of 
ideas and really do not know where to continue looking. I have some time 
on my hands to go searching for the bug - all I need is some direction.

- Bartosz
[1] 
http://lists.freebsd.org/pipermail/freebsd-stable/2004-December/010594.html
[2] 
http://lists.freebsd.org/pipermail/freebsd-current/2004-November/042127.html
diff -u loader_dir_p3/bcache.s loader_dir_pm/bcache.s
--- loader_dir_p3/bcache.s  Wed Jan  5 21:56:29 2005
+++ loader_dir_pm/bcache.s  Wed Jan  5 21:56:29 2005
@@ -684,7 +684,7 @@
pushl   %edi
pushl   %esi
pushl   %ebx
-   subl$36, %esp
+   subl$28, %esp
movl12(%ebp), %ebx
movl16(%ebp), %esi
leal-16(%ebp), %eax
@@ -692,21 +692,19 @@
calltime
movl$0, -20(%ebp)
movlbcache_ctl, %eax
-   movl12(%eax), %eax
-   movl%eax, -24(%ebp)
+   movd12(%eax), %xmm0
movl$1, %ecx
cmplbcache_nblks, %ecx
jae .L99
-   movlbcache_ctl, %eax
-   movl%eax, -36(%ebp)
-   movl%eax, -28(%ebp)
-   movlbcache_nblks, %eax
-   movl%eax, -32(%ebp)
+   movd%eax, %xmm1
+   movl%eax, -24(%ebp)
+   movlbcache_nblks, %edi
+   movl%edi, -28(%ebp)
.p2align 4,,15
 .L103:
movl%ecx, %eax
sall$4, %eax
-   movl-36(%ebp), %edi
+   movd%xmm1, %edi
movl4(%eax,%edi), %edx
xorl%esi, %edx
movl(%eax,%edi), %eax
@@ -717,18 +715,17 @@
jmp .L99
.p2align 4,,7
 .L101:
-   movl-28(%ebp), %edx
+   movl-24(%ebp), %edx
movl%ecx, %eax
sall$4, %eax
-   movl-24(%ebp), %edi
+   movd%xmm0, %edi
cmpl%edi, 12(%eax,%edx)
jge .L100
-   movl12(%eax,%edx), %eax
-   movl%eax, -24(%ebp)
+   movd12(%eax,%edx), %xmm0
movl%ecx, -20(%ebp)
 .L100:
incl%ecx
-   cmpl-32(%ebp), %ecx
+   cmpl-28(%ebp), %ecx
jb  .L103
 .L99:
movlbcache_blksize, %eax
@@ -753,7 +750,7 @@
movl%eax, bcache_bcount
movlbcache_ctl, %eax
movl%edx, 12(%ecx,%eax)
-   addl$36, %esp
+   addl$28, %esp
popl%ebx
popl%esi
popl%edi
diff -u loader_dir_p3/interp_backslash.s loader_dir_pm/interp_backslash.s
--- loader_dir_p3/interp_backslash.sWed Jan  5 21:56:29 2005
+++ loader_dir_pm/interp_backslash.sWed Jan  5 21:56:29 2005
@@ -12,7 +12,7 @@
pushl   %edi
pushl   %esi
pushl   %ebx
-   subl$32, %esp
+   subl$28, %esp
movl8(%ebp), %ebx
movl$0, %edi
movl$0, %esi
@@ -211,39 +211,39 @@
subl$55, %eax
sall$6, %eax
 .L31:
-   movl%eax, -24(%ebp)
+   movd%eax, %xmm0
movsbl  1(%ebx),%eax
leal-48(%eax), %edx
-   movl%edx, -40(%ebp)
-   movl-24(%ebp), %edx
+   movl%edx, -36(%ebp)
+   movd%xmm0, %edx
leal-384(%edx,%eax,8), %eax
-   cmpl$9, -40(%ebp)
+   cmpl$9, -36(%ebp)
jbe .L37
movsbl  1(%ebx),%eax
leal-97(%eax), %edx
-   movl%edx, -40(%ebp)
-   movl-24(%ebp), %edx
+   movl%edx, -36(%ebp)
+   movd%xmm0, %edx
leal-696(%edx,%eax,8), %eax
-