XEN/IA64 critical patch for xen-3.0.0-testing tree
Hi, Keir/Ian,
Attached includes 3 critical fixes which need to be pushed into
xen-3.0.0-testing. Could you please take a look and help? ;-)
Thanks,
Kevin
========================================
This patch includes changesets critical to XEN/IA64 dom0/domU which only touches ia64 specific files and test no regression upon testing tree:
(xen-unstable.hg)
8423 - generic xen0_defconfig_ia64 to run on multiple IA64 boxes (HP-ZX1 and Tiger) which are both commonly used
8413 - Fix dom0 losing virtual timer interrupt issue, which blocks multiple domains stability
(xen-ia64-unstable.hg)
(Following 5 changesets are all related to I/D cache sync issue, to ensure IA64 dom0 running on box with cache split. Patch is made upon 8437)
8437
8435
8434
8375
8371
linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_ia64 | 313
++++++++++----
xen/arch/ia64/xen/domain.c | 20 xen/arch/ia64/xen/vcpu.c | 21 xen/arch/ia64/xen/xenmisc.c | 24 + xen/include/asm-ia64/linux-xen/asm/pal.h | 6 5 files changed, 279 insertions(+), 105 deletions(-)
(xen-unstable.hg)
----
8423
# HG changeset patch
# User [email protected]
# Node ID 663c487a5f2c1bee87062dfe522c4e4516a82f8e
# Parent 97d70c793b67fcd93b9f44529c81d8a9e1eaad63 New default config file that works on both tiger4 and HP boxes
----
8413
# HG changeset patch
# User [email protected]
# Node ID f998426f9069aa9e4e060ceb48a3cd9cfc1231d9
# Parent dda94d6dce94447d29eaf64c53e6e6315e4ac96e
Under some specific conditions, dom0 will lose guest timer interrupt. Signed-off-by Anthony Xu <[email protected]> Signed-off-by Kevin Tian <[email protected]>
The reason is that Xen/ia64 will try to pend guest timer interrupt to dom0
within each machine timer interrupt handler. To avoid duplicated delivery,domain_itm_last recorded domain_itm of last injection. If two are identical,
it means interrupt injected but guest has not set new itm value. Or else corresponding pending irr bit will be turned on. That works in most cases.
However currently guest linux may try to set itm multiple times within one
handler before turn on psr.i again. Among first few settings, new guest timer
interrupt may be pended. Then once guest linux enables interrupt, a new timer interrupt will be injected immediately. However this injection may have
itc still smaller than the domain_itm set at the last round of last handle.
In this case, guest linux will set same domain_itm as last again. However
since domain_itm_last already equals to domain_itm at last read ivr, later
no guest timer interrupt can be injected any more since Xen always thinks
an instance already injected without guest's response.
Attahced patch fixed this issue by adding sanity check upon guest timer vector when deciding to inject interrupt into dom0. We always compare current
itc with latest domain_itm that guest really wants. So if itc < domain_itm
at this point, we simply clear the pending bit and no injection.
There's also a small fix to vcpu_read_ivr, where domain_itm_last should be updated before clearing irr bit. Or els a small window still remains to add a duplicate interrupt.
(xen-ia64-unstable.hg)
----
8437
# HG changeset patch
# User [email protected]
# Node ID b4925703b56c0944e304f073c3117da4f3d71ccd # Parent 5222e8d456aea9a7cf432d0d4ad8a3a7ac602c5b Missing initialization in cache sync code (by Anthony Xu)
----
8435
# HG changeset patch
# User [email protected]
# Node ID 8643b4d778f56c780d2860289d1255c80ab0b32e
# Parent 40648452d45f4b9a26043c0297869c55a6912551
Leave psr.ic on in pal_cache_flush -- fixes Linux bug (by Anthony Xu)
----
8434
# HG changeset patch
# User [email protected]
# Node ID 40648452d45f4b9a26043c0297869c55a6912551
# Parent f218e6ba2653d3f2d50e11ea4b18c743d6c9127f
Sync caches only on split cache machines (dynamic test instead of compile ifdef)
----
8375
# HG changeset patch
# User [email protected]
# Node ID 72f51528d55a9b99f8c7737b34bf6f370de0de7f
# Parent 545ba1b126ca2f06861c3982c4da33dd310e7717
More pal_flush_cache calls for split cache machines (by Anthony Xu)
----
8371
# HG changeset patch
# User [email protected]
# Node ID e1ae4b162128f5b16c626d77c25215a37f9da6e7
# Parent 2d5c57be196d7db66157d3f820858c7acf9dbe58
Turn off ia64_pal_cache_flush for domU (temp, until failure understood)
This patch includes changesets critical to XEN/IA64 dom0/domU:
(xen-unstable.hg)
8413
8423
(xen-ia64-unstable.hg)
8437
8435
8434
8375
8371
(Above 5 changesets are all related to I/D cache sync issue, and we merge into one patch below)
linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_ia64 | 313 ++++++++++---- xen/arch/ia64/xen/domain.c | 20 xen/arch/ia64/xen/vcpu.c | 21 xen/arch/ia64/xen/xenmisc.c | 24 + xen/include/asm-ia64/linux-xen/asm/pal.h | 6 5 files changed, 279 insertions(+), 105 deletions(-)
(xen-unstable.hg)
----
8423
# HG changeset patch
# User [email protected]
# Node ID 663c487a5f2c1bee87062dfe522c4e4516a82f8e
# Parent 97d70c793b67fcd93b9f44529c81d8a9e1eaad63 New default config file that works on both tiger4 and HP boxes
----
8413
# HG changeset patch
# User [email protected]
# Node ID f998426f9069aa9e4e060ceb48a3cd9cfc1231d9
# Parent dda94d6dce94447d29eaf64c53e6e6315e4ac96e
Under some specific conditions, dom0 will lose guest timer interrupt. Signed-off-by Anthony Xu <[email protected]>
Signed-off-by Kevin Tian <[email protected]>
The reason is that Xen/ia64 will try to pend guest timer interrupt to dom0 within each machine timer interrupt handler. To avoid duplicated delivery, domain_itm_last recorded domain_itm of last injection. If two are identical, it means interrupt injected but guest has not set new itm value. Or else corresponding pending irr bit will be turned on. That works in most cases.
However currently guest linux may try to set itm multiple times within one handler before turn on psr.i again. Among first few settings, new guest timer interrupt may be pended. Then once guest linux enables interrupt, a new timer interrupt will be injected immediately. However this injection may have itc still smaller than the domain_itm set at the last round of last handle. In this case, guest linux will set same domain_itm as last again. However since domain_itm_last already equals to domain_itm at last read ivr, later no guest timer interrupt can be injected any more since Xen always thinks an instance already injected without guest's response.
Attahced patch fixed this issue by adding sanity check upon guest timer vector when deciding to inject interrupt into dom0. We always compare current itc with latest domain_itm that guest really wants. So if itc < domain_itm at this point, we simply clear the pending bit and no injection.
There's also a small fix to vcpu_read_ivr, where domain_itm_last should be updated before clearing irr bit. Or els a small window still remains to add a duplicate interrupt.
(xen-ia64-unstable.hg)
----
8437
# HG changeset patch
# User [email protected]
# Node ID b4925703b56c0944e304f073c3117da4f3d71ccd # Parent 5222e8d456aea9a7cf432d0d4ad8a3a7ac602c5b Missing initialization in cache sync code (by Anthony Xu)
----
8435
# HG changeset patch
# User [email protected]
# Node ID 8643b4d778f56c780d2860289d1255c80ab0b32e
# Parent 40648452d45f4b9a26043c0297869c55a6912551
Leave psr.ic on in pal_cache_flush -- fixes Linux bug (by Anthony Xu)
----
8434
# HG changeset patch
# User [email protected]
# Node ID 40648452d45f4b9a26043c0297869c55a6912551
# Parent f218e6ba2653d3f2d50e11ea4b18c743d6c9127f
Sync caches only on split cache machines (dynamic test instead of compile ifdef)
----
8375
# HG changeset patch
# User [email protected]
# Node ID 72f51528d55a9b99f8c7737b34bf6f370de0de7f
# Parent 545ba1b126ca2f06861c3982c4da33dd310e7717
More pal_flush_cache calls for split cache machines (by Anthony Xu)
----
8371
# HG changeset patch
# User [email protected]
# Node ID e1ae4b162128f5b16c626d77c25215a37f9da6e7
# Parent 2d5c57be196d7db66157d3f820858c7acf9dbe58
Turn off ia64_pal_cache_flush for domU (temp, until failure understood)
xen/arch/ia64/xen/vcpu.c +17 -4
@@ -676,6 +676,7 @@* event injection without handle. Later guest may throw out * the event itself. */ +check_start:if (event_pending (vcpu) && !test_bit (vcpu->vcpu_info->arch.evtchn_vector, &PSCBX (vcpu, insvc[0 ])))
@@ -702,6 +703,15 @@//printf("XXXXXXX vcpu_check_pending_interrupts: got bitnum=%p...",bitnum); vector = bitnum+(i*64 ); mask =1L << bitnum; +/* sanity check for guest timer interrupt */ +if (vector == (PSCB (vcpu,itv) &0xff )) { +uint64_t now =ia64_get_itc (); +if (now <PSCBX (vcpu,domain_itm)) { +printk ("Ooops, pending guest timer before its due\n" ); +PSCBX (vcpu,irr[i]) &= ~mask; + goto check_start; + } + }//printf("XXXXXXX vcpu_check_pending_interrupts: got vector=%p...",vector); if (*r >= mask) {// masked by equal inservice
@@ -798,6 +808,13 @@ firsttime[vector]=0; }#endif +/* if delivering a timer interrupt, remember domain_itm, which +* needs to be done before clearing irr +*/ +if (vector == (PSCB (vcpu,itv) &0xff )) { +PSCBX (vcpu,domain_itm_last) =PSCBX (vcpu,domain_itm); + } + i = vector >>6 ; mask =1L << (vector &0x3f );//printf("ZZZZZZ vcpu_get_ivr: setting insvc mask for vector %ld\n",vector);
@@ -805,10 +822,6 @@PSCBX (vcpu,irr[i]) &= ~mask;//PSCB(vcpu,pending_interruption)--; *pval = vector; -// if delivering a timer interrupt, remember domain_itm -if (vector == (PSCB (vcpu,itv) &0xff )) { -PSCBX (vcpu,domain_itm_last) =PSCBX (vcpu,domain_itm); - }return IA64_NO_FAULT ; }
xen/arch/ia64/xen/domain.c +4 -16
@@ -273,14 +273,6 @@if (test_bit (_VCPUF_initialised, &v->vcpu_flags) )return 0 ; -/* Sync d/i cache conservatively */ -if (!running_on_sim) { - ret =ia64_pal_cache_flush (4 ,0 , &progress,NULL ); -if (ret !=PAL_STATUS_SUCCESS ) -panic ("PAL CACHE FLUSH failed for domain.\n" ); -printk ("Sync i/d cache for dom0 image SUCC\n" ); - } -if (c->flags &VGCF_VMX_GUEST ) {if (!vmx_enabled) {printk ("No VMX hardware feature for vmx domain.\n" );
@@ -297,6 +289,7 @@ d->arch.sys_pgnr = c->sys_pgnr;new_thread (v, regs->cr_iip,0 ,0 ); +sync_split_caches (); v->vcpu_info->arch.evtchn_vector = c->vcpu.evtchn_vector;if ( c->vcpu.privregs &©_from_user (v->arch.privregs, c->vcpu.privregs,sizeof (mapped_regs_t))) {
@@ -896,14 +889,6 @@//if ( initrd_len != 0 ) // memcpy((void *)vinitrd_start, initrd_start, initrd_len); -/* Sync d/i cache conservatively */ -if (!running_on_sim) { - ret =ia64_pal_cache_flush (4 ,0 , &progress,NULL ); -if (ret !=PAL_STATUS_SUCCESS ) -panic ("PAL CACHE FLUSH failed for dom0.\n" ); -printk ("Sync i/d cache for dom0 image SUCC\n" ); - } -/* Set up start info area. */ si = (start_info_t *)alloc_xenheap_page ();memset (si,0 ,PAGE_SIZE );
@@ -956,6 +941,7 @@new_thread (v, pkern_entry,0 ,0 );physdev_init_dom0 (d); +sync_split_caches ();// FIXME: Hack for keyboard input #ifdef CLONE_DOMAIN0
@@ -1014,6 +1000,7 @@#endif new_thread (v, pkern_entry,0 ,0 );printk ("new_thread returns\n" ); +sync_split_caches ();__set_bit (0x30 ,VCPU (v, delivery_mask));return 0 ;
@@ -1027,6 +1014,7 @@ v->domain->domain_id);loaddomainelfimage (v->domain,v->domain->arch.image_start);new_thread (v, v->domain->arch.entry,0 ,0 ); + sync_split_caches(); }#endif
xen/arch/ia64/xen/xenmisc.c +26 -0
@@ -368,3 +368,29 @@ goto loop; } } + + + + +/* FIXME: for the forseeable future, all cpu's that enable VTi have split ++ * caches and all cpu's that have split caches enable VTi. This may ++ * eventually be untrue though. */ +#define cpu_has_split_cache vmx_enabled +extern unsigned int vmx_enabled; + +void sync_split_caches (void ) +{ +unsigned long ret, progress=0 ; + +if (cpu_has_split_cache) { +/* Sync d/i cache conservatively */ + ret =ia64_pal_cache_flush (4 ,0 , &progress,NULL ); +if ((ret!=PAL_STATUS_SUCCESS )&& (ret!=PAL_STATUS_UNIMPLEMENTED )) +printk ("PAL CACHE FLUSH failed\n" ); +else printk ("Sync i/d cache for guest SUCC\n" ); + } +else printk ("sync_split_caches ignored for CPU with no split cache\n" ); +} + + +
xen/include/asm-ia64/linux-xen/asm/pal.h +5 -1
@@ -925,7 +925,11 @@ ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector) { struct ia64_pal_retval iprv; -PAL_CALL_IC_OFF (iprv,PAL_CACHE_FLUSH , cache_type, invalidate, *progress); +#ifdef XEN /* fix a bug in Linux... PAL has changed */ +PAL_CALL (iprv,PAL_CACHE_FLUSH , cache_type, invalidate, *progress); +#else +PAL_CALL_IC_OFF (iprv,PAL_CACHE_FLUSH , cache_type, invalidate, *progress); +#endif if (vector) *vector = iprv.v0; *progress = iprv.v1;
linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_ia64 +229 -84
618 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi Kevin,
I'm only moving changesets from xen-unstable to xen-3.0-testing, so I'll wait until all of the changes have made it to xen-unstable before moving them across. It looks like the latest merge from xen-ia64-unstable is going through our test process now, so it should just be another day or so.
Also, I'm pulling them over as individual changesets to maintain as much history as possible, so creating a patch is not strictly necessary. It is still a convenient way to review all the changes at once, of course.
cheers,
robert
Quoted 138 lines · Kevin
Hi, Keir/Ian,
Attached includes 3 critical fixes which need to be pushed into
xen-3.0.0-testing. Could you please take a look and help? ;-)Thanks,
Kevin
========================================
This patch includes changesets critical to XEN/IA64 dom0/domU which only touches ia64 specific files and test no regression upon testing tree:(xen-unstable.hg)
8423 - genericxen0_defconfig_ia64to run on multiple IA64 boxes (HP-ZX1 and Tiger) which are both commonly used
8413 - Fix dom0 losing virtual timer interrupt issue, which blocks multiple domains stability(xen-ia64-unstable.hg)
(Following 5 changesets are all related to I/D cache sync issue, to ensure IA64 dom0 running on box with cache split. Patch is made upon 8437)
8437
8435
8434
8375
8371linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_ia64 | 313
++++++++++----xen/arch/ia64/xen/domain.c | 20 xen/arch/ia64/xen/vcpu.c | 21 xen/arch/ia64/xen/xenmisc.c | 24 + xen/include/asm-ia64/linux-xen/asm/pal.h | 6 5 files changed, 279 insertions(+), 105 deletions(-)(xen-unstable.hg)
----
8423
# HG changeset patch
# User [email protected]
# Node ID663c487a5f2c1bee87062dfe522c4e4516a82f8e
# Parent97d70c793b67fcd93b9f44529c81d8a9e1eaad63New default config file that works on both tiger4 and HP boxes----
8413
# HG changeset patch
# User [email protected]
# Node IDf998426f9069aa9e4e060ceb48a3cd9cfc1231d9
# Parentdda94d6dce94447d29eaf64c53e6e6315e4ac96e
Under some specific conditions, dom0 will lose guest timer interrupt. Signed-off-by Anthony Xu <[email protected]> Signed-off-by Kevin Tian <[email protected]>
The reason is that Xen/ia64 will try to pend guest timer interrupt to dom0
within each machine timer interrupt handler. To avoid duplicated delivery,domain_itm_lastrecordeddomain_itmof last injection. If two are identical,
it means interrupt injected but guest has not set new itm value. Or else corresponding pending irr bit will be turned on. That works in most cases.However currently guest linux may try to set itm multiple times within one
handler before turn on psr.i again. Among first few settings, new guest timer
interrupt may be pended. Then once guest linux enables interrupt, a new timer interrupt will be injected immediately. However this injection may have
itc still smaller than thedomain_itmset at the last round of last handle.
In this case, guest linux will set samedomain_itmas last again. However
sincedomain_itm_lastalready equals todomain_itmat last read ivr, later
no guest timer interrupt can be injected any more since Xen always thinks
an instance already injected without guest's response.Attahced patch fixed this issue by adding sanity check upon guest timer vector when deciding to inject interrupt into dom0. We always compare current
itc with latestdomain_itmthat guest really wants. So if itc <domain_itm
at this point, we simply clear the pending bit and no injection.There's also a small fix to
vcpu_read_ivr, wheredomain_itm_lastshould be updated before clearing irr bit. Or els a small window still remains to add a duplicate interrupt.(xen-ia64-unstable.hg)
----
8437
# HG changeset patch
# User [email protected]
# Node IDb4925703b56c0944e304f073c3117da4f3d71ccd# Parent5222e8d456aea9a7cf432d0d4ad8a3a7ac602c5bMissing initialization in cache sync code (by Anthony Xu)----
8435
# HG changeset patch
# User [email protected]
# Node ID8643b4d778f56c780d2860289d1255c80ab0b32e
# Parent40648452d45f4b9a26043c0297869c55a6912551
Leave psr.ic on inpal_cache_flush-- fixes Linux bug (by Anthony Xu)----
8434
# HG changeset patch
# User [email protected]
# Node ID40648452d45f4b9a26043c0297869c55a6912551
# Parentf218e6ba2653d3f2d50e11ea4b18c743d6c9127f
Sync caches only on split cache machines (dynamic test instead of compile ifdef)Signed-off-by Dan Magenheimer <[email protected]>----
8375
# HG changeset patch
# User [email protected]
# Node ID72f51528d55a9b99f8c7737b34bf6f370de0de7f
# Parent545ba1b126ca2f06861c3982c4da33dd310e7717
Morepal_flush_cachecalls for split cache machines (by Anthony Xu)----
8371
# HG changeset patch
# User [email protected]
# Node IDe1ae4b162128f5b16c626d77c25215a37f9da6e7
# Parent2d5c57be196d7db66157d3f820858c7acf9dbe58
Turn offia64_pal_cache_flushfor domU (temp, until failure understood) <IA64_patches_for_xen_testing.patch>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel