Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] hpsa: allow user to disable accelerated i/o path

Allow SSD Smart Path for a controller to be disabled by
the user, regardless of settings in controller firmware
or array configuration.

To disable: echo 0 > /sys/class/scsi_host/host<id>/acciopath_status
To re-enable: echo 1 > /sys/class/scsi_host/host<id>/acciopath_status
To check state: cat /sys/class/scsi_host/host<id>/acciopath_status

Signed-off-by: Scott Teel <scott.teel@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Scott Teel and committed by
James Bottomley
da0697bd 6b80b18f

+61 -1
+16
Documentation/ABI/testing/sysfs-class-scsi_host
··· 11 11 guaranteed. The 'isci_id' attribute unambiguously identifies 12 12 the controller index: '0' for the first controller, 13 13 '1' for the second. 14 + 15 + What: /sys/class/scsi_host/hostX/acciopath_status 16 + Date: November 2013 17 + Contact: Stephen M. Cameron <scameron@beardog.cce.hp.com> 18 + Description: This file contains the current status of the "SSD Smart Path" 19 + feature of HP Smart Array RAID controllers using the hpsa 20 + driver. SSD Smart Path, when enabled permits the driver to 21 + send i/o requests directly to physical devices that are part 22 + of a logical drive, bypassing the controllers firmware RAID 23 + stack for a performance advantage when possible. A value of 24 + '1' indicates the feature is enabled, and the controller may 25 + use the direct i/o path to physical devices. A value of zero 26 + means the feature is disabled and the controller may not use 27 + the direct i/o path to physical devices. This setting is 28 + controller wide, affecting all configured logical drives on the 29 + controller. This file is readable and writable.
+44 -1
drivers/scsi/hpsa.c
··· 287 287 return 1; 288 288 } 289 289 290 + static ssize_t host_store_hp_ssd_smart_path_status(struct device *dev, 291 + struct device_attribute *attr, 292 + const char *buf, size_t count) 293 + { 294 + int status, len; 295 + struct ctlr_info *h; 296 + struct Scsi_Host *shost = class_to_shost(dev); 297 + char tmpbuf[10]; 298 + 299 + if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 300 + return -EACCES; 301 + len = count > sizeof(tmpbuf) - 1 ? sizeof(tmpbuf) - 1 : count; 302 + strncpy(tmpbuf, buf, len); 303 + tmpbuf[len] = '\0'; 304 + if (sscanf(tmpbuf, "%d", &status) != 1) 305 + return -EINVAL; 306 + h = shost_to_hba(shost); 307 + h->acciopath_status = !!status; 308 + dev_warn(&h->pdev->dev, 309 + "hpsa: HP SSD Smart Path %s via sysfs update.\n", 310 + h->acciopath_status ? "enabled" : "disabled"); 311 + return count; 312 + } 313 + 290 314 static ssize_t host_store_rescan(struct device *dev, 291 315 struct device_attribute *attr, 292 316 const char *buf, size_t count) ··· 356 332 return snprintf(buf, 20, "%s\n", 357 333 h->transMethod & CFGTBL_Trans_Performant ? 358 334 "performant" : "simple"); 335 + } 336 + 337 + static ssize_t host_show_hp_ssd_smart_path_status(struct device *dev, 338 + struct device_attribute *attr, char *buf) 339 + { 340 + struct ctlr_info *h; 341 + struct Scsi_Host *shost = class_to_shost(dev); 342 + 343 + h = shost_to_hba(shost); 344 + return snprintf(buf, 30, "HP SSD Smart Path %s\n", 345 + (h->acciopath_status == 1) ? "enabled" : "disabled"); 359 346 } 360 347 361 348 /* List of controllers which cannot be hard reset on kexec with reset_devices */ ··· 581 546 static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); 582 547 static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO, 583 548 host_show_hp_ssd_smart_path_enabled, NULL); 549 + static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH, 550 + host_show_hp_ssd_smart_path_status, 551 + host_store_hp_ssd_smart_path_status); 584 552 static DEVICE_ATTR(firmware_revision, S_IRUGO, 585 553 host_show_firmware_revision, NULL); 586 554 static DEVICE_ATTR(commands_outstanding, S_IRUGO, ··· 607 569 &dev_attr_commands_outstanding, 608 570 &dev_attr_transport_mode, 609 571 &dev_attr_resettable, 572 + &dev_attr_hp_ssd_smart_path_status, 610 573 NULL, 611 574 }; 612 575 ··· 3380 3341 * Retries always go down the normal I/O path. 3381 3342 */ 3382 3343 if (likely(cmd->retries == 0 && 3383 - cmd->request->cmd_type == REQ_TYPE_FS)) { 3344 + cmd->request->cmd_type == REQ_TYPE_FS && 3345 + h->acciopath_status)) { 3384 3346 if (dev->offload_enabled) { 3385 3347 rc = hpsa_scsi_ioaccel_raid_map(h, c); 3386 3348 if (rc == 0) ··· 6365 6325 6366 6326 goto reinit_after_soft_reset; 6367 6327 } 6328 + 6329 + /* Enable Accelerated IO path at driver layer */ 6330 + h->acciopath_status = 1; 6368 6331 6369 6332 /* Turn the interrupts on so we can service requests */ 6370 6333 h->access.set_intr_mask(h, HPSA_INTR_ON);
+1
drivers/scsi/hpsa.h
··· 181 181 #define HPSATMF_LOG_QRY_TSET (1 << 24) 182 182 #define HPSATMF_LOG_QRY_ASYNC (1 << 25) 183 183 u32 events; 184 + int acciopath_status; 184 185 }; 185 186 #define HPSA_ABORT_MSG 0 186 187 #define HPSA_DEVICE_RESET_MSG 1