Discussion:
No ATA disks on 9.1
(too old to reply)
Alex Keda
2013-05-02 21:02:15 UTC
Permalink
see begin in:
http://lists.freebsd.org/pipermail/freebsd-current/2012-November/038000.html

today, I have time and try find problem commit for 9-stable

2012.05.04.15.20.00 - all work OK
2012.05.05.00.00.00 - cannot boot

it's only two kernel-related file for this period:
Edit src/lib/libc/gen/sem_new.c
Add delta 1.8.2.2 2012.05.04.20.45.53 jilles
Edit src/sys/dev/pci/pci.c
Add delta 1.425.2.8 2012.05.04.15.38.47 hselasky
Edit src/sys/ufs/ufs/ufs_vnops.c
Add delta 1.328.2.7 2012.05.04.15.51.23 jh


diff -Nru /usr/src/sys/dev/pci/pci.c /tmp/src/sys/dev/pci/pci.c
--- /usr/src/sys/dev/pci/pci.c 2013-05-03 00:05:19.000000000 +0400
+++ /tmp/src/sys/dev/pci/pci.c 2013-05-02 23:56:38.000000000 +0400
@@ -27,7 +27,7 @@
*/

#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.425.2.7 2012/04/11
20:50:17 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.425.2.8 2012/05/04
15:38:47 hselasky Exp $");

#include "opt_bus.h"

@@ -2746,16 +2746,15 @@
prefetch ? RF_PREFETCHABLE : 0);
if (res == NULL) {
/*
- * If the allocation fails, clear the BAR and delete
- * the resource list entry to force
- * pci_alloc_resource() to allocate resources from the
- * parent.
+ * If the allocation fails, delete the resource list entry
+ * to force pci_alloc_resource() to allocate resources
+ * from the parent.
*/
resource_list_delete(rl, type, reg);
- start = 0;
- } else
+ } else {
start = rman_get_start(res);
- pci_write_bar(dev, pm, start);
+ pci_write_bar(dev, pm, start);
+ }
return (barlen);
}

@@ -3824,7 +3823,7 @@
if ((desc = malloc(strlen(vp) + strlen(dp) + 3, M_DEVBUF,
M_NOWAIT)) !=
NULL)
sprintf(desc, "%s, %s", vp, dp);
- out:
+out:
if (vp != NULL)
free(vp, M_DEVBUF);
if (dp != NULL)
@@ -4100,7 +4099,7 @@
count, *rid, type, rman_get_start(res));
map = rman_get_start(res);
pci_write_bar(child, pm, map);
-out:;
+out:
return (res);
}

@@ -4289,19 +4288,6 @@
type, rid, rman_get_start(rle->res));
return;
}
-
-#ifndef __PCI_BAR_ZERO_VALID
- /*
- * If this is a BAR, clear the BAR so it stops
- * decoding before releasing the resource.
- */
- switch (type) {
- case SYS_RES_IOPORT:
- case SYS_RES_MEMORY:
- pci_write_bar(child, pci_find_bar(child, rid), 0);
- break;
- }
-#endif
resource_list_unreserve(rl, dev, child, type, rid);
}
resource_list_delete(rl, type, rid);

diff -Nru /usr/src/sys/ufs/ufs/ufs_vnops.c /tmp/src/sys/ufs/ufs/ufs_vnops.c
--- /usr/src/sys/ufs/ufs/ufs_vnops.c 2013-05-03 00:05:30.000000000 +0400
+++ /tmp/src/sys/ufs/ufs/ufs_vnops.c 2013-05-02 23:56:49.000000000 +0400
@@ -35,7 +35,7 @@
*/

#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.328.2.6 2012/05/02
15:15:28 jh Exp $");
+__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.328.2.7 2012/05/04
15:51:23 jh Exp $");

#include "opt_quota.h"
#include "opt_suiddir.h"
@@ -528,6 +528,10 @@
return (EINVAL);
}
if (vap->va_flags != VNOVAL) {
+ if ((vap->va_flags & ~(UF_NODUMP | UF_IMMUTABLE |
UF_APPEND |
+ UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE |
+ SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0)
+ return (EOPNOTSUPP);
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
/*
Alex Keda
2013-05-03 04:35:12 UTC
Permalink
Post by Alex Keda
http://lists.freebsd.org/pipermail/freebsd-current/2012-November/038000.html
today, I have time and try find problem commit for 9-stable
2012.05.04.15.20.00 - all work OK
2012.05.05.00.00.00 - cannot boot
I try build after
Post by Alex Keda
Edit src/sys/dev/pci/pci.c
Add delta 1.425.2.8 2012.05.04.15.38.47 hselasky
it's cannot boot
John Baldwin
2013-05-03 17:20:54 UTC
Permalink
Post by Alex Keda
http://lists.freebsd.org/pipermail/freebsd-current/2012-November/038000.html
Hmm, what I see is that hdac0 is affected by this, but it's a bit odd. Can
you try the patch below, but can you also get the output of 'devinfo -u' and
'devinfo -rv' from the 9.0 kernel?

Index: /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c
===================================================================
--- /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c (revision 250212)
+++ /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c (working copy)
@@ -2816,13 +2816,37 @@
*/
res = resource_list_reserve(rl, bus, dev, type, &reg, start, end, count,
prefetch ? RF_PREFETCHABLE : 0);
+#if 0
+ if (res == NULL && (start != 0 || end != ~0ul)) {
+ /*
+ * If the allocation fails, try to allocate a resource for
+ * this BAR using any available range. The firmware felt
+ * it was important enough to assign a resource, so don't
+ * disable decoding if we can help it.
+ */
+ resource_list_delete(rl, type, reg);
+ start = 0;
+ end = ~0ul;
+ resource_list_add(rl, type, reg, 0, ~0ul, count);
+ resource_list_add(rl, type, reg, start, end, count);
+ res = resource_list_reserve(rl, bus, dev, type, &reg, 0, ~0ul,
+ count, prefetch ? RF_PREFETCHABLE : 0);
+ }
+#endif
if (res == NULL) {
/*
* If the allocation fails, delete the resource list entry
- * to force pci_alloc_resource() to allocate resources
- * from the parent.
+ * and disable decoding for this device.
+ *
+ * If the driver requests this resource in the future,
+ * pci_reserve_map() will try to allocate fresh resources.
*/
resource_list_delete(rl, type, reg);
+ pci_disable_io(dev, type);
+ device_printf(bus,
+ "pci%d:%d:%d:%d bar %#x failed to allocate\n",
+ pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev),
+ pci_get_function(dev), reg);
} else {
start = rman_get_start(res);
pci_write_bar(dev, pm, start);
--
John Baldwin
Alex Keda
2013-05-03 17:54:01 UTC
Permalink
Post by John Baldwin
Post by Alex Keda
http://lists.freebsd.org/pipermail/freebsd-current/2012-November/038000.html
Hmm, what I see is that hdac0 is affected by this, but it's a bit odd. Can
you try the patch below, but can you also get the output of 'devinfo -u' and
'devinfo -rv' from the 9.0 kernel?
see attached files
=========
about patch, I cannot apply it for 9.1 source, too many differents...
John Baldwin
2013-05-03 18:33:57 UTC
Permalink
Post by Alex Keda
Post by John Baldwin
Post by Alex Keda
http://lists.freebsd.org/pipermail/freebsd-current/2012-
November/038000.html
Post by Alex Keda
Post by John Baldwin
Hmm, what I see is that hdac0 is affected by this, but it's a bit odd.
Can
Post by Alex Keda
Post by John Baldwin
you try the patch below, but can you also get the output of 'devinfo -u' and
'devinfo -rv' from the 9.0 kernel?
see attached files
Ok, your BIOS assigns conflicting resources to ahci0 and hdac0. HPS' patch
means that hdac0 claims register reads of ahci0 which breaks things. The
patch I posted should help.

I was able to apply the patch to 9 without any difficulties:

% patch < ~/work/patches/pci_fail_reseve.patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c
|===================================================================
|--- /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c (revision 250212)
|+++ /home/jhb/work/freebsd/svn/head/sys/dev/pci/pci.c (working copy)
--------------------------
Patching file pci.c using Plan A...
Hunk #1 succeeded at 2745 (offset -71 lines).
done

That file hasn't changed since 9.1, so no idea why it doesn't work for you.

% svn info pci.c
Path: pci.c
Name: pci.c
..
URL: svn+ssh://svn.freebsd.org/base/stable/9/sys/dev/pci/pci.c
Repository Root: svn+ssh://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 250212
Node Kind: file
Schedule: normal
Last Changed Author: marius
Last Changed Rev: 248052
--
John Baldwin
Alex Keda
2013-05-03 18:28:19 UTC
Permalink
Post by John Baldwin
Post by Alex Keda
http://lists.freebsd.org/pipermail/freebsd-current/2012-November/038000.html
Hmm, what I see is that hdac0 is affected by this, but it's a bit odd. Can
you try the patch below, but can you also get the output of 'devinfo -u' and
'devinfo -rv' from the 9.0 kernel?
I use this patch:
srv0# diff -Nru sys/dev/pci/pci.c.orig sys/dev/pci/pci.c
--- sys/dev/pci/pci.c.orig 2012-11-17 12:47:51.000000000 +0400
+++ sys/dev/pci/pci.c 2013-05-03 21:49:18.000000000 +0400
@@ -2751,6 +2751,11 @@
* from the parent.
*/
resource_list_delete(rl, type, reg);
+ pci_disable_io(dev, type);
+ device_printf(bus,
+ "pci%d:%d:%d:%d bar %#x failed to allocate\n",
+ pci_get_domain(dev), pci_get_bus(dev),
pci_get_slot(dev),
+ pci_get_function(dev), reg);
} else {
start = rman_get_start(res);
pci_write_bar(dev, pm, start);
srv0#


all OK:

HP# uname -a
FreeBSD HP.lissyara.su 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Fri May
3 22:03:50 MSK 2013
***@srv0.host-food.ru:/usr/obj/usr/src/sys/GENERIC amd64
HP#


Thanks!
Loading...