From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: M A Young <m.a.young@durham.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: Re: xen 4 only seeing one keyboard and mouse
Date: Tue, 31 Aug 2010 11:00:08 -0400 [thread overview]
Message-ID: <20100831150008.GA3829@dumpdata.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1008262319280.7742@vega3.dur.ac.uk>
On Thu, Aug 26, 2010 at 11:24:48PM +0100, M A Young wrote:
> On Thu, 26 Aug 2010, M A Young wrote:
>
> >On Thu, 26 Aug 2010, M A Young wrote:
> >
> >>Okay, here is my first attempt at dirty debugging. I have made a
> >>patch to try to track where vector_irq is being changed
> >>(attached) and have also attached. I have looked at it quickly,
> >>and I don't think some low IRQs are getting set on the second
> >>CPU.
Yeah, that definitly is the problem. Now to why it is happening.
> >
> >My next thoughts on this are that almost all IRQs allocated on the
> >first cpu before the second is started aren't initialized on the
> >second CPU. I presume that __setup_vector_irq from
> >xen/arch/x86/irq.c is where it is supposed to happen
> or perhaps it should happen in io_apic_set_pci_routing from
> xen/arch/x86/io_apic.c where the higher IRQs are set (it doesn't
> because __assign_irq_vector sees the IRQ is already in use
> old_vector = irq_to_vector(irq);
> if (old_vector) {
> cpus_and(tmp_mask, mask, cpu_online_map);
> cpus_and(tmp_mask, cfg->domain, tmp_mask);
> if (!cpus_empty(tmp_mask)) {
> cfg->vector = old_vector;
> return 0;
> }
> }
> but seems to miss the fact that it is only actually configured for
> one cpu.
<nods> That code is actually copied from the Linux kernel .. so that begs
the question how does it work under baremetal?
Lets recap, on Xen we do this in three stages:
1). Set up all the legacy IRQs. We don't know yet how many CPUs we have
so we just set up the first sixteen IRQs of the IOAPIC to the first CPU (0).
We also go through the IDT for CPU0 and set the IDT->IRQ for those legacy
IRQs.
2). Then we find out we got more CPUs, and for the other CPUs (1), we
setup the IDT and we make the IDT->IRQ(-1).
3). Then when Dom0 starts, we get called for those IRQs once more. And we
set the IDT for both CPUs to point to the same IRQ:
(XEN) __assign_irq_vector: setting vector_irq[160]=16 for cpu=0
(XEN) __assign_irq_vector: setting vector_irq[160]=16 for cpu=1
except we don't do it for those that have been already set.
So I wonder how this works on baremetal. I've an inkling, but looking at the
boolean logic it doesn't make much sense. So this is the file
arch/x86/kernel/apic/io_apic.c and the function is: setup_IO_APIC_irq
1442 * For legacy irqs, cfg->domain starts with cpu 0 for legacy
1443 * controllers like 8259. Now that IO-APIC can handle this irq, update
1444 * the cfg->domain.
1445 */
1446 if (irq < legacy_pic->nr_legacy_irqs && cpumask_test_cpu(0, cfg->domain))
1447 apic->vector_allocation_domain(0, cfg->domain);
1448
1449 if (assign_irq_vector(irq, cfg, apic->target_cpus()))
1450 return;
1451
1452 dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
1453
1454 apic_printk(APIC_VERBOSE,KERN_DEBUG
1455 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
1456 "IRQ %d Mode:%i Active:%i)\n",
1457 apic_id, mp_ioapics[apic_id].apicid, pin, cfg->vector,
1458 irq, trigger, polarity);
If you could, can you instrument it to print the cfg->domain, before the 'vector_allocation_domain'
is called, and as well instrument the assign_irq_vector similary to what you did with Xen?
And also instrument the 'dest' value. Basically the idea is to get an idea of what the
per_cpu(vector) gets set during the bootup for legacy IRQs. Similary to what you did
with Xen.
next prev parent reply other threads:[~2010-08-31 15:00 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 20:27 xen 4 only seeing one keyboard and mouse M A Young
2010-07-21 20:40 ` Pasi Kärkkäinen
2010-07-21 21:16 ` M A Young
2010-07-21 21:41 ` Pasi Kärkkäinen
2010-07-21 22:10 ` M A Young
2010-07-22 17:51 ` Konrad Rzeszutek Wilk
2010-07-22 18:54 ` M A Young
2010-07-23 14:27 ` Konrad Rzeszutek Wilk
2010-08-08 18:50 ` M A Young
2010-08-08 20:16 ` M A Young
2010-08-09 4:42 ` Konrad Rzeszutek Wilk
2010-08-16 15:46 ` Konrad Rzeszutek Wilk
2010-08-16 21:05 ` M A Young
2010-08-16 22:33 ` Konrad Rzeszutek Wilk
2010-08-18 23:25 ` Konrad Rzeszutek Wilk
2010-08-20 21:59 ` M A Young
2010-08-22 20:03 ` M A Young
2010-08-23 15:18 ` Konrad Rzeszutek Wilk
2010-08-23 19:34 ` M A Young
2010-08-23 20:37 ` M A Young
2010-08-24 17:10 ` Konrad Rzeszutek Wilk
2010-08-24 19:06 ` M A Young
2010-08-24 19:47 ` Keir Fraser
2010-08-24 20:31 ` M A Young
2010-08-24 21:16 ` Konrad Rzeszutek Wilk
2010-08-24 22:40 ` M A Young
2010-08-25 14:28 ` Konrad Rzeszutek Wilk
2010-08-25 21:32 ` M A Young
2010-08-26 14:04 ` Konrad Rzeszutek Wilk
2010-08-26 14:08 ` Keir Fraser
2010-08-26 20:53 ` M A Young
2010-08-26 22:15 ` M A Young
2010-08-26 22:24 ` M A Young
2010-08-27 7:34 ` Keir Fraser
2010-08-31 15:00 ` Konrad Rzeszutek Wilk [this message]
2010-09-03 18:50 ` M A Young
2010-09-08 15:44 ` Konrad Rzeszutek Wilk
2010-09-08 21:36 ` M A Young
2010-09-08 23:17 ` Konrad Rzeszutek Wilk
2010-09-17 22:49 ` M A Young
2010-09-20 14:51 ` Konrad Rzeszutek Wilk
2010-09-20 15:05 ` xen 4 only seeing one keyboard and mouse, fixed in xen 4.0.2-rc-pre Pasi Kärkkäinen
2010-08-21 21:00 ` xen 4 only seeing one keyboard and mouse M A Young
2010-08-23 14:24 ` Konrad Rzeszutek Wilk
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=20100831150008.GA3829@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=m.a.young@durham.ac.uk \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).