Skip to content

Commit

Permalink
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jejb/scsi

Pull more SCSI updates from James Bottomley:
 "Updates that missed the first pull, mostly because of needing more
  soak time.

  Driver updates (zfcp, ufs, mpi3mr, plus two ipr bug fixes), an
  enclosure services (ses) update (mostly bug fixes) and other minor bug
  fixes and changes"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (32 commits)
  scsi: zfcp: Trace when request remove fails after qdio send fails
  scsi: zfcp: Change the type of all fsf request id fields and variables to u64
  scsi: zfcp: Make the type for accessing request hashtable buckets size_t
  scsi: ufs: core: Simplify ufshcd_execute_start_stop()
  scsi: ufs: core: Rely on the block layer for setting RQF_PM
  scsi: core: Extend struct scsi_exec_args
  scsi: lpfc: Fix double word in comments
  scsi: core: Remove the /proc/scsi/${proc_name} directory earlier
  scsi: core: Fix a source code comment
  scsi: cxgbi: Remove unneeded version.h include
  scsi: qedi: Remove unneeded version.h include
  scsi: mpi3mr: Remove unneeded version.h include
  scsi: mpi3mr: Fix missing mrioc->evtack_cmds initialization
  scsi: mpi3mr: Use number of bits to manage bitmap sizes
  scsi: mpi3mr: Remove unnecessary memcpy() to alltgt_info->dmi
  scsi: mpi3mr: Fix issues in mpi3mr_get_all_tgt_info()
  scsi: mpi3mr: Fix an issue found by KASAN
  scsi: mpi3mr: Replace 1-element array with flex-array
  scsi: ipr: Work around fortify-string warning
  scsi: ipr: Make ipr_probe_ioa_part2() return void
  ...
  • Loading branch information
torvalds committed Mar 3, 2023
2 parents 0a3f9a6 + 901b894 commit 06caa75
Show file tree
Hide file tree
Showing 36 changed files with 291 additions and 252 deletions.
46 changes: 44 additions & 2 deletions drivers/s390/scsi/zfcp_dbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Debug traces for zfcp.
*
* Copyright IBM Corp. 2002, 2020
* Copyright IBM Corp. 2002, 2023
*/

#define KMSG_COMPONENT "zfcp"
Expand Down Expand Up @@ -145,6 +145,48 @@ void zfcp_dbf_hba_fsf_fces(char *tag, const struct zfcp_fsf_req *req, u64 wwpn,
spin_unlock_irqrestore(&dbf->hba_lock, flags);
}

/**
* zfcp_dbf_hba_fsf_reqid - trace only the tag and a request ID
* @tag: tag documenting the source
* @level: trace level
* @adapter: adapter instance the request ID belongs to
* @req_id: the request ID to trace
*/
void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level,
struct zfcp_adapter *const adapter,
const u64 req_id)
{
struct zfcp_dbf *const dbf = adapter->dbf;
struct zfcp_dbf_hba *const rec = &dbf->hba_buf;
struct zfcp_dbf_hba_res *const res = &rec->u.res;
unsigned long flags;

if (unlikely(!debug_level_enabled(dbf->hba, level)))
return;

spin_lock_irqsave(&dbf->hba_lock, flags);
memset(rec, 0, sizeof(*rec));

memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);

rec->id = ZFCP_DBF_HBA_RES;
rec->fsf_req_id = req_id;
rec->fsf_req_status = ~0u;
rec->fsf_cmd = ~0u;
rec->fsf_seq_no = ~0u;

res->req_issued = ~0ull;
res->prot_status = ~0u;
memset(res->prot_status_qual, 0xff, sizeof(res->prot_status_qual));
res->fsf_status = ~0u;
memset(res->fsf_status_qual, 0xff, sizeof(res->fsf_status_qual));
res->port_handle = ~0u;
res->lun_handle = ~0u;

debug_event(dbf->hba, level, rec, sizeof(*rec));
spin_unlock_irqrestore(&dbf->hba_lock, flags);
}

/**
* zfcp_dbf_hba_fsf_uss - trace event for an unsolicited status buffer
* @tag: tag indicating which kind of unsolicited status has been received
Expand Down Expand Up @@ -649,7 +691,7 @@ void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev,
rec->scsi_id = sc->device->id;
rec->scsi_lun = (u32)sc->device->lun;
rec->scsi_lun_64_hi = (u32)(sc->device->lun >> 32);
rec->host_scribble = (unsigned long)sc->host_scribble;
rec->host_scribble = (u64)sc->host_scribble;

memcpy(rec->scsi_opcode, sc->cmnd,
min_t(int, sc->cmd_len, ZFCP_DBF_SCSI_OPCODE));
Expand Down
6 changes: 3 additions & 3 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct zfcp_erp_action {
struct scsi_device *sdev;
u32 status; /* recovery status */
enum zfcp_erp_steps step; /* active step of this erp action */
unsigned long fsf_req_id;
u64 fsf_req_id;
struct timer_list timer;
};

Expand Down Expand Up @@ -163,7 +163,7 @@ struct zfcp_adapter {
struct Scsi_Host *scsi_host; /* Pointer to mid-layer */
struct list_head port_list; /* remote port list */
rwlock_t port_list_lock; /* port list lock */
unsigned long req_no; /* unique FSF req number */
u64 req_no; /* unique FSF req number */
struct zfcp_reqlist *req_list;
u32 fsf_req_seq_no; /* FSF cmnd seq number */
rwlock_t abort_lock; /* Protects against SCSI
Expand Down Expand Up @@ -325,7 +325,7 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev)
*/
struct zfcp_fsf_req {
struct list_head list;
unsigned long req_id;
u64 req_id;
struct zfcp_adapter *adapter;
struct zfcp_qdio_req qdio_req;
struct completion completion;
Expand Down
5 changes: 4 additions & 1 deletion drivers/s390/scsi/zfcp_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* External function declarations.
*
* Copyright IBM Corp. 2002, 2020
* Copyright IBM Corp. 2002, 2023
*/

#ifndef ZFCP_EXT_H
Expand Down Expand Up @@ -46,6 +46,9 @@ extern void zfcp_dbf_hba_fsf_res(char *, int, struct zfcp_fsf_req *);
extern void zfcp_dbf_hba_fsf_fces(char *tag, const struct zfcp_fsf_req *req,
u64 wwpn, u32 fc_security_old,
u32 fc_security_new);
extern void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level,
struct zfcp_adapter *const adapter,
const u64 req_id);
extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
extern void zfcp_dbf_hba_def_err(struct zfcp_adapter *, u64, u16, void **);
extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);
Expand Down
22 changes: 13 additions & 9 deletions drivers/s390/scsi/zfcp_fsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Implementation of FSF commands.
*
* Copyright IBM Corp. 2002, 2020
* Copyright IBM Corp. 2002, 2023
*/

#define KMSG_COMPONENT "zfcp"
Expand Down Expand Up @@ -884,16 +884,19 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
const bool is_srb = zfcp_fsf_req_is_status_read_buffer(req);
struct zfcp_adapter *adapter = req->adapter;
struct zfcp_qdio *qdio = adapter->qdio;
unsigned long req_id = req->req_id;
u64 req_id = req->req_id;

zfcp_reqlist_add(adapter->req_list, req);

req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
req->issued = get_tod_clock();
if (zfcp_qdio_send(qdio, &req->qdio_req)) {
del_timer_sync(&req->timer);

/* lookup request again, list might have changed */
zfcp_reqlist_find_rm(adapter->req_list, req_id);
if (zfcp_reqlist_find_rm(adapter->req_list, req_id) == NULL)
zfcp_dbf_hba_fsf_reqid("fsrsrmf", 1, adapter, req_id);

zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1");
return -EIO;
}
Expand Down Expand Up @@ -1042,7 +1045,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
struct scsi_device *sdev = scmnd->device;
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio;
unsigned long old_req_id = (unsigned long) scmnd->host_scribble;
u64 old_req_id = (u64) scmnd->host_scribble;

spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
Expand All @@ -1065,7 +1068,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
req->handler = zfcp_fsf_abort_fcp_command_handler;
req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
req->qtcb->header.port_handle = zfcp_sdev->port->handle;
req->qtcb->bottom.support.req_handle = (u64) old_req_id;
req->qtcb->bottom.support.req_handle = old_req_id;

zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
if (!zfcp_fsf_req_send(req)) {
Expand Down Expand Up @@ -1919,7 +1922,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
{
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
struct zfcp_fsf_req *req;
unsigned long req_id = 0;
u64 req_id = 0;
int retval = -EIO;

spin_lock_irq(&qdio->req_q_lock);
Expand Down Expand Up @@ -1978,7 +1981,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
{
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
struct zfcp_fsf_req *req;
unsigned long req_id = 0;
u64 req_id = 0;
int retval = -EIO;

spin_lock_irq(&qdio->req_q_lock);
Expand Down Expand Up @@ -2587,6 +2590,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
goto out;
}

BUILD_BUG_ON(sizeof(scsi_cmnd->host_scribble) < sizeof(req->req_id));
scsi_cmnd->host_scribble = (unsigned char *) req->req_id;

io = &req->qtcb->bottom.io;
Expand Down Expand Up @@ -2732,7 +2736,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
struct qdio_buffer *sbal = qdio->res_q[sbal_idx];
struct qdio_buffer_element *sbale;
struct zfcp_fsf_req *fsf_req;
unsigned long req_id;
u64 req_id;
int idx;

for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
Expand All @@ -2747,7 +2751,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
* corruption and must stop the machine immediately.
*/
zfcp_qdio_siosl(adapter);
panic("error: unknown req_id (%lx) on adapter %s.\n",
panic("error: unknown req_id (%llx) on adapter %s.\n",
req_id, dev_name(&adapter->ccw_device->dev));
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/scsi/zfcp_qdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
*/
static inline
void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
unsigned long req_id, u8 sbtype, void *data, u32 len)
u64 req_id, u8 sbtype, void *data, u32 len)
{
struct qdio_buffer_element *sbale;
int count = min(atomic_read(&qdio->req_q_free),
Expand Down
26 changes: 14 additions & 12 deletions drivers/s390/scsi/zfcp_reqlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
* Data structure and helper functions for tracking pending FSF
* requests.
*
* Copyright IBM Corp. 2009, 2016
* Copyright IBM Corp. 2009, 2023
*/

#ifndef ZFCP_REQLIST_H
#define ZFCP_REQLIST_H

#include <linux/types.h>

/* number of hash buckets */
#define ZFCP_REQ_LIST_BUCKETS 128
#define ZFCP_REQ_LIST_BUCKETS 128u

/**
* struct zfcp_reqlist - Container for request list (reqlist)
Expand All @@ -24,7 +26,7 @@ struct zfcp_reqlist {
struct list_head buckets[ZFCP_REQ_LIST_BUCKETS];
};

static inline int zfcp_reqlist_hash(unsigned long req_id)
static inline size_t zfcp_reqlist_hash(u64 req_id)
{
return req_id % ZFCP_REQ_LIST_BUCKETS;
}
Expand All @@ -37,7 +39,7 @@ static inline int zfcp_reqlist_hash(unsigned long req_id)
*/
static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
{
unsigned int i;
size_t i;
struct zfcp_reqlist *rl;

rl = kzalloc(sizeof(struct zfcp_reqlist), GFP_KERNEL);
Expand All @@ -60,7 +62,7 @@ static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
*/
static inline int zfcp_reqlist_isempty(struct zfcp_reqlist *rl)
{
unsigned int i;
size_t i;

for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
if (!list_empty(&rl->buckets[i]))
Expand All @@ -81,10 +83,10 @@ static inline void zfcp_reqlist_free(struct zfcp_reqlist *rl)
}

static inline struct zfcp_fsf_req *
_zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
_zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
{
struct zfcp_fsf_req *req;
unsigned int i;
size_t i;

i = zfcp_reqlist_hash(req_id);
list_for_each_entry(req, &rl->buckets[i], list)
Expand All @@ -102,7 +104,7 @@ _zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
* or NULL if there is no known FSF request with this id.
*/
static inline struct zfcp_fsf_req *
zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
{
unsigned long flags;
struct zfcp_fsf_req *req;
Expand All @@ -127,7 +129,7 @@ zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
* NULL if it has not been found.
*/
static inline struct zfcp_fsf_req *
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, u64 req_id)
{
unsigned long flags;
struct zfcp_fsf_req *req;
Expand All @@ -154,7 +156,7 @@ zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
static inline void zfcp_reqlist_add(struct zfcp_reqlist *rl,
struct zfcp_fsf_req *req)
{
unsigned int i;
size_t i;
unsigned long flags;

i = zfcp_reqlist_hash(req->req_id);
Expand All @@ -172,7 +174,7 @@ static inline void zfcp_reqlist_add(struct zfcp_reqlist *rl,
static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl,
struct list_head *list)
{
unsigned int i;
size_t i;
unsigned long flags;

spin_lock_irqsave(&rl->lock, flags);
Expand Down Expand Up @@ -200,7 +202,7 @@ zfcp_reqlist_apply_for_all(struct zfcp_reqlist *rl,
{
struct zfcp_fsf_req *req;
unsigned long flags;
unsigned int i;
size_t i;

spin_lock_irqsave(&rl->lock, flags);
for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/scsi/zfcp_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
(struct zfcp_adapter *) scsi_host->hostdata[0];
struct zfcp_fsf_req *old_req, *abrt_req;
unsigned long flags;
unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
u64 old_reqid = (u64) scpnt->host_scribble;
int retval = SUCCESS, ret;
int retry = 3;
char *dbf_tag;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/cxgbi/libcxgbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/scatterlist.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/version.h>
#include <scsi/scsi_device.h>
#include <scsi/libiscsi_tcp.h>

Expand Down
4 changes: 3 additions & 1 deletion drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void scsi_remove_host(struct Scsi_Host *shost)
scsi_forget_host(shost);
mutex_unlock(&shost->scan_mutex);
scsi_proc_host_rm(shost);
scsi_proc_hostdir_rm(shost->hostt);

/*
* New SCSI devices cannot be attached anymore because of the SCSI host
Expand Down Expand Up @@ -340,6 +341,7 @@ static void scsi_host_dev_release(struct device *dev)
struct Scsi_Host *shost = dev_to_shost(dev);
struct device *parent = dev->parent;

/* In case scsi_remove_host() has not been called. */
scsi_proc_hostdir_rm(shost->hostt);

/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
Expand All @@ -356,7 +358,7 @@ static void scsi_host_dev_release(struct device *dev)
/*
* Free the shost_dev device name here if scsi_host_alloc()
* and scsi_host_put() have been called but neither
* scsi_host_add() nor scsi_host_remove() has been called.
* scsi_host_add() nor scsi_remove_host() has been called.
* This avoids that the memory allocated for the shost_dev
* name is leaked.
*/
Expand Down
Loading

0 comments on commit 06caa75

Please sign in to comment.