Date: Thu, 20 Dec 2012 10:10:37 -0500 From: "xenophon\\+freebsd" <xenophon+freebsd@irtnog.org> To: <bug-followup@FreeBSD.org>, <leon.kos@lecad.fs.uni-lj.si>, <freebsd-scsi@freebsd.org> Subject: Re: kern/151564: [ciss] ciss(4) should increase CISS_MAX_LOGICAL to 107 Message-ID: <BABF8C57A778F04791343E5601659908236D3C@cinip100ntsbs.irtnog.net>
index | next in thread | raw e-mail
[-- Attachment #1 --]
All:
I've created a patch (see attached) for the ciss driver that makes the
following changes:
* creates a boot-time tunable (hw.ciss.max_logical) that allows
changing the maximum number of logical drives (defaults to
CISS_MAX_LOGICAL, which currently is 15 according to
src/sys/dev/ciss/cissvar.h)
* changes the behavior of another boot-time tunable
(hw.ciss.expose_hidden_physical) such that a value of 2 exposes hidden
physical direct access devices as da(4) devices, where a value of 1
retains the original behavior of exposing them only as pass(4) devices
* updates the ciss(4) manual page regarding the above
modifications
Would a committer be willing to review this patch for potential
inclusion into some future release of FreeBSD? I hereby place this
patch into the public domain.
I tested this successfully using FreeBSD/x86 9.0-RELEASE-p5 on an HP
ProLiant DL380 G3 with an on-board Smart Array 5i controller. For
example, I have 20 single-disk RAID-0 arrays. Without the patch, the
ciss driver returns the error "adapter claims to report absurd number of
logical drives". With the patch applied and hw.ciss.max_logical set to
32 in /boot/loader.conf, the ciss driver correctly detects and
configures all twenty logical drives. Furthermore, with
hw.ciss.expose_hidden_physical to 2, the ciss driver also correctly
exposes the physical disks underlying each of the 20 arrays as da(4)
devices.
I plan to test this patch next week using FreeBSD/amd64 on a DL380 G4,
which has similar specs to my G3.
Best wishes,
Matthew
--
I FIGHT FOR THE USERS
[-- Attachment #2 --]
Index: sys/dev/ciss/ciss.c
===================================================================
--- sys/dev/ciss/ciss.c (revision 244361)
+++ sys/dev/ciss/ciss.c (working copy)
@@ -245,6 +245,9 @@
/*
* This tunable can be set at boot time and controls whether physical devices
* that are marked hidden by the firmware should be exposed anyways.
+ * 0 : hide (default)
+ * 1 : expose; export disks as passthrough devices
+ * 2 : expose; export disks as direct-access devices
*/
static unsigned int ciss_expose_hidden_physical = 0;
TUNABLE_INT("hw.ciss.expose_hidden_physical", &ciss_expose_hidden_physical);
@@ -270,6 +273,13 @@
static int ciss_force_interrupt = 0;
TUNABLE_INT("hw.ciss.force_interrupt", &ciss_force_interrupt);
+/*
+ * This tunable controls how many logical drives this driver can handle.
+ * It defaults to CISS_MAX_LOGICAL.
+ */
+static int ciss_max_logical = CISS_MAX_LOGICAL;
+TUNABLE_INT("hw.ciss.max_logical", &ciss_max_logical);
+
/************************************************************************
* CISS adapters amazingly don't have a defined programming interface
* value. (One could say some very despairing things about PCI and
@@ -1311,7 +1321,7 @@
break;
case CISS_CMD_STATUS_DATA_OVERRUN:
ciss_printf(sc, "WARNING: more units than driver limit (%d)\n",
- CISS_MAX_LOGICAL);
+ ciss_max_logical);
break;
default:
ciss_printf(sc, "error detecting logical drive configuration (%s)\n",
@@ -1345,7 +1355,7 @@
debug_called(1);
cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
- CISS_MAX_LOGICAL);
+ ciss_max_logical);
if (cll == NULL) {
error = ENXIO;
goto out;
@@ -1353,9 +1363,9 @@
/* sanity-check reply */
ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
- if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
+ if ((ndrives < 0) || (ndrives > ciss_max_logical)) {
ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n",
- ndrives, CISS_MAX_LOGICAL);
+ ndrives, ciss_max_logical);
error = ENXIO;
goto out;
}
@@ -1378,19 +1388,19 @@
for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
- malloc(CISS_MAX_LOGICAL * sizeof(struct ciss_ldrive),
+ malloc(ciss_max_logical * sizeof(struct ciss_ldrive),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical[i] == NULL) {
error = ENXIO;
goto out;
}
- for (j = 0; j < CISS_MAX_LOGICAL; j++)
+ for (j = 0; j < ciss_max_logical; j++)
sc->ciss_logical[i][j].cl_status = CISS_LD_NONEXISTENT;
}
- for (i = 0; i < CISS_MAX_LOGICAL; i++) {
+ for (i = 0; i < ciss_max_logical; i++) {
if (i < ndrives) {
struct ciss_ldrive *ld;
int bus, target;
@@ -1975,7 +1985,7 @@
bus_dma_tag_destroy(sc->ciss_parent_dmat);
if (sc->ciss_logical) {
for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
- for (j = 0; j < CISS_MAX_LOGICAL; j++) {
+ for (j = 0; j < ciss_max_logical; j++) {
if (sc->ciss_logical[i][j].cl_ldrive)
free(sc->ciss_logical[i][j].cl_ldrive, CISS_MALLOC_CLASS);
if (sc->ciss_logical[i][j].cl_lstatus)
@@ -2958,9 +2968,9 @@
cpi->hba_inquiry = PI_TAG_ABLE; /* XXX is this correct? */
cpi->target_sprt = 0;
cpi->hba_misc = 0;
- cpi->max_target = CISS_MAX_LOGICAL;
+ cpi->max_target = ciss_max_logical;
cpi->max_lun = 0; /* 'logical drive' channel only */
- cpi->initiator_id = CISS_MAX_LOGICAL;
+ cpi->initiator_id = ciss_max_logical;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "msmith@freebsd.org", HBA_IDLEN);
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
@@ -3316,7 +3326,8 @@
* attached by the PASS driver.
*/
if (CISS_IS_PHYSICAL(bus)) {
- if (SID_TYPE(inq) == T_DIRECT)
+ if ((SID_TYPE(inq) == T_DIRECT) &&
+ (ciss_expose_hidden_physical <= 1))
inq->device = (inq->device & 0xe0) | T_NODEVICE;
return;
}
@@ -3871,7 +3882,7 @@
* drive address.
*/
cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
- CISS_MAX_LOGICAL);
+ ciss_max_logical);
if (cll == NULL)
return;
@@ -3882,7 +3893,7 @@
* firmware.
*/
for (i = 0; i < sc->ciss_max_logical_bus; i++) {
- for (j = 0; j < CISS_MAX_LOGICAL; j++) {
+ for (j = 0; j < ciss_max_logical; j++) {
ld = &sc->ciss_logical[i][j];
if (ld->cl_update == 0)
@@ -4299,7 +4310,7 @@
"\20\1notify_ok\2control_open\3aborting\4running\21fake_synch\22bmic_abort\n");
for (i = 0; i < sc->ciss_max_logical_bus; i++) {
- for (j = 0; j < CISS_MAX_LOGICAL; j++) {
+ for (j = 0; j < ciss_max_logical; j++) {
ciss_printf(sc, "LOGICAL DRIVE %d: ", i);
ciss_print_ldrive(sc, &sc->ciss_logical[i][j]);
}
Index: share/man/man4/ciss.4
===================================================================
--- share/man/man4/ciss.4 (revision 244361)
+++ share/man/man4/ciss.4 (working copy)
@@ -77,11 +77,15 @@
marked as being masked.
Masked devices can be exposed by setting the
.Va hw.ciss.expose_hidden_physical
-tunable to non-zero at boot time.
+tunable to 1 at boot time.
Direct Access devices (such as disk
drives) are only exposed as
.Xr pass 4
-devices.
+devices. To expose them as
+.Xr da 4
+devices instead, set
+.Va hw.ciss.expose_hidden_physical
+to 2 at boot time.
Hot-insertion and removal of devices is supported but a bus
rescan might be necessary.
.Pp
@@ -90,6 +94,13 @@
might be solved by updating the firmware and/or setting the
.Va hw.ciss.nop_message_heartbeat
tunable to non-zero at boot time.
+.Pp
+By default the driver restricts the maximum number of logical drives to 15 in
+order to limit the amount of memory required by the driver. This limit can
+be increased (as long as the computer has enough memory below 4 GiB for DMA
+I/O) by setting the
+.Va hw.ciss.max_logical
+tunable to the new limit at boot time.
.Sh HARDWARE
Controllers supported by the
.Nm
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BABF8C57A778F04791343E5601659908236D3C>
