Bug 162513 - mpt(4), mptutil(8) reports variable, erroneous drive information
Summary: mpt(4), mptutil(8) reports variable, erroneous drive information
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-13 04:50 UTC by Rory Arms
Modified: 2021-08-06 23:08 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rory Arms 2011-11-13 04:50:06 UTC
I have an an  LSI Logic SAS3041X-R Host Adapter 4-Port SAS RAID Controller installed in a 3.3v PCI port on a SUN AXmp based system. I have 2 1TB Hitachi drives attached to it.

The system originally had 7.1-R installed. I noticed that mpt(4) in that version would not even see 2 SATA drives that were attached. So I promptly upgraded to 8.2 where mpt(4) did detect the presence of the drives. However I have noticed issues in trying to create a volume with the drives when using mptutil(8). There are times when 'show config' shows variable number of drives, and other inconsistent results. See the following commands issued seconds between each, with no hardware configurations being made in between:


tatung[/usr/src] 0> sudo mptutil show config
Password:
mpt0 Configuration: 0 volumes, 1 drives
    drive da1 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
tatung[/usr/src] 0> sudo mptutil show drives
mpt0 Physical Drives:
 da0 (  932G) ONLINE <Hitachi HDS72101 A5N0> SATA bus 0 id 0
 da1 (  932G) ONLINE <Hitachi HDS72101 A5N0> SATA bus 0 id 1
tatung[/usr/src] 0> sudo mptutil show config
mpt0 Configuration: 0 volumes, 4 drives
    drive da1 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
tatung[/usr/src] 0> sudo mptutil show config
mpt0 Configuration: 0 volumes, 5 drives
    drive da0 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
    drive da1 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
tatung[/usr/src] 0> sudo mptutil show config
mpt0 Configuration: 0 volumes, 1 drives
    drive da1 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
tatung[/usr/src] 0> sudo mptutil show config
mpt0 Configuration: 0 volumes, 4 drives
    drive da1 (932G) ONLINE <Hitachi HDS72101 A5N0> SATA
tatung[/usr/src] 0> sudo mptutil show drives
mpt0 Physical Drives:
 da0 (  932G) ONLINE <Hitachi HDS72101 A5N0> SATA bus 0 id 0
 da1 (  932G) ONLINE <Hitachi HDS72101 A5N0> SATA bus 0 id 1
tatung[/usr/src] 0> sudo mptutil show drives
mpt0 Physical Drives:
 da1 (  932G) ONLINE <Hitachi HDS72101 A5N0> SATA bus 0 id 1

So as you can see mptutil(8) reports a variable amount of drives attached, when in actuality there are always 2 SATA drives attached

Here's the output of pciconf -lv:

tatung[/usr/src] 0> pciconf -lv
hostb0@pci0:0:0:0:      class=0x060000 card=0x00000000 chip=0x8000108e rev=0x00 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'STP2223BGA UPA to PCI Bus Interface Module (U2P)'
    class      = bridge
    subclass   = HOST-PCI
ebus0@pci0:0:1:0:       class=0x068000 card=0x00000000 chip=0x1000108e rev=0x01 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'SPARC EBUS PCIO PCI I/O Controller'
    class      = bridge
hme0@pci0:0:1:1:        class=0x020000 card=0x00000000 chip=0x1001108e rev=0x01 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'Happy Meal Ethernet (PCIO)'
    class      = network
    subclass   = ethernet
em0@pci0:0:3:0: class=0x020000 card=0x002e8086 chip=0x100e8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Gigabit Ethernet Controller (82540EM)'
    class      = network
    subclass   = ethernet
hostb1@pci1:128:0:0:    class=0x060000 card=0x00000000 chip=0x8000108e rev=0x00 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'STP2223BGA UPA to PCI Bus Interface Module (U2P)'
    class      = bridge
    subclass   = HOST-PCI
mpt0@pci1:128:1:0:      class=0x010000 card=0x30201000 chip=0x00501000 rev=0x03 hdr=0x00
    vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
    device     = 'SAS 3000 series, 4-port with 1064 -StorPort'
    class      = mass storage
    subclass   = SCSI
hostb2@pci2:0:0:0:      class=0x060000 card=0x00000000 chip=0x8000108e rev=0x00 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'STP2223BGA UPA to PCI Bus Interface Module (U2P)'
    class      = bridge
    subclass   = HOST-PCI
sym0@pci2:0:6:0:        class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x14 hdr=0x00
    vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
    device     = 'LSI53C875/E,LSI53C876/E PCI to Ultra SCSI I/O Processor'
    class      = mass storage
    subclass   = SCSI
sym1@pci2:0:6:1:        class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x14 hdr=0x00
    vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
    device     = 'LSI53C875/E,LSI53C876/E PCI to Ultra SCSI I/O Processor'
    class      = mass storage
    subclass   = SCSI
machfb0@pci2:0:2:0:     class=0x030000 card=0x00801002 chip=0x47501002 rev=0x5c hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'ATI 3D Rage Pro 215GP (ATI 3D Rage Pro 215GP)'
    class      = display
    subclass   = VGA
hostb3@pci3:128:0:0:    class=0x060000 card=0x00000000 chip=0x8000108e rev=0x00 hdr=0x00
    vendor     = 'Sun Microsystems'
    device     = 'STP2223BGA UPA to PCI Bus Interface Module (U2P)'
    class      = bridge
    subclass   = HOST-PCI

I use a the following custom kernel config:


cpu             SUN4U
ident           TATUNG



makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols


options         SCHED_4BSD              # 4BSD scheduler
options         INET                    # InterNETworking
options         INET6                   # IPv6 communications protocols
options         SCTP                    # Stream Control Transmission Protocol
options         FFS                     # Berkeley Fast Filesystem
options         SOFTUPDATES             # Enable FFS soft updates support
options         UFS_ACL                 # Support for access control lists
options         UFS_DIRHASH             # Improve performance on big directories
options         UFS_GJOURNAL            # Enable gjournal-based UFS journaling
options         MD_ROOT                 # MD is a potential root device
options         NFSCLIENT               # Network Filesystem Client
options         NFSSERVER               # Network Filesystem Server
options         NFSLOCKD                # Network Lock Manager
options         NFS_ROOT                # NFS usable as /, requires NFSCLIENT
options         CD9660                  # ISO 9660 Filesystem
options         PROCFS                  # Process filesystem (requires PSEUDOFS)
options         PSEUDOFS                # Pseudo-filesystem framework
options         GEOM_PART_GPT           # GUID Partition Tables.
options         GEOM_LABEL              # Provides labelization
options         COMPAT_43TTY            # BSD 4.3 TTY compat (sgtty)
options         COMPAT_FREEBSD7         # Compatible with FreeBSD7
options         SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
options         KTRACE                  # ktrace(1) support
options         STACK                   # stack(9) support
options         SYSVSHM                 # SYSV-style shared memory
options         SYSVMSG                 # SYSV-style message queues
options         SYSVSEM                 # SYSV-style semaphores
options         P1003_1B_SEMAPHORES     # POSIX-style semaphores
options         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options         PRINTF_BUFR_SIZE=128    # Prevent printf output being interspersed.
options         HWPMC_HOOKS             # Necessary kernel hooks for hwpmc(4)
options         AUDIT                   # Security event auditing
options         MAC                     # TrustedBSD MAC Framework
options         INCLUDE_CONFIG_FILE     # Include this file in kernel

options         KDB                     # Kernel debugger related code
options         KDB_TRACE               # Print a stack trace for a panic

options         SMP                     # Symmetric MultiProcessor Kernel

device          ebus
device          pci
device          central
device          fhc


device          ata
device          atadisk         # ATA disk drives

                                        # output.  Adds ~128k to driver.
device          isp             # Qlogic family
device          ispfw           # Firmware module for Qlogic host adapters
device          mpt             # LSI-Logic MPT-Fusion
device          sym             # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D

device          scbus           # SCSI bus (required for SCSI)
device          ch              # SCSI media changers
device          da              # Direct Access (disks)
device          sa              # Sequential Access (tape etc)
device          cd              # CD
device          pass            # Passthrough device (direct SCSI access)
device          ses             # SCSI Environmental Services (and SAF-TE)



device          kbdmux          # keyboard multiplexer

device          sc
device          machfb          # ATI Mach64 framebuffers
device          splash          # Splash screen and screen saver support
options         KBD_INSTALL_CDEV # install a CDEV entry in /dev

device          auxio           # auxiliary I/O device
device          eeprom          # eeprom (really a front-end for the MK48Txx)
device          mk48txx         # Mostek MK48Txx clocks
device          rtc             # rtc (really a front-end for the MC146818)
device          mc146818        # Motorola MC146818 and compatible clocks

device          scc             # Serial communications controllers.
device          uart            # Multi-uart driver


device          em              # Intel PRO/1000 adapter Gigabit Ethernet Card

device          miibus          # MII bus support
device          fxp             # Intel EtherExpress PRO/100B (82557, 82558)
device          hme             # Sun HME (Happy Meal Ethernet)

device          wlan            # 802.11 support
options         IEEE80211_DEBUG # enable debug msgs
options         IEEE80211_AMPDU_AGE     # age frames in AMPDU reorder q's
options         IEEE80211_SUPPORT_MESH  # enable 802.11s D3.0 support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
device          ath             # Atheros pci/cardbus NIC's
device          ath_hal         # Atheros HAL (Hardware Access Layer)
options         AH_SUPPORT_AR5416       # enable AR5416 tx/rx descriptors
device          ath_rate_sample # SampleRate tx rate control for ath

device          loop            # Network loopback
device          random          # Entropy device
device          ether           # Ethernet support
device          vlan            # 802.1Q VLAN support
device          tun             # Packet tunnel.
device          pty             # BSD-style compatibility pseudo ttys
device          md              # Memory "disks"
device          gif             # IPv6 and IPv4 tunneling
device          faith           # IPv6-to-IPv4 relaying (translation)
device          firmware        # firmware assist module

device          bpf             # Berkeley packet filter

How-To-Repeat: repeated runs of mpiutil(8) commands with 'show config' and 'show drives'  returns inconsistent results.
Comment 1 marius 2011-11-13 11:58:12 UTC
This is a known issue; mptutil(8) isn't endian-clean (actually the IOCTL-
interface of mpt(4) is little-endian even on big-endian architectures
and actually also should stay that way as otherwise we would need to add
code to the driver to convert all possible configuration pages, which
doesn't make sense), which requires a non-trivial amount of work to fix.
That mptutil(8) is working that much in it's current state actually is
really amazing. For now you're probably better off using the software
RAID equivalent.

Marius
Comment 2 Rory Arms 2011-11-13 17:06:44 UTC
Thanks for your usual prompt response, Marius. B)

After I submitted this, it crossed my mind that it might be an endian =
issue. Well, I really bought that controller just so I could attach new =
SATA/SAS drives to my aging sun4u. So I don't need to use the RAID =
capabilities on it.

You suggest using software RAID, which was what I was thinking of using =
anyway. So it's sofe to assume that using mpt(4) in a RAID-less =
configuration should not be a problem? I was thinking of using zfs or =
vinum to do RAID1 with 2 1 TB drives. I suppose it's possible that at =
some point I may hove those drives to amd64, so it would be nice if it =
would continue to work there w/o a dump & restore. As a recall zfs does =
write data in the endian order of the host that created the volume, but =
is smart enough to swap byte order as it reads the data from disk, when =
the disk is moved to a PC. But I assume there would be some kind of =
performance penalty for this. How about vinum and UFS2, would these =
require a restore of the data once moved to a PC?

Also at what size drive is OBP 3.10 going to have have a problem =
accessing or addressing a large drive? As I recall OBP had a 2 TB limit, =
so I assume there will be some kind of problem with drives above 2TB in =
size? How about the VTOC8 label, does it have similar limits?

Regarding this endian issue with mpt(4)/mptutil(8) ioctl, I don't see a =
mention of it in the 8.2 release notes, hardware notes or errata =
documents. Wouldn't it make sense to add a note about this in there for =
the impending v9 release? I was actually about to upgrade to v9 to check =
for this problem, before I sent this. But decided to wait for the =
response first. I was just trying to find the corresponding release =
documents on the site for v9 but couldn't find them. At least, it used =
to be that you could see them on the site a few weeks before a release, =
but I can't find them now.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:18 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-07-22 18:10:16 UTC
A commit references this bug:

Author: emaste
Date: Mon Jul 22 17:25:36 UTC 2019
New revision: 350215
URL: https://svnweb.freebsd.org/changeset/base/350215

Log:
  mptutil: emit a warning on big-endian architectures

  It is known to be broken.

  PR:		162513
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/usr.sbin/mptutil/mptutil.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-07-30 14:18:50 UTC
A commit references this bug:

Author: emaste
Date: Tue Jul 30 14:18:05 UTC 2019
New revision: 350441
URL: https://svnweb.freebsd.org/changeset/base/350441

Log:
  MFC r350215: mptutil: emit a warning on big-endian architectures

  It is known to be broken.

  PR:		162513
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/12/
  stable/12/usr.sbin/mptutil/mptutil.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-07-30 14:19:51 UTC
A commit references this bug:

Author: emaste
Date: Tue Jul 30 14:19:19 UTC 2019
New revision: 350442
URL: https://svnweb.freebsd.org/changeset/base/350442

Log:
  MFC r350215: mptutil: emit a warning on big-endian architectures

  It is known to be broken.

  PR:		162513
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/11/
  stable/11/usr.sbin/mptutil/mptutil.c
Comment 7 Ed Maste freebsd_committer freebsd_triage 2021-08-06 23:08:40 UTC
Reclassify from spar64 as this is a big endian issue, not a sparc-specific issue