Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: John Garry <john.garry@huawei.com>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH v2 2/2] ata: libata-sata: Fix device queue depth control
Date: Wed, 28 Sep 2022 18:10:56 +0900	[thread overview]
Message-ID: <bc55b784-f735-ab11-5a50-da01f4d0cca6@opensource.wdc.com> (raw)
In-Reply-To: <13e5e5e5-7dc2-8f14-3dd2-43366343842d@huawei.com>

On 9/28/22 16:53, John Garry wrote:
> On 28/09/2022 08:00, Damien Le Moal wrote:
>>> So we don't return. However the following subsequent test does evaluate
>>> true in ata_change_queue_depth():
>>>
>>> if (sdev->queue_depth == queue_depth)
>>> 	return -EINVAL;
>>>
>>> And we error.
>> I dug further into this. For AHCI, I still get an error when trying to set
>> 33. No capping and defaulting to 32. The reason is I believe that
>> sdev_store_queue_depth() has the check:
>>
>> 	if (depth < 1 || depth > sdev->host->can_queue)
>>                  return -EINVAL;
>>
>> as you mentioned. So all good.
>>
>> So changing that last "if" in ata_change_queue_depth() to
>>
>> 	if (sdev->queue_depth == queue_depth)
>> 		return sdev->queue_depth;
>>
>> has no effect. The error remains.
>>
>> Now, for a libsas SATA drive, if I add the above change, I do indeed get a
>> cap to 32 and the QD changes, no error. That is bothering me as that is
>> really inconsistent. Instead of suppressing the error, shouldn't we unify
>> AHCI and libsas behavior and error if the user is attempting to set a
>> value larger than what the*device*  supports (the host can_queue was
>> checked already). In a nutshell, the difference comes form
>> sdev->host->can_queue being equal to the device max qd for AHCI but not
>> necessarily for libsas.
> 
> Yes, I think consistent behaviour would be good. I suppose we just need 
> the same check to reject QD of > 32 in ata_change_queue_depth() (and not 
> just cap to 32 there).
> 
> Having said all that, scsi_device_max_queue_depth() does introduce some 
> capping. But let's just consider SATA behaviour now.
> 
>>
>> I am tempted to leave things as is for now (not changin gthe current weird
>> behavior) and cleaning that up during the next round. Thoughts ?
>>
> 
> It's up to you. Obviously we are making an improvement in this series, 
> but if we are going to backport then it's better to backport something 
> fully working first time.

OK. Since the current behavior has been in place for a long time, no
urgency to change anything now I think.
I will push the current 2 patches for 6.0-fixes and cook a full cleanup &
improvement for 6.1.

> 
> Thanks,
> John

-- 
Damien Le Moal
Western Digital Research


      reply	other threads:[~2022-09-28  9:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 23:08 [PATCH v2 0/2] Fixes for ATA device queue depth control Damien Le Moal
2022-09-25 23:08 ` [PATCH v2 1/2] ata: libata-scsi: Fix initialization of device queue depth Damien Le Moal
2022-09-25 23:08 ` [PATCH v2 2/2] ata: libata-sata: Fix device queue depth control Damien Le Moal
2022-09-26 11:31   ` John Garry
2022-09-26 23:05     ` Damien Le Moal
2022-09-27  7:05       ` John Garry
2022-09-27  9:28         ` Damien Le Moal
2022-09-27  9:47           ` John Garry
2022-09-27 14:47             ` Damien Le Moal
2022-09-27 11:51   ` John Garry
2022-09-27 15:03     ` Damien Le Moal
2022-09-27 16:09       ` John Garry
2022-09-27 23:39         ` Damien Le Moal
2022-09-28  7:00         ` Damien Le Moal
2022-09-28  7:53           ` John Garry
2022-09-28  9:10             ` Damien Le Moal [this message]

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=bc55b784-f735-ab11-5a50-da01f4d0cca6@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=john.garry@huawei.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox