linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SCSI device/adapter/bus address correlation?
@ 2004-09-02 23:19 Bjorn Helgaas
  2004-09-02 23:36 ` James Bottomley
  0 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2004-09-02 23:19 UTC (permalink / raw)
  To: linux-scsi

Not being a real SCSI person, I'm sure there's some clever way I'm
supposed to figure out which disk is /dev/sda.  But sometimes it's
not clear from the kernel boot messages, particularly for drivers
that don't print the PCI address of the adapter.

Is there any interest in a patch like the attached, which makes
things look like this:

    Attached scsi disk sda at 0000:20:01.0: scsi0, channel 0, id 0, lun 0
    Attached scsi disk sdb at 0000:20:01.0: scsi0, channel 0, id 1, lun 0


===== drivers/scsi/osst.c 1.58 vs edited =====
--- 1.58/drivers/scsi/osst.c	2004-08-08 15:07:47 -06:00
+++ edited/drivers/scsi/osst.c	2004-09-02 16:56:07 -06:00
@@ -5564,8 +5564,9 @@
 	drive->number = devfs_register_tape(SDp->devfs_name);
 
 	printk(KERN_INFO
-		"osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n",
-		SDp->model, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun, tape_name(tpnt));
+		"osst :I: Attached OnStream %.5s tape at %s: scsi%d, channel %d, id %d, lun %d as %s\n",
+		SDp->model, scsi_get_device(SDp->host)->bus_id,
+		SDp->host->host_no, SDp->channel, SDp->id, SDp->lun, tape_name(tpnt));
 
 	return 0;
 
===== drivers/scsi/sd.c 1.156 vs edited =====
--- 1.156/drivers/scsi/sd.c	2004-08-23 02:14:46 -06:00
+++ edited/drivers/scsi/sd.c	2004-09-02 16:51:56 -06:00
@@ -1489,10 +1489,10 @@
 	dev_set_drvdata(dev, sdkp);
 	add_disk(gd);
 
-	printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
+	printk(KERN_NOTICE "Attached scsi %sdisk %s at %s: scsi%d, channel %d, "
 	       "id %d, lun %d\n", sdp->removable ? "removable " : "",
-	       gd->disk_name, sdp->host->host_no, sdp->channel,
-	       sdp->id, sdp->lun);
+	       gd->disk_name, scsi_get_device(sdp->host)->bus_id, 
+	       sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
 
 	return 0;
 
===== drivers/scsi/sg.c 1.95 vs edited =====
--- 1.95/drivers/scsi/sg.c	2004-08-07 20:11:33 -06:00
+++ edited/drivers/scsi/sg.c	2004-09-02 16:54:05 -06:00
@@ -1468,8 +1468,9 @@
 		printk(KERN_WARNING "sg_add: sg_sys INvalid\n");
 
 	printk(KERN_NOTICE
-	       "Attached scsi generic sg%d at scsi%d, channel"
+	       "Attached scsi generic sg%d at %s: scsi%d, channel"
 	       " %d, id %d, lun %d,  type %d\n", k,
+	       scsi_get_device(scsidp->host)->bus_id,
 	       scsidp->host->host_no, scsidp->channel, scsidp->id,
 	       scsidp->lun, scsidp->type);
 
===== drivers/scsi/sr.c 1.114 vs edited =====
--- 1.114/drivers/scsi/sr.c	2004-08-12 18:03:53 -06:00
+++ edited/drivers/scsi/sr.c	2004-09-02 16:54:55 -06:00
@@ -637,8 +637,9 @@
 	add_disk(disk);
 
 	printk(KERN_DEBUG
-	    "Attached scsi CD-ROM %s at scsi%d, channel %d, id %d, lun %d\n",
-	    cd->cdi.name, sdev->host->host_no, sdev->channel,
+	    "Attached scsi CD-ROM %s at %s: scsi%d, channel %d, id %d, lun %d\n",
+	    cd->cdi.name, scsi_get_device(sdev->host)->bus_id,
+	    sdev->host->host_no, sdev->channel,
 	    sdev->id, sdev->lun);
 	return 0;
 
===== drivers/scsi/st.c 1.93 vs edited =====
--- 1.93/drivers/scsi/st.c	2004-08-12 18:03:53 -06:00
+++ edited/drivers/scsi/st.c	2004-09-02 16:55:30 -06:00
@@ -3919,8 +3919,9 @@
 	disk->number = devfs_register_tape(SDp->devfs_name);
 
 	printk(KERN_WARNING
-	"Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
-	       tape_name(tpnt), SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+	"Attached scsi tape %s at %s: scsi%d, channel %d, id %d, lun %d\n",
+	       tape_name(tpnt), scsi_get_device(SDp->host)->bus_id,
+	       SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
 	printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n",
 	       tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
 	       queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-02 23:19 [PATCH] SCSI device/adapter/bus address correlation? Bjorn Helgaas
@ 2004-09-02 23:36 ` James Bottomley
  2004-09-02 23:58   ` Christoph Hellwig
  2004-09-03 14:44   ` Bjorn Helgaas
  0 siblings, 2 replies; 9+ messages in thread
From: James Bottomley @ 2004-09-02 23:36 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: SCSI Mailing List

On Thu, 2004-09-02 at 19:19, Bjorn Helgaas wrote:
> Not being a real SCSI person, I'm sure there's some clever way I'm
> supposed to figure out which disk is /dev/sda.  But sometimes it's
> not clear from the kernel boot messages, particularly for drivers
> that don't print the PCI address of the adapter.

You do it like this:

jejb@gsyprf11> ls -l /sys/block/sda/device
lrwxrwxrwx  1 root root 0 Aug 22 10:57 /sys/block/sda/device ->
../../devices/parisc0/parisc0:0/pci0000:00/0000:00:01.1/host1/1:0:15:0/

There you see the full attachment tree of the pci device.

> Is there any interest in a patch like the attached, which makes
> things look like this:

Not really, unless it's part of a conversion to dev_printk().

James



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-02 23:36 ` James Bottomley
@ 2004-09-02 23:58   ` Christoph Hellwig
  2004-09-03 14:44   ` Bjorn Helgaas
  1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2004-09-02 23:58 UTC (permalink / raw)
  To: James Bottomley; +Cc: Bjorn Helgaas, SCSI Mailing List

On Thu, Sep 02, 2004 at 07:36:15PM -0400, James Bottomley wrote:
> > Is there any interest in a patch like the attached, which makes
> > things look like this:
> 
> Not really, unless it's part of a conversion to dev_printk().

In addition the patch will crash the box for all the legacy drivers
that don't set the device field in struct Scsi_Host


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-02 23:36 ` James Bottomley
  2004-09-02 23:58   ` Christoph Hellwig
@ 2004-09-03 14:44   ` Bjorn Helgaas
  2004-09-03 14:49     ` Olaf Hering
  2004-09-03 18:09     ` Patrick Mansfield
  1 sibling, 2 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2004-09-03 14:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List

On Thursday 02 September 2004 5:36 pm, James Bottomley wrote:
> On Thu, 2004-09-02 at 19:19, Bjorn Helgaas wrote:
> > Not being a real SCSI person, I'm sure there's some clever way I'm
> > supposed to figure out which disk is /dev/sda.  But sometimes it's
> > not clear from the kernel boot messages, particularly for drivers
> > that don't print the PCI address of the adapter.
> 
> You do it like this:
> 
> jejb@gsyprf11> ls -l /sys/block/sda/device
> lrwxrwxrwx  1 root root 0 Aug 22 10:57 /sys/block/sda/device ->
> ../../devices/parisc0/parisc0:0/pci0000:00/0000:00:01.1/host1/1:0:15:0/

Thanks, I knew there must be a cool way.  That doesn't help if you're
trying to figure out the correct "root=" to boot your box, of course...
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-03 14:44   ` Bjorn Helgaas
@ 2004-09-03 14:49     ` Olaf Hering
  2004-09-03 18:09     ` Patrick Mansfield
  1 sibling, 0 replies; 9+ messages in thread
From: Olaf Hering @ 2004-09-03 14:49 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: James Bottomley, SCSI Mailing List

 On Fri, Sep 03, Bjorn Helgaas wrote:

> > jejb@gsyprf11> ls -l /sys/block/sda/device
> > lrwxrwxrwx  1 root root 0 Aug 22 10:57 /sys/block/sda/device ->
> > ../../devices/parisc0/parisc0:0/pci0000:00/0000:00:01.1/host1/1:0:15:0/
> 
> Thanks, I knew there must be a cool way.  That doesn't help if you're
> trying to figure out the correct "root=" to boot your box, of course...

initrd, udev, done.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-03 14:44   ` Bjorn Helgaas
  2004-09-03 14:49     ` Olaf Hering
@ 2004-09-03 18:09     ` Patrick Mansfield
  2004-09-03 20:13       ` Bjorn Helgaas
  1 sibling, 1 reply; 9+ messages in thread
From: Patrick Mansfield @ 2004-09-03 18:09 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: James Bottomley, SCSI Mailing List

On Fri, Sep 03, 2004 at 08:44:40AM -0600, Bjorn Helgaas wrote:
> On Thursday 02 September 2004 5:36 pm, James Bottomley wrote:
> > On Thu, 2004-09-02 at 19:19, Bjorn Helgaas wrote:
> > > Not being a real SCSI person, I'm sure there's some clever way I'm
> > > supposed to figure out which disk is /dev/sda.  But sometimes it's
> > > not clear from the kernel boot messages, particularly for drivers
> > > that don't print the PCI address of the adapter.
> > 
> > You do it like this:
> > 
> > jejb@gsyprf11> ls -l /sys/block/sda/device
> > lrwxrwxrwx  1 root root 0 Aug 22 10:57 /sys/block/sda/device ->
> > ../../devices/parisc0/parisc0:0/pci0000:00/0000:00:01.1/host1/1:0:15:0/
> 
> Thanks, I knew there must be a cool way.  That doesn't help if you're
> trying to figure out the correct "root=" to boot your box, of course...

What exactly is the "root=" problem? You mean device names changing?

Also lsscsi gives simple easy to read output. 

http://www.torque.net/scsi/lsscsi.html

[elm3a211 patman]$ lsscsi
[0:0:0:0]    enclosu IBM      EXP700           9319  -       
[0:0:1:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sda
[0:0:2:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdb
[0:0:3:0]    enclosu IBM      EXP700           9319  -       
[0:0:4:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdc
[0:0:5:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdd

I[elm3a211 patman]$ lsscsi -g
[0:0:0:0]    enclosu IBM      EXP700           9319  -         /dev/sg0
[0:0:1:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sda  /dev/sg1
[0:0:2:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdb  /dev/sg2
[0:0:3:0]    enclosu IBM      EXP700           9319  -         /dev/sg3
[0:0:4:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdc  /dev/sg4
[0:0:5:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sdd  /dev/sg5

I don't know if it works right with udev (i.e. I think it only prints
default kernel names, just those found under sysfs, so if you don't user
default kernels names with udev it might not show the correct /dev name).

-- Patrick Mansfield
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-03 18:09     ` Patrick Mansfield
@ 2004-09-03 20:13       ` Bjorn Helgaas
  2004-09-03 21:42         ` Olaf Hering
  0 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2004-09-03 20:13 UTC (permalink / raw)
  To: Patrick Mansfield; +Cc: James Bottomley, SCSI Mailing List

On Friday 03 September 2004 12:09 pm, Patrick Mansfield wrote:
> > Thanks, I knew there must be a cool way.  That doesn't help if you're
> > trying to figure out the correct "root=" to boot your box, of course...
> 
> What exactly is the "root=" problem? You mean device names changing?

Walk up to a box with a number of data disks already attached.  Plug
in a new disk with a root filesystem on it.  Now try to boot the box,
using the new root filesystem.  What do you specify?  It's difficult
in general to figure it out.  

> Also lsscsi gives simple easy to read output. 
> ...
> [0:0:0:0]    enclosu IBM      EXP700           9319  -       
> [0:0:1:0]    disk    IBM-ESXS ST318453FC    F  B953  /dev/sda

That looks like it gives you the scsi unit, channel, id, lun,
which is already available in dmesg.  It doesn't tell you the
PCI bus address, which you might need if you have more than
one SCSI adapter.

My question has more to do with the situation where your box
doesn't boot because you don't know which sd<x> device has
your root filesystem.  If the PCI bus number gets printed
somewhere before the "can't mount root" panic, you at least
have a clue to solve the problem.

Olaf pointed out what sounds like a reasonable way do to this,
but of course that requires the hassle of an initrd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
       [not found] <20040903204400.26701.76199.Mailman@linux.us.dell.com>
@ 2004-09-03 20:57 ` Matt Domsch
  0 siblings, 0 replies; 9+ messages in thread
From: Matt Domsch @ 2004-09-03 20:57 UTC (permalink / raw)
  To: linux-scsi, Bjorn Helgaas

> From: Bjorn Helgaas <bjorn.helgaas@hp.com>
> Subject: Re: [PATCH] SCSI device/adapter/bus address correlation?
> Date: Fri, 3 Sep 2004 14:13:49 -0600
> 
> On Friday 03 September 2004 12:09 pm, Patrick Mansfield wrote:
> > > Thanks, I knew there must be a cool way.  That doesn't help if you're
> > > trying to figure out the correct "root=" to boot your box, of course...
> > 
> > What exactly is the "root=" problem? You mean device names changing?
> 
> Walk up to a box with a number of data disks already attached.  Plug
> in a new disk with a root filesystem on it.  Now try to boot the box,
> using the new root filesystem.  What do you specify?  It's difficult
> in general to figure it out.  

This is just another manifestation of the fact that there is no
connection between what system BIOS knows of as disks, and what the
kernel knows of as disks.

EDD 3.0 is supposed to help solve this.  Pity so few BIOS
manufactureres implement it, and of those that do, implement it
properly.  http://linux.dell.com/edd/

On EFI systems, there are some EFI Variables exported, BlkXXXXXX which
contain the EDD 3.0 / EFI device path information, probably even with
the partition table GUIDs - it's been too long since I've had a look.
But if so, you could use those to correlate to a Linux device name.

Or, of course, initrd and file system labels work great most of the
time.

Thanks,
Matt

-- 
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] SCSI device/adapter/bus address correlation?
  2004-09-03 20:13       ` Bjorn Helgaas
@ 2004-09-03 21:42         ` Olaf Hering
  0 siblings, 0 replies; 9+ messages in thread
From: Olaf Hering @ 2004-09-03 21:42 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Patrick Mansfield, James Bottomley, SCSI Mailing List

 On Fri, Sep 03, Bjorn Helgaas wrote:

> On Friday 03 September 2004 12:09 pm, Patrick Mansfield wrote:
> > > Thanks, I knew there must be a cool way.  That doesn't help if you're
> > > trying to figure out the correct "root=" to boot your box, of course...
> > 
> > What exactly is the "root=" problem? You mean device names changing?
> 
> Walk up to a box with a number of data disks already attached.  Plug
> in a new disk with a root filesystem on it.  Now try to boot the box,
> using the new root filesystem.  What do you specify?  It's difficult
> in general to figure it out.  

In this case the filesystem UUID or a string returned by an external
udev helper like scsi_id will help. udev will create a /dev/foo and your
initrd will mount that. We have predefined names (symlink to the kernel
device node) like /dev/disk/by-id/SIBM_ST336753LC_3HX1AJJX00007407HDF3p1
in initramfs.
You can use them, or specify your own in udev.rules. Since the disk
content will not change and there will (hopefully) not another one with
the same VPD, everything will work as expected.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-09-03 21:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02 23:19 [PATCH] SCSI device/adapter/bus address correlation? Bjorn Helgaas
2004-09-02 23:36 ` James Bottomley
2004-09-02 23:58   ` Christoph Hellwig
2004-09-03 14:44   ` Bjorn Helgaas
2004-09-03 14:49     ` Olaf Hering
2004-09-03 18:09     ` Patrick Mansfield
2004-09-03 20:13       ` Bjorn Helgaas
2004-09-03 21:42         ` Olaf Hering
     [not found] <20040903204400.26701.76199.Mailman@linux.us.dell.com>
2004-09-03 20:57 ` Matt Domsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).