SCSI adapter: how to freeze and thaw I/O on hibernation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I'm adding code to enable the hv_storvsc driver (drivers/scsi/storvsc_drv.c)
for hibernation (ACPI S5). I know how to save/restore the state of the virtual
Hyper-V SCSI adapter, but I don't know how to prevent the higher layer SCSI
driver(s) from submitting new I/O requests to the low level driver hv_storvsc,
before I disable the Hyper-V SCSI adapter in hv_storvsc.

Note: I can not call scsi_remove_host(), because the SCSI host should not
disappear and re-appear on hibernation.

scsi_target_block() calls scsi_internal_device_block() ->
blk_mq_quiesce_queue(), but it is only used in a few drivers
(scsi_transport_fc.c, scsi_transport_iscsi.c and scsi_transport_srp.c), so
I doubt it is suitable to me?

scsi_block_requests() is used in a lot of drivers and hence is more likely
to be the API I'm looking for, but it only sets a flag
shost->host_self_blocked -- how can this prevent another CPU from
submitting I/O requests?

I also checked scsi_bus_pm_ops, but it's only for "sdev": see
scsi_bus_suspend_common() -> "if (scsi_is_sdev_device(dev))...".

Even for "sdev", it looks the scsi_dev_type_suspend() can't work for me,
because it looks the sdev's driver is sd, whose sd_pm_ops doesn't
define the .freeze and .thaw ops, which are needed in hibernation.

sd_pm_ops does define .suspend and .resume, but it looks they are only
for suspend-to-memory (ACPI S3).

Can you please recommend the standard way to prevent the higher layer
SCSI driver(s) from submitting new I/O requests?

How do the other low level SCSI adapter drivers support hibernation?

I checked some PCI HBA drivers, and they use scsi_block_requests(), but
as I described above, I don't know how setting a flag can prevent another
CPU from submitting I/O requests.

Looking forward to your insights!

Thanks!
--Dexuan




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux