public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <Avri.Altman@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>, Can Guo <cang@codeaurora.org>,
	Bean Huo <beanhuo@micron.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Alim Akhtar <alim.akhtar@samsung.com>
Subject: Re: [PATCH 4/4] ufs: Let the SCSI core allocate per-command UFS data
Date: Thu, 9 Jan 2020 14:28:04 -0800	[thread overview]
Message-ID: <45cb376d-42b8-5bc9-70e1-a93935d02287@acm.org> (raw)
In-Reply-To: <MN2PR04MB69913704982A01708C36374FFC390@MN2PR04MB6991.namprd04.prod.outlook.com>

On 1/9/20 1:48 AM, Avri Altman wrote:
> Bart Van Assche wrote:
>> +       /* See also ufshcd_is_scsi() */
>> +       switch (req_op(cmd->request)) {
>> +       case REQ_OP_DRV_IN:
>> +       case REQ_OP_DRV_OUT:
>> +               WARN_ON_ONCE(true);
 >
> Maybe just WARN_ON_ONCE(!ufshcd_is_scsi(cmd->request))

Good idea. Will do.

>> +static int ufshcd_init_cmd_priv(struct Scsi_Host *shost, struct
>> +scsi_cmnd *cmd) {
>> +       struct ufs_hba *hba = shost_priv(shost);
>> +
>> +       ufshcd_init_lrb(hba, scsi_cmd_priv(cmd), cmd->tag);
 >
> So ufshcd_init_lrb() is called now for every new request?

ufshcd_init_lrb() is only called from inside scsi_add_host(), namely as 
follows:

scsi_add_host()
-> scsi_add_host_with_dma()
   -> scsi_mq_setup_tags()
     -> blk_mq_alloc_tag_set()
       -> blk_mq_alloc_rq_maps()
         -> __blk_mq_alloc_rq_maps()
           -> __blk_mq_alloc_rq_map()
             -> blk_mq_alloc_rqs()
               -> blk_mq_init_request()
                 -> scsi_mq_init_request()
                   -> ufshcd_init_cmd_priv()

>> @@ -6074,7 +6132,8 @@ static int ufshcd_eh_device_reset_handler(struct
>> scsi_cmnd *cmd)
>>
>>          /* clear the commands that were pending for corresponding LUN */
>>          for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs) {
>> -               if (hba->lrb[pos].lun == lrbp->lun) {
>> +               lrbp2 = ufshcd_tag_to_lrb(hba, pos);
 >
> Can lrpb2 be null here?

lrpb2 can only be NULL if the 'pos' argument passed to 
ufshcd_tag_to_lrb() is not a valid tag. for_each_set_bit() however 
guarantees that 0 <= pos < hba->nutrs and hence guarantees that 'pos' is 
a valid tag.

Thanks,

Bart.

  reply	other threads:[~2020-01-09 22:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 19:25 [PATCH 0/4] ufs: Let the SCSI core allocate per-command UFS data Bart Van Assche
2020-01-07 19:25 ` [PATCH 1/4] Introduce {init,exit}_cmd_priv() Bart Van Assche
2020-01-07 19:25 ` [PATCH 2/4] ufs: Introduce ufshcd_init_lrb() Bart Van Assche
2020-01-09 10:28   ` Avri Altman
2020-01-19 14:38   ` Alim Akhtar
2020-01-07 19:25 ` [PATCH 3/4] ufs: Simplify two tests Bart Van Assche
2020-01-09 10:29   ` Avri Altman
2020-01-10 17:17   ` asutoshd
2020-01-11  7:21   ` Stanley Chu
2020-01-07 19:25 ` [PATCH 4/4] ufs: Let the SCSI core allocate per-command UFS data Bart Van Assche
2020-01-09  9:48   ` Avri Altman
2020-01-09 22:28     ` Bart Van Assche [this message]
2020-01-10 12:03       ` Avri Altman
2020-01-08 13:14 ` [PATCH 0/4] " Avri Altman
2020-01-08 22:53   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45cb376d-42b8-5bc9-70e1-a93935d02287@acm.org \
    --to=bvanassche@acm.org \
    --cc=Avri.Altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=cang@codeaurora.org \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=tomas.winkler@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox