virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Daniel Wagner <dwagner@suse.de>
Cc: "Daniel Wagner" <wagi@kernel.org>, "Jens Axboe" <axboe@kernel.dk>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Keith Busch" <kbusch@kernel.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Sagi Grimberg" <sagi@grimberg.me>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, virtualization@lists.linux.dev,
	linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com,
	mpi3mr-linuxdrv.pdl@broadcom.com,
	MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3 4/8] blk-mp: introduce blk_mq_hctx_map_queues
Date: Tue, 12 Nov 2024 17:53:47 +0100	[thread overview]
Message-ID: <2024111212-rash-suffocate-dc13@gregkh> (raw)
In-Reply-To: <5967d256-037e-4ac8-a509-c6955b03db05@flourine.local>

On Tue, Nov 12, 2024 at 05:15:31PM +0100, Daniel Wagner wrote:
> On Tue, Nov 12, 2024 at 04:42:40PM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Nov 12, 2024 at 04:33:09PM +0100, Daniel Wagner wrote:
> > > On Tue, Nov 12, 2024 at 02:58:43PM +0100, Greg Kroah-Hartman wrote:
> > > > > +void blk_mq_hctx_map_queues(struct blk_mq_queue_map *qmap,
> > > > > +			    struct device *dev, unsigned int offset)
> > > > > +
> > > > > +{
> > > > > +	const struct cpumask *mask;
> > > > > +	unsigned int queue, cpu;
> > > > > +
> > > > > +	if (!dev->bus->irq_get_affinity)
> > > > > +		goto fallback;
> > > > 
> > > > I think this is better than hard-coding it, but are you sure that the
> > > > bus will always be bound to the device here so that you have a valid
> > > > bus-> pointer?
> > > 
> > > No, I just assumed the bus pointer is always valid. If it is possible to
> > > have a device without a bus, than I'll better extend the condition to
> > > 
> > > 	if (!dev->bus || !dev->bus->irq_get_affinity)
> > >         	goto fallback;
> > 
> > I don't know if it's possible as I don't know what codepaths are calling
> > this, it was hard to unwind.  But you should check "just to be safe" :)
> 
> The main path to map_queues is via the probe functions. There are some
> more paths like when updating a tagset after the number of queues but
> that is all after the probe function.
> 
> nvme_probe
>   nvme_alloc_admin_tag_set
>     blk_mq_alloc_tag_set
>        blk_mq_update_queue_map
>           set->ops->map_queues
> 	     blk_mq_htcx_map_queues
>   nvme_alloc_io_tag_set
>     blk_mq_alloc_tag_set
>       blk_mq_update_queue_map
>         set->ops->map_queues
>           blk_mq_htcx_map_queues
> 
> virtscsi_probe, hisi_sas_v3_probe, ...
>   scsi_add_host
>     scsi_add_host_with_dma
>       scsi_mq_setup_tags
>          blk_mq_alloc_tag_set
>            blk_mq_update_queue_map
>              set->ops->map_queues
>                blk_mq_htcx_map_queues
> 
> virtblk_probe
>   blk_mq_alloc_tag_set
>     blk_mq_update_queue_map
>       set->ops->map_queues
>         blk_mq_htcx_map_queues
> 
> Does this help?

Ok, that seems fine.  Worst case, you crash and it's obvious that it
needs to be checked in the future :)

thanks,

greg k-h

  reply	other threads:[~2024-11-12 16:53 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 13:26 [PATCH v3 0/8] blk: refactor queue affinity helpers Daniel Wagner
2024-11-12 13:26 ` [PATCH v3 1/8] driver core: bus: add irq_get_affinity callback to bus_type Daniel Wagner
2024-11-12 16:54   ` Christoph Hellwig
2024-11-13  9:46   ` Hannes Reinecke
2024-11-13 10:16   ` John Garry
2024-11-13 12:36     ` Daniel Wagner
2024-11-13 13:44       ` John Garry
2024-11-13 13:54         ` Greg Kroah-Hartman
2024-11-13 14:12           ` John Garry
2024-11-13 14:24             ` Greg Kroah-Hartman
2024-11-13 14:30           ` Christoph Hellwig
2024-11-12 13:26 ` [PATCH v3 2/8] PCI: hookup irq_get_affinity callback Daniel Wagner
2024-11-12 16:54   ` Christoph Hellwig
2024-11-13  9:47   ` Hannes Reinecke
2024-11-12 13:26 ` [PATCH v3 3/8] virtio: " Daniel Wagner
2024-11-12 16:55   ` Christoph Hellwig
2024-11-12 22:07   ` kernel test robot
2024-11-13  9:47   ` Hannes Reinecke
2024-11-12 13:26 ` [PATCH v3 4/8] blk-mp: introduce blk_mq_hctx_map_queues Daniel Wagner
2024-11-12 13:58   ` Greg Kroah-Hartman
2024-11-12 15:33     ` Daniel Wagner
2024-11-12 15:42       ` Greg Kroah-Hartman
2024-11-12 16:15         ` Daniel Wagner
2024-11-12 16:53           ` Greg Kroah-Hartman [this message]
2024-11-12 16:56   ` Christoph Hellwig
2024-11-12 18:25   ` Daniel Wagner
2024-11-13  9:48   ` Hannes Reinecke
2024-11-12 13:26 ` [PATCH v3 5/8] scsi: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Daniel Wagner
2024-11-13  9:49   ` Hannes Reinecke
2024-11-13 10:09   ` John Garry
2024-11-12 13:26 ` [PATCH v3 6/8] nvme: " Daniel Wagner
2024-11-13  9:50   ` Hannes Reinecke
2024-11-12 13:26 ` [PATCH v3 7/8] virtio: blk/scsi: replace blk_mq_virtio_map_queues " Daniel Wagner
2024-11-13  9:51   ` Hannes Reinecke
2024-11-12 13:26 ` [PATCH v3 8/8] blk-mq: remove unused queue mapping helpers Daniel Wagner
2024-11-13  9:52   ` Hannes Reinecke

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=2024111212-rash-suffocate-dc13@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=axboe@kernel.dk \
    --cc=bhelgaas@google.com \
    --cc=dwagner@suse.de \
    --cc=eperezma@redhat.com \
    --cc=hch@lst.de \
    --cc=jasowang@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=mpi3mr-linuxdrv.pdl@broadcom.com \
    --cc=mst@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=storagedev@microchip.com \
    --cc=virtualization@lists.linux.dev \
    --cc=wagi@kernel.org \
    --cc=xuanzhuo@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).