From nobody@FreeBSD.org  Thu Aug 16 19:34:13 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 13B0A10656A5
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Aug 2012 19:34:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D89638FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Aug 2012 19:34:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q7GJYCLr080086
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Aug 2012 19:34:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q7GJYCaR080085;
	Thu, 16 Aug 2012 19:34:12 GMT
	(envelope-from nobody)
Message-Id: <201208161934.q7GJYCaR080085@red.freebsd.org>
Date: Thu, 16 Aug 2012 19:34:12 GMT
From: Harald von Fellenberg <productnews@hvf.ch>
To: freebsd-gnats-submit@FreeBSD.org
Subject: FreeBSD 9.x does not boot if 2 hard disks are on system
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         170677
>Category:       amd64
>Synopsis:       FreeBSD 9.x does not boot if 2 hard disks are on system
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ae
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 16 19:40:11 UTC 2012
>Closed-Date:    Wed Jan 16 03:53:36 UTC 2013
>Last-Modified:  Wed Jan 16 03:53:36 UTC 2013
>Originator:     Harald von Fellenberg
>Release:        FreeBSD 9.1-BETA1
>Organization:
>Environment:
FreeBSD 9.1-BETA1 FreeBSD 9.1-BETA1 #0: Thu Jul 12 09:38:51 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
FreeBSD 9.x does not boot on AMD64 system (16GB mem) when 2 hard disks are present, but boots if second disk is removed. 
I tried FreeBSD 9.1-BETA1 and, earlier, PCBSD 9.0-RELEASE and PCBSD 9.0-STABLE-20120524 (all 64 bit). The behaviour is similar.

Hardware configuration:
-----------------------
Motherboard: GA-Z68X-UD3H-B3(rev. 1.0)
BIOS version: F9

CPU: Intel i5 2500K (3300) Quad Core
CPU frequency: 3300 MHz

Memory: 16 GB, Kingston DDR3-SDRAM 1333 MHz

Harddisks: 2 Western Digital  WDC WD10EALX-009BA0 1 TB (SATA)

CD/DVD R/W: iHAS124 (SATA)

Graphics card: ASUS Nvidia GeForce ENGTX550 Ti DC DI

Power Supply: 550 W

BIOS Parameters (only the interesting ones)
-------------------------------------------

BIOS Version F9
EFI CD/DVD boot option AUTO
HDD SMART ENABLED
PCH SATA control mode  AHCI
SATA Port 0-3 native mode ENABLED
GSATA3 controller ENABLED

System Behaviour:
-----------------
I bought the system in November 2011 with one HD and one DVD R/W.
I run this in a multi-boot configuration with Windows-7,
Ubuntu 10.04 (lucid lynx), Debian (squeeze), PCBSD 9.0 (FreeBSD based).
Everything worked fine.

Last month I added a second HD (identical type to first HD).
Installation details see above.
Windows-7, Ubuntu, and Debian worked as expected. But FreeBSD and PCBSD do not
start properly. I get the following display:

BTX loader 1.00 BTX version is 1.02
Console: internal video/keyboard
BIOS drive C: is disk 0
BIOS drive D: is disk 1
|

The vertical bar | shows usually the "spinner", a rapid
sequence of | / - \ giving the user the impression ot a spinnign wheel,
until the loader prompt is displayed and the boot process continues.

In my case, the "spinner" does not spin, but remains quiet or advances
a few times in a multi-second interval until coming to  complete stop.
This behaviour is the same for all the different SCSI and BIOS
configurations that I have tried.
The same behaviour occurs for booting PCBSD 9.x from HD, from DVD, and from
USB stick. FreeBSD 9.1-BETA1 boots from CD and can be installed on HD, but the installed system then gets stuck like shown.
In other words, FreeBSD cannot be run.

I assume that it is the bootstrap loader that poses a problem.

>How-To-Repeat:
the second disk has been unplugged (power and/or SATA), then both PCBSD and FreeBSD can be booted and run from the first HD. After pluggin in the second disk, booting FreeBSD and PCBSD fails.
>Fix:


>Release-Note:
>Audit-Trail:
Date: Thu, 25 Oct 2012 17:37:48 GMT
From: Harald von Fellenberg <productnews@hvf.ch>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Followup to amd64/170677: FreeBSD 9.x does not boot if 2 hard disks are on system

Followup to my earlier bug report amd64/170677.
I instrumented the loader code (in /usr/src/sys/boot) with various
printf's to see where the delay occurs. Here are my findings:

1. in /usr/src/sys/boot/common/devopen.c around line 47:

    /* point to device-specific data so that device open can use it */
    f->f_devdata = dev;
    result = dev->d_dev->dv_open(f, dev);
    if (result != 0) {

the call to dev->d_dev->dv_open(f, dev) always blocks for around 15
seconds, both for existing and non-existing files. Why is that?

2. the loader opens about 19 existing files (among them the kernel at
/boot/kernel/kernel five times!) and tries to open about 18 non-existing
files (among them /boot/kernel/linker.hints twice). Each open adds about
15 seconds, so the complete time to get to the loader menu is around 10
to 11 minutes.

I do not know why this delay occurs, why it only occurs when 2 HDs are
present, and how it can be avoided. every help to solve this riddle is
appreciated!

From: "Andrey V. Elsukov" <ae@FreeBSD.org>
To: bug-followup@FreeBSD.org, productnews@hvf.ch
Cc:  
Subject: Re: amd64/170677: FreeBSD 9.x does not boot if 2 hard disks are on
 system
Date: Sun, 06 Jan 2013 00:58:57 +0400

 Hi Harald,
 
 Can you try the loader from the fresh FreeBSD 10-CURRENT snapshot or
 from the FreeBSD 9-STABLE? They both contains many fixes and
 improvements for the loader.
 
 -- 
 WBR, Andrey V. Elsukov

From: Productnews <productnews@hvf.ch>
To: "Andrey V. Elsukov" <ae@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: amd64/170677: FreeBSD 9.x does not boot if 2 hard disks are on
 system
Date: Sun, 06 Jan 2013 17:21:11 +0100

 Am 05.01.2013 21:58, schrieb Andrey V. Elsukov:
 > Hi Harald,
 >
 > Can you try the loader from the fresh FreeBSD 10-CURRENT snapshot or
 > from the FreeBSD 9-STABLE? They both contains many fixes and
 > improvements for the loader.
 >
 Hi Andrey
 
 I will try it with pleasure as soon as I am back at my 64 bit machine, 
 i.e. in about 10 days. I will then report back to you.
 
 Harald

From: Productnews <productnews@hvf.ch>
To: "Andrey V. Elsukov" <ae@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, kris@pcbsd.org
Subject: Re: amd64/170677: FreeBSD 9.x does not boot if 2 hard disks are on
 system
Date: Mon, 14 Jan 2013 14:51:54 +0100

 Am 06.01.2013 17:21, schrieb Productnews:
 > Am 05.01.2013 21:58, schrieb Andrey V. Elsukov:
 >> Hi Harald,
 >>
 >> Can you try the loader from the fresh FreeBSD 10-CURRENT snapshot or
 >> from the FreeBSD 9-STABLE? They both contains many fixes and
 >> improvements for the loader.
 >>
 > Hi Andrey
 >
 > I will try it with pleasure as soon as I am back at my 64 bit machine, 
 > i.e. in about 10 days. I will then report back to you.
 >
 > Harald
 Hi Andrey
 
 I have installed 9.1-STABLE (amd64-20131018-r245175) on my system with 2 
 HDs, and the system boots like a rocket! Excellent job of yours, thanks 
 a lot! Dobro dobro :-)
 
 Now I wish that the new loader finds its way into PCBSD asap!
 
 thank you again
 
 Harald
State-Changed-From-To: open->closed 
State-Changed-By: ae 
State-Changed-When: Wed Jan 16 03:51:02 UTC 2013 
State-Changed-Why:  
The submitter has confirmed, that problem is fixed now. 


Responsible-Changed-From-To: freebsd-amd64->ae 
Responsible-Changed-By: ae 
Responsible-Changed-When: Wed Jan 16 03:51:02 UTC 2013 
Responsible-Changed-Why:  
Take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=170677 
>Unformatted:
