From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
John Garry <john.garry@huawei.com>,
Sagi Grimberg <sagi@grimberg.me>, Daniel Wagner <dwagner@suse.de>,
Wen Xiong <wenxiong@us.ibm.com>, Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH V5 1/3] driver core: add device_has_managed_msi_irq
Date: Wed, 21 Jul 2021 15:48:39 +0200 [thread overview]
Message-ID: <YPglty/1YLI0DW4q@kroah.com> (raw)
In-Reply-To: <20210721091723.1152456-2-ming.lei@redhat.com>
On Wed, Jul 21, 2021 at 05:17:21PM +0800, Ming Lei wrote:
> irq vector allocation with managed affinity may be used by driver, and
> blk-mq needs this info for draining queue because genirq core will shutdown
> managed irq when all CPUs in the affinity mask are offline.
>
> The info of using managed irq is often produced by drivers, and it is
> consumed by blk-mq, so different subsystems are involved in this info flow.
>
> Address this issue by adding one helper of device_has_managed_msi_irq()
> which is suggested by John Garry.
>
> Suggested-by: John Garry <john.garry@huawei.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> drivers/base/core.c | 15 +++++++++++++++
> include/linux/device.h | 2 ++
> 2 files changed, 17 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index cadcade65825..41daf9fabdfb 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -29,6 +29,7 @@
> #include <linux/sched/mm.h>
> #include <linux/sysfs.h>
> #include <linux/dma-map-ops.h> /* for dma_default_coherent */
> +#include <linux/msi.h> /* for device_has_managed_irq */
>
> #include "base.h"
> #include "power/power.h"
> @@ -4797,3 +4798,17 @@ int device_match_any(struct device *dev, const void *unused)
> return 1;
> }
> EXPORT_SYMBOL_GPL(device_match_any);
> +
> +bool device_has_managed_msi_irq(struct device *dev)
> +{
> + struct msi_desc *desc;
> +
> + if (IS_ENABLED(CONFIG_GENERIC_MSI_IRQ)) {
> + for_each_msi_entry(desc, dev) {
> + if (desc->affinity && desc->affinity->is_managed)
> + return true;
> + }
> + }
> + return false;
> +}
> +EXPORT_SYMBOL_GPL(device_has_managed_msi_irq);
> diff --git a/include/linux/device.h b/include/linux/device.h
> index 59940f1744c1..b1255524ce8b 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -981,4 +981,6 @@ extern long sysfs_deprecated;
> #define sysfs_deprecated 0
> #endif
>
> +bool device_has_managed_msi_irq(struct device *dev);
This really belongs in msi.h, not device.h, as it is very MSI specific.
Same for the .c change.
thanks,
greg k-h
next prev parent reply other threads:[~2021-07-21 13:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-21 9:17 [PATCH V5 0/3] blk-mq: fix blk_mq_alloc_request_hctx Ming Lei
2021-07-21 9:17 ` [PATCH V5 1/3] driver core: add device_has_managed_msi_irq Ming Lei
2021-07-21 13:48 ` Greg Kroah-Hartman [this message]
2021-07-21 14:36 ` Christoph Hellwig
2021-07-21 9:17 ` [PATCH V5 2/3] blk-mq: mark if one queue map uses managed irq Ming Lei
2021-07-21 14:37 ` Christoph Hellwig
2021-07-22 1:24 ` Ming Lei
2021-07-21 18:53 ` John Garry
2021-07-22 1:22 ` Ming Lei
2021-07-21 9:17 ` [PATCH V5 3/3] blk-mq: don't deactivate hctx if managed irq isn't used Ming Lei
2021-07-21 14:37 ` Christoph Hellwig
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=YPglty/1YLI0DW4q@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.garry@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
--cc=tglx@linutronix.de \
--cc=wenxiong@us.ibm.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