From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 6 Feb 2018 16:23:54 +0800 From: Ming Lei To: "chenxiang (M)" Cc: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , Mike Snitzer , linux-scsi@vger.kernel.org, Hannes Reinecke , Arun Easi , Omar Sandoval , "Martin K . Petersen" , James Bottomley , Christoph Hellwig , Don Brace , Kashyap Desai , Peter Rivera , Paolo Bonzini , Laurence Oberman Subject: Re: [PATCH V2 8/8] scsi: hpsa: use blk_mq to solve irq affinity issue Message-ID: <20180206082353.GB14651@ming.t460p> References: <20180205152035.15016-1-ming.lei@redhat.com> <20180205152035.15016-9-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: List-ID: Hello chenxiang, On Tue, Feb 06, 2018 at 10:18:19AM +0800, chenxiang (M) wrote: > 在 2018/2/5 23:20, Ming Lei 写道: > > This patch uses .force_blk_mq to drive HPSA via SCSI_MQ, meantime maps > > each reply queue to blk_mq's hw queue, then .queuecommand can always > > choose the hw queue as the reply queue. And if no any online CPU is > > mapped to one hw queue, request can't be submitted to this hw queue > > at all, finally the irq affinity issue is solved. > > > > Cc: Hannes Reinecke > > Cc: Arun Easi > > Cc: Omar Sandoval , > > Cc: "Martin K. Petersen" , > > Cc: James Bottomley , > > Cc: Christoph Hellwig , > > Cc: Don Brace > > Cc: Kashyap Desai > > Cc: Peter Rivera > > Cc: Paolo Bonzini > > Cc: Mike Snitzer > > Tested-by: Laurence Oberman > > Signed-off-by: Ming Lei > > --- > > drivers/scsi/hpsa.c | 51 ++++++++++++++++++++++++++++++++++----------------- > > 1 file changed, 34 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c > > index 443eabf63a9f..e517a4c74a28 100644 > > --- a/drivers/scsi/hpsa.c > > +++ b/drivers/scsi/hpsa.c > > @@ -51,6 +51,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include "hpsa_cmd.h" > > @@ -956,6 +957,13 @@ static struct device_attribute *hpsa_shost_attrs[] = { > > #define HPSA_NRESERVED_CMDS (HPSA_CMDS_RESERVED_FOR_DRIVER +\ > > HPSA_MAX_CONCURRENT_PASSTHRUS) > > +static int hpsa_map_queues(struct Scsi_Host *shost) > > +{ > > + struct ctlr_info *h = shost_to_hba(shost); > > + > > + return blk_mq_pci_map_queues(&shost->tag_set, h->pdev); > > +} > > + > > Hi Lei Ming, > It is okay to use blk_mq_pci_map_queue to solve automatic irq affinity issue > when the first interrupt vector for queues is 0. > But if the first interrupt vector for queues is not 0, we seems couldn't > use blk_mq_pci_map_queue directly, > such as blk_mq_virtio_map_queues, it realizes a interface itself. Is it > possible to provide a general interface for those > situations? I guess it isn't necessary to do that, as you see .map_queues has been introduced to 'scsi_host_template' for dealing driver specific irq vector difference, such as, virtio-pci, 'irq_affinity' is needed for excluding 'pre_vectors' which should serve as virtio config vector. But that should belong to another topic about implementing generic .map_queues interface, and seems not related with this patch, since the usage of blk_mq_pci_map_queues() in this patch is correct. Thanks, Ming