From: Prarit Bhargava <prarit@redhat.com>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>,
Michel Lespinasse <walken@google.com>,
Seiji Aguchi <seiji.aguchi@hds.com>,
"Zhang, Yang Z" <yang.z.zhang@intel.com>,
"Gortmaker, Paul (Wind River)" <paul.gortmaker@windriver.com>,
"Morgan, Janet" <janet.morgan@intel.com>,
Ruiv Wang <ruiv.wang@gmail.com>,
"H. Peter Anvin" <hpa@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
chen gong <gong.chen@linux.intel.com>
Subject: Re: [PATCH] x86: Add check for number of available vectors before CPU down [v6]
Date: Tue, 07 Jan 2014 13:46:15 -0500 [thread overview]
Message-ID: <52CC4B77.9090401@redhat.com> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F31D96D8F@ORSMSX106.amr.corp.intel.com>
On 01/07/2014 12:54 PM, Luck, Tony wrote:
> + for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
> + irq = __this_cpu_read(vector_irq[vector]);
> + if (irq >= 0) {
> + desc = irq_to_desc(irq);
> + data = irq_desc_get_irq_data(desc);
> + cpumask_copy(&affinity_new, data->affinity);
> + cpu_clear(this_cpu, affinity_new);
> + /*
> + * The check below determines if this irq requires
> + * an empty vector_irq[irq] entry on an online
> + * cpu.
> + *
> + * The code only counts active non-percpu irqs, and
> + * those irqs that are not linked to on an online cpu.
> + * The first test is trivial, the second is not.
> + *
> + * The second test takes into account the
> + * account that a single irq may be mapped to multiple
> + * cpu's vector_irq[] (for example IOAPIC cluster
> + * mode). In this case we have two
> + * possibilities:
> + *
> + * 1) the resulting affinity mask is empty; that is
> + * this the down'd cpu is the last cpu in the irq's
> + * affinity mask, and
> Code says "||" - so I think comment should say "or".
> + *
> + * 2) the resulting affinity mask is no longer
> + * a subset of the online cpus but the affinity
> + * mask is not zero; that is the down'd cpu is the
> + * last online cpu in a user set affinity mask.
> + *
> + * In both possibilities, we need to remap the irq
> + * to a new vector_irq[].
> + *
> + */
> + if (irq_has_action(irq) && !irqd_is_per_cpu(data) &&
> + (cpumask_empty(&affinity_new) ||
> + !cpumask_subset(&affinity_new, &online_new)))
> + this_count++;
> + }
>
> That's an impressive 6:1 ratio of lines-of-comment to lines-of-code!
Heh -- I couldn't decide if I should keep it all together in one comment or
divide it up. I guess it does look less scary if I divide it up. So how about
(sorry for the cut-and-paste)
for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
irq = __this_cpu_read(vector_irq[vector]);
if (irq >= 0) {
desc = irq_to_desc(irq);
data = irq_desc_get_irq_data(desc);
cpumask_copy(&affinity_new, data->affinity);
cpu_clear(this_cpu, affinity_new);
/* Do not count inactive or per-cpu irqs. */
if (!irq_has_action(irq) || irqd_is_per_cpu(data))
continue;
/*
* A single irq may be mapped to multiple
* cpu's vector_irq[] (for example IOAPIC cluster
* mode). In this case we have two
* possibilities:
*
* 1) the resulting affinity mask is empty; that is
* this the down'd cpu is the last cpu in the irq's
* affinity mask, or
*
* 2) the resulting affinity mask is no longer
* a subset of the online cpus but the affinity
* mask is not zero; that is the down'd cpu is the
* last online cpu in a user set affinity mask.
*/
if (cpumask_empty(&affinity_new) ||
!cpumask_subset(&affinity_new, &online_new))
this_count++;
}
}
Everyone okay with that?
P.
prev parent reply other threads:[~2014-01-07 18:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 12:47 [PATCH] x86: Add check for number of available vectors before CPU down [v6] Prarit Bhargava
2014-01-07 17:54 ` Luck, Tony
2014-01-07 18:46 ` Prarit Bhargava [this message]
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=52CC4B77.9090401@redhat.com \
--to=prarit@redhat.com \
--cc=ak@linux.intel.com \
--cc=gong.chen@linux.intel.com \
--cc=hpa@linux.intel.com \
--cc=janet.morgan@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=ruiv.wang@gmail.com \
--cc=seiji.aguchi@hds.com \
--cc=tony.luck@intel.com \
--cc=walken@google.com \
--cc=x86@kernel.org \
--cc=yang.z.zhang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.