From: Thomas Gleixner <tglx@linutronix.de>
To: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Randy Dunlap <rdunlap@infradead.org>,
Yinghai Lu <yinghai@kernel.org>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Tony Luck <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-acpi@vger.kernel.org,
Daniel J Blueman <daniel@numascale.com>
Subject: Re: [Patch v2] x86, irq: Support CPU vector allocation policies
Date: Wed, 6 May 2015 12:22:02 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1505061216390.4225@nanos> (raw)
In-Reply-To: <1430901368-20686-1-git-send-email-jiang.liu@linux.intel.com>
On Wed, 6 May 2015, Jiang Liu wrote:
> Hi Thomas,
> This is the simplified version, which removed the kernel parameter.
> Seems much simpler:)
But it can be made even simpler. :)
> +enum {
> + /* Allocate CPU vectors from CPUs on device local node */
> + X86_VECTOR_POL_NODE = 0x1,
> + /* Allocate CPU vectors from all online CPUs */
> + X86_VECTOR_POL_GLOBAL = 0x2,
> + /* Allocate CPU vectors from caller specified CPUs */
> + X86_VECTOR_POL_CALLER = 0x4,
> + X86_VECTOR_POL_MIN = X86_VECTOR_POL_NODE,
> + X86_VECTOR_POL_MAX = X86_VECTOR_POL_CALLER,
> +};
> +static int assign_irq_vector_policy(int irq, int node,
> + struct apic_chip_data *data,
> + struct irq_alloc_info *info)
> +{
> + int err = -EBUSY;
> + unsigned int policy;
> + const struct cpumask *mask;
> +
> + if (info && info->mask)
> + policy = X86_VECTOR_POL_CALLER;
> + else
> + policy = X86_VECTOR_POL_MIN;
> +
> + for (; policy <= X86_VECTOR_POL_MAX; policy <<= 1) {
> + switch (policy) {
> + case X86_VECTOR_POL_NODE:
> + if (node >= 0)
> + mask = cpumask_of_node(node);
> + else
> + mask = NULL;
> + break;
> + case X86_VECTOR_POL_GLOBAL:
> + mask = apic->target_cpus();
> + break;
> + case X86_VECTOR_POL_CALLER:
> + if (info && info->mask)
> + mask = info->mask;
> + else
> + mask = NULL;
> + break;
> + default:
> + mask = NULL;
> + break;
> + }
> + if (mask) {
> + err = assign_irq_vector(irq, data, mask);
> + if (!err)
> + return 0;
> + }
> + }
This looks pretty overengineered now that you don't have that parameter check.
if (info && info->mask)
return assign_irq_vector(irq, data, info->mask);
if (node >= 0) {
err = assign_irq_vector(irq, data, cpumask_of_node(node));
if (!err)
return 0;
}
return assign_irq_vector(irq, data, apic->target_cpus());
Should do the same, right?
Thanks,
tglx
next prev parent reply other threads:[~2015-05-06 10:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 2:47 [Patch 0/2] Optimize CPU vector allocation for NUMA systems Jiang Liu
2015-05-04 2:47 ` [Patch 1/2] irq_remapping/vt-d: Fix regression caused by commit b106ee63abcc Jiang Liu
2015-05-05 9:15 ` [tip:x86/apic] irq_remapping/vt-d: Init all MSI entries not just the first one tip-bot for Thomas Gleixner
2015-05-04 2:47 ` [Patch 2/2] x86, irq: Support CPU vector allocation policies Jiang Liu
2015-05-05 19:25 ` Thomas Gleixner
2015-05-06 5:17 ` Jiang Liu
2015-05-06 8:36 ` [Patch v2] " Jiang Liu
2015-05-06 10:22 ` Thomas Gleixner [this message]
2015-05-07 2:53 ` [Patch v3] x86, irq: Allocate CPU vectors from device local CPUs if possible Jiang Liu
2015-05-08 7:21 ` Daniel J Blueman
2015-05-13 7:54 ` [tip:x86/apic] " tip-bot for Jiang Liu
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=alpine.DEB.2.11.1505061216390.4225@nanos \
--to=tglx@linutronix.de \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=daniel@numascale.com \
--cc=hpa@zytor.com \
--cc=jiang.liu@linux.intel.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yinghai@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
all inboxes | Powered by JetHome®