From 79a3e83fbf092d8746535f5b02935780cc64c4f6 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 18 Jul 2014 19:32:57 +0200 Subject: [PATCH] kernel: Switch to mrsas(4) as the default for 'Thunderbird' series cards. --- UPDATING | 12 ++++ share/man/man4/mfi.4 | 14 +--- share/man/man4/mrsas.4 | 129 +++++-------------------------------- sys/dev/raid/mfi/mfi_pci.c | 33 ++++------ sys/dev/raid/mfi/mfivar.h | 1 - sys/dev/raid/mrsas/mrsas.c | 23 +++++-- 6 files changed, 57 insertions(+), 155 deletions(-) diff --git a/UPDATING b/UPDATING index d458c87576..f28a3a88eb 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,18 @@ + UPGRADING DRAGONFLY FROM 3.8 TO LATER VERSIONS + +-----------------------------------------------------------------------+ +DEFAULT DRIVER CHANGED FOR LSI "THUNDERBOLT" SERIES RAID CONTROLLERS +-------------------------------------------------------------------- + +The default driver for those controllers is now mrsas(4) due to reports +of file system corruption using the mfi(4) driver. The whole issue (and +how to deal with potential problems when switching) was explained here: + +http://lists.dragonflybsd.org/pipermail/users/2014-July/128703.html + +A tunable is provided for letting those controllers still attach via +the mfi(4) driver, hw.mrsas.mfi_enable (see mrsas(4) manual page). + OLDER NETWORK DRIVERS MOVED TO I386 ONLY ---------------------------------------- diff --git a/share/man/man4/mfi.4 b/share/man/man4/mfi.4 index 61a4112bcc..252dbc8192 100644 --- a/share/man/man4/mfi.4 +++ b/share/man/man4/mfi.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD: src/share/man/man4/mfi.4,v 1.13 2010/05/12 17:12:38 brueffer Exp $ .\" -.Dd June 14, 2014 +.Dd July 18, 2014 .Dt MFI 4 .Os .Sh NAME @@ -90,18 +90,6 @@ If the sysctl .Va dev.mfi.%d.delete_busy_volumes is set to 1, then the driver will allow mounted volumes to be removed. -.Pp -A tunable is provided to adjust the -.Nm -driver's behaviour when attaching to a card. -By default the driver will attach to all known cards with high probe priority. -If the tunable -.Va hw.mfi.mrsas_enable -is set to 1, -then the driver will reduce its probe priority to allow -.Cd mrsas -to attach to the card instead of -.Nm . .Sh LOADER TUNABLES .Bl -tag -width indent .It Va hw.mfi.msi.enable diff --git a/share/man/man4/mrsas.4 b/share/man/man4/mrsas.4 index 0cda1e8ff2..13a8f2b943 100644 --- a/share/man/man4/mrsas.4 +++ b/share/man/man4/mrsas.4 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD: head/share/man/man4/mrsas.4 267182 2014-06-06 19:00:43Z joel $ .\" -.Dd June 14, 2014 +.Dd July 18, 2014 .Dt MRSAS 4 .Os .Sh NAME @@ -97,28 +97,6 @@ and .Nm drivers can detect and manage the LSI MegaRAID SAS 2208/2308/3008/3108 series of controllers. -.Pp -The -.Xr device.hints 5 -option is provided to tune the -.Nm -driver's behavior for LSI MegaRAID SAS 2208/2308/3008/3108 controllers. -By default, the -.Xr mfi 4 -driver will detect these controllers. -See the -.Nm PRIORITY -section to know more about driver priority for MR-Fusion devices. -.Pp -.Nm -will provide a priority of (-30) (between -.Dv BUS_PROBE_DEFAULT -and -.Dv BUS_PROBE_LOW_PRIORITY ) -at probe call for device id's 0x005B, 0x005D, and -0x005F so that -.Nm -does not take control of these devices without user intervention. .Sh HARDWARE The .Nm @@ -164,6 +142,21 @@ DELL PERC H730/P DELL PERC H330 .El .Sh CONFIGURATION +A tunable is provided to adjust the +.Nm +driver's behaviour when attaching to a card. +By default, the driver will attach to all known cards with +high probe priority. +For +.Dq Thunderbolt +series cards this behavior can be changed to attaching via the +.Xr mfi 4 +driver by setting the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mrsas.mfi_enable=1 +.Ed +.Pp By default, the driver will use MSI if it is supported. This behavior can be turned off by setting the following tunable value in .Xr loader.conf 5 : @@ -229,96 +222,6 @@ Enable prints for OCR and I/O timeout. .It 0x10 Enable prints for AEN events. .El -.Sh PRIORITY -The -.Nm -driver will always set a default (-30) priority in the PCI subsystem for -selection of MR-Fusion cards. -(It is between -.Dv BUS_PROBE_DEFAULT -and -.Dv BUS_PROBE_LOW_PRIORITY ) . -MR-Fusion Controllers include all cards with the -Device IDs - -0x005B, -0x005D, -0x005F. -.Pp -The -.Xr mfi 4 -driver will set a priority of either -.Dv BUS_PROBE_DEFAULT -or -.Dv BUS_PROBE_LOW_PRIORITY -(depending on the device.hints setting) in the PCI -subsystem for selection of MR-Fusion cards. -With the above design in place, the -.Xr mfi 4 -driver will attach to a MR-Fusion card given that it has a higher priority than -.Nm . -.Pp -Using -.Pa /boot/device.hints -(as mentioned below), the user can provide a preference -for the -.Nm -driver to detect a MR-Fusion card instead of the -.Xr mfi 4 -driver. -.Bd -ragged -offset indent -.Cd hw.mfi.mrsas_enable="1" -.Ed -.Pp -At boot time, the -.Xr mfi 4 -driver will get priority to detect MR-Fusion controllers by default. -Before -changing this default driver selection policy, LSI advises users to understand -how the driver selection policy works. -LSI's policy is to provide priority to -the -.Xr mfi 4 -driver to detect MR-Fusion cards, but allow for the ability to choose the -.Nm -driver to detect MR-Fusion cards. -.Pp -LSI recommends setting hw.mfi.mrsas_enable="0" for customers who are using the -older -.Xr mfi 4 -driver and do not want to switch to -.Nm . -For those customers who are using a MR-Fusion controller for the first time, LSI -recommends using the -.Nm -driver and setting hw.mfi.mrsas_enable="1". -.Pp -Changing the default behavior is well tested under most conditions, but -unexpected behavior may pop up if more complex and unrealistic operations are -executed by switching between the -.Xr mfi 4 -and -.Nm -drivers for MR-Fusion. -Switching drivers is designed to happen only one time. -Although multiple -switching is possible, it is not recommended. -The user should decide from -.Nm Start of Day -which driver they want to use for the MR-Fusion card. -.Pp -The user may see different device names when switching from -.Xr mfi 4 -to -.Nm . -This behavior is -.Nm Functions As Designed -and the user needs to change the -.Xr fstab 5 -entry manually if they are doing any experiments with -.Xr mfi 4 -and -.Nm -interoperability. .Sh FILES .Bl -tag -width ".Pa /dev/mrsas?" -compact .It Pa /dev/da? diff --git a/sys/dev/raid/mfi/mfi_pci.c b/sys/dev/raid/mfi/mfi_pci.c index e12469aeb3..4d62eec028 100644 --- a/sys/dev/raid/mfi/mfi_pci.c +++ b/sys/dev/raid/mfi/mfi_pci.c @@ -107,9 +107,6 @@ MODULE_VERSION(mfi, 1); static int mfi_msi_enable = 1; TUNABLE_INT("hw.mfi.msi.enable", &mfi_msi_enable); -static int mfi_mrsas_enable = 0; -TUNABLE_INT("hw.mfi.mrsas_enable", &mfi_mrsas_enable); - struct mfi_ident { uint16_t vendor; uint16_t device; @@ -119,37 +116,37 @@ struct mfi_ident { const char *desc; } mfi_identifiers[] = { { 0x1000, 0x005b, 0x1028, 0x1f2d, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H810 Adapter" }, { 0x1000, 0x005b, 0x1028, 0x1f30, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710 Embedded" }, { 0x1000, 0x005b, 0x1028, 0x1f31, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710P Adapter" }, { 0x1000, 0x005b, 0x1028, 0x1f33, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710P Mini (blades)" }, { 0x1000, 0x005b, 0x1028, 0x1f34, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710P Mini (monolithics)" }, { 0x1000, 0x005b, 0x1028, 0x1f35, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710 Adapter" }, { 0x1000, 0x005b, 0x1028, 0x1f37, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710 Mini (blades)" }, { 0x1000, 0x005b, 0x1028, 0x1f38, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Dell PERC H710 Mini (monolithics)" }, { 0x1000, 0x005b, 0x8086, 0x9265, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Intel (R) RAID Controller RS25DB080" }, { 0x1000, 0x005b, 0x8086, 0x9285, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "Intel (R) RAID Controller RS25NB008" }, { 0x1000, 0x005b, 0xffff, 0xffff, - MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT | MFI_FLAGS_MRSAS, + MFI_FLAGS_SKINNY | MFI_FLAGS_TBOLT, "ThunderBolt" }, { 0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6" }, @@ -215,13 +212,7 @@ mfi_pci_probe(device_t dev) if ((id = mfi_find_ident(dev)) != NULL) { device_set_desc(dev, id->desc); - - /* give priority to mrsas if tunable set */ - TUNABLE_INT_FETCH("hw.mfi.mrsas_enable", &mfi_mrsas_enable); - if ((id->flags & MFI_FLAGS_MRSAS) && mfi_mrsas_enable) - return (ENXIO); /* XXX (BUS_PROBE_LOW_PRIORITY); */ - else - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_DEFAULT); } return (ENXIO); } diff --git a/sys/dev/raid/mfi/mfivar.h b/sys/dev/raid/mfi/mfivar.h index 6841ab6caf..18eb7d708d 100644 --- a/sys/dev/raid/mfi/mfivar.h +++ b/sys/dev/raid/mfi/mfivar.h @@ -187,7 +187,6 @@ struct mfi_softc { #define MFI_FLAGS_GEN2 (1<<6) #define MFI_FLAGS_SKINNY (1<<7) #define MFI_FLAGS_TBOLT (1<<8) -#define MFI_FLAGS_MRSAS (1<<9) // Start: LSIP200113393 bus_dma_tag_t verbuf_h_dmat; bus_dmamap_t verbuf_h_dmamap; diff --git a/sys/dev/raid/mrsas/mrsas.c b/sys/dev/raid/mrsas/mrsas.c index ab00278d2e..daf058b88c 100644 --- a/sys/dev/raid/mrsas/mrsas.c +++ b/sys/dev/raid/mrsas/mrsas.c @@ -185,6 +185,9 @@ static struct dev_ops mrsas_ops = { MALLOC_DEFINE(M_MRSAS, "mrsasbuf", "Buffers for the MRSAS driver"); +static int mrsas_mfi_enable = 0; +TUNABLE_INT("hw.mrsas.mfi_enable", &mrsas_mfi_enable); + static int mrsas_msi_enable = 1; TUNABLE_INT("hw.mrsas.msi.enable", &mrsas_msi_enable); @@ -339,13 +342,19 @@ static int mrsas_probe(device_t dev) struct mrsas_ident *id; if ((id = mrsas_find_ident(dev)) != NULL) { - if (first_ctrl) { - kprintf("LSI MegaRAID SAS FreeBSD mrsas driver version: %s\n", MRSAS_VERSION); - first_ctrl = 0; - } - device_set_desc(dev, id->desc); - /* between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY */ - return (-30); + /* give priority to mfi(4) if tunable set */ + TUNABLE_INT_FETCH("hw.mrsas.mfi_enable", &mrsas_mfi_enable); + if ((id->device == MRSAS_TBOLT) && mrsas_mfi_enable) { + return (ENXIO); + } else { + if (first_ctrl) { + kprintf("LSI MegaRAID SAS FreeBSD mrsas driver version: %s\n", + MRSAS_VERSION); + first_ctrl = 0; + } + device_set_desc(dev, id->desc); + return (BUS_PROBE_DEFAULT); + } } return (ENXIO); } -- 2.41.0