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
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)
Created attachment 223966 [details] Add functionality to mpsutil wrong attachment - sorry (fixed!)
(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.
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
Created attachment 224099 [details] update mpsutil.8 with set ncq My two cents to update mpsutil manpage
(In reply to Yuri Pankov from comment #4) Hi Yuri, Could you let me know the output of: mpsutil show cfgpage 0 7
(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 |....|
(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!
(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
Daniel, how would you like to be attributed in a commit? Is Daniel Austin <freebsd-ports@dan.me.uk> okay?
(In reply to Andriy Gapon from comment #10) Hi Andriy, That's fine with me - sure. Thanks.
Daniel, the new file, mps_set.c, has copyrights that appear to be copied from one of the existing source files. I think that you should put your own copyright there unless you think that you copied a significant portion of the original file (which seems unlikely).
Created attachment 224748 [details] Replacement mps_set.c Replacement mps_set.c fixing copyright information.
(In reply to Daniel Austin from comment #13) Sorry for being pedantic, but could you please use the latest BSD license template from share/examples/etc/bsd-style-copyright ? Since you are both the author and the copyright holder you don't need the "Written by" line, just put everything you want (name, email) on the "Copyright" line. I could do those changes for you, but since this is a copyright matter, it's a little delicate :-) Thank you!
Created attachment 224749 [details] Updated copyright
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51 commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51 Author: Daniel Austin <freebsd-ports@dan.me.uk> AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2021-05-07 12:22:22 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 MFC after: 2 weeks Relnotes: perhaps usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c (new) | 129 +++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 +++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=395bc3598b47ef270d17beae778830e134814fbe commit 395bc3598b47ef270d17beae778830e134814fbe Author: Daniel Austin <freebsd-ports@dan.me.uk> AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2021-05-21 10:29:17 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 MFC after: 2 weeks Relnotes: perhaps (cherry picked from commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51) usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c (new) | 129 +++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 +++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=4b9d54e2aeca7435698bd37a2d99416acb23c9b5 commit 4b9d54e2aeca7435698bd37a2d99416acb23c9b5 Author: Daniel Austin <freebsd-ports@dan.me.uk> AuthorDate: 2021-05-07 11:41:53 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2021-05-21 10:32:35 +0000 mpsutil: extend show adapter information, add NCQ control 'show adapter' now shows PCIe width and speed, IOC Speed, and the temperature of the controller. A new command, 'set ncq', is added. It enables or disables SATA NCQ in the NVRAM of the card. Its current setting is added to 'show adapter' as well. PR: 254841 Relnotes: perhaps (cherry picked from commit e2ea6942ab316d4cd5c2fef73ab28dc974b8dc51) usr.sbin/mpsutil/Makefile | 2 +- usr.sbin/mpsutil/mps_set.c (new) | 129 +++++++++++++++++++++++++++++++++++++++ usr.sbin/mpsutil/mps_show.c | 34 +++++++++++ usr.sbin/mpsutil/mpsutil.8 | 8 ++- 4 files changed, 171 insertions(+), 2 deletions(-)
Thank you again for the great submission. The change is in all supported branches now.