From: Qing He <qing.he@intel.com>
To: "Zhang, Xiantao" <xiantao.zhang@intel.com>
Cc: "Cinco, Dante" <Dante.Cinco@lsi.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
keir.fraser@eu.citrix.com
Subject: Re: IRQ SMP affinity problems in domU with vcpus > 4 on HP ProLiant G6 with dual Xeon 5540 (Nehalem)
Date: Thu, 22 Oct 2009 13:10:48 +0800 [thread overview]
Message-ID: <20091022051048.GA775@ub-qhe2> (raw)
In-Reply-To: <706158FABBBA044BAD4FE898A02E4BC201C9BD914F@pdsmsx503.ccr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]
On Thu, 2009-10-22 at 09:58 +0800, Zhang, Xiantao wrote:
> > (XEN) traps.c:1626: guest_io_write::pci_conf_write data=0x40ba
>
> This should be written by dom0(likely to be Qemu). And if it does
> exist, we may have to prohibit such unsafe writings about MSI in
> Qemu.
Yes, it is the case, the problem happens in Qemu, the algorithm looks
like below:
pt_pci_write_config(new_value)
{
dev_value = pci_read_block();
value = msi_write_handler(dev_value, new_value);
pci_write_block(value);
}
msi_write_handler(dev_value, new_value)
{
HYPERVISOR_bind_pt_irq(); // updates MSI binding
return dev_value; // it decides not to change it
}
The problem lies here, when bind_pt_irq is called, the real physical
data/address is updated by the hypervisor. There were no problem
exposed before because at that time hypervisor uses a universal vector
, the data/address of msi remains unchanged. But this isn't the case
when per-CPU vector is there, the pci_write_block is undesirable in
QEmu now, it writes stale value back into the register and invalidate
any modifications.
Clearly, if QEmu decides to hand the management of these registers
to the hypervisor, it shouldn't touch them again. Here is a patch
to fix this by introducing a no_wb flag. Can you have a try?
Thanks,
Qing
[-- Attachment #2: qemu-msi-no-wb.patch --]
[-- Type: text/x-diff, Size: 2471 bytes --]
diff --git a/hw/pass-through.c b/hw/pass-through.c
index 8d80755..b1a3b09 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -626,6 +626,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = {
.init_val = 0x00000000,
.ro_mask = 0x00000003,
.emu_mask = 0xFFFFFFFF,
+ .no_wb = 1,
.init = pt_common_reg_init,
.u.dw.read = pt_long_reg_read,
.u.dw.write = pt_msgaddr32_reg_write,
@@ -638,6 +639,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = {
.init_val = 0x00000000,
.ro_mask = 0x00000000,
.emu_mask = 0xFFFFFFFF,
+ .no_wb = 1,
.init = pt_msgaddr64_reg_init,
.u.dw.read = pt_long_reg_read,
.u.dw.write = pt_msgaddr64_reg_write,
@@ -650,6 +652,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = {
.init_val = 0x0000,
.ro_mask = 0x0000,
.emu_mask = 0xFFFF,
+ .no_wb = 1,
.init = pt_msgdata_reg_init,
.u.w.read = pt_word_reg_read,
.u.w.write = pt_msgdata_reg_write,
@@ -662,6 +665,7 @@ static struct pt_reg_info_tbl pt_emu_reg_msi_tbl[] = {
.init_val = 0x0000,
.ro_mask = 0x0000,
.emu_mask = 0xFFFF,
+ .no_wb = 1,
.init = pt_msgdata_reg_init,
.u.w.read = pt_word_reg_read,
.u.w.write = pt_msgdata_reg_write,
@@ -1550,10 +1554,12 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
val >>= ((address & 3) << 3);
out:
- ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len);
+ if (!reg->no_wb) {
+ ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len);
- if (!ret)
- PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret);
+ if (!ret)
+ PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret);
+ }
if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
/* set QEMUTimer */
diff --git a/hw/pass-through.h b/hw/pass-through.h
index 028a03e..3c79885 100644
--- a/hw/pass-through.h
+++ b/hw/pass-through.h
@@ -364,6 +364,8 @@ struct pt_reg_info_tbl {
uint32_t ro_mask;
/* reg emulate field mask (ON:emu, OFF:passthrough) */
uint32_t emu_mask;
+ /* no write back allowed */
+ uint32_t no_wb;
/* emul reg initialize method */
conf_reg_init init;
union {
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2009-10-22 5:10 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 1:38 IRQ SMP affinity problems in domU with vcpus > 4 on HP ProLiant G6 with dual Xeon 5540 (Nehalem) Cinco, Dante
2009-10-16 2:34 ` Qing He
2009-10-16 6:37 ` Keir Fraser
2009-10-16 7:32 ` Zhang, Xiantao
2009-10-16 8:24 ` Qing He
2009-10-16 8:22 ` Zhang, Xiantao
2009-10-16 8:34 ` Qing He
2009-10-16 8:35 ` Zhang, Xiantao
2009-10-16 9:01 ` Qing He
2009-10-16 9:42 ` Qing He
2009-10-16 9:49 ` Zhang, Xiantao
2009-10-16 14:54 ` Zhang, Xiantao
2009-10-16 18:24 ` Cinco, Dante
2009-10-17 0:59 ` Zhang, Xiantao
2009-10-20 0:19 ` Cinco, Dante
2009-10-20 5:46 ` Zhang, Xiantao
2009-10-20 7:51 ` Zhang, Xiantao
2009-10-20 17:26 ` Cinco, Dante
2009-10-21 1:10 ` Zhang, Xiantao
2009-10-22 1:00 ` Cinco, Dante
2009-10-22 1:58 ` Zhang, Xiantao
2009-10-22 2:42 ` Zhang, Xiantao
2009-10-22 6:25 ` Keir Fraser
2009-10-22 21:11 ` Jeremy Fitzhardinge
2009-10-22 5:10 ` Qing He [this message]
2009-10-23 0:10 ` Cinco, Dante
2009-10-22 6:46 ` Jan Beulich
2009-10-22 7:11 ` Zhang, Xiantao
2009-10-22 7:31 ` Jan Beulich
2009-10-22 8:41 ` Zhang, Xiantao
2009-10-22 9:42 ` Keir Fraser
2009-10-22 16:32 ` Zhang, Xiantao
2009-10-22 16:33 ` Cinco, Dante
2009-10-23 1:06 ` Zhang, Xiantao
2009-10-26 13:02 ` Zhang, Xiantao
2009-10-26 13:34 ` Keir Fraser
2009-10-16 9:41 ` Keir Fraser
2009-10-16 9:57 ` Qing He
2009-10-16 9:58 ` Zhang, Xiantao
2009-10-16 10:21 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2009-10-08 0:08 Cinco, Dante
2009-10-08 16:07 ` Bruce Edge
2009-10-08 18:05 ` Keir Fraser
2009-10-08 18:11 ` Cinco, Dante
2009-10-08 21:35 ` Keir Fraser
2009-10-09 9:07 ` Qing He
2009-10-09 15:59 ` Cinco, Dante
2009-10-09 23:39 ` Cinco, Dante
2009-10-10 9:43 ` Qing He
2009-10-10 10:10 ` Keir Fraser
2009-10-12 5:25 ` Cinco, Dante
2009-10-12 5:54 ` Qing He
2009-10-14 19:54 ` Cinco, Dante
2009-10-16 0:09 ` Konrad Rzeszutek Wilk
2009-10-16 1:40 ` 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=20091022051048.GA775@ub-qhe2 \
--to=qing.he@intel.com \
--cc=Dante.Cinco@lsi.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
--cc=xiantao.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.