From: ks0204.kim@samsung.com (김경산)
Subject: setting nvme irq per cpu affinity in device driver
Date: Thu, 03 Sep 2015 14:01:07 +0900 [thread overview]
Message-ID: <007c01d0e605$8b054df0$a10fe9d0$@samsung.com> (raw)
In-Reply-To: <20150902140517.GA9787@infradead.org>
Hi Christoph Hellwig,
Thank you for your comment.
I've fixed to call kernel API, irq_set_affinity(), assuming it will be
provided again.
Let me ask one thing.
My current approach is that assigning a CPU to an IRQ for a CQ interrupt by
retrieving cpu id with get_cpu_mask().
Do you think blk_mq_tags_cpumask() might work better?
module_param(shutdown_timeout, byte, 0644);
MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller
shutdown");
+static int use_set_irq_affinity;
+module_param(use_set_irq_affinity, int, 0);
+MODULE_PARM_DESC(use_set_irq_affinity, "set irq affinity to assign CPU per
IRQ evenly");
+
static int nvme_major;
module_param(nvme_major, int, 0);
@@ -249,6 +253,14 @@
blk_mq_start_request(blk_mq_rq_from_pdu(cmd));
}
+static nvme_set_irq_affinity(unsigned int irq, const struct cpumask *mask)
+{
+ int ret = 0;
+ /* call kernel API when provided */
+ /* ret = irq_set_affinity() */
+ return ret;
+}
+
static void *iod_get_private(struct nvme_iod *iod)
{
return (void *) (iod->private & ~0x1UL);
@@ -2839,13 +2851,19 @@
int i;
for (i = 0; i < dev->online_queues; i++) {
+ int cpu_id;
nvmeq = dev->queues[i];
- if (!nvmeq->tags || !(*nvmeq->tags))
+ if (!nvmeq)
continue;
- irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector,
- blk_mq_tags_cpumask(*nvmeq->tags));
+ cpu_id = (i <= 1) ? 0 : i-1;
+ irq_set_affinity_hint(dev->entry[nvmeq-
>cq_vector].vector,get_cpu_mask(cpu_id));
+ if(use_set_irq_affinity){
+ dev_info(dev->dev,"set affinity(IRQ%d-
>CPU%d)\n",dev->entry[nvmeq->cq_vector].vector,cpu_id);
+ nvme_set_irq_affinity(dev->entry[nvmeq-
>cq_vector].vector,get_cpu_mask(cpu_id),false);
+ }
+
}
}
-----Original Message-----
From: Christoph Hellwig [mailto:hch@infradead.org]
Sent: Wednesday, September 02, 2015 11:05 PM
To: ??????
Cc: Linux-nvme at lists.infradead.org
Subject: Re: setting nvme irq per cpu affinity in device driver
We'll need a proper API in the interrupt subsystem to set the affinity
instead of poking directly into the internals. The irq subsystem
maintainer already indicated he's fine with adding suh an API in principle.
Please go ahead and propose something similar to your implementation, just
as an exported API in kernel/irq instead of inside the NVMe driver.
next prev parent reply other threads:[~2015-09-03 5:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 10:26 setting nvme irq per cpu affinity in device driver 김경산
2015-09-02 14:05 ` Christoph Hellwig
2015-09-03 5:01 ` 김경산 [this message]
2015-09-06 8:06 ` 김경산
2015-09-07 17:54 ` 'Christoph Hellwig'
2015-09-10 10:25 ` 김경산
2015-09-08 14:47 ` Keith Busch
2015-09-09 0:35 ` 김경산
2015-09-02 19:07 ` Keith Busch
2015-09-03 0:33 ` 김경산
2015-09-03 14:14 ` Keith Busch
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='007c01d0e605$8b054df0$a10fe9d0$@samsung.com' \
--to=ks0204.kim@samsung.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