Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2007-01-06 Thread Frans Pop
On Friday 05 January 2007 20:47, Joey Hess wrote:
> Here's a patch that does the same thing, while avoiding the xargs, pwd
> -P, and awk (and also the cd). I haven't tested it in d-i yet, but /sys
> should be there, so it probably works.

Works in d-i on vmware:
modulemap: 8086:7111 piix
modulemap: 8086:7112 uhci_hcd
modulemap: 1000:0030 mptspi
modulemap: 1022:2000 pcnet32

Note: your patch still does the 'cd /sys/bus/pci/devices' at the beginning 
of list_loaded_modules, so the WD will still be different after it exits.
It does no real harm, so I'm unsure if it really needs fixing or not.


pgpld95vkn1AS.pgp
Description: PGP signature


Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2007-01-05 Thread Joey Hess
Frans Pop wrote:
> + module=$(cd $address/driver/module; pwd -P | xargs 
> basename)

I'm concerned about the portability of pwd -P. /bin/pwd does not support
this, although all the major shells, including busybox sh, have builtins
that do support it.

Here's a patch that does the same thing, while avoiding the xargs, pwd -P,
and awk (and also the cd). I haven't tested it in d-i yet, but /sys should
be there, so it probably works.

-- 
see shy jo
Index: report-hw
===
--- report-hw   (revision 43888)
+++ report-hw   (working copy)
@@ -14,11 +14,29 @@
fi
 }
 
+list_loaded_modules () {
+   cd /sys/bus/pci/devices
+   for address in *; do
+   if [ -d "$address/driver/module" ]; then
+   module=$(basename "$(readlink $address/driver/module)")
+   if grep -q "^$module " /proc/modules; then
+   address=$(echo $address | sed s/://)
+   echo "$(lspci -n -s $address | tail -n 1 | cut 
-d ' ' -f 3) $module"
+   fi
+   fi
+   done
+}
+
 uname -a 2>&1 | addinfo "umame -a"
 
 if type lspci >/dev/null 2>&1; then
lspci -nn  2>&1 | addinfo "lspci -nn"
lspci -vnn 2>&1 | addinfo "lspci -vnn"
+
+   # List which modules are referring to which PCI devices
+   if [ -d /sys/bus/pci/devices ] ; then
+   list_loaded_modules | addinfo modulemap
+   fi
 else
addfile /proc/pci
addfile /proc/bus/pci/devices


signature.asc
Description: Digital signature


Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2007-01-03 Thread Frans Pop
On Sunday 31 December 2006 11:14, Petter Reinholdtsen wrote:
> In bug #403876 I got code for discover-data from Auke Kok to extract
> which PCI devices the various kernel modules are attached to.  This
> information would make it a lot easier to figure out which kernel
> module have a problem if the Debian installation isn't working as it
> should, so I believe it is important to get it included in the
> installation-report package in Etch.  I set severity important because
> of this.

I have reworked the patch a bit and was going to commit when I noticed two 
commands are used that are not supported in the d-i environment: awk and 
xargs.

Can you please have a look at fixing that?

Cheers,
FJP

Index: report-hw
===
--- report-hw	(revision 43840)
+++ report-hw	(working copy)
@@ -14,11 +14,30 @@
 	fi
 }
 
+list_loaded_modules () {
+	cd /sys/bus/pci/devices
+	for address in *; do
+		if [ -d "$address/driver/module" ]; then
+			module=$(cd $address/driver/module; pwd -P | xargs basename)
+			if grep -q "^$module " /proc/modules; then
+address=$(echo $address | sed s/://)
+echo "$(lspci -n -s $address | tail -n 1 | awk '{print $3}') $module"
+			fi
+		fi
+	done
+}
+
 uname -a 2>&1 | addinfo "umame -a"
 
 if type lspci >/dev/null 2>&1; then
 	lspci -nn  2>&1 | addinfo "lspci -nn"
 	lspci -vnn 2>&1 | addinfo "lspci -vnn"
+
+	# List which modules are referring to which PCI devices
+	if [ -d /sys/bus/pci/devices ] ; then
+		# Avoid working directory change
+		( list_loaded_modules ) | addinfo modulemap
+	fi
 else
 	addfile /proc/pci
 	addfile /proc/bus/pci/devices


pgp3ZXQTYV9zl.pgp
Description: PGP signature


Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2007-01-01 Thread Petter Reinholdtsen

[Frans Pop]
> Not yet tested the patch, but the idea looks nice.

Good to hear.  On my laptop, the code in question give me this output:

  8086:2590 intel_agp
  8086:2658 uhci_hcd
  8086:2659 uhci_hcd
  8086:265a uhci_hcd
  8086:265b uhci_hcd
  8086:265c ehci_hcd
  8086:266e snd_intel8x0
  8086:266d snd_intel8x0m
  8086:2653 ata_piix
  8086:266a i2c_i801
  14e4:167d tg3
  1180:0476 yenta_socket
  8086:4224 ipw2200

Just the kind of information needed to understand what drivers are
activated. :)

> This should be '$lspci', right?

Yes.  I forgot to change the call itself to use the detected path to
lspci.

Friendly,
-- 
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2006-12-31 Thread Frans Pop
Hi Petter,

Not yet tested the patch, but the idea looks nice.

On Sunday 31 December 2006 11:14, Petter Reinholdtsen wrote:
> + if grep -q "^$module " /proc/modules ; then
> + address=$(echo $address |sed s/://)
> + echo "`lspci -n -s $address | tail -n 1 | awk '{print $3}'` 
> $module"

This should be '$lspci', right?

Some minor comments:
- please always use tab indentation in d-i (saves memory)
- we slightly prefer '$(...)' over '`...`'.

Cheers,
FJP

Note to self and joeyh;
Is the check for /target//usr/bin/lspci still useful now that lspci
is no longer installed by default?
I suspect that the chance of it not being available in d-i environment
but somehow installed in /target is very close to zero.


pgpd5F0Obki9w.pgp
Description: PGP signature


Bug#405102: installation-report: Include info on which PCI device is in used by which kernel module

2006-12-31 Thread Petter Reinholdtsen

Package:  installation-report
Version:  2.25
Severity: important
Tags: patch

In bug #403876 I got code for discover-data from Auke Kok to extract
which PCI devices the various kernel modules are attached to.  This
information would make it a lot easier to figure out which kernel
module have a problem if the Debian installation isn't working as it
should, so I believe it is important to get it included in the
installation-report package in Etch.  I set severity important because
of this.

Here is a patch to enable it, based on the current svn code.  I've
tested it on my installed system, but not in the udeb / d-i
environment.  I'm not sure if for example awk, sed and the /sys/ mount
point is available in that environment, so it might fail there.

Index: report-hw
===
--- report-hw   (revision 43704)
+++ report-hw   (working copy)
@@ -17,9 +17,11 @@
 uname -a 2>&1 | addinfo "umame -a"
 
 if type lspci >/dev/null 2>&1; then
+   lspci=lspci
lspci -nn  2>&1 | addinfo "lspci -nn"
lspci -vnn 2>&1 | addinfo "lspci -vnn"
 elif /target/usr/bin/lspci >/dev/null; then
+   lspci=/target/usr/bin/lspci
/target/usr/bin/lspci -nn 2>&1 | addinfo "lspci -nn"
/target/usr/bin/lspci -vnn 2>&1 | addinfo "lspci -vnn"
 else
@@ -49,3 +51,20 @@
/usr/lib/directfb-0.9.25/bin/dfbinfo 2>&1 | addinfo dfbinfo
fi
 fi
+
+# List which modules are refering to which PCI devices
+if [ "$lspci" ] && [ -d /sys/bus/pci/devices ] ; then
+echo loaded modules:
+(
+   cd /sys/bus/pci/devices
+   for address in * ; do
+   if [ -d "$address/driver/module" ] ; then
+   module=`cd $address/driver/module ; pwd -P | xargs basename`
+   if grep -q "^$module " /proc/modules ; then
+   address=$(echo $address |sed s/://)
+   echo "`lspci -n -s $address | tail -n 1 | awk '{print $3}'` 
$module"
+   fi
+   fi
+   done
+) | addinfo modulemap
+fi


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]