Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-11 Thread P. J. McDermott
On 01/04/2011 07:46 AM, Colin Watson wrote:
 On Tue, Jan 04, 2011 at 12:06:54AM +, Colin Watson wrote:
   
 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
 
 2011-01-02  Colin Watson  cjwat...@ubuntu.com

 * grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
 on devices that do not implement function 0.
   
 I've applied this patch to trunk following an ack from Vladimir on IRC.
 I'll prepare an updated package for unstable shortly.
 
 Uploading now.  I'd appreciate confirmation from affected folks that
 this is enough to make things boot.  If it is, we can perhaps avoid
 worrying about the rest; otherwise, we'll have to get more creative.

 Thanks,
   

Sorry I haven't responded to this more quickly; I was busy with some
personal business last week. Thanks for the patch, and it does make GRUB
2's graphical menu load on my AO751h. :)

I noticed an odd lingering aesthetics issue though; most of the
background image is missing. The only parts of Squeeze's
`spacefun-grub.png' that are visible are the bottom of Earth and the two
stars on the top-right corner (basically, anything along the edges).
I've consistently reproduced this on two installations (one is a fresh
installation on a flash drive), even after purging and reinstalling
grub-pc and grub-common. The odd thing though is that it only happens
with desktop-base 6.0.5. The `spacefun-grub.png' from version 6.0.2 is
displayed in full.

P. J.



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-05 Thread Matt Zagrabelny
On Tue, Jan 4, 2011 at 6:46 AM, Colin Watson cjwat...@debian.org wrote:
 On Tue, Jan 04, 2011 at 12:06:54AM +, Colin Watson wrote:
 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
  2011-01-02  Colin Watson  cjwat...@ubuntu.com
 
      * grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
      on devices that do not implement function 0.

 I've applied this patch to trunk following an ack from Vladimir on IRC.
 I'll prepare an updated package for unstable shortly.

 Uploading now.  I'd appreciate confirmation from affected folks that
 this is enough to make things boot.  If it is, we can perhaps avoid
 worrying about the rest; otherwise, we'll have to get more creative.

Graphical booting is back. Thanks Colin.

-matt



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-04 Thread Colin Watson
On Tue, Jan 04, 2011 at 12:06:54AM +, Colin Watson wrote:
 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
  2011-01-02  Colin Watson  cjwat...@ubuntu.com
  
  * grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
  on devices that do not implement function 0.
 
 I've applied this patch to trunk following an ack from Vladimir on IRC.
 I'll prepare an updated package for unstable shortly.

Uploading now.  I'd appreciate confirmation from affected folks that
this is enough to make things boot.  If it is, we can perhaps avoid
worrying about the rest; otherwise, we'll have to get more creative.

Thanks,

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-04 Thread Steve McIntyre
On Tue, Jan 04, 2011 at 12:46:54PM +, Colin Watson wrote:
On Tue, Jan 04, 2011 at 12:06:54AM +, Colin Watson wrote:
 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
  2011-01-02  Colin Watson  cjwat...@ubuntu.com
  
 * grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
 on devices that do not implement function 0.
 
 I've applied this patch to trunk following an ack from Vladimir on IRC.
 I'll prepare an updated package for unstable shortly.

Uploading now.  I'd appreciate confirmation from affected folks that
this is enough to make things boot.  If it is, we can perhaps avoid
worrying about the rest; otherwise, we'll have to get more creative.

Just tested on Jo's laptop now, and the new version works exactly as
hoped. Thanks for the quick fix! Jo says many thankyous too. :-)

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
Since phone messaging became popular, the young generation has lost the
 ability to read or write anything that is longer than one hundred and sixty
 characters.  -- Ignatios Souvatzis




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-03 Thread Steve McIntyre
On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:

Whoops, I forgot to right-shift the header word.  Can you try 4.iso
instead, at the same location?  I also made it handle PCI-to-CardBus
bridges the same way as PCI-to-PCI bridges since that's what pciutils
does.

(In addition to 'set debug=pci', I'd recommend also doing 'set pager=1'
so that lspci's output will be paged.)

4.iso:

  grub set debug=pci
  grub set pager=1
  grub lspci
  bus/pci.c:92: bus 0x0
  00:00.0 8086:8100 [0600] Host Bridge
  00:02.0 8086:8108 [0300] VGA Controller
  00:1b.0 8086:811b [0403] Multimedia device
  bus/pci.c:143: bridge range 0x2-0x2
  00:1c.0 8086:8110 [0604] PCI-PCI Bridge
  bus/pci.c:143: bridge range 0x3-0x3
  00:1c.1 8086:8112 [0604] PCI-PCI Bridge
  00:1d.0 8086:8114 [0c03] USB Controller
  00:1d.1 8086:8115 [0c03] USB Controller
  00:1d.2 8086:8116 [0c03] USB Controller
  00:1d.7 8086:8117 [0c03] USB Controller [PI 20]
  00:1f.0 8086:8119 [0601] ISA Bridge
  00:1f.1 8086:811a [0101] IDE Controller [PI 80]
  bus/pci.c:92: bus 0x2
  02:00.0 10ec:8136 [0200] Ethernet Controller
  bus/pci.c:92: bus 0x3
  03:00.0 168c:001c [0200] Ethernet Controller
  grub


-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
Because heaters aren't purple! -- Catherine Pitt




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-03 Thread Colin Watson
On Mon, Jan 03, 2011 at 11:04:17AM +, Steve McIntyre wrote:
 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
 Whoops, I forgot to right-shift the header word.  Can you try 4.iso
 instead, at the same location?  I also made it handle PCI-to-CardBus
 bridges the same way as PCI-to-PCI bridges since that's what pciutils
 does.
 
 (In addition to 'set debug=pci', I'd recommend also doing 'set pager=1'
 so that lspci's output will be paged.)
 
 4.iso:
 
   grub set debug=pci
   grub set pager=1
   grub lspci
   bus/pci.c:92: bus 0x0
   00:00.0 8086:8100 [0600] Host Bridge
   00:02.0 8086:8108 [0300] VGA Controller
   00:1b.0 8086:811b [0403] Multimedia device
   bus/pci.c:143: bridge range 0x2-0x2
   00:1c.0 8086:8110 [0604] PCI-PCI Bridge
   bus/pci.c:143: bridge range 0x3-0x3
   00:1c.1 8086:8112 [0604] PCI-PCI Bridge
   00:1d.0 8086:8114 [0c03] USB Controller
   00:1d.1 8086:8115 [0c03] USB Controller
   00:1d.2 8086:8116 [0c03] USB Controller
   00:1d.7 8086:8117 [0c03] USB Controller [PI 20]
   00:1f.0 8086:8119 [0601] ISA Bridge
   00:1f.1 8086:811a [0101] IDE Controller [PI 80]
   bus/pci.c:92: bus 0x2
   02:00.0 10ec:8136 [0200] Ethernet Controller
   bus/pci.c:92: bus 0x3
   03:00.0 168c:001c [0200] Ethernet Controller
   grub

This looks right to me.  Excellent.  Vladimir, how does this patch look,
on top of my previous one?  (This is edited slightly relative to what
Steve tested, to make sure that the bus number never overflows
bus_present; this will never happen on x86 but might happen on other
architectures.  I've smoke-tested this change.)

2011-01-03  Colin Watson  cjwat...@ubuntu.com

* grub-core/bus/pci.c (grub_pci_iterate): Only scan bus 0 plus any
buses linked by PCI-to-PCI or PCI-to-CardBus bridges.
* include/grub/pci.h: Add definitions for bridges.

=== modified file 'grub-core/bus/pci.c'
--- grub-core/bus/pci.c 2010-06-30 00:30:05 +
+++ grub-core/bus/pci.c 2011-01-03 00:05:27 +
@@ -20,6 +20,7 @@
 #include grub/dl.h
 #include grub/pci.h
 #include grub/mm.h
+#include grub/misc.h
 
 /* FIXME: correctly support 64-bit architectures.  */
 /* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
@@ -78,9 +79,18 @@ grub_pci_iterate (grub_pci_iteratefunc_t
   grub_pci_address_t addr;
   grub_pci_id_t id;
   grub_uint32_t hdr;
+  grub_uint8_t bus_present[(GRUB_PCI_NUM_BUS + 7) / 8];
+
+  grub_memset (bus_present, 0, sizeof (bus_present));
+  bus_present[0] = 1; /* bus 0 is always enabled */
 
   for (dev.bus = 0; dev.bus  GRUB_PCI_NUM_BUS; dev.bus++)
 {
+  if (!(bus_present[dev.bus / 8]  (1  (dev.bus % 8
+   continue;
+
+  grub_dprintf (pci, bus 0x%x\n, dev.bus);
+
   for (dev.device = 0; dev.device  GRUB_PCI_NUM_DEVICES; dev.device++)
{
  for (dev.function = 0; dev.function  8; dev.function++)
@@ -112,6 +119,38 @@ grub_pci_iterate (grub_pci_iteratefunc_t
continue;
 #endif
 
+ /* On bus 0, look for PCI-to-PCI bridges and mark all buses
+within their ranges as present.  */
+ if (dev.bus == 0)
+   {
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE);
+ hdr = grub_pci_read (addr);
+
+ switch ((hdr  16)  0x7F) {
+   case GRUB_PCI_HEADER_PCI_BRIDGE:
+   case GRUB_PCI_HEADER_CARDBUS_BRIDGE:
+ {
+   grub_uint32_t bus_numbers;
+   grub_uint32_t secondary, subordinate, i;
+
+   addr = grub_pci_make_address
+ (dev, GRUB_PCI_REG_SEC_LAT_TIMER);
+   bus_numbers = grub_pci_read (addr);
+   secondary = (bus_numbers  8)  0xFF;
+   subordinate = (bus_numbers  16)  0xFF;
+
+   grub_dprintf (pci, bridge range 0x%x-0x%x\n,
+ secondary, subordinate);
+
+   for (i = secondary;
+i = subordinate  i  GRUB_PCI_NUM_BUS; i++)
+ bus_present[i / 8] |= (1  (i % 8));
+
+   break;
+ }
+ }
+   }
+
  if (hook (dev, id))
return;
 

=== modified file 'include/grub/pci.h'
--- include/grub/pci.h  2010-08-11 02:18:07 +
+++ include/grub/pci.h  2011-01-02 17:32:28 +
@@ -68,6 +68,24 @@
 #define  GRUB_PCI_REG_MIN_GNT  0x3e
 #define  GRUB_PCI_REG_MAX_LAT  0x3f
 
+/* Alternative register meanings if header type is 1 (PCI-to-PCI bridge).  */
+#define  GRUB_PCI_REG_SEC_LAT_TIMER 0x18
+#define  GRUB_PCI_REG_SUB_BUS_NUMBER0x19
+#define  GRUB_PCI_REG_SEC_BUS_NUMBER0x1a
+#define  GRUB_PCI_REG_PRI_BUS_NUMBER0x1b
+#define  GRUB_PCI_REG_SEC_STATUS0x1c
+#define  GRUB_PCI_REG_IO_LIMIT  0x1e
+#define  GRUB_PCI_REG_IO_BASE   0x1f
+#define  GRUB_PCI_REG_MEM_LIMIT 0x20
+#define  

Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-03 Thread Colin Watson
On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
 On Sun, Jan 02, 2011 at 10:41:50PM +, Steve McIntyre wrote:
  2.iso:
  
goes all the way through to bus ff and returns to a grub prompt
 
 This is interesting and suggests a measure of coincidence.  What that
 patch did was skip remaining functions on a device that doesn't
 implement function 0, taking that as an indication that it doesn't
 exist.  This was based on:
 
   http://en.wikipedia.org/wiki/PCI_configuration_space#Bus_enumeration
 
 Vladimir, are you OK with this change to trunk?
 
 2011-01-02  Colin Watson  cjwat...@ubuntu.com
 
   * grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
   on devices that do not implement function 0.

I've applied this patch to trunk following an ack from Vladimir on IRC.
I'll prepare an updated package for unstable shortly.

 Nevertheless, I'm not confident that this will fix the problem on all
 machines, so I would like to sort out the bridge handling as well.

This may be more complicated than I thought.  Seth Goldberg pointed out
that my approach fails to deal with peer host bridges correctly (i.e.
cases where there are multiple trees, not just a single one rooted at
bus 0).  Linux deals with this by asking the PCI BIOS for the last bus
number, but at this point things get complicated as you have to do
things in different ways for different firmware.

I am inclined to try the first piece alone and see how this works out,
and if we can fix the affected systems by just probing function 0 on
every device on every bus then let it stand at that, even if it feels
less elegant.  Inventing new piles of infrastructure to handle a case
I'm unsure about in a subsystem I don't know well isn't my idea of a
good time.

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-03 Thread Seth Goldberg


On Jan 3, 2011, at 4:06 PM, Colin Watson cjwat...@debian.org wrote:

 On Mon, Jan 03, 2011 at 12:13:01AM +, Colin Watson wrote:
 On Sun, Jan 02, 2011 at 10:41:50PM +, Steve McIntyre wrote:
 2.iso:
 
  goes all the way through to bus ff and returns to a grub prompt
 
 This is interesting and suggests a measure of coincidence.  What that
 patch did was skip remaining functions on a device that doesn't
 implement function 0, taking that as an indication that it doesn't
 exist.  This was based on:
 
  http://en.wikipedia.org/wiki/PCI_configuration_space#Bus_enumeration
 
 Vladimir, are you OK with this change to trunk?
 
 2011-01-02  Colin Watson  cjwat...@ubuntu.com
 
* grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
on devices that do not implement function 0.
 
 I've applied this patch to trunk following an ack from Vladimir on IRC.
 I'll prepare an updated package for unstable shortly.
 
 Nevertheless, I'm not confident that this will fix the problem on all
 machines, so I would like to sort out the bridge handling as well.
 
 This may be more complicated than I thought.  Seth Goldberg pointed out
 that my approach fails to deal with peer host bridges correctly (i.e.
 cases where there are multiple trees, not just a single one rooted at
 bus 0).  Linux deals with this by asking the PCI BIOS for the last bus
 number, but at this point things get complicated as you have to do
 things in different ways for different firmware.
 

  The proper way to do this on modern systems is to traverse the system's 
[DSDT/SSDT] ACPI tables looking for Device objects with the host bridge HID/CID 
and evaluate the BBN object (which can be a method), if it exists (which it 
must if there are multiple host bridges).  Since grub2 does not have a full 
ACPI interpreter (pulling in Intel's acpica would work ;), though the license 
may force it to be a grub-extra), going that route with anything less would 
never cover all systems' BBNs, so PCI BIOS would be simplest.  Things get a bit 
more complicated when a system has multiple PCI segments (i.e.: using the MCFG 
table, MMIO addresses that may be 4G, etc.), but that can be tackled later.

  --S



 I am inclined to try the first piece alone and see how this works out,
 and if we can fix the affected systems by just probing function 0 on
 every device on every bus then let it stand at that, even if it feels
 less elegant.  Inventing new piles of infrastructure to handle a case
 I'm unsure about in a subsystem I don't know well isn't my idea of a
 good time.
 
 -- 
 Colin Watson   [cjwat...@debian.org]
 
 ___
 Grub-devel mailing list
 grub-de...@gnu.org
 http://lists.gnu.org/mailman/listinfo/grub-devel



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-02 Thread Colin Watson
On Sat, Jan 01, 2011 at 10:12:44PM -0500, P. J. McDermott wrote:
 On 01/01/2011 06:57 PM, Colin Watson wrote:
  One effect of these changes was to load the video_cirrus and video_bochs
  modules by default (you can test whether this is the culprit by
  commenting them out in grub.cfg).  I've seen a handful of systems that
  hang while trying to enumerate the PCI bus in GRUB; it so happens that
  those are the only modules that usually trigger GRUB's PCI bus
  enumeration in normal circumstances ...
 
  You can also verify this at a lower level by trying 'lspci' at a GRUB
  prompt.  If it's the same problem, this will hang.
 
 I noticed the new bochs and cirrus files, but I didn't think they would
 affect a Poulsbo system. You're right though; I commented out those
 lines, and I'm now looking at a graphical menu for GNU GRUB  version
 1.98+20100804-11 (as installed by Squeeze beta1's debian-installer) on
 an AO751h. I suppose the problem then is in either grub_pci_iterate() or
 the hook functions passed to it by the cirrus and bochs modules?

grub_pci_iterate itself, IIRC.  On the system I briefly had access to,
it hung when it tried to read from a particular address in PCI memory
(when it got to some high-numbered bus - 171 or something like that, I
forget the exact number).

GRUB just reads through PCI busses sequentially from 0 to 255.  Linux
does something much more complicated.  In the time I had available I
couldn't figure out how to reproduce it in GRUB, or whether it was
necessary - it seemed to be stopping well before bus 255 though.  I
think it was getting the limit from PCI configuration space, but there
seemed to be some kind of multi-level scheme going on.

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-02 Thread Colin Watson
On Sun, Jan 02, 2011 at 09:14:25AM +, Colin Watson wrote:
 grub_pci_iterate itself, IIRC.  On the system I briefly had access to,
 it hung when it tried to read from a particular address in PCI memory
 (when it got to some high-numbered bus - 171 or something like that, I
 forget the exact number).
 
 GRUB just reads through PCI busses sequentially from 0 to 255.  Linux
 does something much more complicated.  In the time I had available I
 couldn't figure out how to reproduce it in GRUB, or whether it was
 necessary - it seemed to be stopping well before bus 255 though.  I
 think it was getting the limit from PCI configuration space, but there
 seemed to be some kind of multi-level scheme going on.

The PCI specification itself is behind a membership-only interface (I
haven't looked yet to see if membership is free).  However, from what I
can make out, we shouldn't be just walking from 0 to 255.  What you're
supposed to do is:

  * Walk through bus 0.
  * If any PCI-PCI bridge devices (class 6, subclass 4) were found, then
they may have additional buses behind them.  The bus numbers behind
these bridges must be  the bridge's Secondary Bus Number register,
and = the bridge's Subordinate Bus Number register.  Recursively
walk these buses in the same way as bus 0.

Since the Subordinate Bus Number is a recursive upper bound for any bus
beyond a given bridge, perhaps it's enough to take the maximum of all
the Subordinate Bus Number registers for all PCI-PCI bridges on bus 0
and use that as the system's maximum bus number.  It would seem more
efficient to account for possible gaps in bus numbering and not try to
interrogate buses we know to be in the gaps, though.

http://tldp.org/LDP/tlk/dd/pci.html seems like a reasonable layman's
summary.

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-02 Thread Colin Watson
On Sun, Jan 02, 2011 at 12:14:59AM +, Steve McIntyre wrote:
 On Sat, Jan 01, 2011 at 11:57:39PM +, Colin Watson wrote:
 Unfortunately, I haven't had my hands on an affected machine for more
 than a day or so, and that was when I was under deadline pressure so a
 workaround was the best I could manage.  Steve, is your affected system
 at home?  Maybe I could visit at some point (for others on the bug,
 we're in the same city) ...
 
 Hi Colin,
 
 Yup, it is at the moment - Jo's around here for the next couple of
 days and it's her machine. If that works for you, then great. Or we
 can work something out - contact me in private...

I have a few images you, or anyone with an affected system, can try
without needing me to be in front of the machine.  (If this doesn't work
then we can see if we can make arrangements.)  These are the usual
hybrid CD/USB images created by grub-mkrescue, despite the .iso
extension.  The patch files alongside them are each relative to
http://bzr.sv.gnu.org/r/grub/trunk/grub/ revision 3006, built with
'./autogen.sh  ./configure --with-platform=pc  make 
./grub-mkrescue --grub-mkimage=./grub-mkimage
--override-directory=grub-core -o 1.iso' (etc.).

  http://people.debian.org/~cjwatson/tmp/grub-pci/

Boot each of the images, which should result in a GRUB prompt, and run:

  set debug=pci
  lspci

The first image should hang; I'm interested in the last bus number
printed.  The second may or may not hang, depending on the exact point
things go wrong; again, I'm interested in the last bus number printed.
If my theory is correct, then the third should complete successfully;
either way, I'd like the full output from the third image (sorry, it may
take a little while to transcribe).

Thanks,

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-02 Thread Steve McIntyre
On Sun, Jan 02, 2011 at 06:18:08PM +, Colin Watson wrote:

  http://people.debian.org/~cjwatson/tmp/grub-pci/

Boot each of the images, which should result in a GRUB prompt, and run:

  set debug=pci
  lspci

The first image should hang; I'm interested in the last bus number
printed.  The second may or may not hang, depending on the exact point
things go wrong; again, I'm interested in the last bus number printed.
If my theory is correct, then the third should complete successfully;
either way, I'd like the full output from the third image (sorry, it may
take a little while to transcribe).

No problem, glad to help. :-)

1.iso:

  last bus number printed is b0

2.iso:

  goes all the way through to bus ff and returns to a grub prompt

3.iso: 

  grub set debug=pci
  grub lspci
  bus/pci.c:92: bus 0
  00:00.0 8086:8100 [0600] Host Bridge
  00:02.0 8086:8108 [0300] VGA Controller
  00:1b.0 8086:811b [0403] Multimedia device
  00:1c.0 8086:8110 [0604] PCI-PCI Bridge
  00:1c.1 8086:8112 [0604] PCI-PCI Bridge
  00:1d.0 8086:8114 [0c03] USB Controller
  00:1d.1 8086:8115 [0c03] USB Controller
  00:1d.2 8086:8116 [0c03] USB Controller
  00:1d.7 8086:8117 [0c03] USB Controller [PI 20]
  00:1f.0 8086:8119 [0601] ISA Bridge
  00:1f.1 8086:811a [0101] IDE Controller [PI 80]
  grub

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
Further comment on how I feel about IBM will appear once I've worked out
 whether they're being malicious or incompetent. Capital letters are forecast.
 Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-02 Thread Colin Watson
On Sun, Jan 02, 2011 at 10:41:50PM +, Steve McIntyre wrote:
 1.iso:
 
   last bus number printed is b0
 
 2.iso:
 
   goes all the way through to bus ff and returns to a grub prompt

This is interesting and suggests a measure of coincidence.  What that
patch did was skip remaining functions on a device that doesn't
implement function 0, taking that as an indication that it doesn't
exist.  This was based on:

  http://en.wikipedia.org/wiki/PCI_configuration_space#Bus_enumeration

Vladimir, are you OK with this change to trunk?

2011-01-02  Colin Watson  cjwat...@ubuntu.com

* grub-core/bus/pci.c (grub_pci_iterate): Skip remaining functions
on devices that do not implement function 0.

=== modified file 'grub-core/bus/pci.c'
--- grub-core/bus/pci.c 2010-06-30 00:30:05 +
+++ grub-core/bus/pci.c 2011-01-02 17:31:32 +
@@ -90,7 +90,14 @@ grub_pci_iterate (grub_pci_iteratefunc_t
 
  /* Check if there is a device present.  */
  if (id  16 == 0x)
-   continue;
+   {
+ if (dev.function == 0)
+   /* Devices are required to implement function 0, so if
+  it's missing then there is no device here.  */
+   break;
+ else
+   continue;
+   }
 
 #ifdef GRUB_MACHINE_MIPS_YEELOONG
  /* Skip ghosts.  */

Nevertheless, I'm not confident that this will fix the problem on all
machines, so I would like to sort out the bridge handling as well.

 3.iso: 
 
   grub set debug=pci
   grub lspci
   bus/pci.c:92: bus 0
   00:00.0 8086:8100 [0600] Host Bridge
   00:02.0 8086:8108 [0300] VGA Controller
   00:1b.0 8086:811b [0403] Multimedia device
   00:1c.0 8086:8110 [0604] PCI-PCI Bridge
   00:1c.1 8086:8112 [0604] PCI-PCI Bridge
   00:1d.0 8086:8114 [0c03] USB Controller
   00:1d.1 8086:8115 [0c03] USB Controller
   00:1d.2 8086:8116 [0c03] USB Controller
   00:1d.7 8086:8117 [0c03] USB Controller [PI 20]
   00:1f.0 8086:8119 [0601] ISA Bridge
   00:1f.1 8086:811a [0101] IDE Controller [PI 80]
   grub

Whoops, I forgot to right-shift the header word.  Can you try 4.iso
instead, at the same location?  I also made it handle PCI-to-CardBus
bridges the same way as PCI-to-PCI bridges since that's what pciutils
does.

(In addition to 'set debug=pci', I'd recommend also doing 'set pager=1'
so that lspci's output will be paged.)

Thanks,

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-01 Thread P. J. McDermott
I'm Cc'ing everyone involved in this bug for information, since I don't
know who's subscribed (I am though).

I first noticed this issue a month or two ago on installing Squeeze onto
my Acer Aspire One AO751h, though I didn't have time to do anything more
than install the old working GRUB 2 version. Yesterday I made myself a
Squeeze installation on a flash drive and tried to boot it on the
AO751h, only to be reminded of the issue. I'm on break now, so today I
began investigating the bug. I'm looking through the differences between
20100617-1 and 20100702-1 (thanks Steve for bisecting this).

Considering the machines this is affecting (machines with the Poulsbo
chipset) and the configuration workaround, I'd bet the issue lies in the
video subsystem. So far, the changes in the video/ directory appear to
be mostly code re-factoring, so I think my next step will be to add some
debugging output to 20100702-1's kernel and see where GRUB hangs up or
what isn't being done. Don't expect any miracles though, as this is my
first time in the GRUB 2 code. ;) If anyone has any thoughts on what the
problem might be or familiarity with the GRUB kernel's initialization of
the video subsystem, that would be helpful.

P. J.



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-01 Thread Colin Watson
On Sat, Jan 01, 2011 at 06:35:52PM -0500, P. J. McDermott wrote:
 Considering the machines this is affecting (machines with the Poulsbo
 chipset) and the configuration workaround, I'd bet the issue lies in the
 video subsystem. So far, the changes in the video/ directory appear to
 be mostly code re-factoring, so I think my next step will be to add some
 debugging output to 20100702-1's kernel and see where GRUB hangs up or
 what isn't being done. Don't expect any miracles though, as this is my
 first time in the GRUB 2 code. ;) If anyone has any thoughts on what the
 problem might be or familiarity with the GRUB kernel's initialization of
 the video subsystem, that would be helpful.

I think (with respect) that Vladimir was mistaken when he said that the
video changes in 20100702-1 only affected the EFI port.

One effect of these changes was to load the video_cirrus and video_bochs
modules by default (you can test whether this is the culprit by
commenting them out in grub.cfg).  I've seen a handful of systems that
hang while trying to enumerate the PCI bus in GRUB; it so happens that
those are the only modules that usually trigger GRUB's PCI bus
enumeration in normal circumstances ...

You can also verify this at a lower level by trying 'lspci' at a GRUB
prompt.  If it's the same problem, this will hang.

Unfortunately, I haven't had my hands on an affected machine for more
than a day or so, and that was when I was under deadline pressure so a
workaround was the best I could manage.  Steve, is your affected system
at home?  Maybe I could visit at some point (for others on the bug,
we're in the same city) ...

I've been meaning to post this hint to this bug for a while now, not to
mention trying to figure out what's actually going on rather than merely
a workaround.  Thanks for providing a nudge.

-- 
Colin Watson   [cjwat...@debian.org]



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-01 Thread Steve McIntyre
On Sat, Jan 01, 2011 at 11:57:39PM +, Colin Watson wrote:
On Sat, Jan 01, 2011 at 06:35:52PM -0500, P. J. McDermott wrote:
 Considering the machines this is affecting (machines with the Poulsbo
 chipset) and the configuration workaround, I'd bet the issue lies in the
 video subsystem. So far, the changes in the video/ directory appear to
 be mostly code re-factoring, so I think my next step will be to add some
 debugging output to 20100702-1's kernel and see where GRUB hangs up or
 what isn't being done. Don't expect any miracles though, as this is my
 first time in the GRUB 2 code. ;) If anyone has any thoughts on what the
 problem might be or familiarity with the GRUB kernel's initialization of
 the video subsystem, that would be helpful.

I think (with respect) that Vladimir was mistaken when he said that the
video changes in 20100702-1 only affected the EFI port.

One effect of these changes was to load the video_cirrus and video_bochs
modules by default (you can test whether this is the culprit by
commenting them out in grub.cfg).  I've seen a handful of systems that
hang while trying to enumerate the PCI bus in GRUB; it so happens that
those are the only modules that usually trigger GRUB's PCI bus
enumeration in normal circumstances ...

You can also verify this at a lower level by trying 'lspci' at a GRUB
prompt.  If it's the same problem, this will hang.

Unfortunately, I haven't had my hands on an affected machine for more
than a day or so, and that was when I was under deadline pressure so a
workaround was the best I could manage.  Steve, is your affected system
at home?  Maybe I could visit at some point (for others on the bug,
we're in the same city) ...

Hi Colin,

Yup, it is at the moment - Jo's around here for the next couple of
days and it's her machine. If that works for you, then great. Or we
can work something out - contact me in private...

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
I've only once written 'SQL is my bitch' in a comment. But that code 
 is in use on a military site... -- Simon Booth




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#594967: Bug #594967: [poulsbo] grub-pc Hangs After Welcome to GRUB!

2011-01-01 Thread P. J. McDermott
On 01/01/2011 06:57 PM, Colin Watson wrote:
 On Sat, Jan 01, 2011 at 06:35:52PM -0500, P. J. McDermott wrote:
   
 Considering the machines this is affecting (machines with the Poulsbo
 chipset) and the configuration workaround, I'd bet the issue lies in the
 video subsystem. So far, the changes in the video/ directory appear to
 be mostly code re-factoring, so I think my next step will be to add some
 debugging output to 20100702-1's kernel and see where GRUB hangs up or
 what isn't being done. Don't expect any miracles though, as this is my
 first time in the GRUB 2 code. ;) If anyone has any thoughts on what the
 problem might be or familiarity with the GRUB kernel's initialization of
 the video subsystem, that would be helpful.
 
 I think (with respect) that Vladimir was mistaken when he said that the
 video changes in 20100702-1 only affected the EFI port.

 One effect of these changes was to load the video_cirrus and video_bochs
 modules by default (you can test whether this is the culprit by
 commenting them out in grub.cfg).  I've seen a handful of systems that
 hang while trying to enumerate the PCI bus in GRUB; it so happens that
 those are the only modules that usually trigger GRUB's PCI bus
 enumeration in normal circumstances ...

 You can also verify this at a lower level by trying 'lspci' at a GRUB
 prompt.  If it's the same problem, this will hang.
   

I noticed the new bochs and cirrus files, but I didn't think they would
affect a Poulsbo system. You're right though; I commented out those
lines, and I'm now looking at a graphical menu for GNU GRUB  version
1.98+20100804-11 (as installed by Squeeze beta1's debian-installer) on
an AO751h. I suppose the problem then is in either grub_pci_iterate() or
the hook functions passed to it by the cirrus and bochs modules?

 Unfortunately, I haven't had my hands on an affected machine for more
 than a day or so, and that was when I was under deadline pressure so a
 workaround was the best I could manage.  Steve, is your affected system
 at home?  Maybe I could visit at some point (for others on the bug,
 we're in the same city) ...
   

I can do testing and debugging on my system as well, if it helps. I
might poke around grub_pci_iterate() and the hook functions tonight or
tomorrow sometime.

P. J.



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org