diff options
author | Jason Yan <yanaijie@huawei.com> | 2017-12-08 17:42:05 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-01-08 21:59:28 -0500 |
commit | f12486e06ae87453530f00a6cb49b60ae3fe4551 (patch) | |
tree | 831a4dd957ced9acdff2349e03ae84fcaacad88e /include/scsi | |
parent | 1c393b970e0f4070e4376d45f89a2d19a5c895d0 (diff) | |
download | linux-rt-f12486e06ae87453530f00a6cb49b60ae3fe4551.tar.gz |
scsi: libsas: shut down the PHY if events reached the threshold
If the PHY burst too many events, we will alloc a lot of events for the
worker. This may leads to memory exhaustion.
Dan Williams suggested to shut down the PHY if the events reached the
threshold, because in this case the PHY may have gone into some
erroneous state. Users can re-enable the PHY by sysfs if they want.
We cannot use the fixed memory pool because if we run out of events, the
shut down event and loss of signal event will lost too. The events still
need to be allocated and processed in this case.
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
CC: John Garry <john.garry@huawei.com>
CC: Johannes Thumshirn <jthumshirn@suse.de>
CC: Ewan Milne <emilne@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libsas.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index ee1b25299dd6..de8f043475c2 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -75,6 +75,7 @@ enum phy_event { PHYE_OOB_ERROR, PHYE_SPINUP_HOLD, /* hot plug SATA, no COMWAKE sent */ PHYE_RESUME_TIMEOUT, + PHYE_SHUTDOWN, PHY_NUM_EVENTS, }; @@ -311,12 +312,15 @@ static inline void INIT_SAS_EVENT(struct asd_sas_event *ev, ev->event = event; } +#define SAS_PHY_SHUTDOWN_THRES 1024 /* The phy pretty much is controlled by the LLDD. * The class only reads those fields. */ struct asd_sas_phy { /* private: */ + atomic_t event_nr; + int in_shutdown; int error; int suspended; @@ -404,6 +408,8 @@ struct sas_ha_struct { struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */ struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */ + + int event_thres; }; #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) |