All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: John Garry <john.garry@huawei.com>,
	jejb@linux.ibm.com, martin.petersen@oracle.com,
	jinpu.wang@cloud.ionos.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ajish.Koshy@microchip.com, linuxarm@huawei.com,
	Viswas.G@microchip.com, hch@lst.de, liuqi115@huawei.com,
	chenxiang66@hisilicon.com
Subject: Re: [PATCH 3/4] scsi: pm8001: Use libsas internal abort support
Date: Mon, 7 Mar 2022 11:47:25 +0900	[thread overview]
Message-ID: <d5145a6b-0985-030a-0288-1f7853b518d4@opensource.wdc.com> (raw)
In-Reply-To: <966a1048-cd14-d796-8b9d-734605796652@huawei.com>

On 3/4/22 18:41, John Garry wrote:
>>>   /**
>>>     * pm8001_queue_command - register for upper layer used, all IO commands sent
>>>     * to HBA are from this interface.
>>> @@ -379,16 +428,15 @@ int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags)
>>>   	enum sas_protocol task_proto = task->task_proto;
>>>   	struct domain_device *dev = task->dev;
>>>   	struct pm8001_device *pm8001_dev = dev->lldd_dev;
>>> +	bool internal_abort = sas_is_internal_abort(task);
>>>   	struct pm8001_hba_info *pm8001_ha;
>>>   	struct pm8001_port *port = NULL;
>>>   	struct pm8001_ccb_info *ccb;
>>> -	struct sas_tmf_task *tmf = task->tmf;
>>> -	int is_tmf = !!task->tmf;
>>>   	unsigned long flags;
>>>   	u32 n_elem = 0;
>>>   	int rc = 0;
>>>   
>>> -	if (!dev->port) {
>>> +	if (!internal_abort && !dev->port) {
>>>   		ts->resp = SAS_TASK_UNDELIVERED;
>>>   		ts->stat = SAS_PHY_DOWN;
>>>   		if (dev->dev_type != SAS_SATA_DEV)
>>> @@ -410,7 +458,8 @@ int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags)
>>>   	pm8001_dev = dev->lldd_dev;
>>>   	port = &pm8001_ha->port[sas_find_local_port_id(dev)];
>>>   
>>> -	if (DEV_IS_GONE(pm8001_dev) || !port->port_attached) {
>>> +	if (!internal_abort && (DEV_IS_GONE(pm8001_dev) ||
>>> +				!port->port_attached)) {
>> Wrapping the line after "&&" would make this a lot cleaner and easier to read.
> 
> Agreed, I can do it.
> 
> But if you can see any neater ways to skip these checks for internal 
> abort in the common queue command path then I would be glad to hear it.

Would need to check the locking context, but if there is no race
possible with the context setting the device as gone, libata should
already be aware of it and not issuing the command in the first place.
So these checks should not be needed at all.

Will try to have a look when I have some time.

There are several things that needs better integration with libata
anyway, like the "manual" read log on error. We should try to address
these for 5.19.


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2022-03-07  2:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 12:18 [PATCH 0/4] scsi: libsas and users: Factor out internal abort code John Garry
2022-03-03 12:18 ` [PATCH 1/4] scsi: libsas: Add sas_execute_internal_abort_single() John Garry
2022-03-03 16:31   ` Damien Le Moal
2022-03-04  9:33     ` John Garry
2022-04-20 12:21   ` Hannes Reinecke
2022-04-25  8:27     ` John Garry
2022-04-25  8:34       ` Hannes Reinecke
2022-04-25  8:51         ` John Garry
2022-03-03 12:18 ` [PATCH 2/4] scsi: libsas: Add sas_execute_internal_abort_dev() John Garry
2022-04-20 12:22   ` Hannes Reinecke
2022-03-03 12:18 ` [PATCH 3/4] scsi: pm8001: Use libsas internal abort support John Garry
2022-03-03 16:36   ` Damien Le Moal
2022-03-04  9:41     ` John Garry
2022-03-07  2:47       ` Damien Le Moal [this message]
2022-04-20 12:24   ` Hannes Reinecke
2022-03-03 12:18 ` [PATCH 4/4] scsi: hisi_sas: " John Garry
2022-03-03 16:42   ` Damien Le Moal
2022-03-04  9:47     ` John Garry
2022-04-20 12:29   ` Hannes Reinecke
2022-04-25  8:43     ` John Garry
2022-03-03 16:29 ` [PATCH 0/4] scsi: libsas and users: Factor out internal abort code Damien Le Moal
2022-03-03 17:05   ` John Garry
2022-03-07  0:55 ` Damien Le Moal

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=d5145a6b-0985-030a-0288-1f7853b518d4@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=Ajish.Koshy@microchip.com \
    --cc=Viswas.G@microchip.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liuqi115@huawei.com \
    --cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.