public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* proc_name in sysfs
@ 2005-04-06 11:40 Frederic TEMPORELLI
  2005-04-06 18:36 ` Patrick Mansfield
  2005-04-08  6:46 ` Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: Frederic TEMPORELLI @ 2005-04-06 11:40 UTC (permalink / raw)
  To: linux-scsi

Hello,


We are using HBAs modules names from "proc_name" interface in sysfs:
/sys/class/scsi_host/hostX/proc_name.

But with new Emulex drivers (8.0.21 and +), proc_name is reporting <NULL> 
(previous drivers were reporting "lpfc").
=> In the driver code, .proc_name field from scsi_host_template structure is no 
more initialized.
James Smart told us that the "removal" of .proc_name field (not really removed, 
but no more initialized) was part of the /proc interfaces removal (suggested by 
scsi-linux feedback).

So:
1/ now, what is the aim of proc_name interface (reporting "<NULL>") in sysfs ?
2/ now, how can we get the adapter module name from sysfs ?

=> I'm just thinking that .proc_name field has to be kept initialized and/or 
something has to be changed to replace the confusing "proc" prefix.


Best regards


-- 
Frederic TEMPORELLI
Bull - Echirolles - France

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

* Re: proc_name in sysfs
  2005-04-06 11:40 proc_name in sysfs Frederic TEMPORELLI
@ 2005-04-06 18:36 ` Patrick Mansfield
  2005-04-07  1:06   ` Douglas Gilbert
  2005-04-08  6:46 ` Christoph Hellwig
  1 sibling, 1 reply; 12+ messages in thread
From: Patrick Mansfield @ 2005-04-06 18:36 UTC (permalink / raw)
  To: Frederic TEMPORELLI; +Cc: linux-scsi

On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:

> 2/ now, how can we get the adapter module name from sysfs ?

Why do you need it?

Anyway, try lsscsi, it walks the sysfs tree:

[elm3b79 patman]$ lsscsi  -H
[0]    qla1280
[1]    qla1280
[2]    qla2xxx
[3]    qla2xxx

Or, script it:

[elm3b79 tmp]$ more xx.sh
#! /bin/sh

hdir=/sys/class/scsi_host

for i in ${hdir}/host*
do
        host_dir=$(cd ${i}/device;/bin/pwd)
        driver_dir=$(cd ${host_dir}/../driver;/bin/pwd)
        module=$(basename ${driver_dir})
        # echo ${i} is in: ${host_dir}
        echo "${i} module (driver) is: ${module}"
done

[elm3b79 tmp]$ sh ./xx.sh
/sys/class/scsi_host/host0 module (driver) is: qla1280
/sys/class/scsi_host/host1 module (driver) is: qla1280
/sys/class/scsi_host/host2 module (driver) is: qla2300
/sys/class/scsi_host/host3 module (driver) is: qla2300

-- Patrick Mansfield

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

* Re: proc_name in sysfs
  2005-04-06 18:36 ` Patrick Mansfield
@ 2005-04-07  1:06   ` Douglas Gilbert
  2005-04-07  6:35     ` Frederic TEMPORELLI
  2005-04-08  0:00     ` Patrick Mansfield
  0 siblings, 2 replies; 12+ messages in thread
From: Douglas Gilbert @ 2005-04-07  1:06 UTC (permalink / raw)
  To: Patrick Mansfield; +Cc: Frederic TEMPORELLI, linux-scsi

Patrick Mansfield wrote:
> On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
> 
> 
>>2/ now, how can we get the adapter module name from sysfs ?
> 
> 
> Why do you need it?
> 
> Anyway, try lsscsi, it walks the sysfs tree:
> 
> [elm3b79 patman]$ lsscsi  -H
> [0]    qla1280
> [1]    qla1280
> [2]    qla2xxx
> [3]    qla2xxx
> 
> Or, script it:
> 
> [elm3b79 tmp]$ more xx.sh
> #! /bin/sh
> 
> hdir=/sys/class/scsi_host
> 
> for i in ${hdir}/host*
> do
>         host_dir=$(cd ${i}/device;/bin/pwd)
>         driver_dir=$(cd ${host_dir}/../driver;/bin/pwd)
>         module=$(basename ${driver_dir})
>         # echo ${i} is in: ${host_dir}
>         echo "${i} module (driver) is: ${module}"
> done
> 
> [elm3b79 tmp]$ sh ./xx.sh
> /sys/class/scsi_host/host0 module (driver) is: qla1280
> /sys/class/scsi_host/host1 module (driver) is: qla1280
> /sys/class/scsi_host/host2 module (driver) is: qla2300
> /sys/class/scsi_host/host3 module (driver) is: qla2300

Patrick,
lsscsi currently uses proc_name so it needs to be
changed to use the above logic (if LLDs are going
to stop populating proc_name).

It has been suggested that I extend lsscsi to show
transport info (as seen from the HBA) found in the
various *_transport directories in sysfs.

Also I have been thinking about ways to list less
tha all scsi devices. For example: "lsscsi 1:0:3:0"
to look at one device and "lsscsi 1:-" for all scsi
devices hanging off host1. I'm not sure whether
"lsscsi /dev/sda" is a good idea. Any suggestions?

Doug Gilbert

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

* Re: proc_name in sysfs
  2005-04-07  1:06   ` Douglas Gilbert
@ 2005-04-07  6:35     ` Frederic TEMPORELLI
  2005-04-07  8:17       ` Douglas Gilbert
  2005-04-08  0:02       ` Patrick Mansfield
  2005-04-08  0:00     ` Patrick Mansfield
  1 sibling, 2 replies; 12+ messages in thread
From: Frederic TEMPORELLI @ 2005-04-07  6:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: dougg, Patrick Mansfield

Hi,


Sorry, no such "driver" directory in /sys/class/scsi_host/hostX/
(checked: Emulex "lpfc" 8.0.24 and LSI "mptscsih" 3.01.18)

note: there's also a "proc_name" interface for LSI "mtpscsih", located in 
/sys/class/scsi_host/hostX/, which is reporting "mptscsih" string.

Any other ideas ?

Best regards.


Douglas Gilbert a écrit :
> Patrick Mansfield wrote:
> 
>> On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
>>
>>
>>> 2/ now, how can we get the adapter module name from sysfs ?
>>
>>
>>
>> Why do you need it?
>>
>> Anyway, try lsscsi, it walks the sysfs tree:
>>
>> [elm3b79 patman]$ lsscsi  -H
>> [0]    qla1280
>> [1]    qla1280
>> [2]    qla2xxx
>> [3]    qla2xxx
>>
>> Or, script it:
>>
>> [elm3b79 tmp]$ more xx.sh
>> #! /bin/sh
>>
>> hdir=/sys/class/scsi_host
>>
>> for i in ${hdir}/host*
>> do
>>         host_dir=$(cd ${i}/device;/bin/pwd)
>>         driver_dir=$(cd ${host_dir}/../driver;/bin/pwd)
>>         module=$(basename ${driver_dir})
>>         # echo ${i} is in: ${host_dir}
>>         echo "${i} module (driver) is: ${module}"
>> done
>>
>> [elm3b79 tmp]$ sh ./xx.sh
>> /sys/class/scsi_host/host0 module (driver) is: qla1280
>> /sys/class/scsi_host/host1 module (driver) is: qla1280
>> /sys/class/scsi_host/host2 module (driver) is: qla2300
>> /sys/class/scsi_host/host3 module (driver) is: qla2300
> 
> 
> Patrick,
> lsscsi currently uses proc_name so it needs to be
> changed to use the above logic (if LLDs are going
> to stop populating proc_name).
> 
> It has been suggested that I extend lsscsi to show
> transport info (as seen from the HBA) found in the
> various *_transport directories in sysfs.
> 
> Also I have been thinking about ways to list less
> tha all scsi devices. For example: "lsscsi 1:0:3:0"
> to look at one device and "lsscsi 1:-" for all scsi
> devices hanging off host1. I'm not sure whether
> "lsscsi /dev/sda" is a good idea. Any suggestions?
> 
> Doug Gilbert
> -
> 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
> 


-- 
Frederic TEMPORELLI
-
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] 12+ messages in thread

* Re: proc_name in sysfs
  2005-04-07  6:35     ` Frederic TEMPORELLI
@ 2005-04-07  8:17       ` Douglas Gilbert
  2005-04-08  0:02       ` Patrick Mansfield
  1 sibling, 0 replies; 12+ messages in thread
From: Douglas Gilbert @ 2005-04-07  8:17 UTC (permalink / raw)
  To: Frederic TEMPORELLI; +Cc: linux-scsi, Patrick Mansfield

Frederic TEMPORELLI wrote:
> Hi,
> 
> 
> Sorry, no such "driver" directory in /sys/class/scsi_host/hostX/
> (checked: Emulex "lpfc" 8.0.24 and LSI "mptscsih" 3.01.18)

I may have missed the point here. Are you talking about
Patrick's shell script? It sort of works for me. Example:

$ ./scan_hosts.sh
/sys/class/scsi_host/host0 module (driver) is: mptbase
/sys/class/scsi_host/host1 module (driver) is: mptbase
/sys/class/scsi_host/host2 module (driver) is: mptbase
/sys/class/scsi_host/host3 module (driver) is: mptbase
/sys/class/scsi_host/host4 module (driver) is: qla2300
/sys/class/scsi_host/host5 module (driver) is: qla2300
$ lsscsi -H
[0]    mptscsih
[1]    mptscsih
[2]    mptscsih
[3]    mptscsih
[4]    qla2xxx
[5]    qla2xxx

Note that the module name and the proc_name are different!
It looks like Patrick's script gives the module name
"closest" to the PCI bus while proc_name gives the
"upper" lower level driver name :-)

BTW "/bin/pwd" gives a different result to "pwd"
in a bash shell just after a symlink has been
followed.

Doug Gilbert

> note: there's also a "proc_name" interface for LSI "mtpscsih", located 
> in /sys/class/scsi_host/hostX/, which is reporting "mptscsih" string.
> 
> Any other ideas ?
> 
> Best regards.
> 
> 
> Douglas Gilbert a écrit :
> 
>> Patrick Mansfield wrote:
>>
>>> On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
>>>
>>>
>>>> 2/ now, how can we get the adapter module name from sysfs ?
>>>
>>>
>>>
>>>
>>> Why do you need it?
>>>
>>> Anyway, try lsscsi, it walks the sysfs tree:
>>>
>>> [elm3b79 patman]$ lsscsi  -H
>>> [0]    qla1280
>>> [1]    qla1280
>>> [2]    qla2xxx
>>> [3]    qla2xxx
>>>
>>> Or, script it:
>>>
>>> [elm3b79 tmp]$ more xx.sh
>>> #! /bin/sh
>>>
>>> hdir=/sys/class/scsi_host
>>>
>>> for i in ${hdir}/host*
>>> do
>>>         host_dir=$(cd ${i}/device;/bin/pwd)
>>>         driver_dir=$(cd ${host_dir}/../driver;/bin/pwd)
>>>         module=$(basename ${driver_dir})
>>>         # echo ${i} is in: ${host_dir}
>>>         echo "${i} module (driver) is: ${module}"
>>> done
>>>
>>> [elm3b79 tmp]$ sh ./xx.sh
>>> /sys/class/scsi_host/host0 module (driver) is: qla1280
>>> /sys/class/scsi_host/host1 module (driver) is: qla1280
>>> /sys/class/scsi_host/host2 module (driver) is: qla2300
>>> /sys/class/scsi_host/host3 module (driver) is: qla2300
>>
>>
>>
>> Patrick,
>> lsscsi currently uses proc_name so it needs to be
>> changed to use the above logic (if LLDs are going
>> to stop populating proc_name).
>>
>> It has been suggested that I extend lsscsi to show
>> transport info (as seen from the HBA) found in the
>> various *_transport directories in sysfs.
>>
>> Also I have been thinking about ways to list less
>> tha all scsi devices. For example: "lsscsi 1:0:3:0"
>> to look at one device and "lsscsi 1:-" for all scsi
>> devices hanging off host1. I'm not sure whether
>> "lsscsi /dev/sda" is a good idea. Any suggestions?
>>
>> Doug Gilbert
-
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] 12+ messages in thread

* Re: proc_name in sysfs
  2005-04-07  1:06   ` Douglas Gilbert
  2005-04-07  6:35     ` Frederic TEMPORELLI
@ 2005-04-08  0:00     ` Patrick Mansfield
  1 sibling, 0 replies; 12+ messages in thread
From: Patrick Mansfield @ 2005-04-08  0:00 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: Frederic TEMPORELLI, linux-scsi

On Thu, Apr 07, 2005 at 11:06:03AM +1000, Douglas Gilbert wrote:
> Patrick Mansfield wrote:
> >On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
> >
> >
> >>2/ now, how can we get the adapter module name from sysfs ?
> >
> >
> >Why do you need it?


> Patrick,
> lsscsi currently uses proc_name so it needs to be
> changed to use the above logic (if LLDs are going
> to stop populating proc_name).

Oops, I didn't notice, I had assumed it was using the sysfs layout.

Yes, seems like it should use the sysfs driver info, proc_name is
rather useless in sysfs context.

> It has been suggested that I extend lsscsi to show
> transport info (as seen from the HBA) found in the
> various *_transport directories in sysfs.

As an option that sounds nice.

> Also I have been thinking about ways to list less
> tha all scsi devices. For example: "lsscsi 1:0:3:0"
> to look at one device and "lsscsi 1:-" for all scsi
> devices hanging off host1. I'm not sure whether
> "lsscsi /dev/sda" is a good idea. Any suggestions?

Sounds good, but maybe not (directly) for /dev. udevinfo can supply that,
it has a /dev to /sys mapping:

[elm3b79 patman]$ udevinfo -q path -n /udev/mydisk-sdag
/block/sdm

-- Patrick Mansfield

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

* Re: proc_name in sysfs
  2005-04-07  6:35     ` Frederic TEMPORELLI
  2005-04-07  8:17       ` Douglas Gilbert
@ 2005-04-08  0:02       ` Patrick Mansfield
  2005-04-08  7:37         ` Frederic TEMPORELLI
  1 sibling, 1 reply; 12+ messages in thread
From: Patrick Mansfield @ 2005-04-08  0:02 UTC (permalink / raw)
  To: Frederic TEMPORELLI; +Cc: linux-scsi, dougg

On Thu, Apr 07, 2005 at 08:35:16AM +0200, Frederic TEMPORELLI wrote:
> Hi,
> 
> 
> Sorry, no such "driver" directory in /sys/class/scsi_host/hostX/

Doug answered that.

> >>Why do you need it?

If you answer the above you might get better/other suggestions.

-- Patrick Mansfield

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

* Re: proc_name in sysfs
  2005-04-06 11:40 proc_name in sysfs Frederic TEMPORELLI
  2005-04-06 18:36 ` Patrick Mansfield
@ 2005-04-08  6:46 ` Christoph Hellwig
  2005-04-08  8:03   ` Douglas Gilbert
  1 sibling, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2005-04-08  6:46 UTC (permalink / raw)
  To: Frederic TEMPORELLI; +Cc: linux-scsi

On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
> Hello,
> 
> 
> We are using HBAs modules names from "proc_name" interface in sysfs:
> /sys/class/scsi_host/hostX/proc_name.
> 
> But with new Emulex drivers (8.0.21 and +), proc_name is reporting <NULL> 
> (previous drivers were reporting "lpfc").
> => In the driver code, .proc_name field from scsi_host_template structure 
> is no more initialized.
> James Smart told us that the "removal" of .proc_name field (not really 
> removed, but no more initialized) was part of the /proc interfaces removal 
> (suggested by scsi-linux feedback).
> 
> So:
> 1/ now, what is the aim of proc_name interface (reporting "<NULL>") in 
> sysfs ?
> 2/ now, how can we get the adapter module name from sysfs ?
> 
> => I'm just thinking that .proc_name field has to be kept initialized 
> and/or something has to be changed to replace the confusing "proc" prefix.

The real problem is that someone decided to export the proc_name in sysfs.
It's supposed to be only procfs-specific but someone violated that rule.

Not sure how to proceed forward with this.

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

* Re: proc_name in sysfs
  2005-04-08  0:02       ` Patrick Mansfield
@ 2005-04-08  7:37         ` Frederic TEMPORELLI
  0 siblings, 0 replies; 12+ messages in thread
From: Frederic TEMPORELLI @ 2005-04-08  7:37 UTC (permalink / raw)
  To: Patrick Mansfield; +Cc: linux-scsi, dougg

Hi,

Patrick Mansfield a écrit :
> On Thu, Apr 07, 2005 at 08:35:16AM +0200, Frederic TEMPORELLI wrote:
> 
>>Hi,
>>
>>
>>Sorry, no such "driver" directory in /sys/class/scsi_host/hostX/
> 
> 
> Doug answered that.
> 

thx, I've just try the script and it works...
(mea culpa, I should have look in details to the symlinks)


> 
>>>>Why do you need it?
> 
> 
> If you answer the above you might get better/other suggestions.

We already have scripts for getting HBAs informations, and these scripts are 
based on /sys/class/scsi_host/hostX/proc_name to define how to process 
informations (we don't care about WWPN when using U320 adapter).

=> I'll change our scripts according to Doug's solution, this should be fine.

Thanks again...


-- 
Frederic TEMPORELLI
-
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] 12+ messages in thread

* Re: proc_name in sysfs
  2005-04-08  6:46 ` Christoph Hellwig
@ 2005-04-08  8:03   ` Douglas Gilbert
  2005-04-11 11:52     ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: Douglas Gilbert @ 2005-04-08  8:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Frederic TEMPORELLI, linux-scsi

Christoph Hellwig wrote:
> On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:
> 
>>Hello,
>>
>>
>>We are using HBAs modules names from "proc_name" interface in sysfs:
>>/sys/class/scsi_host/hostX/proc_name.
>>
>>But with new Emulex drivers (8.0.21 and +), proc_name is reporting <NULL> 
>>(previous drivers were reporting "lpfc").
>>=> In the driver code, .proc_name field from scsi_host_template structure 
>>is no more initialized.
>>James Smart told us that the "removal" of .proc_name field (not really 
>>removed, but no more initialized) was part of the /proc interfaces removal 
>>(suggested by scsi-linux feedback).
>>
>>So:
>>1/ now, what is the aim of proc_name interface (reporting "<NULL>") in 
>>sysfs ?
>>2/ now, how can we get the adapter module name from sysfs ?
>>
>>=> I'm just thinking that .proc_name field has to be kept initialized 
>>and/or something has to be changed to replace the confusing "proc" prefix.
> 
> 
> The real problem is that someone decided to export the proc_name in sysfs.
> It's supposed to be only procfs-specific but someone violated that rule.

Forget the "proc_" part. It is effectively the lld_name.

Allowing the LLD to name itself to the scsi subsystem
makes sense, especially when the LLD is made up of several
kernel modules. See my previous example comparing the
output of lsscsi -H and scan_host.sh .

> Not sure how to proceed forward with this.

Doug Gilbert


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

* Re: proc_name in sysfs
  2005-04-08  8:03   ` Douglas Gilbert
@ 2005-04-11 11:52     ` Christoph Hellwig
  2005-04-11 14:19       ` James Bottomley
  0 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2005-04-11 11:52 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: Frederic TEMPORELLI, linux-scsi

On Fri, Apr 08, 2005 at 06:03:16PM +1000, Douglas Gilbert wrote:
> >The real problem is that someone decided to export the proc_name in sysfs.
> >It's supposed to be only procfs-specific but someone violated that rule.
> 
> Forget the "proc_" part. It is effectively the lld_name.
> 
> Allowing the LLD to name itself to the scsi subsystem
> makes sense, especially when the LLD is made up of several
> kernel modules. See my previous example comparing the
> output of lsscsi -H and scan_host.sh .

In theory we have ->name for that, but people have decided to put really
verbose stuff in there.  A module name is important, not just for scsi.

James once had a proposal where the scsi_host can link to the module in
sysfs, which is the right thing and needed for other things like mkinitrd
aswell.

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

* Re: proc_name in sysfs
  2005-04-11 11:52     ` Christoph Hellwig
@ 2005-04-11 14:19       ` James Bottomley
  0 siblings, 0 replies; 12+ messages in thread
From: James Bottomley @ 2005-04-11 14:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Douglas Gilbert, Frederic TEMPORELLI, SCSI Mailing List

On Mon, 2005-04-11 at 12:52 +0100, Christoph Hellwig wrote:
> James once had a proposal where the scsi_host can link to the module in
> sysfs, which is the right thing and needed for other things like mkinitrd
> aswell.

The code is actually in.  Taking advantage of it is slightly more
complex than I anticipated.  I'll dig out the patches I had for sym2 to
do it.

James



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

end of thread, other threads:[~2005-04-11 14:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-06 11:40 proc_name in sysfs Frederic TEMPORELLI
2005-04-06 18:36 ` Patrick Mansfield
2005-04-07  1:06   ` Douglas Gilbert
2005-04-07  6:35     ` Frederic TEMPORELLI
2005-04-07  8:17       ` Douglas Gilbert
2005-04-08  0:02       ` Patrick Mansfield
2005-04-08  7:37         ` Frederic TEMPORELLI
2005-04-08  0:00     ` Patrick Mansfield
2005-04-08  6:46 ` Christoph Hellwig
2005-04-08  8:03   ` Douglas Gilbert
2005-04-11 11:52     ` Christoph Hellwig
2005-04-11 14:19       ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox