Re: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler

2017-06-23 Thread kbuild test robot
Hi Hannes,

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:329:0,
from include/linux/kernel.h:13,
from include/linux/delay.h:21,
from drivers/scsi/cxlflash/main.c:15:
   drivers/scsi/cxlflash/main.c: In function 'cxlflash_eh_host_reset_handler':
>> drivers/scsi/cxlflash/main.c:2186:15: warning: format '%s' expects argument 
>> of type 'char *', but argument 4 has type 'unsigned int' [-Wformat=]
 dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
  ^
   include/linux/dynamic_debug.h:134:39: note: in definition of macro 
'dynamic_dev_dbg'
  __dynamic_dev_dbg(&descriptor, dev, fmt, \
  ^~~
>> drivers/scsi/cxlflash/main.c:2186:2: note: in expansion of macro 'dev_dbg'
 dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
 ^~~
>> drivers/scsi/cxlflash/main.c:2186:15: warning: format '%d' expects a 
>> matching 'int' argument [-Wformat=]
 dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
  ^
   include/linux/dynamic_debug.h:134:39: note: in definition of macro 
'dynamic_dev_dbg'
  __dynamic_dev_dbg(&descriptor, dev, fmt, \
  ^~~
>> drivers/scsi/cxlflash/main.c:2186:2: note: in expansion of macro 'dev_dbg'
 dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
 ^~~

vim +2186 drivers/scsi/cxlflash/main.c

  2170   * Following a reset, the state is evaluated again in case an EEH 
occurred
  2171   * during the reset. In such a scenario, the host reset will either 
yield
  2172   * until the EEH recovery is complete or return success or failure based
  2173   * upon the current device state.
  2174   *
  2175   * Return:
  2176   *  SUCCESS as defined in scsi/scsi.h
  2177   *  FAILED as defined in scsi/scsi.h
  2178   */
  2179  static int cxlflash_eh_host_reset_handler(struct Scsi_Host *host)
  2180  {
  2181  int rc = SUCCESS;
  2182  int rcr = 0;
  2183  struct cxlflash_cfg *cfg = shost_priv(host);
  2184  struct device *dev = &cfg->dev->dev;
  2185  
> 2186  dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
  2187  
  2188  switch (cfg->state) {
  2189  case STATE_NORMAL:
  2190  cfg->state = STATE_RESET;
  2191  drain_ioctls(cfg);
  2192  cxlflash_mark_contexts_error(cfg);
  2193  rcr = afu_reset(cfg);
  2194  if (rcr) {

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler

2017-06-23 Thread kbuild test robot
Hi Hannes,

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-x004-201725 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from drivers/scsi/53c700.c:140:0:
   drivers/scsi/53c700.c: In function 'NCR_700_host_reset':
>> drivers/scsi/53c700.c:1980:26: error: 'shost' undeclared (first use in this 
>> function)
 shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
 ^
   include/scsi/scsi_host.h:747:23: note: in definition of macro 'shost_printk'
 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
  ^
   drivers/scsi/53c700.c:1980:26: note: each undeclared identifier is reported 
only once for each function it appears in
 shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
 ^
   include/scsi/scsi_host.h:747:23: note: in definition of macro 'shost_printk'
 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
  ^
--
   drivers/scsi/sym53c416.c: In function 'sym53c416_info':
   drivers/scsi/sym53c416.c:723:6: warning: unused variable 'i' 
[-Wunused-variable]
 int i;
 ^
   drivers/scsi/sym53c416.c: At top level:
>> drivers/scsi/sym53c416.c:762:12: error: conflicting types for 
>> 'sym53c416_host_reset'
static int sym53c416_host_reset(struct Scsi_Host *SChost)
   ^~~~
   In file included from drivers/scsi/sym53c416.c:45:0:
   drivers/scsi/sym53c416.h:29:12: note: previous declaration of 
'sym53c416_host_reset' was here
static int sym53c416_host_reset(Scsi_Cmnd *);
   ^~~~
   drivers/scsi/sym53c416.c: In function 'sym53c416_host_reset':
   drivers/scsi/sym53c416.c:766:6: warning: unused variable 'i' 
[-Wunused-variable]
 int i;
 ^

vim +/shost +1980 drivers/scsi/53c700.c

  1974  return SUCCESS;
  1975  }
  1976  
  1977  STATIC int
  1978  NCR_700_host_reset(struct Scsi_Host * host)
  1979  {
> 1980  shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
  1981  
  1982  spin_lock_irq(host->host_lock);
  1983  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler

2017-06-23 Thread Bart Van Assche
On Fri, 2017-06-23 at 15:02 +0200, Hannes Reinecke wrote:
> diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
> index 227dd2c..187bfaf 100644
> --- a/drivers/scsi/eata.c
> +++ b/drivers/scsi/eata.c
> @@ -507,7 +507,7 @@
>  static int eata2x_release(struct Scsi_Host *);
>  static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
>  static int eata2x_eh_abort(struct scsi_cmnd *);
> -static int eata2x_eh_host_reset(struct scsi_cmnd *);
> +static int eata2x_eh_host_reset(struct Scsi_Host *);
>  static int eata2x_bios_param(struct scsi_device *, struct block_device *,
>sector_t, int *);
>  static int eata2x_slave_configure(struct scsi_device *);
> @@ -1896,21 +1896,16 @@ static int eata2x_eh_abort(struct scsi_cmnd *SCarg)
>   panic("%s: abort, mbox %d, invalid cp_stat.\n", ha->board_name, i);
>  }
>  
> -static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
> +static int eata2x_eh_host_reset(struct Scsi_Host *shost)
>  {
>   unsigned int i, time, k, c, limit = 0;
> - int arg_done = 0;
>   struct scsi_cmnd *SCpnt;
> - struct Scsi_Host *shost = SCarg->device->host;
>   struct hostdata *ha = (struct hostdata *)shost->hostdata;
>  
> - scmd_printk(KERN_INFO, SCarg, "reset, enter.\n");
> + shost_printk(KERN_INFO, shost, "reset, enter.\n");
>  
>   spin_lock_irq(shost->host_lock);
>  
> - if (SCarg->host_scribble == NULL)
> - printk("%s: reset, inactive.\n", ha->board_name);
> -
>   if (ha->in_reset) {
>   printk("%s: reset, exit, already in reset.\n", ha->board_name);
>   spin_unlock_irq(shost->host_lock);
> @@ -1967,9 +1962,6 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
>   if (SCpnt->scsi_done == NULL)
>   panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n",
> ha->board_name, i);
> -
> - if (SCpnt == SCarg)
> - arg_done = 1;
>   }
>  
>   if (do_dma(shost->io_port, 0, RESET_PIO)) {

Please isolate the "arg_done" removal into a separate patch.

> @@ -865,23 +858,6 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
>   if (!ha->active)
>   return (FAILED);
>  
> - /* See if the command is on the copp queue */
> - item = ha->copp_waitlist.head;
> - while ((item) && (item->scsi_cmd != SC))
> - item = item->next;
> -
> - if (item) {
> - /* Found it */
> - ips_removeq_copp(&ha->copp_waitlist, item);
> - return (SUCCESS);
> - }
> -
> - /* See if the command is on the wait queue */
> - if (ips_removeq_wait(&ha->scb_waitlist, SC)) {
> - /* command not sent yet */
> - return (SUCCESS);
> - }
> -
>   /* An explanation for the casual observer:  
> */
>   /* Part of the function of a RAID controller is automatic error 
> */
>   /* detection and recovery.  As such, the only problem that physically   
> */

Shouldn't this change be isolated into a separate patch too?

> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index 3c63c29..906570a 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -1887,13 +1887,13 @@ static DEF_SCSI_QCMD(megaraid_queue)
>  
>  
>  static int
> -megaraid_reset(struct scsi_cmnd *cmd)
> +megaraid_reset(struct Scsi_Host *shost)
>  {
>   adapter_t   *adapter;
>   megacmd_t   mc;
>   int rval;
>  
> - adapter = (adapter_t *)cmd->device->host->hostdata;
> + adapter = (adapter_t *)shost->hostdata;
>  
>  #if MEGA_HAVE_CLUSTERING
>   mc.cmd = MEGA_CLUSTER_CMD;
> @@ -1909,7 +1909,7 @@ static DEF_SCSI_QCMD(megaraid_queue)
>  
>   spin_lock_irq(&adapter->lock);
>  
> - rval =  megaraid_abort_and_reset(adapter, cmd, SCB_RESET);
> + rval =  megaraid_abort_and_reset(adapter, NULL, SCB_RESET);
>  
>   /*
>* This is required here to complete any completed requests
> @@ -1948,7 +1948,7 @@ static DEF_SCSI_QCMD(megaraid_queue)
>  
>   scb = list_entry(pos, scb_t, list);
>  
> - if (scb->cmd == cmd) { /* Found command */
> + if (!cmd || scb->cmd == cmd) { /* Found command */
>  
>   scb->state |= aor;
>  
> @@ -1977,7 +1977,7 @@ static DEF_SCSI_QCMD(megaraid_queue)
>   "%s-[%x], driver owner\n",
>   (aor==SCB_ABORT) ? "ABORTING":"RESET",
>   scb->idx);
> -
> + cmd = scb->cmd;
>   mega_free_scb(adapter, scb);

This looks weird. Assigning scb->cmd to cmd will cause 
megaraid_abort_and_reset()
to abort or reset the first command on pending_list if the cmd argument is NULL.
If the cmd argument is NULL, shouldn't all commands on pending_list be aborted 
or
reset?

> -static int megasas_reset_bu

[PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler

2017-06-23 Thread Hannes Reinecke
Issuing a host reset should not rely on any commands.
So use Scsi_Host as argument for eh_host_reset_handler.

Signed-off-by: Hannes Reinecke 
---
 Documentation/scsi/scsi_eh.txt  |  2 +-
 Documentation/scsi/scsi_mid_low_api.txt |  4 +-
 arch/ia64/hp/sim/simscsi.c  |  2 +-
 drivers/infiniband/ulp/srp/ib_srp.c |  6 +--
 drivers/message/fusion/mptscsih.c   | 17 
 drivers/message/fusion/mptscsih.h   |  2 +-
 drivers/s390/scsi/zfcp_scsi.c   |  3 +-
 drivers/scsi/3w-9xxx.c  | 11 ++---
 drivers/scsi/3w-sas.c   | 11 ++---
 drivers/scsi/3w-.c  | 11 +++--
 drivers/scsi/53c700.c   | 15 +++
 drivers/scsi/BusLogic.c | 14 ++
 drivers/scsi/NCR5380.c  |  5 +--
 drivers/scsi/NCR53c406a.c   |  6 +--
 drivers/scsi/aacraid/linit.c|  4 +-
 drivers/scsi/advansys.c | 26 +--
 drivers/scsi/aha152x.c  | 11 +
 drivers/scsi/aha152x.h  |  2 +-
 drivers/scsi/aha1542.c  | 17 
 drivers/scsi/arm/fas216.c   |  4 +-
 drivers/scsi/arm/fas216.h   |  6 +--
 drivers/scsi/atari_scsi.c   |  4 +-
 drivers/scsi/cxlflash/main.c| 13 ++
 drivers/scsi/dpt_i2o.c  | 14 +++---
 drivers/scsi/dpti.h |  2 +-
 drivers/scsi/eata.c | 19 ++---
 drivers/scsi/eata_pio.c | 29 ++---
 drivers/scsi/esas2r/esas2r.h|  2 +-
 drivers/scsi/esas2r/esas2r_main.c   | 16 ---
 drivers/scsi/esp_scsi.c |  4 +-
 drivers/scsi/fdomain.c  |  2 +-
 drivers/scsi/fdomain.h  |  2 +-
 drivers/scsi/fnic/fnic.h|  2 +-
 drivers/scsi/fnic/fnic_scsi.c   |  3 +-
 drivers/scsi/hptiop.c   |  6 +--
 drivers/scsi/ibmvscsi/ibmvfc.c  |  4 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c|  4 +-
 drivers/scsi/imm.c  |  7 ++-
 drivers/scsi/ipr.c  |  4 +-
 drivers/scsi/ips.c  | 40 -
 drivers/scsi/libfc/fc_fcp.c |  5 +--
 drivers/scsi/lpfc/lpfc_scsi.c   |  3 +-
 drivers/scsi/mac53c94.c |  8 ++--
 drivers/scsi/megaraid.c | 12 +++---
 drivers/scsi/megaraid.h |  2 +-
 drivers/scsi/megaraid/megaraid_mbox.c   | 16 ++-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 28 +---
 drivers/scsi/mesh.c | 10 ++---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c| 13 +++---
 drivers/scsi/mvumi.c|  7 ++-
 drivers/scsi/nsp32.c| 14 +++---
 drivers/scsi/pcmcia/aha152x_stub.c  |  2 +-
 drivers/scsi/pcmcia/nsp_cs.c|  4 +-
 drivers/scsi/pcmcia/sym53c500_cs.c  |  8 ++--
 drivers/scsi/pmcraid.c  |  4 +-
 drivers/scsi/ppa.c  |  7 ++-
 drivers/scsi/qedf/qedf_main.c   |  4 +-
 drivers/scsi/qedi/qedi_iscsi.c  |  3 +-
 drivers/scsi/qla1280.c  | 23 --
 drivers/scsi/qla2xxx/qla_os.c   | 17 +++-
 drivers/scsi/qla4xxx/ql4_os.c   | 16 +++
 drivers/scsi/scsi_debug.c   | 16 +++
 drivers/scsi/scsi_error.c   |  2 +-
 drivers/scsi/snic/snic.h|  3 +-
 drivers/scsi/snic/snic_main.c   |  2 +-
 drivers/scsi/snic/snic_scsi.c   | 57 -
 drivers/scsi/stex.c |  7 ++-
 drivers/scsi/storvsc_drv.c  |  4 +-
 drivers/scsi/sym53c416.c| 16 +++
 drivers/scsi/sym53c8xx_2/sym_glue.c |  4 +-
 drivers/scsi/ufs/ufshcd.c   |  8 ++--
 drivers/scsi/vmw_pvscsi.c   |  5 +--
 drivers/scsi/wd33c93.c  |  4 +-
 drivers/scsi/wd33c93.h  |  2 +-
 drivers/scsi/wd719x.c   |  4 +-
 drivers/staging/unisys/visorhba/visorhba_main.c |  4 +-
 drivers/usb/image/microtek.c|  4 +-
 include/scsi/libfc.h|  2 +-
 include/scsi/scsi_host.h|  2 +-
 79 files changed, 298 insertions(+), 410 deletions(-)

diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt
index 11e447b..78cd6b9 100644