public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Sagar.Biradar@microchip.com, jejb@linux.ibm.com,
	Don.Brace@microchip.com, Gilbert.Wu@microchip.com,
	linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	brking@linux.vnet.ibm.com, stable@vger.kernel.org,
	Tom.White@microchip.com
Subject: Re: [PATCH] aacraid: reply queue mapping to CPUs based of IRQ affinity
Date: Wed, 19 Apr 2023 08:42:33 +0100	[thread overview]
Message-ID: <67baaecb-984d-cf2f-03c8-c4d8d7a650f7@oracle.com> (raw)
In-Reply-To: <BYAPR11MB36062386E7B3DBE1FA69CEB4FA9D9@BYAPR11MB3606.namprd11.prod.outlook.com>

On 19/04/2023 00:55, Sagar.Biradar@microchip.com wrote:
> [I'm with Jon: your email style makes digging information out of the emails very hard, which is why I only quote this section] On Mon, 2023-04-10 at 21:17 +0000,Sagar.Biradar@microchip.com  wrote:

I stopped replying as this wasn't fixed... and still isn't :((

>> ***blk-mq already does what you want here, including handling for the
>> case I mention above. It maintains a CPU -> HW queue mapping, and
>> using a reply map in the LLD is the old way of doing this.
>>
>> We also tried implementing the blk-mq mechanism in the driver and we
>> saw command timeouts.
>> The firmware has limitation of fixed number of queues per vector and
>> the blk-mq changes would saturate that limit.
>> That answers the possible command timeout.
> Could we have more details on this, please?  The problem is that this is a very fragile area of the kernel, so you rolling your own special snowflake implementation in the driver is going to be an ongoing maintenance problem (and the fact that you need this at all indicates you have long tail customers who will be around for a while yet).  If the only issue is limiting the number of queues per vector, we can look at getting the block layer to do that.  Although I was under the impression that you can do it yourself with the ->map_queues() callback.  Can you say a bit about why this didn't work?
> 
> [Sagar Biradar]
> Thank you for your response.
> We did venture trying into something like what you pointed to.
> We mapped the hardware queues, and we still see command timeout. This change doesn’t work for us at this stage.
> Also, we observed that the load is not balanced across all the CPUs.
> I am pasting the code snippets for better understanding.
> 
> 
> During the probe, we assigned the hardware queues.
> shost->nr_hw_queues = shost->can_queue; //inside aac_probe_one().

That is wrong - .can_queue is the number of IOs which the scsi host may 
be sent at any given time, while .nr_hw_queues should be the number of 
MSI(X) vectors returned from pci_alloc_vectors()

You should also set shost->host_tagset = 1.

Since the driver has reserved commands, the .can_queue should be reduced 
by the amount of reserved commands and the driver needs to manually 
choose which HW queue to send those reserved commands on - see example 
in other driver here: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/hisi_sas/hisi_sas_main.c?h=v6.3-rc7#n523

JFYI, We have tried to add reserved command support to SCSI ML, but it 
still has not been finished - see 
https://lore.kernel.org/linux-scsi/20211125151048.103910-1-hare@suse.de/

> 
> We also wrote a new routine "blk_mq_pci_map_queues" (mapped to .map_queues in scsi_host_template).
> static void aac_map_queues(struct Scsi_Host *shost)
> {
>                  struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
>                  blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
>                                                        aac->pdev, 0);
> }

This looks ok.

> 
> With the above changes, we see command timeouts in the firmware space and the commands never return to the driver.
> This may need some changes in the firmware, but the firmware changes are restricted (since this is EOL product).
> Also, we saw that the load was entirely upon one CPU and it was not balanced across other CPUs.
> 
> We have had this reply_queue mechanism (patch) in our Out Of Box driver (OOB) for more than three years.
> We(vendors/customers included) have not observed any issues.


      reply	other threads:[~2023-04-19  7:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 21:41 [PATCH] aacraid: reply queue mapping to CPUs based of IRQ affinity Sagar Biradar
2023-03-29  7:08 ` John Garry
2023-04-10 21:17   ` Sagar.Biradar
2023-04-12  9:38     ` John Garry
2023-04-12 19:29       ` Sagar.Biradar
2023-04-13 21:52         ` Sagar.Biradar
2023-04-14  7:20           ` John Garry
2023-04-14 20:07       ` Sagar.Biradar
2023-04-18 16:36         ` Sagar.Biradar
2023-04-18 17:12     ` James Bottomley
2023-04-18 23:55       ` Sagar.Biradar
2023-04-19  7:42         ` John Garry [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=67baaecb-984d-cf2f-03c8-c4d8d7a650f7@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=Don.Brace@microchip.com \
    --cc=Gilbert.Wu@microchip.com \
    --cc=Sagar.Biradar@microchip.com \
    --cc=Tom.White@microchip.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /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