From: ebiederm@xmission.com (Eric W. Biederman)
To: Alan Mayer <ajm@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>,
jeremy@goop.org, rusty@rustcorp.com.au,
suresh.b.siddha@intel.com, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org, Dean Nelson <dcn@sgi.com>,
Cliff Wickman <cpw@sgi.com>, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Yinghai Lu <Yinghai.lu@amd.com>
Subject: Re: [PATCH] x86_64: (NEW) Dynamically allocate arch specific system vectors
Date: Mon, 11 Aug 2008 12:39:22 -0700 [thread overview]
Message-ID: <m1y733mjdh.fsf@frodo.ebiederm.org> (raw)
In-Reply-To: <48A0737F.9010207@sgi.com> (Alan Mayer's message of "Mon, 11 Aug 2008 12:14:39 -0500")
Alan Mayer <ajm@sgi.com> writes:
> Okay, here it is as an attachment. I think my email client is munging it.
> I haven't been able to fix it, apparently.
>
> I, too, would like to know what Eric thinks.
I think arch/x86 is about to fall over from accidental complexity of
the irq handling. Looking at your problem and the problem of killing
NR_IRQS I spent way to much time playing with it this weekend then
I should have, but I think I have found a path that works and is
fairly easily verifiable.
The short version is we make vector_irq the one repository of knowledge
about what we are doing with vectors.
We create a common factor of assign_irq_vector that looks something like:
bool __grab_irq_vector(struct irq_desc *desc, unsigned vector, cpumask_t new_domain)
{
/* Must be called with vector lock */
struct irq_cfg *cfg;
bool grabbed = false;
unsigned int old_vector;
cpumask_t mask;
int cpu;
cfg = get_irqp_cfg(irq);
old_vector = cfg->vector;
cpus_and(mask, new_domain, cpu_online_map);
for_each_cpu_mask_nr(cpu, mask) {
if (per_cpu(vector_irq, cpu)[vector])
goto out;
}
/* Available reserve it */
for_each_cpu_mask_nr(cpu, mask)
per_cpu(vector_irq, cpu)[vector] = desc;
if (cfg->vector) {
cfg->move_in_progress;
cfg->old_domain = cfg->domain;
}
cfg->vector = vector;
cfg->domain = mask;
grabbed = true;
out:
return grabbed;
}
Then in your allocator for per cpu irqs you can do:
spin_lock(&vector_lock);
for (vector = FIRST_VECTOR; vector != LAST_VECTOR, vector--) {
if (__grab_irq_vector(desc, CPU_MASK_ALL))
goto found;
}
spin_unlock(&vector_lock);
Although I am not at all convinced that dynamic allocation of
the vector number (instead of statically reserving it makes sense).
The only way I can see to guarantee all of the special is to
statically allocate them with a lot of good comments. I think
the introduction of system_vectors quite likely defeated the
errata work around we have the lapic timer in a separate priority.
Still if we go in for dynamic allocation of the system vectors
the above looks much simpler and easier to work with than
a lot of other possibilities.
I think used_vectors and system_vectors are data structures that
we need to remove, as their interactions with assign_irq_vector
are not at all well defined or nice.
I think vector_irq should return an irq_desc and have an entry for
all of the static vectors as well (if we are going to do weird
things with dynamic high priority vector allocation, and dynamic
detection of which vectors assign_irq_vector may use).
I have a patch series that gets me 90% of the way there, and the
rest appears easy but I don't have any time to mess with it right
now. I will try and post it something in the next couple of days.
Eric
next prev parent reply other threads:[~2008-08-11 19:43 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-08 15:37 [Fwd: [PATCH] x86_64: (NEW) Dynamically allocate arch specific system vectors] Alan Mayer
2008-08-11 16:59 ` [PATCH] x86_64: (NEW) Dynamically allocate arch specific system vectors Ingo Molnar
2008-08-11 17:14 ` Alan Mayer
2008-08-11 19:39 ` Eric W. Biederman [this message]
2008-08-11 19:51 ` Ingo Molnar
2008-08-11 19:55 ` Jeremy Fitzhardinge
2008-08-11 20:10 ` Eric W. Biederman
2008-08-11 20:02 ` Alan Mayer
2008-09-11 15:23 ` [RFC 0/4] dynamically " Dean Nelson
2008-09-11 15:25 ` [RFC 1/4] switch vector_irq[] from irq number to irq_desc pointer Dean Nelson
2008-09-11 15:27 ` [RFC 2/4] introduce dynamically allocated system vectors Dean Nelson
2008-09-14 15:39 ` Ingo Molnar
2008-09-14 15:46 ` Ingo Molnar
2008-09-11 15:28 ` [RFC 3/4] switch static system vector allocation to use vector_irq[] Dean Nelson
2008-09-11 15:29 ` [RFC 4/4] switch non-standard SYSCALL_VECTOR " Dean Nelson
2008-09-14 15:40 ` Ingo Molnar
2008-09-14 15:42 ` Ingo Molnar
2008-09-11 20:04 ` [RFC 0/4] dynamically allocate arch specific system vectors H. Peter Anvin
2008-09-12 11:46 ` Dean Nelson
2008-09-14 15:35 ` Ingo Molnar
2008-09-14 15:48 ` Ingo Molnar
2008-09-15 21:50 ` Dean Nelson
2008-09-16 8:24 ` Ingo Molnar
2008-09-16 20:46 ` Dean Nelson
2008-09-17 17:30 ` Dimitri Sivanich
2008-09-17 18:59 ` Eric W. Biederman
2008-09-18 13:37 ` Dean Nelson
2008-09-18 19:18 ` H. Peter Anvin
2008-09-17 19:15 ` H. Peter Anvin
2008-09-17 20:21 ` Jack Steiner
2008-09-17 22:15 ` Eric W. Biederman
2008-09-18 1:09 ` H. Peter Anvin
2008-09-18 19:10 ` Jack Steiner
2008-09-19 0:28 ` Eric W. Biederman
2008-09-19 8:48 ` Ingo Molnar
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=m1y733mjdh.fsf@frodo.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=Yinghai.lu@amd.com \
--cc=ajm@sgi.com \
--cc=cpw@sgi.com \
--cc=dcn@sgi.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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