Bug 254841 - usr.sbin/mpsutil: add functionality (temperature monitoring, PCIe speed etc)
Summary: usr.sbin/mpsutil: add functionality (temperature monitoring, PCIe speed etc)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2021-04-06 23:54 UTC by Daniel Austin
Modified: 2021-04-14 10:20 UTC (History)
4 users (show)

See Also:


Attachments
Add functionality to mpsutil (1.55 KB, patch)
2021-04-06 23:54 UTC, Daniel Austin
no flags Details | Diff
Add functionality to mpsutil (2.32 KB, patch)
2021-04-09 22:53 UTC, Daniel Austin
no flags Details | Diff
Add functionality to mpsutil (6.80 KB, patch)
2021-04-09 22:59 UTC, Daniel Austin
no flags Details | Diff
update mpsutil.8 with set ncq (674 bytes, patch)
2021-04-14 09:53 UTC, Rodrigo Osorio
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Austin 2021-04-06 23:54:38 UTC
Created attachment 223884 [details]
Add functionality to mpsutil

The attached patch adds a little functionality to the 'mpsutil' (and therefore probably also mprutil).
In the 'show adapter' output, it now shows PCIe width and speed, IOC Speed, and (the reason I wrote this patch) the temperature of the controller.

I run LSI 9206-16e cards which are notoriously hot (literally boil water hot!) and I wanted to monitor its temperature but this was awkward before.

I added the other features because they seemed useful and were already fetched in the same config page as the temperature.  (note: the temperature units come from the card itself, although i've only ever seen Celcius)

Here's an example output on a LSI 9207-8i card I used for testing the patch:

mps0 Adapter:
       Board Name: SAS9207-8i
   Board Assembly: H3-25590-00B
        Chip Name: LSISAS2308
    Chip Revision: ALL
    BIOS Revision: 7.29.00.00
Firmware Revision: 20.00.07.00
  Integrated RAID: no
 PCIe Width/Speed: x8 (5.0 GB/sec)
        IOC Speed: Full
      Temperature: 63 C

PhyNum  CtlrHandle  DevHandle  Disabled  Speed   Min    Max    Device
0                              N                 1.5    6.0    SAS Initiator
1                              N                 1.5    6.0    SAS Initiator
2                              N                 1.5    6.0    SAS Initiator
3                              N                 1.5    6.0    SAS Initiator
4       0001        0009       N         6.0     1.5    6.0    SAS Initiator
5       0002        000a       N         6.0     1.5    6.0    SAS Initiator
6       0003        000b       N         6.0     1.5    6.0    SAS Initiator
7       0004        000c       N         6.0     1.5    6.0    SAS Initiator
Comment 1 Daniel Austin 2021-04-09 22:53:43 UTC
Created attachment 223965 [details]
Add functionality to mpsutil

I've updated the patch to show whether SATA NCQ is enabled in 'show adapter' and also added a new command "set ncq [enable|disable]" which enables or disables NCQ in the NVRAM of the card.

This is particularly useful in some external JBOD enclosures.
For example, I use a QNAP TL-D1600S 16 bay and with NCQ enabled wth mps cards I receive errors from all attached drives.

Once the system is booted, you can use camcontrol tags to effectively disable NCQ which works around the problem, but the kernel still has to suffer before that point (e.g. with ZFS, just probing for pools could make my system take 5+ mins to boot)... I discovered this workaround via Google.

I had worked around it by using lsiutil in Linux to disable NCQ on the card, and with this patch users of FreeBSD / TrueNAS etc can set that setting in their chosen OS.

Note: this diff also adds a new file (mps_set.c)
Comment 2 Daniel Austin 2021-04-09 22:59:21 UTC
Created attachment 223966 [details]
Add functionality to mpsutil

wrong attachment - sorry (fixed!)
Comment 3 Andriy Gapon freebsd_committer 2021-04-14 08:58:34 UTC
(In reply to Daniel Austin from comment #2)
mps_set.c looks like a new file, you should put your own copyright into it (assuming you are the author, of course).

Other than that, the change looks good to me and I can commit it unless anyone objects.
Comment 4 Yuri Pankov freebsd_committer 2021-04-14 09:39:57 UTC
The patch seems to work fine for me, sadly it looks like my board does not have temp sensor (I was worried about it getting very hot too and even slapped a small fan on it):

mps0 Adapter:
       Board Name: SAS9211-8i
   Board Assembly: H3-25250-02G
        Chip Name: LSISAS2008
    Chip Revision: ALL
    BIOS Revision: 7.37.00.00
Firmware Revision: 20.00.07.00
  Integrated RAID: no
         SATA NCQ: ENABLED
 PCIe Width/Speed: x8 (5.0 GB/sec)
        IOC Speed: Full
      Temperature: Unknown/Unsupported
Comment 5 Rodrigo Osorio freebsd_committer 2021-04-14 09:53:28 UTC
Created attachment 224099 [details]
update mpsutil.8 with set ncq

My two cents to update mpsutil manpage
Comment 6 Daniel Austin 2021-04-14 09:54:24 UTC
(In reply to Yuri Pankov from comment #4)
Hi Yuri,

Could you let me know the output of:

mpsutil show cfgpage 0 7
Comment 7 Yuri Pankov freebsd_committer 2021-04-14 09:55:55 UTC
(In reply to Daniel Austin from comment #6)
Daniel, here you go:

Page 0x0: IO Unit 7, Read-only
0000   00 07 0a 04  |....|
0004   01 08 00 00  |....|
0008   00 00 00 00  |....|
000c   00 00 00 00  |....|
0010   01 00 00 00  |....|
0014   00 00 00 00  |....|
0018   00 01 00 00  |....|
001c   00 00 00 00  |....|
0020   00 00 00 00  |....|
0024   00 00 01 00  |....|
Comment 8 Daniel Austin 2021-04-14 10:11:08 UTC
(In reply to Yuri Pankov from comment #7)
Ah, sadly that means there are no temperature sensors on your board or controller ICs :-(

I've never seen a lsisas2008 chip overheat so long as it had airflow though, so your fan will be working fine... I managed to clock my lsisas2308 at 111C with a fan nearby... now with better more direct fans i've got it down to around 70C.
I've never seen cards run as hot as the 2308s!
Comment 9 Yuri Pankov freebsd_committer 2021-04-14 10:20:00 UTC
(In reply to Daniel Austin from comment #8)
In any case, works with 2308 for me too, thanks for the patch!

mps0 Adapter:
       Board Name: SAS9205-8e
   Board Assembly: H3-25360-04G
        Chip Name: LSISAS2308
    Chip Revision: ALL
    BIOS Revision: 7.35.00.00
Firmware Revision: 18.00.00.00
  Integrated RAID: no
         SATA NCQ: ENABLED
 PCIe Width/Speed: x8 (5.0 GB/sec)
        IOC Speed: Full
      Temperature: 49 C