[Xen-ia64-devel] [PATCH][MCA] Avoid calling xmcalloc from interrupt handler
Hi, This patch fixes to avoid calling xmalloc() from the interrupt handler. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki k...@jp.fujitsu.com diff -r 46b4096813dc xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Mon Feb 02 11:11:36 2009 +0900 +++ b/xen/arch/ia64/linux-xen/mca.c Tue Feb 10 15:52:51 2009 +0900 @@ -210,6 +210,7 @@ static ia64_state_log_t ia64_state_log[I #define IA64_LOG_COUNT(it) ia64_state_log[it].isl_count #ifdef XEN +sal_queue_entry_t sal_entry[NR_CPUS][IA64_MAX_LOG_TYPES]; struct list_head *sal_queue, sal_log_queues[IA64_MAX_LOG_TYPES]; sal_log_record_header_t *sal_record; DEFINE_SPINLOCK(sal_queue_lock); @@ -358,6 +359,7 @@ ia64_log_queue(int sal_info_type, int vi if (total_len) { int queue_type; + int cpuid = smp_processor_id(); spin_lock_irqsave(sal_queue_lock, flags); @@ -366,15 +368,22 @@ ia64_log_queue(int sal_info_type, int vi else queue_type = sal_info_type; - e = xmalloc(sal_queue_entry_t); - BUG_ON(e == NULL); - e-cpuid = smp_processor_id(); + /* Skip if sal_entry is already listed in sal_queue */ + list_for_each_entry(e, sal_queue[queue_type], list) { + if (e == sal_entry[cpuid][queue_type]) + goto found; + } + e = sal_entry[cpuid][queue_type]; + memset(e, 0, sizeof(sal_queue_entry_t)); + e-cpuid = cpuid; e-sal_info_type = sal_info_type; e-vector = IA64_CMC_VECTOR; e-virq = virq; e-length = total_len; list_add_tail(e-list, sal_queue[queue_type]); + + found: spin_unlock_irqrestore(sal_queue_lock, flags); IA64_LOG_INDEX_INC(sal_info_type); diff -r 46b4096813dc xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Mon Feb 02 11:11:36 2009 +0900 +++ b/xen/arch/ia64/xen/fw_emul.c Tue Feb 10 14:07:18 2009 +0900 @@ -95,7 +95,7 @@ void get_state_info_on(void *data) { rec_name[arg-type], smp_processor_id(), arg-ret); if (arg-corrected) { sal_record-severity = sal_log_severity_corrected; - IA64_SAL_DEBUG(%s: IA64_SAL_CLEAR_STATE_INFO(SAL_INFO_TYPE_MCA) + IA64_SAL_DEBUG(%s: IA64_SAL_GET_STATE_INFO(SAL_INFO_TYPE_MCA) force\n, __FUNCTION__); } if (arg-ret 0) { @@ -293,9 +293,7 @@ sal_emulator (long index, unsigned long } r9 = arg.ret; status = arg.status; - if (r9 == 0) { - xfree(e); - } else { + if (r9 != 0) { /* Re-add the entry to sal_queue */ spin_lock_irqsave(sal_queue_lock, flags); list_add(e-list, sal_queue[in1]); @@ -359,7 +357,12 @@ sal_emulator (long index, unsigned long } r9 = arg.ret; status = arg.status; - xfree(e); + if (r9 = 0) { + IA64_SAL_DEBUG(SAL_CLEAR_STATE_INFO: more errors are available\n); + spin_lock_irqsave(sal_queue_lock, flags); + list_add(e-list, sal_queue[in1]); + spin_unlock_irqrestore(sal_queue_lock, flags); + } } break; case SAL_MC_RENDEZ: ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar
Hi, I think gp passed from SAL is changed to a virtual address by DATA_PA_TO_VA() in VIRTUAL_MODE_ENTER(). #define DATA_PA_TO_VA(addr,temp)\ mov temp= 0xf ;; \ dep addr= temp, addr, 60, 4 Could you please explain the issue a little more in detail? Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar Date: Thu, 7 Aug 2008 19:30:11 +0900 On Tue, Aug 05, 2008 at 02:19:06PM +0900, Isaku Yamahata wrote: On Tue, Aug 05, 2008 at 12:37:17PM +0900, Isaku Yamahata wrote: Hi Kazu. Sorry for late alert. VIRTUAL_MODE_ENTER() still refers ar.k6. Could you fix it? One more. Before pinning down vpd and vhpt, it's necessary to make sure that they doesn't overlap with stack like __vmxswitch_rr7() and ia64_new_rr7(). And more. VIRTUAL_MODE_ENTER() sets gp (r1) to ia64_os_mca_virtual_begin and then call ia64_mca_ucmc_handler(). It this correct? It looks like that accessing global variable in ia64_mca_ucmc_handler() results in rondom place access. Linux has the related fix. What do you think? commit f5a3f3dc189485d607fbd42678cc23958acc0a6e Author: Zou Nan hai [EMAIL PROTECTED] Date: Thu Sep 14 08:25:15 2006 +0800 [IA64] Make gp value point to Region 5 in mca handler MCA dispatch code take physical address of GP passed from SAL, then call DATA_PA_TO_VA twice on GP before call into C code. The first time is in ia64_set_kernel_register, the second time is in VIRTUAL_MODE_ENTER. The gp is changed to a virtual address in region 7 because DATA_PA_TO_VA is implemented by dep instruction. However when notify blocks were called from MCA handler code, because notify blocks are supported by callback function pointers, gp value value was switched to region 5 again. The patch set gp register to kernel gp of region 5 at entry of MCA dispatch. Signed-off-by: Zou Nan hai [EMAIL PROTECTED] Signed-off-by: Tony Luck [EMAIL PROTECTED] -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar
Hi, Thank you for explaining. I see. I have tested the attached porting patch, it was confirmed to work. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar Date: Fri, 8 Aug 2008 17:03:05 +0900 On Fri, Aug 08, 2008 at 03:41:17PM +0900, SUZUKI Kazuhiro wrote: I think gp passed from SAL is changed to a virtual address by DATA_PA_TO_VA() in VIRTUAL_MODE_ENTER(). #define DATA_PA_TO_VA(addr,temp)\ mov temp= 0xf ;; \ dep addr= temp, addr, 60, 4 Could you please explain the issue a little more in detail? The xen vmm image was made relocatable so that xen text and data are located at the area starting at #define KERNEL_START 0xf4000400 wherever the image is loaded. So __gp is a value of 0xf4000400 + offset and it's impossible to calculate __gp from the physical address of __gp. On the other hand the macro, DATA_PA_TO_VA(), gives a value of 0xf000 + physical address. The value points to the same physical memory location pointed by __gp, so possibly the current code may just work. But it worried me much so that I checked the linux code to find the c/s f5a3f3dc189485d607fbd42678cc23958acc0a6e. Yes, it's easy for me (and you) to port the following hunk of the c/s, however it's difficult for me to test the handler. thanks, diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h index 27c9203..76203f9 100644 --- a/include/asm-ia64/mca_asm.h +++ b/include/asm-ia64/mca_asm.h @@ -197,9 +197,9 @@ movltemp2 = start_addr; \ ;; \ mov cr.iip = temp2; \ + movlgp = __gp \ ;; \ DATA_PA_TO_VA(sp, temp1); \ - DATA_PA_TO_VA(gp, temp2); \ srlz.i; \ ;; \ nop 1; \ -- yamahata diff -r e9706492e960 xen/include/asm-ia64/linux-xen/asm/mca_asm.h --- a/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Thu Jul 31 12:25:50 2008 +0900 +++ b/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Fri Aug 08 16:46:08 2008 +0900 @@ -239,9 +239,9 @@ 30: mov ar.lc = _tmp1; \ movltemp2 = start_addr; \ ;; \ mov cr.iip = temp2; \ + movlgp = __gp \ ;; \ DATA_PA_TO_VA(sp, temp1); \ - DATA_PA_TO_VA(gp, temp2); \ srlz.i; \ ;; \ nop 1; \ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar
Hi Isaku, VIRTUAL_MODE_ENTER() still refers ar.k6. Could you fix it? ar.k6 is saved in ia64_os_mca_proc_state_dump, and restored in ia64_os_mca_proc_state_restore. I think that the mca handler will not destroy ar.k6. Is it need to fix that? Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar Date: Tue, 5 Aug 2008 12:37:17 +0900 Hi Kazu. Sorry for late alert. VIRTUAL_MODE_ENTER() still refers ar.k6. Could you fix it? On Wed, Jul 30, 2008 at 01:29:39PM +0900, SUZUKI Kazuhiro wrote: Hi, Thank you for your comments. I attached an updated patch following to the comments. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [PATCH] Fix mca handler so as not to destroy ar(was: Re: [Xen-ia64-devel] Re: mca handler) Date: Mon, 28 Jul 2008 11:20:05 +0900 On Fri, Jul 25, 2008 at 05:47:37PM +0900, SUZUKI Kazuhiro wrote: The following patch fixes the mca handler so as not to destroy ar and some bugs. Thank you for fixing some bugs and it looks basically good. Some comments below. @@ -524,24 +457,111 @@ ia64_reload_tr: srlz.d ;; #ifdef XEN -.reload_vhpt: - // 5. VHPT - GET_THIS_PADDR(r1, inserted_vhpt);; - cmp.eq p7,p0=r2,r0 -(p7) br.cond.sptk.overlap_vhpt // vhpt isn't mapped. + // 5. shared_info + GET_THIS_PADDR(r2, inserted_shared_info);; + ld8 r16=[r2] + mov r18=XSI_SHIFT2 + movl r20=__pgprot(__DIRTY_BITS | _PAGE_PL_PRIV | _PAGE_AR_RW) + ;; + GET_THIS_PADDR(r2, domain_shared_info);; + ld8 r17=[r2] + ;; + dep r17=0,r17,60,4 + ;; + or r17=r17,r20 // construct PA | page properties + mov cr.itir=r18 + mov cr.ifa=r16 + ;; + mov r16=IA64_TR_SHARED_INFO + ;; + itr.d dtr[r16]=r17 // wire in new mapping... + ;; + srlz.d + ;; Unconditionally pinning down shared_info into inserted_shared_info is wrong because shared_info is shared only with PV domain and xen VMM. So In VMX domain case, it shouldn't pinned down. Otherwise VMX guest wrongly accesses to shared_info. In ia64_do_tlb_purge() case, unconditionally purging DTR[IA64_TR_SHARED_INFO] is okay, but unconditionally inserting DTR[IA64_TR_SHARED_INFO] is bad. thanks, diff -r 1970781956c7 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Wed Jul 23 12:10:20 2008 +0900 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Wed Jul 30 11:33:51 2008 +0900 @@ -154,71 +154,6 @@ .text .align 16 -#ifdef XEN -/* - * void set_per_cpu_data(void) - * { - * int i; - * for (i = 0; i 64; i++) { - * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { - * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); - * return; - * } - * } - * while(1); // Endless loop on error - * } - */ -#define SET_PER_CPU_DATA() \ - LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ - mov r7 = r0;\ - mov r6 = r0;; \ - adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ -1: add r4 = r6, r2;\ - mov r5=cr.lid;; \ - adds r7 = 1, r7;\ - ld8 r4 = [r4];; \ - cmp.ne p6, p7 = r5, r4; \ - cmp4.lt p8, p9 = NR_CPUS-1, r7; \ -(p7) br.cond.dpnt 3f;\ - adds r6 = 16, r6; \ -(p9) br.cond.sptk 1b;\ -2: br 2b;; /* Endless loop on error */ \ -3: add r4 = r6, r3;; \ - ld8 r4 = [r4];; \ - mov ar.k3=r4 - -/* - * GET_VA_VCPU_VHPT_MADDR() emulates 'reg = __va_ul(vcpu_vhpt_maddr(v))'. - */ -#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT -#define HAS_PERVCPU_VHPT_MASK 0x2 -#define GET_VA_VCPU_VHPT_MADDR(reg,tmp)\ - GET_THIS_PADDR(reg,cpu_kr);;\ - add reg=IA64_KR_CURRENT_OFFSET,reg;;\ - ld8 reg=[reg];; \ - dep tmp=0,reg,60,4;;/* V to P */\ - add tmp=IA64_VCPU_VHPT_PAGE_OFFSET,tmp;;\ - ld8 tmp=[tmp
[Xen-ia64-devel] Re: [PATCH] Fix mca handler so as not to destroy ar
Hi, Thank you for your comments. I attached an updated patch following to the comments. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [PATCH] Fix mca handler so as not to destroy ar(was: Re: [Xen-ia64-devel] Re: mca handler) Date: Mon, 28 Jul 2008 11:20:05 +0900 On Fri, Jul 25, 2008 at 05:47:37PM +0900, SUZUKI Kazuhiro wrote: The following patch fixes the mca handler so as not to destroy ar and some bugs. Thank you for fixing some bugs and it looks basically good. Some comments below. @@ -524,24 +457,111 @@ ia64_reload_tr: srlz.d ;; #ifdef XEN -.reload_vhpt: - // 5. VHPT - GET_THIS_PADDR(r1, inserted_vhpt);; - cmp.eq p7,p0=r2,r0 -(p7) br.cond.sptk.overlap_vhpt // vhpt isn't mapped. + // 5. shared_info + GET_THIS_PADDR(r2, inserted_shared_info);; + ld8 r16=[r2] + mov r18=XSI_SHIFT2 + movl r20=__pgprot(__DIRTY_BITS | _PAGE_PL_PRIV | _PAGE_AR_RW) + ;; + GET_THIS_PADDR(r2, domain_shared_info);; + ld8 r17=[r2] + ;; + dep r17=0,r17,60,4 + ;; + or r17=r17,r20 // construct PA | page properties + mov cr.itir=r18 + mov cr.ifa=r16 + ;; + mov r16=IA64_TR_SHARED_INFO + ;; + itr.d dtr[r16]=r17 // wire in new mapping... + ;; + srlz.d + ;; Unconditionally pinning down shared_info into inserted_shared_info is wrong because shared_info is shared only with PV domain and xen VMM. So In VMX domain case, it shouldn't pinned down. Otherwise VMX guest wrongly accesses to shared_info. In ia64_do_tlb_purge() case, unconditionally purging DTR[IA64_TR_SHARED_INFO] is okay, but unconditionally inserting DTR[IA64_TR_SHARED_INFO] is bad. thanks, -- yamahata diff -r 1970781956c7 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Wed Jul 23 12:10:20 2008 +0900 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Wed Jul 30 11:33:51 2008 +0900 @@ -154,71 +154,6 @@ .text .align 16 -#ifdef XEN -/* - * void set_per_cpu_data(void) - * { - * int i; - * for (i = 0; i 64; i++) { - * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { - * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); - * return; - * } - * } - * while(1); // Endless loop on error - * } - */ -#define SET_PER_CPU_DATA() \ - LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ - mov r7 = r0;\ - mov r6 = r0;; \ - adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ -1: add r4 = r6, r2;\ - mov r5=cr.lid;; \ - adds r7 = 1, r7;\ - ld8 r4 = [r4];; \ - cmp.ne p6, p7 = r5, r4; \ - cmp4.lt p8, p9 = NR_CPUS-1, r7; \ -(p7) br.cond.dpnt 3f;\ - adds r6 = 16, r6; \ -(p9) br.cond.sptk 1b;\ -2: br 2b;; /* Endless loop on error */ \ -3: add r4 = r6, r3;; \ - ld8 r4 = [r4];; \ - mov ar.k3=r4 - -/* - * GET_VA_VCPU_VHPT_MADDR() emulates 'reg = __va_ul(vcpu_vhpt_maddr(v))'. - */ -#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT -#define HAS_PERVCPU_VHPT_MASK 0x2 -#define GET_VA_VCPU_VHPT_MADDR(reg,tmp)\ - GET_THIS_PADDR(reg,cpu_kr);;\ - add reg=IA64_KR_CURRENT_OFFSET,reg;;\ - ld8 reg=[reg];; \ - dep tmp=0,reg,60,4;;/* V to P */\ - add tmp=IA64_VCPU_VHPT_PAGE_OFFSET,tmp;;\ - ld8 tmp=[tmp];; \ - cmp.eq p6,p0=tmp,r0;/* v-arch.vhpt_page == NULL */ \ -(p6) br.cond.sptk 1f;\ - add reg=IA64_VCPU_VHPT_MADDR_OFFSET,reg;; \ - dep reg=0,reg,60,4;;/* V to P */\ - ld8 reg=[reg];; \ - dep reg=-1,reg,60,4;/* P to V */\ - br.sptk 2f; \ -1: \ - GET_THIS_PADDR(reg, vhpt_paddr);; \ - ld8 reg=[reg];; \ - dep reg=-1,reg,60,4;/* P to V */\ -2: -#else /* CONFIG_XEN_IA64_PERVCPU_VHPT */ -#define GET_VA_VCPU_VHPT_MADDR(reg,tmp
[PATCH] Fix mca handler so as not to destroy ar(was: Re: [Xen-ia64-devel] Re: mca handler)
Hi, The following patch fixes the mca handler so as not to destroy ar and some bugs. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: SUZUKI Kazuhiro [EMAIL PROTECTED] Subject: [Xen-ia64-devel] Re: mca handler Date: Wed, 23 Jul 2008 11:10:57 +0900 (JST) Hi, You are right. The ar registers should not be destroyed. So, I will try to make a patch which fixes it. Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: mca handler Date: Thu, 17 Jul 2008 11:54:46 +0900 Hi. While I was debugging kexec/kdump, I have a question about the mca handler. I cited the related hunks below. Could you please clarify them? On mca the firmware saves non-banked and banked general registers and the most of ar registers must be unchanged. However before ia64_os_mca_proc_state_dump saves such registers, the cited hunks unconditionally overwrite ar.k[36] so that they are destroyed. Am I missing anything? changeset: 12447:2afdc0066df6 user:[EMAIL PROTECTED] date:Sun Oct 29 09:27:11 2006 -0700 files: xen/arch/ia64/linux-xen/mca_asm.S description: [IA64] MCA support - Add percpu data physical addr mca_asm.S Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] ... ... @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#define SET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0;; \ + adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ +1: add r4 = r6, r2;\ + mov r5=cr.lid;; \ + adds r7 = 1, r7;\ + ld8 r4 = [r4];; \ + cmp.ne p6, p7 = r5, r4; \ + cmp4.lt p8, p9 = NR_CPUS-1, r7; \ +(p7) br.cond.dpnt 3f;\ + adds r6 = 16, r6; \ +(p9) br.cond.sptk 1b;\ +2: br 2b;; /* Endless loop on error */ \ +3: add r4 = r6, r3;; \ + ld8 r4 = [r4];; \ + mov ar.k3=r4 +#endif /* XEN */ + ... @@ -235,6 +327,9 @@ cmp.ne p6,p0=r4,r0 (p6) br ia64_os_mca_spin +#ifdef XEN + SET_PER_CPU_DATA();; +#endif // Save the SAL to OS MCA handoff state as defined // by SAL SPEC 3.0 // NOTE : The order in which the state gets saved @@ -250,7 +345,19 @@ ia64_os_mca_done_dump: +#ifdef XEN + // Set current to ar.k6 + GET_THIS_PADDR(r2,cpu_kr);; + add r2=IA64_KR_CURRENT_OFFSET,r2;; + ld8 r2=[r2];; + mov ar.k6=r2;; + + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; + ld8 r2=[r2];; + adds r16=56,r2 +#else LOAD_PHYSICAL(p0,r16,ia64_sal_to_os_handoff_state+56) +#endif ;; ld8 r18=[r16] // Get processor state parameter on existing PA LE_CHECK. ;; ... @@ -874,12 +1003,6 @@ br ia64_os_mca_done_restore;; //EndStub/ / -#else -ia64_os_mca_dispatch: -1: - br.sptk 1b -ia64_os_mca_dispatch_end: -#endif /* !XEN */ // ok, the issue here is that we need to save state information so @@ -911,6 +1034,15 @@ GLOBAL_ENTRY(ia64_monarch_init_handler) .prologue +#ifdef XEN /* Need in ia64_monarch_init_handler? */ + SET_PER_CPU_DATA();; + + // Set current to ar.k6 + GET_THIS_PADDR(r2,cpu_kr);; + add r2=IA64_KR_CURRENT_OFFSET,r2;; + ld8 r2=[r2];; + mov ar.k6=r2;; +#endif // stash the information the SAL passed to os SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(r2) ;; -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel diff -r 1970781956c7 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Wed Jul
[Xen-ia64-devel] Re: mca handler
Hi, You are right. The ar registers should not be destroyed. So, I will try to make a patch which fixes it. Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: mca handler Date: Thu, 17 Jul 2008 11:54:46 +0900 Hi. While I was debugging kexec/kdump, I have a question about the mca handler. I cited the related hunks below. Could you please clarify them? On mca the firmware saves non-banked and banked general registers and the most of ar registers must be unchanged. However before ia64_os_mca_proc_state_dump saves such registers, the cited hunks unconditionally overwrite ar.k[36] so that they are destroyed. Am I missing anything? changeset: 12447:2afdc0066df6 user:[EMAIL PROTECTED] date:Sun Oct 29 09:27:11 2006 -0700 files: xen/arch/ia64/linux-xen/mca_asm.S description: [IA64] MCA support - Add percpu data physical addr mca_asm.S Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] ... ... @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#define SET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0;; \ + adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ +1: add r4 = r6, r2;\ + mov r5=cr.lid;; \ + adds r7 = 1, r7;\ + ld8 r4 = [r4];; \ + cmp.ne p6, p7 = r5, r4; \ + cmp4.lt p8, p9 = NR_CPUS-1, r7; \ +(p7) br.cond.dpnt 3f;\ + adds r6 = 16, r6; \ +(p9) br.cond.sptk 1b;\ +2: br 2b;; /* Endless loop on error */ \ +3: add r4 = r6, r3;; \ + ld8 r4 = [r4];; \ + mov ar.k3=r4 +#endif /* XEN */ + ... @@ -235,6 +327,9 @@ cmp.ne p6,p0=r4,r0 (p6) br ia64_os_mca_spin +#ifdef XEN + SET_PER_CPU_DATA();; +#endif // Save the SAL to OS MCA handoff state as defined // by SAL SPEC 3.0 // NOTE : The order in which the state gets saved @@ -250,7 +345,19 @@ ia64_os_mca_done_dump: +#ifdef XEN + // Set current to ar.k6 + GET_THIS_PADDR(r2,cpu_kr);; + add r2=IA64_KR_CURRENT_OFFSET,r2;; + ld8 r2=[r2];; + mov ar.k6=r2;; + + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; + ld8 r2=[r2];; + adds r16=56,r2 +#else LOAD_PHYSICAL(p0,r16,ia64_sal_to_os_handoff_state+56) +#endif ;; ld8 r18=[r16] // Get processor state parameter on existing PA LE_CHECK. ;; ... @@ -874,12 +1003,6 @@ br ia64_os_mca_done_restore;; //EndStub/ / -#else -ia64_os_mca_dispatch: -1: - br.sptk 1b -ia64_os_mca_dispatch_end: -#endif /* !XEN */ // ok, the issue here is that we need to save state information so @@ -911,6 +1034,15 @@ GLOBAL_ENTRY(ia64_monarch_init_handler) .prologue +#ifdef XEN /* Need in ia64_monarch_init_handler? */ + SET_PER_CPU_DATA();; + + // Set current to ar.k6 + GET_THIS_PADDR(r2,cpu_kr);; + add r2=IA64_KR_CURRENT_OFFSET,r2;; + ld8 r2=[r2];; + mov ar.k6=r2;; +#endif // stash the information the SAL passed to os SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(r2) ;; -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][Open GFW] Fix guest panic with particular memory size
Hi Tristan, I found that an HVM guest panics which has particular memory size(e.g. 3073MB). This is because an address of the auto variable is referred, so it will be overwritten. Then it causes Unaligned reference exception. The following patch fixes it. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] fix_overwrite.patch.bz2 Description: Binary data ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] Re: [GFW bug]crash when Input the description
Hi, It seems that my patch is not applyed in ./binaries/xenia64-gfw.bin. When I used it, I also got such an exception. But I confirmed that it worked with no exception when the GFW built from source code for myself was used. Thanks, KAZ From: Zhang, Xing Z [EMAIL PROTECTED] Subject: [GFW bug]crash when Input the description Date: Fri, 23 May 2008 20:41:46 +0800 Hi Kazuhiro: I notice you sent a patch(cset 125) to fix this issue and Tristan added a new build at cset 133. But with the new build, I still meet the issue when a boot option added for linux guest. GFW output a log as below: Exception=5a00 Iip=1ec37780 B0=1ec25210^M IFA=ffd9 IPSR=12006018 ISR=0204^M Is the issue same with you fixed one? Good good study,day day up ! ^_^ -Wing(zhang xin) OTC,Intel Corporation ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH][GFW][RFC] fix EFI_SAL_SET_VECTORS
Hi, I could not boot the guest HVM when I build gfw with cached physical addresses. So I changed to uncached addresses. I confirmed to boot it with your patch. Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH][GFW][RFC] fix EFI_SAL_SET_VECTORS Date: Wed, 14 May 2008 18:18:03 +0900 On Wed, May 14, 2008 at 10:43:24AM +0200, [EMAIL PROTECTED] wrote: Quoting Isaku Yamahata [EMAIL PROTECTED]: On Tue, May 13, 2008 at 12:24:16PM +0200, [EMAIL PROTECTED] wrote: The uncached physical addresses are hard coded, but they aren't relocated when switching to virtual address mode. I am not sure ConvertPointer is able to deal with uncached addresses. Anyway, using normal addresses should be harmless. I guess that the original auther concerned about a race so that he used uncached addresses. I don't catch your point. Uncached addresses won't prevent races. No, it doesn't prevent. I don't understand why uncached address was used either. I had tried to guess the code intention, but I'm not sure. Kaz, any comment? -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][Open GFW] Fix windows guest panic in INIT handler
Hi Tristan, I found that the Windows guest panics when an INIT event is received. The following patch fixes it. We need to set ar.rsc = 0. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] # HG changeset patch # User Kazuhiro Suzuki [EMAIL PROTECTED] # Date 1207294804 -32400 # Node ID 7433c80d83e71f29868ff7f923815ab2351a0c14 # Parent c51f419011fd0a6319c8527ecf75c028ff1089a2 Add ar.rsc = 0 so that the Windows guest should not panic when an INIT event is received. Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r c51f419011fd -r 7433c80d83e7 edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s --- a/edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s Tue Apr 01 04:04:02 2008 +0200 +++ b/edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s Fri Apr 04 16:40:04 2008 +0900 @@ -1172,6 +1172,7 @@ load_slave_entry_point: movlr2=slave_init_handler 1: movlr12=_init_return// Set return address + mov ar.rsc=0// lazy mode, 0 dirty bytes. ;; ld8 r3=[r2],8 // Load init handler entry point ;; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][Open GFW]Support ACPI SPCR table
Hi Tristan, The following patch supports ACPI Serial Port Console Redirection(SPCR) table, by which we can use Windows Special Administration Console(SAC). Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] # HG changeset patch # User Kazuhiro Suzuki [EMAIL PROTECTED] # Date 1206681923 -32400 # Node ID c5bbf82de136f80f67ce863ee3412e5de4f11e9f # Parent 7097ce08e5befea698f130279ccdcd3e1e08545e Supports ACPI Serial Port Console Redirection(SPCR) table, by which we can use Windows Special Administration Console(SAC). Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 7097ce08e5be -r c5bbf82de136 edk2-sparse/EdkXenPkg/Dxe/XenAcpi/acpi2_0.h --- a/edk2-sparse/EdkXenPkg/Dxe/XenAcpi/acpi2_0.h Fri Mar 28 02:50:55 2008 +0100 +++ b/edk2-sparse/EdkXenPkg/Dxe/XenAcpi/acpi2_0.h Fri Mar 28 14:25:23 2008 +0900 @@ -263,6 +263,34 @@ struct acpi_20_hpet { #define ACPI_HPET_ADDRESS 0xFED0UL /* + * SPCR - Serial Port Console Redirection table + */ +struct acpi_20_spcr { +struct acpi_header header;/* Common ACPI table header */ +uint8_t interface_type; /* 0=full 16550, 1=subset of 16550 */ +uint8_t reserved[3]; +struct acpi_20_generic_address addr; +uint8_t interrupt_type; +uint8_t pc_interrupt; +uint32_t interrupt; +uint8_t baud_rate; +uint8_t parity; +uint8_t stop_bits; +uint8_t flow_control; +uint8_t terminal_type; +uint8_t reserved1; +uint16_t pci_device_id; +uint16_t pci_vendor_id; +uint8_t pci_bus; +uint8_t pci_device; +uint8_t pci_function; +uint32_t pci_flags; +uint8_t pci_segment; +uint32_t reserved2; +}; +#define ACPI_SPCR_ADDRESS 0x03F8UL + +/* * Multiple APIC Flags. */ #define ACPI_PCAT_COMPAT (1 0) @@ -351,6 +379,7 @@ struct acpi_20_madt_iosapic { #define ACPI_2_0_XSDT_SIGNATURE ASCII32('X','S','D','T') #define ACPI_2_0_TCPA_SIGNATURE ASCII32('T','C','P','A') #define ACPI_2_0_HPET_SIGNATURE ASCII32('H','P','E','T') +#define ACPI_2_0_SPCR_SIGNATURE ASCII32('S','P','C','R') /* * Table revision numbers. @@ -362,6 +391,7 @@ struct acpi_20_madt_iosapic { #define ACPI_2_0_XSDT_REVISION 0x01 #define ACPI_2_0_TCPA_REVISION 0x02 #define ACPI_2_0_HPET_REVISION 0x01 +#define ACPI_2_0_SPCR_REVISION 0x01 #pragma pack () diff -r 7097ce08e5be -r c5bbf82de136 edk2-sparse/EdkXenPkg/Dxe/XenAcpi/build.c --- a/edk2-sparse/EdkXenPkg/Dxe/XenAcpi/build.c Fri Mar 28 02:50:55 2008 +0100 +++ b/edk2-sparse/EdkXenPkg/Dxe/XenAcpi/build.c Fri Mar 28 14:25:23 2008 +0900 @@ -187,11 +187,53 @@ int construct_hpet(struct acpi_20_hpet * return offset; } +int construct_spcr(struct acpi_20_spcr *spcr) +{ +int offset; + +memset(spcr, 0, sizeof(*spcr)); +spcr-header.signature= ACPI_2_0_SPCR_SIGNATURE; +spcr-header.revision = ACPI_2_0_SPCR_REVISION; +strncpy(spcr-header.oem_id, ACPI_OEM_ID, 6); +strncpy(spcr-header.oem_table_id, ACPI_OEM_TABLE_ID, 8); +spcr-header.oem_revision = ACPI_OEM_REVISION; +spcr-header.creator_id = ACPI_CREATOR_ID; +spcr-header.creator_revision = ACPI_CREATOR_REVISION; +spcr-interface_type = 0; +spcr-addr.address_space_id = 1; +spcr-addr.register_bit_width = 8; +spcr-addr.register_bit_offset = 0; +spcr-addr.address = ACPI_SPCR_ADDRESS;; +spcr-interrupt_type = 5; +spcr-pc_interrupt = 4; +spcr-interrupt = 4; +spcr-baud_rate = 7; +spcr-parity = 0; +spcr-stop_bits = 1; +spcr-flow_control = 3; +spcr-terminal_type = 2; +spcr-pci_device_id = 0x; +spcr-pci_vendor_id = 0x; +spcr-pci_bus = 0; +spcr-pci_device = 0; +spcr-pci_function = 0; +spcr-pci_flags = 0; +spcr-pci_segment = 0; + +offset = sizeof(*spcr); + +spcr-header.length = offset; +set_checksum(spcr, offsetof(struct acpi_header, checksum), offset); + +return offset; +} + int construct_secondary_tables(uint8_t *buf, unsigned long *table_ptrs) { int offset = 0, nr_tables = 0; struct acpi_20_madt *madt; struct acpi_20_hpet *hpet; +struct acpi_20_spcr *spcr; #if 0 struct acpi_20_tcpa *tcpa; static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001}; @@ -210,6 +252,11 @@ int construct_secondary_tables(uint8_t * hpet = (struct acpi_20_hpet *)buf[offset]; offset += construct_hpet(hpet); table_ptrs[nr_tables++] = (unsigned long)hpet; + +/* SPCR. */ +spcr = (struct acpi_20_spcr *)buf[offset]; +offset += construct_spcr(spcr); +table_ptrs[nr_tables++] = (unsigned long)spcr; #if 0 /* TPM TCPA and SSDT. */ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] Re: [PATCH][OpenGFW] Fix bug in the Boot Maintenance Manager
Hi Tristan, Please add edk2-patches/fix_popup.patch file in your tree, which is also included in my patch. (please, note that I still prefer you submit a complete changeset. This avoids me to recreate the log message). I see. Thanks, KAZ From: Tristan Gingold [EMAIL PROTECTED] Subject: Re: [PATCH][OpenGFW] Fix bug in the Boot Maintenance Manager Date: Fri, 28 Mar 2008 02:46:19 +0100 On Tue, Mar 25, 2008 at 06:51:14PM +0900, SUZUKI Kazuhiro wrote: Hi Tristan, I found a bug in the Boot Maintenance Manager. When we select `Input the description' or `Input Optional Data' after the boot option is added, the guest domain panics. The following patch fixes it. Added. Thanks for the fix. (please, note that I still prefer you submit a complete changeset. This avoids me to recreate the log message). Tristan. ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][OpenGFW] Fix bug in the Boot Maintenance Manager
Hi Tristan, I found a bug in the Boot Maintenance Manager. When we select `Input the description' or `Input Optional Data' after the boot option is added, the guest domain panics. The following patch fixes it. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] fix_popup.patch.bz2 Description: Binary data ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][OpenGFW] Enable to handle xm trigger domain init
Hi Tristan, When `xm trigger domain init' is called, the guest domain panics on current OpenGFW. The following patch enables to send INIT to guest and to call INIT handlers(monarch and slave). Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 9e4b5bb76049 edk2-sparse/EdkXenPkg/Dxe/XenSal/Sal.c --- a/edk2-sparse/EdkXenPkg/Dxe/XenSal/Sal.cWed Feb 20 16:26:26 2008 +0900 +++ b/edk2-sparse/EdkXenPkg/Dxe/XenSal/Sal.cFri Mar 07 09:28:05 2008 +0900 @@ -3,10 +3,13 @@ #define BUILD_CMD(addr) ((0x8000 | (addr)) ~3) #define REG_OFFSET(addr) (0x00FF (addr)) -struct { +struct Fptr { UINT64 Ip; UINT64 Gp; } SalRendezVector; + +struct Fptr *SalMonarchInitVector = (struct Fptr *)0x8000ff80; +struct Fptr *SalSlaveInitVector = (struct Fptr *)0x8000ff90 ; STATIC EFI_SAL_STATUS @@ -108,11 +111,26 @@ SalProc return (SAL_RETURN_REGS) {EFI_SAL_INVALID_ARGUMENT, r9, r10, r11}; } status = EFI_SAL_SUCCESS; - } else if (FunctionId == EFI_SAL_SET_VECTORS - Arg2 == EFI_SAL_SET_BOOT_RENDEZ_VECTOR) { -SalRendezVector.Ip = Arg3; -SalRendezVector.Gp = Arg4; -status = EFI_SAL_SUCCESS; + } else if (FunctionId == EFI_SAL_SET_VECTORS) { +switch (Arg2) { +case EFI_SAL_SET_MCA_VECTOR: + return SalEmulator (FunctionId, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); +case EFI_SAL_SET_INIT_VECTOR: + SalMonarchInitVector-Ip = Arg3; + SalMonarchInitVector-Gp = Arg4; + SalSlaveInitVector-Ip = Arg6; + SalSlaveInitVector-Gp = Arg7; + + status = EFI_SAL_SUCCESS; + return SalEmulator (FunctionId, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); +case EFI_SAL_SET_BOOT_RENDEZ_VECTOR: + SalRendezVector.Ip = Arg3; + SalRendezVector.Gp = Arg4; + status = EFI_SAL_SUCCESS; + break; +default: + return (SAL_RETURN_REGS) {EFI_SAL_INVALID_ARGUMENT, r9, r10, r11}; +} } else { return SalEmulator (FunctionId, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); } diff -r 9e4b5bb76049 edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s --- a/edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s Wed Feb 20 16:26:26 2008 +0900 +++ b/edk2-sparse/EdkXenPkg/SecMain/Ipf/startup.s Wed Mar 12 14:31:06 2008 +0900 @@ -12,6 +12,26 @@ #define SCRATCH_REG5r28 #define SCRATCH_REG6r29 #define PR_REG r30 + +#defineUC_BIT (163) +#define IA64_IPI_DEFAULT_BASE_ADDR 0xfee0 +#define IA64_IPI_DM_INIT 0x5 + +/* + * Calculates percpu minstate address like `min_state + cpu_id * 0x200'. + * cr.lid is defined as follows. + * cr.lid = (id 24) | (eid 16) + * id and eid is set in EdkXenPkg/Dxe/XenAcpi/build.c. + * id = cpu_id + * eid = 0 + */ +#defineMINSTATE(reg,tmp) \ + mov tmp=cr.lid;;\ + extrtmp=tmp,24,8; \ + movlreg=min_state;; \ + ld8 reg=[reg]; \ + dep.z tmp=tmp,9,8;; \ + add reg=tmp,reg #define VECTOR(offset) \ .org base + offset ; \ @@ -943,6 +963,346 @@ 1:break 0 .endp _start + .align 16 + .globl _init + .proc _init +_init: + MINSTATE(r2,r3);; + mov r17=r2 // min_state + add r20=16,r2 + mov r19=ar.unat + ;; + st8.spill [r20]=r19,8 // @0 + ;; + st8.spill [r20]=r1,8 // @8 + ;; + st8.spill [r20]=r2,8 // @10 + ;; + st8.spill [r20]=r3,8 // @18 + ;; + st8.spill [r20]=r4,8 // @20 + ;; + st8.spill [r20]=r5,8 // @28 + ;; + st8.spill [r20]=r6,8 // @30 + ;; + st8.spill [r20]=r7,8 // @38 + ;; + st8.spill [r20]=r8,8 // @40 + ;; + st8.spill [r20]=r9,8 // @48 + ;; + st8.spill [r20]=r10,8 // @50 + ;; + st8.spill [r20]=r11,8 // @58 + ;; + st8.spill [r20]=r12,8 // @60 + ;; + st8.spill [r20]=r13,8 // @68 + ;; + st8.spill [r20]=r14,8 // @70 + ;; + add r9=8,r20 + st8.spill [r20]=r15 // @78 + ;; +bsw.0;; +srlz.d + + st8.spill [r9]=r16,8 // @80 + ;; + st8.spill [r9]=r17,8 // @88 + ;; + st8.spill [r9]=r18,8 // @90 + ;; + st8.spill [r9]=r19,8 // @98 + ;; + st8.spill [r9]=r20,8 // @a0 + ;; + st8.spill [r9]=r21,8 // @a8 + ;; + st8.spill [r9]=r22,8 // @b0 + ;; + st8.spill [r9]=r23,8 // @b8 + ;; + st8.spill [r9]=r24,8 // @c0 + ;; + st8.spill
Re: [Xen-ia64-devel] GFW release
Hi Tristan, [ I made this patch before adding INIT support. Should I make a new release ?] Please add INIT support to a binary release. I want you to release a new one. Thanks, KAZ From: Tristan Gingold [EMAIL PROTECTED] Subject: [Xen-ia64-devel] GFW release Date: Thu, 13 Mar 2008 13:46:27 +0100 Hi, I have just updated the GFW binary. Please test it. If it is OK, it will be used for the official GFW release. [ I made this patch before adding INIT support. Should I make a new release ?] Tristan. ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] Re: [PATCH 0/12] various fixes related the xen relocation
Hi Isaku, To be honest I didn't test the mca patch(). Kazuhiro, Could you please review and test it? I tested this, but it caused system hang. I have some questions and comments as follows. diff -r 8558c0017136 -r e532cad65b1c xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Tue Dec 18 15:38:46 2007 +0900 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Thu Dec 20 14:53:49 2007 +0900 @@ -479,14 +479,26 @@ ia64_reload_tr: ;; // 4. Reload DTR for stack. #ifdef XEN - // avoid overlapping with kernel TR - movl r17=KERNEL_START + // avoid overlapping with xenheap TR + mov r17=ip + ;; + tpa r17=r17 It is necessary to delete this line, because ip contains physical address. + ;; + dep r17=0,r17,0,KERNEL_TR_PAGE_SHIFT + ;; + shr.u r17=r17,IA64_GRANULE_SHIFT + ;; GET_THIS_PADDR(r2,cpu_kr);; add r2=IA64_KR_CURRENT_OFFSET,r2;; Is it IA64_KR_CURRENT_STACK_OFFSET? I think that [cpu_kr + IA64_KR_CURRENT_STACK_OFFSET] contains (physical address IA64_GRANULE_SHIFT). ld8 r16=[r2];; ;; - dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT - ;; +#if KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT +# error KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT shouldn't happen +#endif +#if KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT + dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT + ;; +#endif cmp.eq p7,p0=r17,r16 (p7) br.cond.sptk.reload_vhpt @@ -522,6 +534,25 @@ ia64_reload_tr: // 5. VHPT #if VHPT_ENABLED GET_VA_VCPU_VHPT_MADDR(r2,r3);; dep r2=0,r2,60,4;; This line should be inserted here, because GET_VA_VCPU_VHPT_MADDR(r2,r3) emulates the virtual address of vcpu_vhpt_maddr. + dep r3=0,r2,0,KERNEL_TR_PAGE_SHIFT + ;; + shr.u r3=r3,IA64_GRANULE_SHIFT + ;; + cmp.eq p7,p0=r3,r17 +(p7) br.cond.sptk.overlap_vhpt + ;; + + // avoid overlapping with stack TR + shr.u r17=r2,IA64_GRANULE_SHIFT + GET_THIS_PADDR(r3, cpu_kr);; + add r3=IA64_KR_CURRENT_STACK_OFFSET,r3 + ;; + ld8 r3=[r3] + ;; + cmp.eq p7,p0=r3,r17 +(p7) br.cond.sptk.overlap_vhpt + ;; + dep r16=0,r2,0,IA64_GRANULE_SHIFT movl r20=PAGE_KERNEL ;; @@ -538,6 +569,7 @@ ia64_reload_tr: ;; srlz.d ;; +.overlap_vhpt: #endif #endif br.sptk.many done_tlb_purge_and_reload I attached modified patch, and I confirmed this worked. Thanks. KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: [PATCH 0/12] various fixes related the xen relocation Date: Thu, 20 Dec 2007 16:37:04 +0900 When Xen was made relocatable, some code are broken. This patch set addresses on it. I went little further. Some of the assembler functions related to context switch maps stack, others doesn't. It isn't consistent. So there were two choice for consistency. My choice is mapping stacks. After that, it isn't necessary that stack is allocated from xenheap. Allocate stack from domheap, thus memory pressure on xenheap was reduced. To be honest I didn't test the mca patch(). Kazuhiro, Could you please review and test it? thanks diff -u xen/arch/ia64/linux-xen/mca_asm.S.orig xen/arch/ia64/linux-xen/mca_asm.S --- xen/arch/ia64/linux-xen/mca_asm.S.orig 2007-12-21 18:11:11.0 +0900 +++ xen/arch/ia64/linux-xen/mca_asm.S 2007-12-21 18:21:30.0 +0900 @@ -482,32 +482,26 @@ // avoid overlapping with xenheap TR mov r17=ip ;; - tpa r17=r17 - ;; dep r17=0,r17,0,KERNEL_TR_PAGE_SHIFT ;; shr.u r17=r17,IA64_GRANULE_SHIFT ;; - GET_THIS_PADDR(r2,cpu_kr);; - add r2=IA64_KR_CURRENT_OFFSET,r2;; - ld8 r16=[r2];; + // Kernel registers are saved in a per_cpu cpu_kr_ia64_t + // to allow the kernel registers themselves to be used by domains. + GET_THIS_PADDR(r2, cpu_kr);; + add r2=IA64_KR_CURRENT_STACK_OFFSET,r2 + ;; + ld8 r16=[r2] ;; #if KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT # error KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT shouldn't happen #endif #if KERNEL_TR_PAGE_SHIFT IA64_GRANULE_SHIFT - dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT + dep r18=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT ;; #endif - cmp.eq p7,p0=r17,r16 + cmp.eq p7,p0=r17,r18 (p7) br.cond.sptk.reload_vhpt - - // Kernel registers are saved in a per_cpu cpu_kr_ia64_t - // to allow the kernel registers themselves to be used by domains. - GET_THIS_PADDR(r2, cpu_kr);; - add r2=IA64_KR_CURRENT_STACK_OFFSET,r2 - ;; - ld8 r16=[r2] #else mov r16=IA64_KR(CURRENT_STACK) #endif @@ -535,6 +529,9 @@ #if VHPT_ENABLED GET_VA_VCPU_VHPT_MADDR(r2,r3);; dep r3=0,r2,0,KERNEL_TR_PAGE_SHIFT + ;; +
[Xen-ia64-devel] [PATCH] Fix ia64_sal_get_state_info() emulation bug
Hi all, It is possible to double-free the sal queue entry when the multiple ia64_sal_get_state_info() from Dom0 are called simulteniously. In the worst case, the kernel might do a panic. The attached patch fixes it. Thanks. KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r a07288a84785 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Tue Oct 30 15:34:44 2007 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Wed Oct 31 13:22:08 2007 +0900 @@ -242,6 +242,8 @@ sal_emulator (long index, unsigned long } e = list_entry(sal_queue[in1].next, sal_queue_entry_t, list); + + list_del(e-list); spin_unlock_irqrestore(sal_queue_lock, flags); IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s = %s) @@ -277,10 +279,12 @@ sal_emulator (long index, unsigned long r9 = arg.ret; status = arg.status; if (r9 == 0) { + xfree(e); + } else { + /* Re-add the entry to sal_queue */ spin_lock_irqsave(sal_queue_lock, flags); - list_del(e-list); + list_add(e-list, sal_queue[in1]); spin_unlock_irqrestore(sal_queue_lock, flags); - xfree(e); } } else { status = IA64_SAL_NO_INFORMATION_AVAILABLE; @@ -316,10 +320,10 @@ sal_emulator (long index, unsigned long on CPU#%d.\n, rec_name[e-sal_info_type], rec_name[in1], e-cpuid); - arg.type = e-sal_info_type; arg.status = 0; + if (e-cpuid == smp_processor_id()) { IA64_SAL_DEBUG(SAL_CLEAR_STATE_INFO: local\n); clear_state_info_on(arg); ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH] Fix MCA error handler problems (was: Re: [patch 06/12] Kexec: Fix ia64_do_tlb_purge so that it works with XEN)
Hi Simon, I tested MCA error handler with your patch, then some problems were found. 2. Use the per_cpu variable to derive CURRENT_STACK_OFFSET rather than reading it from a kernel register. See 1) for explanation of why. I added the same code in Reload DTR for stack part and also added a code to avoid overlapping with kernel TR. 3. In the VHPT pruning code, don't use r25 as ia64_jump_to_sal, which branches to ia64_do_tlb_purge expects r25 to be preserved. There seems no reason not to use r2 as per the other purges done in ia64_do_tlb_purge. Furthermore use r16 and r18 instead of r20 and r24 for consistency reasons. The r25 kept the value of __va_ul(vcpu_vhpt_maddr(v)), and it was referred to by the following lines. 468 // r25 = __va_ul(vcpu_vhpt_maddr(v)); 469 dep r20=0,r25,0,IA64_GRANULE_SHIFT 470 movl r26=PAGE_KERNEL 471 ;; 472 mov r21=IA64_TR_VHPT 473 dep r22=0,r20,60,4 // physical address of I defined GET_VA_VCPU_VHPT_MADDR() macro to re-calculate the value of __va_ul(vcpu_vhpt_maddr(v)) in each part. And I renamed the register names for same reasons. I attached a patch that contains those fixes. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Simon Horman [EMAIL PROTECTED] Subject: [patch 06/12] Kexec: Fix ia64_do_tlb_purge so that it works with XEN Date: Thu, 27 Sep 2007 17:17:20 +0900 Fix ia64_do_tlb_purge, its broken in too many ways 1. Call SET_PER_CPU_DATA before making any calls to GET_THIS_PADDR to ensure that per-cpu data is set up correctly. 2. Use the per_cpu variable to derive CURRENT_STACK_OFFSET rather than reading it from a kernel register. See 1) for explanation of why. 3. In the VHPT pruning code, don't use r25 as ia64_jump_to_sal, which branches to ia64_do_tlb_purge expects r25 to be preserved. There seems no reason not to use r2 as per the other purges done in ia64_do_tlb_purge. Furthermore use r16 and r18 instead of r20 and r24 for consistency reasons. 4. Move __va_ul(vcpu_vhpt_maddr(v)) comment outside of #if VHPT_ENABLED as it also applies to code further down that is outside the #if Cc: Tristan Gingold [EMAIL PROTECTED], Cc: Yutaka Ezaki [EMAIL PROTECTED], Cc: Masaki Kanno [EMAIL PROTECTED], Cc: Kazuhiro Suzuki [EMAIL PROTECTED], Signed-off-by: Simon Horman [EMAIL PROTECTED] --- Date: Thu, 13 Sep 2007 15:31:43 +0900 From: Horms [EMAIL PROTECTED] Fixes as suggested by SUZUKI Kazuhiro: - Fix up comment relating to the use of SET_PER_CPU_DATA - it was describing a previous version of the fix. - 2.6.18 does perge the DTR for PERCPU data, so there is no need to guard it with #ifdef XEN, although later kernels do remove this code - Dereference what is at offset IA64_DOMAIN_FLAGS_OFFSET Index: xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S === --- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/mca_asm.S2007-07-11 12:05:33.0 +0900 +++ xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S 2007-07-11 13:13:56.0 +0900 @@ -195,6 +195,10 @@ */ ia64_do_tlb_purge: +#ifdef XEN + // This needs to be called in order for GET_THIS_PADDR to work + SET_PER_CPU_DATA();; +#endif #define O(member)IA64_CPUINFO_##member##_OFFSET GET_THIS_PADDR(r2, cpu_info)// load phys addr of cpu_info into r2 @@ -263,7 +269,16 @@ ia64_do_tlb_purge: srlz.i ;; // 4. Purge DTR for stack. +#ifdef XEN + // Kernel registers are saved in a per_cpu cpu_kr_ia64_t + // to allow the kernel registers themselves to be used by domains. + GET_THIS_PADDR(r2, cpu_kr);; + add r2=IA64_KR_CURRENT_STACK_OFFSET,r2 + ;; + ld8 r16=[r2] +#else mov r16=IA64_KR(CURRENT_STACK) +#endif ;; shl r16=r16,IA64_GRANULE_SHIFT movl r19=PAGE_OFFSET @@ -277,8 +292,8 @@ ia64_do_tlb_purge: ;; #ifdef XEN // 5. VHPT + // r2 = __va_ul(vcpu_vhpt_maddr(v)); #if VHPT_ENABLED - // r25 = __va_ul(vcpu_vhpt_maddr(v)); GET_THIS_PADDR(r2,cpu_kr);; add r2=IA64_KR_CURRENT_OFFSET,r2;; ld8 r2=[r2];; @@ -289,18 +304,18 @@ ia64_do_tlb_purge: add r2=IA64_VCPU_VHPT_MADDR_OFFSET,r2;; dep r2=0,r2,60,4;; // virtual to physical ld8 r2=[r2];; - dep r25=-1,r2,60,4;;// physical to virtual + dep r2=-1,r2,60,4;; // physical to virtual br.sptk .percpu_vhpt_done #endif .not_pervcpu_vhpt: GET_THIS_PADDR(r2, vhpt_paddr);; ld8 r2=[r2];; - dep r25=-1,r2,60,4;;// physical to virtual + dep r2=-1,r2,60,4;; // physical to virtual .percpu_vhpt_done: - dep r20=0,r25,0,IA64_GRANULE_SHIFT - mov r24=IA64_GRANULE_SHIFT2 + dep r16=0,r2,0,IA64_GRANULE_SHIFT + mov r18
Re: [Xen-ia64-devel] does xen support MCA now?
Hi Anthony, Sorry, I didn't see xen_mca handler purge and reload TLB in latest changeset. The code is commented out. Maybe I miss something, could you elaborate it? TLB purge and reload code is in xen/arch/ia64/linux-xen/mca_asm.S 367 // The following code purges TC and TR entries. Then reload all TC entries. 368 // Purge percpu data TC entries. 369 begin_tlb_purge_and_reload: 370 movl r18=ia64_reload_tr;; 371 LOAD_PHYSICAL(p0,r18,ia64_reload_tr);; 372 mov b1=r18;; 373 br.sptk.many ia64_do_tlb_purge;; 374 My understanding is, corrected platform MCA is CPE, and this MCA should have been corrected by firmware ( PAL or SAL), CPE interrupt is just used to inform OS something has happened. Uncorrected platform MCA still invoke OS_MCA, it still rendezvous other processors. TLB-related uncorrected MCA is recoverd in xen_mca handler. But when the other uncorrected MCA happens, it just causes system reset. The other error recoveries are not implemented yet. Thanks, KAZ From: Xu, Anthony [EMAIL PROTECTED] Subject: RE: [Xen-ia64-devel] does xen support MCA now? Date: Fri, 21 Sep 2007 09:01:08 +0800 1. If this is a TLB-related MCA, when xen_mca handler returns to guest, this MCA may happen again. When a TLB-relate MCA is occured, xen_mca handler tries to purge and reload TLB. In the current implementation, MCA is logged in dom0 but there is no way to notify the guest who caused it. Sorry, I didn't see xen_mca handler purge and reload TLB in latest changeset. The code is commented out. Maybe I miss something, could you elaborate it? 1216 /* TLB error is only exist in this SAL error record */ 1217 recover = (psp-tc !(psp-cc || psp-bc || psp-rc || psp-uc)) 1218 /* other error recovery */ 1219 #ifndef XEN 1220|| (ia64_mca_ucmc_extension 1221 ia64_mca_ucmc_extension( 1222 IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA), 1223 ia64_sal_to_os_handoff_state, 1224 ia64_os_to_sal_handoff_state)); 1225 #else 2. If this is a platform MCA, other pCPUs wakened up may trigger this again. The platform MCA(CPE) is handled as correctable error. The other pCPUs are not rendezvoused. Are all platform MCAs belonging to CPE? My understanding is, corrected platform MCA is CPE, and this MCA should have been corrected by firmware ( PAL or SAL), CPE interrupt is just used to inform OS something has happened. Uncorrected platform MCA still invoke OS_MCA, it still rendezvous other processors. - Anthony ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] does xen support MCA now?
Hi Anthony, We implemented MCA handler based on the following design memo. http://lists.xensource.com/archives/html/xen-ia64-devel/2006-07/msg00166.html 1. If this is a TLB-related MCA, when xen_mca handler returns to guest, this MCA may happen again. When a TLB-relate MCA is occured, xen_mca handler tries to purge and reload TLB. In the current implementation, MCA is logged in dom0 but there is no way to notify the guest who caused it. 2. If this is a platform MCA, other pCPUs wakened up may trigger this again. The platform MCA(CPE) is handled as correctable error. The other pCPUs are not rendezvoused. Thanks, KAZ From: Xu, Anthony [EMAIL PROTECTED] Subject: RE: [Xen-ia64-devel] does xen support MCA now? Date: Thu, 20 Sep 2007 13:55:07 +0800 Hi akio, I just looked over the INIT/MCA mechanism. And have some questions. The process is like following, 1. xen_mca handler gets control, at this time all other pCPUs are rendezvoused at SAL. 2. xen_mca handler get MCA log from SAL and copy it inot dom0's log buffer. 3. xen_mca handler wake up all others pCPU, and return. Questions: 1. If this is a TLB-related MCA, when xen_mca handler returns to guest, this MCA may happen again. 2. If this is a platform MCA, other pCPUs wakened up may trigger this again. Can you explain how to handle this? Thanks, - Anthony -Original Message- From: [EMAIL PROTECTED] [mailto:xen-ia64-devel- [EMAIL PROTECTED] On Behalf Of Akio Takebe Sent: Thursday, September 13, 2007 10:51 AM To: Duan, Ronghui; xen-ia64-devel Subject: Re: [Xen-ia64-devel] does xen support MCA now? Hi, Ronghui Yes, xen-ia64 support MCA. What is the use of code mca.c in directory xen-unstable.hg/xen/arch/ia64/linux-xen? Thanks! Xen use it for INIT/MCA. Xen get the MCA log from SAL and copy it into dom0's log buffer. FYI, Xen will use it for kexec-ia64. Best Regards, Akio Takebe ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [patch 07/14] Kexec: Fix ia64_do_tlb_purge so that it works with XEN
Hi Simon, I have some comments. 1. Make all calls to GET_THIS_PADDR before purging the DTR for PERCPU. This is because the kernel registers are saved in per_cpu data to allow the real kernel registers to be used by domains. I did not notice that ia64_do_tlb_purge is called from ia64_jump_to_sal. SET_PER_CPU_DATA() is called in ia64_os_mca_dispatch that calls ia64_do_tlb_purge, because SET_PER_CPU_DATA() has to be called once. 2. Wrap the purging of the DTR for PERCPU in #ifdef XEN as Linux doesn't seem to do this (any more?) The following lines are found in Linux tree. arch/ia64/kernel/mca_asm.S: 104 // 2. Purge DTR for PERCPU data. 105 movl r16=PERCPU_ADDR 106 mov r18=PERCPU_PAGE_SHIFT2 107 ;; 108 ptr.d r16,r18 109 ;; 110 srlz.d 111 ;; Isn't it such a meaning? 4. Fix VHPT purging code to treat what is at the IA64_DOMAIN_FLAGS_OFFSET offset as a litteral value (flag) rather than a pointer to a literal. Suppose that, struct domain *dom = 0xf7ccc080; IA64_DOMAIN_FLAGS_OFFSET= 0x688 And I show how the value of r3 becomes since each instruction is executed. @@ -289,25 +304,24 @@ ia64_do_tlb_purge: ld8 r3=[r3];; // r3=0xf7ccc080 virtual address of dom dep r3=0,r3,60,4;; // r3=0x07ccc080 physical address of dom add r3=IA64_DOMAIN_FLAGS_OFFSET,r3;; // r3=0x07ccc708 physical address of dom-arch.flags ld8 r3=[r3];; // r3=2 load the value of domain-arch.flags So 'r3=[r3]' is necessary. Thanks, KAZ From: Simon Horman [EMAIL PROTECTED] Subject: [Xen-ia64-devel] [patch 07/14] Kexec: Fix ia64_do_tlb_purge so that it works with XEN Date: Wed, 12 Sep 2007 17:08:52 +0900 Fix ia64_do_tlb_purge, its broken in too many ways 1. Make all calls to GET_THIS_PADDR before purging the DTR for PERCPU. This is because the kernel registers are saved in per_cpu data to allow the real kernel registers to be used by domains. 2. Wrap the purging of the DTR for PERCPU in #ifdef XEN as Linux doesn't seem to do this (any more?) 3. Use the per_cpu variable to derive CURRENT_STACK_OFFSET rather than reading it from a kernel register. See 1) for explanation of why. 4. Fix VHPT purging code to treat what is at the IA64_DOMAIN_FLAGS_OFFSET offset as a litteral value (flag) rather than a pointer to a literal. 5. In the VHPT pruning code, don't use r25 as ia64_jump_to_sal, which branches to ia64_do_tlb_purge expects r25 to be preserved. There seems no reason not to use r2 as per the other purges done in ia64_do_tlb_purge. Furthermore use r16 and r18 instead of r20 and r24 for consistency reasons. 6. Move __va_ul(vcpu_vhpt_maddr(v)) comment outside of #if VHPT_ENABLED as it also applies to code further down that is outside the #if 7. There is no 7th change Cc: Tristan Gingold [EMAIL PROTECTED], Cc: Yutaka Ezaki [EMAIL PROTECTED], Cc: Masaki Kanno [EMAIL PROTECTED], Cc: Kazuhiro Suzuki [EMAIL PROTECTED], Signed-off-by: Simon Horman [EMAIL PROTECTED] Index: xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S === --- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/mca_asm.S2007-07-11 12:05:33.0 +0900 +++ xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S 2007-07-11 13:13:56.0 +0900 @@ -195,6 +195,10 @@ */ ia64_do_tlb_purge: +#ifdef XEN + // This needs to be called in order for GET_THIS_PADDR to work + SET_PER_CPU_DATA();; +#endif #define O(member)IA64_CPUINFO_##member##_OFFSET GET_THIS_PADDR(r2, cpu_info)// load phys addr of cpu_info into r2 @@ -244,6 +248,7 @@ ia64_do_tlb_purge: ;; srlz.d ;; +#ifdef XEN // 2. Purge DTR for PERCPU data. movl r16=PERCPU_ADDR mov r18=PERCPU_PAGE_SHIFT2 @@ -252,6 +257,7 @@ ia64_do_tlb_purge: ;; srlz.d ;; +#endif // 3. Purge ITR for PAL code. GET_THIS_PADDR(r2, ia64_mca_pal_base) ;; @@ -263,7 +269,16 @@ ia64_do_tlb_purge: srlz.i ;; // 4. Purge DTR for stack. +#ifdef XEN + // Kernel registers are saved in a per_cpu cpu_kr_ia64_t + // to allow the kernel registers themselves to be used by domains. + GET_THIS_PADDR(r2, cpu_kr);; + add r2=IA64_KR_CURRENT_STACK_OFFSET,r2 + ;; + ld8 r16=[r2] +#else mov r16=IA64_KR(CURRENT_STACK) +#endif ;; shl r16=r16,IA64_GRANULE_SHIFT movl r19=PAGE_OFFSET @@ -277,8 +292,8 @@ ia64_do_tlb_purge: ;; #ifdef XEN // 5. VHPT + // r2 = __va_ul(vcpu_vhpt_maddr(v)); #if VHPT_ENABLED - // r25 = __va_ul(vcpu_vhpt_maddr(v)); GET_THIS_PADDR(r2,cpu_kr);; add r2=IA64_KR_CURRENT_OFFSET,r2;; ld8 r2=[r2];; @@ -289,25 +304,24 @@ ia64_do_tlb_purge: ld8
[Xen-ia64-devel] Re: [PATCH][MCA] avoid allocating memory in interrupt context
Hi Alex, Sorry, I made a patch to take out vfree() outside of IRQ disabled. I checked that the call trace did not come out on the SMP Dom0. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [PATCH][MCA] avoid allocating memory in interrupt context (was Re: [Xen-ia64-devel] [PATCH 2/3] xencomm consolidation: linux side) Date: Tue, 04 Sep 2007 10:37:06 -0600 On Sun, 2007-09-02 at 16:04 -0600, Alex Williamson wrote: On Tue, 2007-08-28 at 20:48 +0900, SUZUKI Kazuhiro wrote: Hi, The attached patch fixes to avoid allocating memory in interrupt context. I tried to allocate xencomm_handle in IA64_LOG_ALLOCATE instead of allocating each time. Applied. Thanks, Oops, looks like this introduced another problem: BUG: warning at /home/awilliam/xen/20070902-patches/linux-2.6.18-xen.hg/arch/ia64/kernel/smp.c:341/smp_call_function() Call Trace: [a0010001d520] show_stack+0x40/0xa0 sp=e001b51cfb70 bsp=e001b51c9588 [a0010001d5b0] dump_stack+0x30/0x60 sp=e001b51cfd40 bsp=e001b51c9570 [a00100061b40] smp_call_function+0x180/0x440 sp=e001b51cfd40 bsp=e001b51c9528 [a00100094fe0] on_each_cpu+0x40/0x1c0 sp=e001b51cfd60 bsp=e001b51c94f0 [a00100060ed0] smp_flush_tlb_all+0x30/0x60 sp=e001b51cfd60 bsp=e001b51c94d8 [a00100115250] unmap_vm_area+0x390/0x440 sp=e001b51cfd60 bsp=e001b51c9490 [a00100115390] __remove_vm_area+0x90/0x100 sp=e001b51cfd70 bsp=e001b51c9458 [a00100115430] remove_vm_area+0x30/0x80 sp=e001b51cfd70 bsp=e001b51c9430 [a001001154f0] __vunmap+0x70/0x280 sp=e001b51cfd70 bsp=e001b51c9400 [a00100115950] vfree+0x90/0xc0 sp=e001b51cfd70 bsp=e001b51c93d8 [a0010003ba40] salinfo_log_release+0x140/0x260 sp=e001b51cfd70 bsp=e001b51c93a8 ... We can't vfree() with IRQs disabled. Can you please find an alternate algorithm for freeing the log area and submit a follow up patch? Thanks, Alex -- Alex Williamson HP Open Source Linux Org. diff -r df2d73ab847a arch/ia64/kernel/salinfo.c --- a/arch/ia64/kernel/salinfo.cTue Aug 28 12:44:22 2007 -0600 +++ b/arch/ia64/kernel/salinfo.cThu Sep 06 12:29:32 2007 +0900 @@ -408,6 +408,7 @@ salinfo_log_release(struct inode *inode, #ifdef CONFIG_XEN if (is_running_on_xen()) { struct list_head *pos, *n; + ia64_mca_xencomm_t *found_entry = NULL; unsigned long flags; spin_lock_irqsave(ia64_mca_xencomm_lock, flags); @@ -417,10 +418,15 @@ salinfo_log_release(struct inode *inode, entry = list_entry(pos, ia64_mca_xencomm_t, list); if (entry-record == data-log_buffer) { list_del(entry-list); - vfree(entry); + found_entry = entry; + break; } } spin_unlock_irqrestore(ia64_mca_xencomm_lock, flags); + if (found_entry) { + xencomm_free(found_entry-handle); + vfree(found_entry); + } } #endif vfree(data-log_buffer); ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[PATCH][MCA] avoid allocating memory in interrupt context (was Re: [Xen-ia64-devel] [PATCH 2/3] xencomm consolidation: linux side)
Hi, The attached patch fixes to avoid allocating memory in interrupt context. I tried to allocate xencomm_handle in IA64_LOG_ALLOCATE instead of allocating each time. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 2/3] xencomm consolidation: linux side Date: Mon, 20 Aug 2007 12:52:02 +0900 Hi Kaz. You may want to test the following hank. Although I didn't change the logic, but it certainly needs fix. NOTE: [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 http://lists.xensource.com/archives/html/xen-ia64-devel/2006-11/msg00358.html http://lists.xensource.com/archives/html/xen-ia64-devel/2006-11/msg00362.html On Thu, Aug 16, 2007 at 12:21:04PM +0900, Isaku Yamahata wrote: diff -r 3470a432a082 -r ea78d46a2ea0 include/asm-ia64/sal.h --- a/include/asm-ia64/sal.hTue Aug 07 16:54:04 2007 +0900 +++ b/include/asm-ia64/sal.hThu Aug 16 11:55:08 2007 +0900 @@ -701,9 +701,9 @@ ia64_sal_get_state_info (u64 sal_info_ty if (is_running_on_xen()) { struct xencomm_handle *desc; - if (xencomm_create(sal_info, - ia64_sal_get_state_info_size(sal_info_type), - desc, GFP_KERNEL)) + desc = xencomm_map(sal_info, + ia64_sal_get_state_info_size(sal_info_type)); + if (desc == NULL) return 0; SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, -- yamahata diff -r 057b47cada5c arch/ia64/kernel/mca.c --- a/arch/ia64/kernel/mca.cThu Aug 23 15:18:40 2007 -0600 +++ b/arch/ia64/kernel/mca.cTue Aug 28 19:43:33 2007 +0900 @@ -160,11 +160,33 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifdef CONFIG_XEN +DEFINE_SPINLOCK(ia64_mca_xencomm_lock); +LIST_HEAD(ia64_mca_xencomm_list); + +#define IA64_MCA_XENCOMM_ALLOCATE(rec, desc) \ + if (is_running_on_xen()) { \ + ia64_mca_xencomm_t *entry; \ + entry = alloc_bootmem(sizeof(ia64_mca_xencomm_t)); \ + entry-record = rec; \ + entry-handle = desc; \ + list_add(entry-list, ia64_mca_xencomm_list); \ + } +#define IA64_LOG_ALLOCATE(it, size) \ + {ia64_err_rec_t *rec; \ + ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = rec = \ + (ia64_err_rec_t *)alloc_bootmem(size); \ + IA64_MCA_XENCOMM_ALLOCATE(rec, xencomm_map(rec, size)); \ + ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = rec = \ + (ia64_err_rec_t *)alloc_bootmem(size); \ + IA64_MCA_XENCOMM_ALLOCATE(rec, xencomm_map(rec, size));} +#else #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size); \ ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size);} +#endif #define IA64_LOG_LOCK_INIT(it) spin_lock_init(ia64_state_log[it].isl_lock) #define IA64_LOG_LOCK(it) spin_lock_irqsave(ia64_state_log[it].isl_lock, s) #define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(ia64_state_log[it].isl_lock,s) diff -r 057b47cada5c arch/ia64/kernel/salinfo.c --- a/arch/ia64/kernel/salinfo.cThu Aug 23 15:18:40 2007 -0600 +++ b/arch/ia64/kernel/salinfo.cTue Aug 28 19:45:39 2007 +0900 @@ -375,6 +375,20 @@ salinfo_log_open(struct inode *inode, st data-open = 0; return -ENOMEM; } +#ifdef CONFIG_XEN + if (is_running_on_xen()) { + ia64_mca_xencomm_t *entry; + unsigned long flags; + + entry = vmalloc(sizeof(ia64_mca_xencomm_t)); + entry-record = data-log_buffer; + entry-handle = xencomm_map(data-log_buffer, + ia64_sal_get_state_info_size(data-type)); + spin_lock_irqsave(ia64_mca_xencomm_lock, flags); + list_add(entry-list, ia64_mca_xencomm_list); + spin_unlock_irqrestore(ia64_mca_xencomm_lock, flags); + } +#endif return 0; } @@ -386,6 +400,24 @@ salinfo_log_release(struct inode *inode, struct salinfo_data *data = entry-data; if (data-state == STATE_NO_DATA) { +#ifdef CONFIG_XEN + if (is_running_on_xen()) { + struct list_head *pos, *n; + unsigned long flags; + + spin_lock_irqsave(ia64_mca_xencomm_lock, flags); + list_for_each_safe(pos, n, ia64_mca_xencomm_list) { + ia64_mca_xencomm_t *entry; + + entry = list_entry(pos, ia64_mca_xencomm_t, list); + if (entry-record == data-log_buffer) { +
[Xen-ia64-devel] [PATCH] Fix typo in xen/arch/ia64/linux-xen/perfmon.c
Hi all, I found the disunity of error messages and typo in perfmon.c. This patch fixes it. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r f378c424e0ce xen/arch/ia64/linux-xen/perfmon.c --- a/xen/arch/ia64/linux-xen/perfmon.c Tue Apr 03 13:04:51 2007 -0600 +++ b/xen/arch/ia64/linux-xen/perfmon.c Thu Apr 05 17:03:33 2007 +0900 @@ -7471,8 +7471,8 @@ xenpfm_context_load(XEN_GUEST_HANDLE(pfa spin_unlock(xenpfm_context_lock); for_each_online_cpu(cpu) { if (arg.error[cpu]) { - gdprintk(XENLOG_INFO, %s: error %d cpu %d\n, -__func__, error, cpu); + gdprintk(XENLOG_INFO, %s: cpu %d error %d\n, +__func__, cpu, arg.error[cpu]); error = arg.error[cpu]; } } @@ -7518,8 +7518,8 @@ xenpfm_context_unload(void) spin_unlock(xenpfm_context_lock); for_each_online_cpu(cpu) { if (arg.error[cpu]) { - gdprintk(XENLOG_INFO, %s: error %d cpu %d\n, -__func__, error, cpu); + gdprintk(XENLOG_INFO, %s: cpu %d error %d\n, +__func__, cpu, arg.error[cpu]); error = arg.error[cpu]; } } @@ -7699,7 +7699,7 @@ xenpfm_start_stop_locked(int is_start) local_irq_restore(flags); for_each_online_cpu(cpu) { - if (!arg.error[cpu]) { + if (arg.error[cpu]) { gdprintk(XENLOG_INFO, %s: cpu %d error %d\n, __func__, cpu, arg.error[cpu]); error = arg.error[cpu]; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH] Fix a bug in xencomm_copy_from/to_guest()
Hi Isaku, Thank you for your comment. It seems good. I think that your patch is better. Thanks, KAZ From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH] Fix a bug in xencomm_copy_from/to_guest() Date: Wed, 27 Dec 2006 19:16:16 +0900 Hi Kaz. On Wed, Dec 27, 2006 at 06:27:26PM +0900, SUZUKI Kazuhiro wrote: diff -r 80c5b5914b79 xen/arch/ia64/xen/xencomm.c --- a/xen/arch/ia64/xen/xencomm.c Wed Dec 20 14:55:02 2006 -0700 +++ b/xen/arch/ia64/xen/xencomm.c Wed Dec 27 18:03:10 2006 +0900 @@ -148,6 +148,13 @@ xencomm_copy_from_guest( pgoffset = src_paddr % PAGE_SIZE; chunksz = PAGE_SIZE - pgoffset; +if (chunksz = skip) { +from_pos += chunksz; +skip -= chunksz; +i++; +continue; +} + chunk_skip = min(chunksz, skip); from_pos += chunk_skip; chunksz -= chunk_skip; This condition looks odd. I guess the issues which you've seen is calling xencomm_copy_chunk_{to, from} with len = 0. (If I'm wrong, correct me.) The patch should looks like as follows. And xen/common/xencomm.c should modified similary too. --- xen/arch/ia64/xen/xencomm.c 2006-12-21 12:05:05.0 +0900 +++ xen/arch/ia64/xen/xencomm.c.new 2006-12-27 19:12:19.0 +0900 @@ -153,7 +153,7 @@ xencomm_copy_from_guest( chunksz -= chunk_skip; skip -= chunk_skip; -if (skip == 0) { +if (skip == 0 chunksz 0) { unsigned int bytes = min(chunksz, n - to_pos); int res; @@ -295,7 +295,7 @@ xencomm_copy_to_guest( skip -= chunk_skip; dest_paddr += chunk_skip; -if (skip == 0) { +if (skip == 0 chunksz 0) { unsigned int bytes = min(chunksz, n - from_pos); int res; -- yamahata ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi Isaku, Thank you for your comment. I attached a modified patch following to your comment. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Isaku Yamahata [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Tue, 28 Nov 2006 13:43:42 +0900 Hi Kazuhiro. ia64_sal_get_state_info() can be called in interrupt context so that GFP_KERNEL shouldn't be used. irq_safe argument of ia64_log_get() should be checked? On Wed, Nov 08, 2006 at 07:24:16PM +0900, SUZUKI Kazuhiro wrote: --- a/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-09-13 03:02:10.0 +0900 +++ b/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-11-08 16:02:49.0 +0900 @@ -42,6 +42,9 @@ #include asm/pal.h #include asm/system.h #include asm/fpu.h +#ifdef CONFIG_XEN +#include asm/xen/xencomm.h +#endif extern spinlock_t sal_lock; @@ -686,10 +689,28 @@ /* Get the processor and platform information logged by SAL with respect to the machine * state at the time of the MCAs, INITs, CMCs, or CPEs. */ +#ifdef CONFIG_XEN +static inline u64 ia64_sal_get_state_info_size (u64 sal_info_type); +#endif + static inline u64 ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info) { struct ia64_sal_retval isrv; +#ifdef CONFIG_XEN + if (is_running_on_xen()) { + struct xencomm_handle *desc; + + if (xencomm_create(sal_info, + ia64_sal_get_state_info_size(sal_info_type), + desc, GFP_KERNEL)) + return 0; + + SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, + desc, 0, 0, 0, 0); + xencomm_free(desc); + } else +#endif SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, sal_info, 0, 0, 0, 0); if (isrv.status) -- yamahata diff -r 7e7846ea4ab3 linux-2.6-xen-sparse/include/asm-ia64/sal.h --- a/linux-2.6-xen-sparse/include/asm-ia64/sal.h Mon Nov 27 10:10:57 2006 -0700 +++ b/linux-2.6-xen-sparse/include/asm-ia64/sal.h Thu Nov 30 10:52:00 2006 +0900 @@ -703,7 +703,7 @@ ia64_sal_get_state_info (u64 sal_info_ty if (xencomm_create(sal_info, ia64_sal_get_state_info_size(sal_info_type), - desc, GFP_KERNEL)) + desc, GFP_ATOMIC)) return 0; SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH][MCA] Fix dom0 fails with nomca option
Hi all, When nomca is specified to Xen and salinfod is started on dom0, table lookup failed exception is occured. This patch fixes it. Thanks, KAZ Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 7e7846ea4ab3 xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Mon Nov 27 10:10:57 2006 -0700 +++ b/xen/arch/ia64/linux-xen/mca.c Wed Nov 29 14:03:21 2006 +0900 @@ -155,7 +155,11 @@ static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); +#ifdef XEN +int mca_init; +#else static int mca_init; +#endif /* * IA64_MCA log support @@ -1606,7 +1610,7 @@ ia64_mca_cpu_init(void *cpu_data) } } #ifdef XEN - else { + else if (mca_init) { int i; for (i = 0; i IA64_MAX_LOG_TYPES; i++) ia64_log_queue(i, 0); diff -r 7e7846ea4ab3 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Mon Nov 27 10:10:57 2006 -0700 +++ b/xen/arch/ia64/xen/fw_emul.c Tue Nov 28 18:29:22 2006 +0900 @@ -65,6 +65,7 @@ struct smp_call_args_t { void *data; }; +extern int mca_init; extern sal_log_record_header_t *sal_record; DEFINE_SPINLOCK(sal_record_lock); @@ -213,7 +214,7 @@ sal_emulator (long index, unsigned long struct smp_call_args_t arg; spin_lock_irqsave(sal_queue_lock, flags); - if (list_empty(sal_queue[in1])) { + if (!mca_init || list_empty(sal_queue[in1])) { sal_log_record_header_t header; XEN_GUEST_HANDLE(void) handle = *(XEN_GUEST_HANDLE(void)*)in3; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] MCA patches causing Xen to hang on sn2
Hi Jes, I tried this and attached the output below. I was wondering why we seem to allocate pages to MCA handlers on 64 processors even if we only boot 8, but thats a detail. It's OK. The mca_data is allocated up to NR_CPUS(=64) in MCA initialization routine. And I think that your system will boot up if nomca is specified in boot parameters. This didn't make any difference :( Please confirm whether to have specified nomca for not only the Domain0 boot parameter but also Xen. And please send me a boot log with nomca too. Thanks, KAZ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, Sorry, there was a mistake in the patch I sent before, please replace `mca-mca.patch' with the attached patch. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: SUZUKI Kazuhiro [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Wed, 08 Nov 2006 19:24:16 +0900 (JST) Hi Alex, I attached updated patches as follows. [mca-mca.patch] It was clarified that mod_timer() should not be defined to set_timer(). These timer resolutions are incompatible, so I defined jiffies and HZ for set_timer() resolution. Please check whether this patch solves the hang problem. xencomm_init_desc: could only translate 49152 of 13 bytes xencomm_init_desc: could only translate 49152 of 17 bytes Seems like we need a solution for handling larger error logs. [mca-sal_h.patch] I modified xencomm_create_mini() to xencomm_create() in sal.h so that larger error logs could be handled. I think it may also be wrong that SAL_GET/CLEAR_STATE_INFO are exposed to non-privileged domains. Thanks, [mca-fw_emul.patch] I added to check whether current-domain is dom0. Otherwise, a warning message is displayed. The MCA information is notified only to dom0 in this implementation. For future, when we want to notify it to non-privileged domains, we just remove this check. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 29 Oct 2006 10:54:14 -0700 Hi Kaz, I'm still having several problems with the MCA support patches. I've published my tree here: http://free.linux.hp.com/~awilliam/xen-ia64-mca Could you take a look and make sure I didn't break anything when applying the patches or updating them to the latest tree? I'm seeing hangs during dom0 bootup. The system has several error logs, so I thought there might be a race. However, if I deconfigure the 2nd CPU (2-way Madison system), it hangs even before launching dom0. Maybe it's trying to retrieve an error log from the offline CPU? On another system I have that did boot up, I saw several of these errors: xencomm_init_desc: could only translate 49152 of 13 bytes xencomm_init_desc: could only translate 49152 of 17 bytes Seems like we need a solution for handling larger error logs. I think it may also be wrong that SAL_GET/CLEAR_STATE_INFO are exposed to non-privileged domains. Thanks, Alex -- Alex Williamson HP Open Source Linux Org. diff -r 11b718eb22c9 xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Thu Nov 02 12:43:04 2006 -0700 +++ b/xen/arch/ia64/linux-xen/mca.c Thu Nov 09 09:26:12 2006 +0900 @@ -81,6 +81,9 @@ #include xen/symbols.h #include xen/mm.h #include xen/console.h +#include xen/event.h +#include xen/softirq.h +#include asm/xenmca.h #endif #if defined(IA64_MCA_DEBUG_INFO) @@ -108,18 +111,33 @@ unsigned long __per_cpu_mca[NR_CPUS]; /* In mca_asm.S */ extern voidia64_monarch_init_handler (void); extern voidia64_slave_init_handler (void); +#ifdef XEN +extern void setup_vector (unsigned int vec, struct irqaction *action); +#define setup_irq(irq, action) setup_vector(irq, action) +#endif static ia64_mc_info_t ia64_mc_info; -#ifndef XEN +#ifdef XEN +#define jiffiesNOW() +#undef HZ +#define HZ ((unsigned long)(1000*1000*1000)) +#endif + #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */ #define MIN_CPE_POLL_INTERVAL (2*60*HZ) /* 2 minutes */ #define CMC_POLL_INTERVAL (1*60*HZ) /* 1 minute */ #define CPE_HISTORY_LENGTH5 #define CMC_HISTORY_LENGTH5 +#ifndef XEN static struct timer_list cpe_poll_timer; static struct timer_list cmc_poll_timer; +#else +#define mod_timer(timer, expires) set_timer(timer, expires) +static struct timer cpe_poll_timer; +static struct timer cmc_poll_timer; +#endif /* * This variable tells whether we are currently in polling mode. * Start with this in the wrong state so we won't play w/ timers @@ -136,11 +154,9 @@ static int cpe_poll_enabled = 1; static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); -#endif /* !XEN */ static int mca_init; -#ifndef XEN /* * IA64_MCA log support */ @@ -157,11 +173,24 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifndef XEN #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX
[Xen-ia64-devel] [PATCH][MCA] Disable CPE interrupt mode for dom0
Hi all, This patch disables CPE interupt mode for dom0. In current MCA implementaion, CPE interrupts do not notify to dom0. The dom0 is expected to get error logs in polling mode. Therefore I modified the ACPI table to disable CPE interrupt mode in before the address of it is passed through to dom0. I think that there is no problem because the initialization of ACPI is completed by the passed time even if this modification is added. I would appreciate any comments. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 622bb65e2011 xen/arch/ia64/xen/dom_fw.c --- a/xen/arch/ia64/xen/dom_fw.cSun Oct 29 11:18:17 2006 -0700 +++ b/xen/arch/ia64/xen/dom_fw.cWed Nov 01 18:04:45 2006 +0900 @@ -240,6 +240,23 @@ acpi_update_lsapic (acpi_table_entry_hea return 0; } +static int __init +acpi_patch_plat_int_src ( + acpi_table_entry_header *header, const unsigned long end) +{ + struct acpi_table_plat_int_src *plintsrc; + + plintsrc = (struct acpi_table_plat_int_src *) header; + if (!plintsrc) + return -EINVAL; + + if (plintsrc-type == ACPI_INTERRUPT_CPEI) { + printk(ACPI_INTERRUPT_CPEI disabled for Domain0\n); + plintsrc-type = -1; + } + return 0; +} + static u8 generate_acpi_checksum(void *tbl, unsigned long len) { @@ -271,7 +288,11 @@ static void touch_acpi_table(void) { lsapic_nbr = 0; if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_update_lsapic, 0) 0) - printk(Error parsing MADT - no LAPIC entires\n); + printk(Error parsing MADT - no LAPIC entries\n); + if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, + acpi_patch_plat_int_src, 0) 0) + printk(Error parsing MADT - no PLAT_INT_SRC entries\n); + acpi_table_parse(ACPI_APIC, acpi_update_madt_checksum); return; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, I attached updated patches as follows. [mca-mca.patch] It was clarified that mod_timer() should not be defined to set_timer(). These timer resolutions are incompatible, so I defined jiffies and HZ for set_timer() resolution. Please check whether this patch solves the hang problem. xencomm_init_desc: could only translate 49152 of 13 bytes xencomm_init_desc: could only translate 49152 of 17 bytes Seems like we need a solution for handling larger error logs. [mca-sal_h.patch] I modified xencomm_create_mini() to xencomm_create() in sal.h so that larger error logs could be handled. I think it may also be wrong that SAL_GET/CLEAR_STATE_INFO are exposed to non-privileged domains. Thanks, [mca-fw_emul.patch] I added to check whether current-domain is dom0. Otherwise, a warning message is displayed. The MCA information is notified only to dom0 in this implementation. For future, when we want to notify it to non-privileged domains, we just remove this check. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 29 Oct 2006 10:54:14 -0700 Hi Kaz, I'm still having several problems with the MCA support patches. I've published my tree here: http://free.linux.hp.com/~awilliam/xen-ia64-mca Could you take a look and make sure I didn't break anything when applying the patches or updating them to the latest tree? I'm seeing hangs during dom0 bootup. The system has several error logs, so I thought there might be a race. However, if I deconfigure the 2nd CPU (2-way Madison system), it hangs even before launching dom0. Maybe it's trying to retrieve an error log from the offline CPU? On another system I have that did boot up, I saw several of these errors: xencomm_init_desc: could only translate 49152 of 13 bytes xencomm_init_desc: could only translate 49152 of 17 bytes Seems like we need a solution for handling larger error logs. I think it may also be wrong that SAL_GET/CLEAR_STATE_INFO are exposed to non-privileged domains. Thanks, Alex -- Alex Williamson HP Open Source Linux Org. diff -r 11b718eb22c9 xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Thu Nov 02 12:43:04 2006 -0700 +++ b/xen/arch/ia64/linux-xen/mca.c Wed Nov 08 17:06:07 2006 +0900 @@ -81,6 +81,9 @@ #include xen/symbols.h #include xen/mm.h #include xen/console.h +#include xen/event.h +#include xen/softirq.h +#include asm/xenmca.h #endif #if defined(IA64_MCA_DEBUG_INFO) @@ -108,18 +111,33 @@ unsigned long __per_cpu_mca[NR_CPUS]; /* In mca_asm.S */ extern voidia64_monarch_init_handler (void); extern voidia64_slave_init_handler (void); +#ifdef XEN +extern void setup_vector (unsigned int vec, struct irqaction *action); +#define setup_irq(irq, action) setup_vector(irq, action) +#endif static ia64_mc_info_t ia64_mc_info; -#ifndef XEN +#ifdef XEN +#define jiffiesNOW() +#undef HZ +#define HZ ((unsigned long)(1000*1000*1000)) +#endif + #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */ #define MIN_CPE_POLL_INTERVAL (2*60*HZ) /* 2 minutes */ #define CMC_POLL_INTERVAL (1*60*HZ) /* 1 minute */ #define CPE_HISTORY_LENGTH5 #define CMC_HISTORY_LENGTH5 +#ifndef XEN static struct timer_list cpe_poll_timer; static struct timer_list cmc_poll_timer; +#else +#define mod_timer(timer, expires) set_timer(timer, expires) +static struct timer cpe_poll_timer; +static struct timer cmc_poll_timer; +#endif /* * This variable tells whether we are currently in polling mode. * Start with this in the wrong state so we won't play w/ timers @@ -136,11 +154,9 @@ static int cpe_poll_enabled = 1; static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); -#endif /* !XEN */ static int mca_init; -#ifndef XEN /* * IA64_MCA log support */ @@ -157,11 +173,24 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifndef XEN #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size); \ ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size);} +#else +#define IA64_LOG_ALLOCATE(it, size) \ + do { \ + unsigned int pageorder; \ + pageorder = get_order_from_bytes(sizeof(struct ia64_mca_cpu)); \ + ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ +
Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, Thank you for your information. I finally ascertained the cause of hang. If CPE interrupt is disabled in ACPI, CPE polling timer starts. But I made a mistake in the timer. I would modify and post the patch of this problem. Thanks, KAZ From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Wed, 01 Nov 2006 09:06:27 -0700 FWIW, I also merged the MCA tree with xen-unstable.hg since there's been a lot of console work lately on the upstream tree. Dom0 still hangs on bootup at the same place as the first log. Thanks, Alex -- Alex Williamson HP Open Source Linux Org. ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH] Modify vmx fault handler
Hi all, This patch fixes the vmx fault handler to set the fault vector number in r19. The r19 is used to display a fault message in dispatch_to_fault_handler(). Signed-off-by: Akio Takebe [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] Thanks, KAZ diff -r 11b718eb22c9 xen/arch/ia64/vmx/vmx_ivt.S --- a/xen/arch/ia64/vmx/vmx_ivt.S Thu Nov 02 12:43:04 2006 -0700 +++ b/xen/arch/ia64/vmx/vmx_ivt.S Mon Nov 06 10:17:53 2006 +0900 @@ -95,6 +95,7 @@ #define VMX_FAULT(n)\ vmx_fault_##n:; \ +mov r19=n;; \ br.sptk.many dispatch_to_fault_handler; \ ;; \ @@ -106,7 +107,7 @@ vmx_fault_##n:; \ ;; \ tbit.z p6,p7=r29,IA64_PSR_VM_BIT; \ (p7)br.sptk.many vmx_dispatch_reflection;\ -VMX_FAULT(n);\ +br.sptk.many dispatch_to_fault_handler; \ GLOBAL_ENTRY(vmx_panic) ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, It seems good for me. I could bootup your tree on our system(2-way Madison and 4-way Montecito system). Please give me more information about the hang-up environment, and boot log if you have. I also checked that such error messages are displayed, so I would correct for handling larger error logs. Thanks, KAZ From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 29 Oct 2006 10:54:14 -0700 Hi Kaz, I'm still having several problems with the MCA support patches. I've published my tree here: http://free.linux.hp.com/~awilliam/xen-ia64-mca Could you take a look and make sure I didn't break anything when applying the patches or updating them to the latest tree? I'm seeing hangs during dom0 bootup. The system has several error logs, so I thought there might be a race. However, if I deconfigure the 2nd CPU (2-way Madison system), it hangs even before launching dom0. Maybe it's trying to retrieve an error log from the offline CPU? On another system I have that did boot up, I saw several of these errors: xencomm_init_desc: could only translate 49152 of 13 bytes xencomm_init_desc: could only translate 49152 of 17 bytes Seems like we need a solution for handling larger error logs. I think it may also be wrong that SAL_GET/CLEAR_STATE_INFO are exposed to non-privileged domains. Thanks, Alex -- Alex Williamson HP Open Source Linux Org. ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, How about the following patch. I issued outside the prototype declaration of ia64_sal_get_state_info_size(). I checked that it could compile by both gcc-3.4.3 and gcc-4.0.0. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2 Date: Wed, 18 Oct 2006 16:01:04 -0600 On Mon, 2006-10-16 at 14:46 +0900, SUZUKI Kazuhiro wrote: Hi Alex, I modified to insert is_running_on_xen() and I attached this patch. Hi Kaz, Does this build for you? I get this: In file included from include/asm-ia64/mca.h:20, from arch/ia64/kernel/asm-offsets.c:16: include/asm/sal.h: In function 'ia64_sal_get_state_info': include/asm/sal.h:702: error: invalid storage class for function 'ia64_sal_get_state_info_size' include/asm/sal.h:704: warning: implicit declaration of function 'ia64_sal_get_state_info_size' include/asm/sal.h: At top level: include/asm/sal.h:726: error: conflicting types for 'ia64_sal_get_state_info_size' include/asm/sal.h:704: error: previous implicit declaration of 'ia64_sal_get_state_info_size' was here make[1]: *** [arch/ia64/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 Thanks, Alex -- Alex Williamson HP Open Source Linux Org. --- a/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-09-13 03:02:10.0 +0900 +++ b/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-10-24 11:12:13.0 +0900 @@ -42,6 +42,9 @@ #include asm/pal.h #include asm/system.h #include asm/fpu.h +#ifdef CONFIG_XEN +#include asm/xen/xencomm.h +#endif extern spinlock_t sal_lock; @@ -686,10 +689,30 @@ /* Get the processor and platform information logged by SAL with respect to the machine * state at the time of the MCAs, INITs, CMCs, or CPEs. */ +#ifdef CONFIG_XEN +static inline u64 ia64_sal_get_state_info_size (u64 sal_info_type); +#endif + static inline u64 ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info) { struct ia64_sal_retval isrv; +#ifdef CONFIG_XEN + if (is_running_on_xen()) { + struct xencomm_mini xc_area[2]; + int nbr_area = 2; + struct xencomm_handle *desc; + int rc; + rc = xencomm_create_mini(xc_area, nbr_area, sal_info, + ia64_sal_get_state_info_size(sal_info_type), +desc); + if (rc) + return 0; + + SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, + desc, 0, 0, 0, 0); + } else +#endif SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, sal_info, 0, 0, 0, 0); if (isrv.status) ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 2/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, I attached updated patches for CONFIG_XEN_IA64_PERVCPU_VHPT configuration. I modified to read the vhpt address from vcpu-arch.vhpt_maddr. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 2/12]MCA handler support for Xen/ia64 TAKE 2 Date: Mon, 16 Oct 2006 16:38:38 -0600 On Tue, 2006-10-10 at 20:02 +0900, SUZUKI Kazuhiro wrote: +#ifdef XEN + // 5. VHPT +#if VHPT_ENABLED + mov r24=VHPT_SIZE_LOG22 + movl r22=VHPT_ADDR + mov r21=IA64_TR_VHPT ... +#ifdef XEN + // 5. VHPT +#if VHPT_ENABLED + mov r24=VHPT_SIZE_LOG22 + movl r22=VHPT_ADDR Hi Kaz, VHPT_ADDR was just removed from the tree in this patch: http://xenbits.xensource.com/ext/xen-ia64-unstable.hg?cs=685586518b2e Can you send me a patch to apply on top of this one that removes VHPT_ADDR? Thanks, Alex -- Alex Williamson HP Open Source Linux Org. diff -r fcd746cf4647 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Sat Oct 14 18:10:08 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Wed Oct 18 14:57:07 2006 +0900 @@ -24,6 +24,9 @@ #include asm/processor.h #include asm/mca_asm.h #include asm/mca.h +#ifdef XEN +#include asm/vhpt.h +#endif /* * When we get a machine check, the kernel stack pointer is no longer @@ -50,8 +53,7 @@ */ #ifdef XEN #define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \ - movl_tmp=THIS_CPU(ia64_sal_to_os_handoff_state_addr);; \ - tpa _tmp=_tmp;; \ + GET_THIS_PADDR(_tmp, ia64_sal_to_os_handoff_state_addr);; \ ld8 _tmp=[_tmp];; \ st8 [_tmp]=r1,0x08;;\ st8 [_tmp]=r8,0x08;;\ @@ -72,6 +74,7 @@ st8 [_tmp]=r12,0x08;; \ st8 [_tmp]=r17,0x08;; \ st8 [_tmp]=r18,0x08 +#endif /* XEN */ /* * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec) @@ -101,6 +104,24 @@ * imots_sal_check_ra=Return address to location within SAL_CHECK * */ +#ifdef XEN +#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ + movltmp=IA64_MCA_COLD_BOOT; \ + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; \ + ld8 sal_to_os_handoff=[sal_to_os_handoff];; \ + movlos_to_sal_handoff=ia64_os_to_sal_handoff_state;;\ + dep os_to_sal_handoff = 0, os_to_sal_handoff, 60, 4;; \ + /*DATA_VA_TO_PA(os_to_sal_handoff);;*/ \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],48;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + movltmp=IA64_MCA_SAME_CONTEXT;; \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],-8;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff];; \ + st8 [os_to_sal_handoff]=tmp;; +#else /* XEN */ #define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ movltmp=IA64_MCA_COLD_BOOT; \ movlsal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \ @@ -114,13 +135,13 @@ st8 [os_to_sal_handoff]=tmp,8;; \ ld8 tmp=[sal_to_os_handoff];; \ st8 [os_to_sal_handoff]=tmp;; +#endif /* XEN */ #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] -#endif /* XEN */ .global ia64_os_mca_dispatch .global ia64_os_mca_dispatch_end #ifndef XEN @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#defineSET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0
Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, I modified to insert is_running_on_xen() and I attached this patch. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 15 Oct 2006 15:13:28 -0600 On Wed, 2006-10-11 at 09:11 +0900, SUZUKI Kazuhiro wrote: Hi Alex, Sorry, I forgot to clean up my debug messages. Please replace `mca-sal_h.patch' by attached patch. Hi Kaz, This patch would break transparent paravirtualization. Please re-work with a runtime xen check. Thanks, Alex -- Alex Williamson HP Open Source Linux Org. --- a/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-10-10 18:06:14.0 +0900 +++ b/linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-10-16 11:48:26.0 +0900 @@ -42,6 +42,9 @@ #include asm/pal.h #include asm/system.h #include asm/fpu.h +#ifdef CONFIG_XEN +#include asm/xen/xencomm.h +#endif extern spinlock_t sal_lock; @@ -690,6 +693,23 @@ ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info) { struct ia64_sal_retval isrv; +#ifdef CONFIG_XEN + if (is_running_on_xen()) { + struct xencomm_mini xc_area[2]; + int nbr_area = 2; + struct xencomm_handle *desc; + int rc; + static inline u64 ia64_sal_get_state_info_size (u64 sal_info_type); + rc = xencomm_create_mini(xc_area, nbr_area, sal_info, + ia64_sal_get_state_info_size(sal_info_type), +desc); + if (rc) + return 0; + + SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, + desc, 0, 0, 0, 0); + } else +#endif SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, sal_info, 0, 0, 0, 0); if (isrv.status) ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 01 Oct 2006 14:14:31 -0600 There's one more problem here, SAL_GET_STATE_INFO is SMP safe and re-entrant, but there's only one record header allocated, and it's not protected by a lock. Couldn't a second caller of SAL_GET_STATE_INFO clear the record header while it's in use? Also, please clean up the line wrapping in this area (tabs are 8 spaces, lines are 80 chars). Thanks, I modified to lock sal record buffer. I confined the procedures which used sal record buffer to get_state_info_on(). And I added a lock in this function. It is necessary to support xencomm to copy the mca error record to Dom0 with this lock mechanism. So, I have to modify linux/include/asm-ia64/sal.h. I copied this file to linux-2.6-xen-sparse/include/asm-ia64/sal.h first, and then modified ia64_sal_get_state_info(). Attached `mca-sal-copy.patch' is a patch to copy original sal.h. The `mca-sal_h.patch' is a patch which modifies sal.h. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 1a0b58e7b5de xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Thu Oct 05 12:25:53 2006 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Tue Oct 10 17:56:33 2006 +0900 @@ -22,6 +22,7 @@ #include linux/efi.h #include asm/pal.h #include asm/sal.h +#include asm/xenmca.h #include public/sched.h #include hpsim_ssc.h @@ -32,6 +33,95 @@ extern unsigned long running_on_sim; +struct sal_mc_params { + u64 param_type; + u64 i_or_m; + u64 i_or_m_val; + u64 timeout; + u64 rz_always; +} sal_mc_params[SAL_MC_PARAM_CPE_INT+1]; + +struct sal_vectors { + u64 vector_type; + u64 handler_addr1; + u64 gp1; + u64 handler_len1; + u64 handler_addr2; + u64 gp2; + u64 handler_len2; +} sal_vectors[SAL_VECTOR_OS_BOOT_RENDEZ+1]; + +struct smp_call_args_t { + u64 type; + u64 ret; + u64 target; + struct domain *domain; + int corrected; + int status; + void *data; +}; + +extern sal_log_record_header_t *sal_record; +DEFINE_SPINLOCK(sal_record_lock); + +extern spinlock_t sal_queue_lock; + +#defineIA64_SAL_NO_INFORMATION_AVAILABLE -5 + +#if defined(IA64_SAL_DEBUG_INFO) +static const char * const rec_name[] = { MCA, INIT, CMC, CPE }; + +# define IA64_SAL_DEBUG(fmt...)printk(sal_emulator: fmt) +#else +# define IA64_SAL_DEBUG(fmt...) +#endif + +void get_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + int flags; + + spin_lock_irqsave(sal_record_lock, flags); + memset(sal_record, 0, ia64_sal_get_state_info_size(arg-type)); + arg-ret = ia64_sal_get_state_info(arg-type, (u64 *)sal_record); + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) on CPU#%d + returns %ld.\n, + rec_name[arg-type], smp_processor_id(), arg-ret); + if (arg-corrected) { + sal_record-severity = sal_log_severity_corrected; + IA64_SAL_DEBUG(%s: IA64_SAL_CLEAR_STATE_INFO(SAL_INFO_TYPE_MCA) force\n, + __FUNCTION__); + } + if (arg-ret 0) { + /* +* Save current-domain and set to local(caller) domain for +* xencomm_paddr_to_maddr() which calculates maddr from +* paddr using mpa value of current-domain. +*/ + struct domain *save; + save = current-domain; + current-domain = arg-domain; + if (xencomm_copy_to_guest((void*)arg-target, sal_record, arg-ret, 0)) { + printk(SAL_GET_STATE_INFO + can't copy to user\n); + arg-status = IA64_SAL_NO_INFORMATION_AVAILABLE; + arg-ret = 0; + } + /* Restore current-domain to saved value. */ + current-domain = save; + } + spin_unlock_irqrestore(sal_record_lock, flags); +} + +void clear_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_clear_state_info(arg-type); + IA64_SAL_DEBUG(SAL_CLEAR_STATE_INFO(%s) on CPU#%d + returns %ld.\n, + rec_name[arg-type], smp_processor_id(), arg-ret); + +} + struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, @@ -102,27 +192,143 @@ sal_emulator (long index, unsigned long } } else - printf(*** CALLED SAL_SET_VECTORS %lu. IGNORED...\n, - in1); + { +
Re: [Xen-ia64-devel] [PATCH 1/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, Sorry for my late reply. I attached updated patches following to your comments. From: Alex Williamson [EMAIL PROTECTED] Subject: Re: [Xen-ia64-devel] [PATCH 1/12]MCA handler support for Xen/ia64 TAKE 2 Date: Sun, 01 Oct 2006 14:14:35 -0600 On Thu, 2006-09-28 at 16:10 +0900, SUZUKI Kazuhiro wrote: * It looks like we're not returning a value for several functions that specify a return type. Please make sure the code compiles cleanly. I'm sorry but I cannot find such functions. Please teach me which functions correspond. It is confirmed that no warnings are found when compiling. Hi Kaz, My mistake, I didn't check back that irqreturn_t is typedef'd to a void on Xen. However, I don't see anybody actually using IRQ_HANDLED. Perhaps we could #define IRQ_HANDLED (to nothing) to avoid all the #ifndef XEN return IRQ_HANDLED; #else return; #endf Also, I think you can skip the /* XEN */ on every #else/#endif. As long as the #if/#else/#endif are all pretty close together (within an 80x24 screen) and not interspersed with other #ifdefs. I defined IRQ_HANDLED to nothing in xen/include/asm-ia64/linux-xen/linux/interrupt.h to remove #ifndef XEN/#else/#endif. I also attached this patch. And I removed the /* XEN */ close to #ifdef/#ifndef. Thanks, I think the same should be done with setup_irq/setup_vector. I also defined setup_irq() to setup_vector() macro. Shouldn't we check that the xmalloc didn't return NULL? Thanks, I inserted error check like BUG_ON(e == NULL). Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 1a0b58e7b5de xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Thu Oct 05 12:25:53 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca.c Tue Oct 10 17:56:26 2006 +0900 @@ -80,6 +80,9 @@ #ifdef XEN #include xen/symbols.h #include xen/mm.h +#include xen/event.h +#include xen/softirq.h +#include asm/xenmca.h #endif #if defined(IA64_MCA_DEBUG_INFO) @@ -107,18 +110,27 @@ unsigned long __per_cpu_mca[NR_CPUS]; /* In mca_asm.S */ extern voidia64_monarch_init_handler (void); extern voidia64_slave_init_handler (void); +#ifdef XEN +extern void setup_vector (unsigned int vec, struct irqaction *action); +#definesetup_irq(irq, action) setup_vector(irq, action) +#endif static ia64_mc_info_t ia64_mc_info; -#ifndef XEN #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */ #define MIN_CPE_POLL_INTERVAL (2*60*HZ) /* 2 minutes */ #define CMC_POLL_INTERVAL (1*60*HZ) /* 1 minute */ #define CPE_HISTORY_LENGTH5 #define CMC_HISTORY_LENGTH5 +#ifndefXEN static struct timer_list cpe_poll_timer; static struct timer_list cmc_poll_timer; +#else +#definemod_timer(timer, expires) set_timer(timer, expires) +static struct timer cpe_poll_timer; +static struct timer cmc_poll_timer; +#endif /* * This variable tells whether we are currently in polling mode. * Start with this in the wrong state so we won't play w/ timers @@ -135,11 +147,9 @@ static int cpe_poll_enabled = 1; static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); -#endif /* !XEN */ static int mca_init; -#ifndef XEN /* * IA64_MCA log support */ @@ -156,11 +166,24 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifndefXEN #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size); \ ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size);} +#else +#define IA64_LOG_ALLOCATE(it, size) \ + do { \ + unsigned int pageorder; \ + pageorder = get_order_from_bytes(sizeof(struct ia64_mca_cpu)); \ + ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + } while(0) +#endif + #define IA64_LOG_LOCK_INIT(it) spin_lock_init(ia64_state_log[it].isl_lock) #define IA64_LOG_LOCK(it) spin_lock_irqsave(ia64_state_log[it].isl_lock, s) #define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(ia64_state_log[it].isl_lock,s) @@ -175,6 +198,12 @@ static ia64_state_log_t ia64_state_log[I #define IA64_LOG_CURR_BUFFER(it) (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)])) #define IA64_LOG_COUNT(it) ia64_state_log[it].isl_count +#ifdef XEN +struct list_head sal_queue[IA64_MAX_LOG_TYPES]; +sal_log_record_header_t*sal_record = NULL
Re: [Xen-ia64-devel] [PATCH 2/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, I removed the /* XEN */ close to #ifdef/#ifndef as well as mca.c Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 1a0b58e7b5de xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Thu Oct 05 12:25:53 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Fri Oct 06 09:41:40 2006 +0900 @@ -24,6 +24,9 @@ #include asm/processor.h #include asm/mca_asm.h #include asm/mca.h +#ifdef XEN +#include asm/vhpt.h +#endif /* * When we get a machine check, the kernel stack pointer is no longer @@ -50,8 +53,7 @@ */ #ifdef XEN #define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \ - movl_tmp=THIS_CPU(ia64_sal_to_os_handoff_state_addr);; \ - tpa _tmp=_tmp;; \ + GET_THIS_PADDR(_tmp, ia64_sal_to_os_handoff_state_addr);; \ ld8 _tmp=[_tmp];; \ st8 [_tmp]=r1,0x08;;\ st8 [_tmp]=r8,0x08;;\ @@ -72,6 +74,7 @@ st8 [_tmp]=r12,0x08;; \ st8 [_tmp]=r17,0x08;; \ st8 [_tmp]=r18,0x08 +#endif /* XEN */ /* * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec) @@ -101,6 +104,24 @@ * imots_sal_check_ra=Return address to location within SAL_CHECK * */ +#ifdef XEN +#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ + movltmp=IA64_MCA_COLD_BOOT; \ + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; \ + ld8 sal_to_os_handoff=[sal_to_os_handoff];; \ + movlos_to_sal_handoff=ia64_os_to_sal_handoff_state;;\ + dep os_to_sal_handoff = 0, os_to_sal_handoff, 60, 4;; \ + /*DATA_VA_TO_PA(os_to_sal_handoff);;*/ \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],48;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + movltmp=IA64_MCA_SAME_CONTEXT;; \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],-8;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff];; \ + st8 [os_to_sal_handoff]=tmp;; +#else /* XEN */ #define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ movltmp=IA64_MCA_COLD_BOOT; \ movlsal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \ @@ -114,13 +135,13 @@ st8 [os_to_sal_handoff]=tmp,8;; \ ld8 tmp=[sal_to_os_handoff];; \ st8 [os_to_sal_handoff]=tmp;; +#endif /* XEN */ #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] -#endif /* XEN */ .global ia64_os_mca_dispatch .global ia64_os_mca_dispatch_end #ifndef XEN @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#defineSET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0;; \ + adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ +1: add r4 = r6, r2;\ + mov r5=cr.lid;; \ + adds r7 = 1, r7;\ + ld8 r4 = [r4];; \ + cmp.ne p6, p7 = r5, r4; \ + cmp4.lt p8, p9 = NR_CPUS-1, r7; \ +(p7) br.cond.dpnt 3f;\ + adds r6 = 16, r6; \ +(p9) br.cond.sptk 1b;\ +2: br 2b;; /* Endless loop on error */ \ +3: add r4 = r6, r3;; \ + ld8 r4 = [r4];; \ + mov
Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, Sorry, I forgot to clean up my debug messages. Please replace `mca-sal_h.patch' by attached patch. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] *** linux-2.6-xen-sparse/include/asm-ia64/sal.h.orig2006-10-10 18:06:14.0 +0900 --- linux-2.6-xen-sparse/include/asm-ia64/sal.h 2006-10-11 09:04:07.0 +0900 *** *** 42,47 --- 42,48 #include asm/pal.h #include asm/system.h #include asm/fpu.h + #include asm/xen/xencomm.h extern spinlock_t sal_lock; *** *** 690,697 ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info) { struct ia64_sal_retval isrv; SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, ! sal_info, 0, 0, 0, 0); if (isrv.status) return 0; --- 691,710 ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info) { struct ia64_sal_retval isrv; + struct xencomm_mini xc_area[4]; + int nbr_area = 4; + struct xencomm_handle *desc; + int rc; + static inline u64 ia64_sal_get_state_info_size (u64 sal_info_type); + + rc = xencomm_create_mini(xc_area, nbr_area, sal_info, +ia64_sal_get_state_info_size(sal_info_type), +desc); + if (rc) + return 0; + SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0, ! desc, 0, 0, 0, 0); if (isrv.status) return 0; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Re: [Xen-ia64-devel] [PATCH 1/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, Thank you for your comment. I attached updated patches following to the comment. On Fri, 2006-09-22 at 19:32 +0900, SUZUKI Kazuhiro wrote: [1/12] patch for MCA handler.[mca-mca.patch] Looks good, a couple minor comments: * It looks like we're not returning a value for several functions that specify a return type. Please make sure the code compiles cleanly. I'm sorry but I cannot find such functions. Please teach me which functions correspond. It is confirmed that no warnings are found when compiling. * #define'ing mod_timer to set_timer may help remove #ifdef XEN in a few places. I defined `mod_timer' macro and removed several #ifdef XEN. * You might make a comment about the origin of disable_irq_nosync() and enable_irq() since they appear to be unchanged copies of the generic IRQ functions from Linux. I put the comment like Copy from linux/kernel/irq/manage.c. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca.c Thu Sep 28 12:03:22 2006 +0900 @@ -80,6 +80,9 @@ #ifdef XEN #include xen/symbols.h #include xen/mm.h +#include xen/event.h +#include xen/softirq.h +#include asm/xenmca.h #endif #if defined(IA64_MCA_DEBUG_INFO) @@ -107,18 +110,26 @@ unsigned long __per_cpu_mca[NR_CPUS]; /* In mca_asm.S */ extern voidia64_monarch_init_handler (void); extern voidia64_slave_init_handler (void); +#ifdef XEN +extern void setup_vector (unsigned int vec, struct irqaction *action); +#endif static ia64_mc_info_t ia64_mc_info; -#ifndef XEN #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */ #define MIN_CPE_POLL_INTERVAL (2*60*HZ) /* 2 minutes */ #define CMC_POLL_INTERVAL (1*60*HZ) /* 1 minute */ #define CPE_HISTORY_LENGTH5 #define CMC_HISTORY_LENGTH5 +#ifndefXEN static struct timer_list cpe_poll_timer; static struct timer_list cmc_poll_timer; +#else /* XEN */ +#definemod_timer(timer, expires) set_timer(timer, expires) +static struct timer cpe_poll_timer; +static struct timer cmc_poll_timer; +#endif /* * This variable tells whether we are currently in polling mode. * Start with this in the wrong state so we won't play w/ timers @@ -135,11 +146,9 @@ static int cpe_poll_enabled = 1; static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); -#endif /* !XEN */ static int mca_init; -#ifndef XEN /* * IA64_MCA log support */ @@ -156,11 +165,24 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifndefXEN #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size); \ ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size);} +#else /* XEN */ +#define IA64_LOG_ALLOCATE(it, size) \ + do { \ + unsigned int pageorder; \ + pageorder = get_order_from_bytes(sizeof(struct ia64_mca_cpu)); \ + ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + } while(0) +#endif /* XEN */ + #define IA64_LOG_LOCK_INIT(it) spin_lock_init(ia64_state_log[it].isl_lock) #define IA64_LOG_LOCK(it) spin_lock_irqsave(ia64_state_log[it].isl_lock, s) #define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(ia64_state_log[it].isl_lock,s) @@ -175,6 +197,11 @@ static ia64_state_log_t ia64_state_log[I #define IA64_LOG_CURR_BUFFER(it) (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)])) #define IA64_LOG_COUNT(it) ia64_state_log[it].isl_count +#ifdef XEN +struct list_head sal_queue[IA64_MAX_LOG_TYPES]; +DEFINE_SPINLOCK(sal_queue_lock); +#endif /* XEN */ + /* * ia64_log_init * Reset the OS ia64 log buffer @@ -201,6 +228,7 @@ ia64_log_init(int sal_info_type) memset(IA64_LOG_NEXT_BUFFER(sal_info_type), 0, max_size); } +#ifndef XEN /* * ia64_log_get * @@ -276,15 +304,158 @@ ia64_mca_log_sal_error_record(int sal_in if (rh-severity == sal_log_severity_corrected) ia64_sal_clear_state_info(sal_info_type); } +#else /* XEN */ +/* + * ia64_log_queue + * + * Get the current MCA log from SAL and copy it into the OS log buffer. + * + * Inputs : info_type (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE}) + * Outputs : size(total record length
Re: [Xen-ia64-devel] [PATCH 2/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, On Fri, 2006-09-22 at 19:32 +0900, SUZUKI Kazuhiro wrote: [2/12] Add percpu data physical addr mca_asm.S [mca-mca_asm.patch] @@ -221,6 +275,17 @@ 4: ;; srlz.i ;; + // 5. VHPT +#if VHPT_ENABLED + mov r24=VHPT_SIZE_LOG22 + movl r22=VHPT_ADDR + mov r21=IA64_TR_VHPT + ;; + ptr.d r22,r24 + ;; + srlz.d + ;; +#endif Does this need to be inside a #ifdef XEN? @@ -342,6 +422,26 @@ ia64_reload_tr: ;; srlz.d ;; + // 5. VHPT +#if VHPT_ENABLED + mov r24=VHPT_SIZE_LOG22 + movl r22=VHPT_ADDR + mov r21=IA64_TR_VHPT + movl r26=PAGE_KERNEL + ;; + GET_THIS_PADDR(r2, vhpt_paddr) + ;; + ld8 r18=[r2] + ;; + or r23=r18,r26 // construct PA | page properties + mov cr.itir=r24 + mov cr.ifa=r22 + ;; + itr.d dtr[r21]=r23 // wire in new mapping... + ;; + srlz.d + ;; +#endif Same question on this one. Thanks, Yes. I forgot to enclose them with #ifdef XEN. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Tue Sep 26 10:11:07 2006 +0900 @@ -24,6 +24,9 @@ #include asm/processor.h #include asm/mca_asm.h #include asm/mca.h +#ifdef XEN +#include asm/vhpt.h +#endif /* XEN */ /* * When we get a machine check, the kernel stack pointer is no longer @@ -50,8 +53,7 @@ */ #ifdef XEN #define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \ - movl_tmp=THIS_CPU(ia64_sal_to_os_handoff_state_addr);; \ - tpa _tmp=_tmp;; \ + GET_THIS_PADDR(_tmp, ia64_sal_to_os_handoff_state_addr);; \ ld8 _tmp=[_tmp];; \ st8 [_tmp]=r1,0x08;;\ st8 [_tmp]=r8,0x08;;\ @@ -72,6 +74,7 @@ st8 [_tmp]=r12,0x08;; \ st8 [_tmp]=r17,0x08;; \ st8 [_tmp]=r18,0x08 +#endif /* XEN */ /* * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec) @@ -101,6 +104,24 @@ * imots_sal_check_ra=Return address to location within SAL_CHECK * */ +#ifdef XEN +#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ + movltmp=IA64_MCA_COLD_BOOT; \ + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; \ + ld8 sal_to_os_handoff=[sal_to_os_handoff];; \ + movlos_to_sal_handoff=ia64_os_to_sal_handoff_state;;\ + dep os_to_sal_handoff = 0, os_to_sal_handoff, 60, 4;; \ + /*DATA_VA_TO_PA(os_to_sal_handoff);;*/ \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],48;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + movltmp=IA64_MCA_SAME_CONTEXT;; \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],-8;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff];; \ + st8 [os_to_sal_handoff]=tmp;; +#else /* XEN */ #define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ movltmp=IA64_MCA_COLD_BOOT; \ movlsal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \ @@ -114,13 +135,13 @@ st8 [os_to_sal_handoff]=tmp,8;; \ ld8 tmp=[sal_to_os_handoff];; \ st8 [os_to_sal_handoff]=tmp;; +#endif /* XEN */ #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] -#endif /* XEN */ .global ia64_os_mca_dispatch .global ia64_os_mca_dispatch_end #ifndef XEN @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#defineSET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list
Re: [Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, On Fri, 2006-09-22 at 19:33 +0900, SUZUKI Kazuhiro wrote: [6/12] Add sal emulation.[mca-fw_emul.patch] case SAL_GET_STATE_INFO: ... + + spin_lock_irqsave(sal_queue_lock, flags); + ... + ret = smp_call_function_single(e-cpuid, get_state_info_on, arg, 0, 1); Both SAL_GET_STATE_INFO and SAL_CLEAR_STATE_INFO use smp_call_function_single() with interrupts disabled. This is dangerous and can lead to deadlocks. Imagine if two processors called smp_call_function_single() with interrupts disabled, possibly from unrelated code paths. One processor would get the call_lock and send an IPI to the second processor. However, the second processor is spinning trying to get the call_lock with interrupts disabled hang. Thanks, Interrupts disabled state was made only the operation of sal_queue[] like list_entry() and list_del(). Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Thu Sep 28 12:30:34 2006 +0900 @@ -23,6 +23,7 @@ #include linux/efi.h #include asm/pal.h #include asm/sal.h +#include asm/xenmca.h #include public/sched.h #include hpsim_ssc.h @@ -32,6 +33,54 @@ extern unsigned long running_on_sim; +struct sal_mc_params { + u64 param_type; + u64 i_or_m; + u64 i_or_m_val; + u64 timeout; + u64 rz_always; +} sal_mc_params[SAL_MC_PARAM_CPE_INT+1]; + +struct sal_vectors { + u64 vector_type; + u64 handler_addr1; + u64 gp1; + u64 handler_len1; + u64 handler_addr2; + u64 gp2; + u64 handler_len2; +} sal_vectors[SAL_VECTOR_OS_BOOT_RENDEZ+1]; + +struct smp_call_args_t { + u64 type; + u64 ret; + void *data; +}; + +extern spinlock_t sal_queue_lock; + +#defineIA64_SAL_NO_INFORMATION_AVAILABLE -5 + +#if defined(IA64_SAL_DEBUG_INFO) +static const char * const rec_name[] = { MCA, INIT, CMC, CPE }; + +# define IA64_SAL_DEBUG(fmt...)printk(sal_emulator: fmt) +#else +# define IA64_SAL_DEBUG(fmt...) +#endif + +void get_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_get_state_info(arg-type, (u64 *)arg-data); +} + +void clear_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_clear_state_info(arg-type); +} + struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, @@ -102,27 +151,206 @@ sal_emulator (long index, unsigned long } } else - printf(*** CALLED SAL_SET_VECTORS %lu. IGNORED...\n, - in1); + { + if (in1 sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) + BUG(); + sal_vectors[in1].vector_type= in1; + sal_vectors[in1].handler_addr1 = in2; + sal_vectors[in1].gp1= in3; + sal_vectors[in1].handler_len1 = in4; + sal_vectors[in1].handler_addr2 = in5; + sal_vectors[in1].gp2= in6; + sal_vectors[in1].handler_len2 = in7; + } break; case SAL_GET_STATE_INFO: - /* No more info. */ - status = -5; - r9 = 0; + { + sal_queue_entry_t *e; + unsigned long flags; + int size = ia64_sal_get_state_info_size(in1); + static sal_log_record_header_t *record = NULL; + + if (record == NULL) { + unsigned int pageorder; + + pageorder = get_order_from_bytes(size); + record = (sal_log_record_header_t *)alloc_xenheap_pages(pageorder); + } + memset(record, 0, size); + + spin_lock_irqsave(sal_queue_lock, flags); + if (list_empty(sal_queue[in1])) { + sal_log_record_header_t header; + + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) + no sal_queue entry found.\n, rec_name[in1]); + memset(header, 0, sizeof(header)); + if (copy_to_user((void __user *)in3, header, sizeof(header))) { + printk(sal_emulator: SAL_GET_STATE_INFO
Re: [Xen-ia64-devel] [PATCH 12/12]MCA handler support for Xen/ia64 TAKE 2
Hi Alex, On Fri, 2006-09-22 at 19:33 +0900, SUZUKI Kazuhiro wrote: [12/12] Fix conflicts of typedef of UINT64 and BOOLEAN.[mca-typedef.patch] This is kind of ugly. Can we converge on a single definition for these or at least confine the fix to the ia64 specific code? Thanks, I modified to remove typedef of UINT64/BOOLEAN, and to include linux/acpi.h from vcpu.h instead of using `__TYPEDEF_UINT64__/_BOOLEAN__' macros. Thanks, KAZ Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/include/asm-ia64/vcpu.h --- a/xen/include/asm-ia64/vcpu.h Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/asm-ia64/vcpu.h Tue Sep 26 10:15:40 2006 +0900 @@ -10,9 +10,8 @@ #include asm/ia64_int.h #include xen/types.h #include public/xen.h -typedefunsigned long UINT64; typedefunsigned int UINT; -typedefint BOOLEAN; +#include linux/acpi.h struct vcpu; typedefstruct vcpu VCPU; typedef cpu_user_regs_t REGS; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 0/12]MCA handler support for Xen/ia64 TAKE 2
Hi, all The following patches are improvement and cleanup patches of the MCA support for xen/ia64 we've posted. http://lists.xensource.com/archives/html/xen-ia64-devel/2006-09/msg00034.html We have already tested not only MCA uncorrectable error handler but also corrected error(CMC/CPE) handlers. We added a improvement to save the MCA error record for logging by salinfod after reboot. At the boot time, Xen queues MCA error log, and salinfod on Dom0 gets the error log and save it. And several bug fixes and cleanups are also included in these patches. We would appreciate any comments. Thanks, You, Kan, and KAZ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 1/12]MCA handler support for Xen/ia64 TAKE 2
[1/12] patch for MCA handler.[mca-mca.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/linux-xen/mca.c --- a/xen/arch/ia64/linux-xen/mca.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca.c Fri Sep 22 09:26:49 2006 +0900 @@ -80,6 +80,9 @@ #ifdef XEN #include xen/symbols.h #include xen/mm.h +#include xen/event.h +#include xen/softirq.h +#include asm/xenmca.h #endif #if defined(IA64_MCA_DEBUG_INFO) @@ -107,18 +110,25 @@ unsigned long __per_cpu_mca[NR_CPUS]; /* In mca_asm.S */ extern voidia64_monarch_init_handler (void); extern voidia64_slave_init_handler (void); +#ifdef XEN +extern void setup_vector (unsigned int vec, struct irqaction *action); +#endif static ia64_mc_info_t ia64_mc_info; -#ifndef XEN #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */ #define MIN_CPE_POLL_INTERVAL (2*60*HZ) /* 2 minutes */ #define CMC_POLL_INTERVAL (1*60*HZ) /* 1 minute */ #define CPE_HISTORY_LENGTH5 #define CMC_HISTORY_LENGTH5 +#ifndefXEN static struct timer_list cpe_poll_timer; static struct timer_list cmc_poll_timer; +#else /* XEN */ +static struct timer cpe_poll_timer; +static struct timer cmc_poll_timer; +#endif /* * This variable tells whether we are currently in polling mode. * Start with this in the wrong state so we won't play w/ timers @@ -135,11 +145,9 @@ static int cpe_poll_enabled = 1; static int cpe_poll_enabled = 1; extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe); -#endif /* !XEN */ static int mca_init; -#ifndef XEN /* * IA64_MCA log support */ @@ -156,11 +164,24 @@ typedef struct ia64_state_log_s static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES]; +#ifndefXEN #define IA64_LOG_ALLOCATE(it, size) \ {ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size); \ ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ (ia64_err_rec_t *)alloc_bootmem(size);} +#else /* XEN */ +#define IA64_LOG_ALLOCATE(it, size) \ + do { \ + unsigned int pageorder; \ + pageorder = get_order_from_bytes(sizeof(struct ia64_mca_cpu)); \ + ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \ + (ia64_err_rec_t *)alloc_xenheap_pages(pageorder); \ + } while(0) +#endif /* XEN */ + #define IA64_LOG_LOCK_INIT(it) spin_lock_init(ia64_state_log[it].isl_lock) #define IA64_LOG_LOCK(it) spin_lock_irqsave(ia64_state_log[it].isl_lock, s) #define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(ia64_state_log[it].isl_lock,s) @@ -175,6 +196,11 @@ static ia64_state_log_t ia64_state_log[I #define IA64_LOG_CURR_BUFFER(it) (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)])) #define IA64_LOG_COUNT(it) ia64_state_log[it].isl_count +#ifdef XEN +struct list_head sal_queue[IA64_MAX_LOG_TYPES]; +DEFINE_SPINLOCK(sal_queue_lock); +#endif /* XEN */ + /* * ia64_log_init * Reset the OS ia64 log buffer @@ -201,6 +227,7 @@ ia64_log_init(int sal_info_type) memset(IA64_LOG_NEXT_BUFFER(sal_info_type), 0, max_size); } +#ifndef XEN /* * ia64_log_get * @@ -276,15 +303,151 @@ ia64_mca_log_sal_error_record(int sal_in if (rh-severity == sal_log_severity_corrected) ia64_sal_clear_state_info(sal_info_type); } +#else /* XEN */ +/* + * ia64_log_queue + * + * Get the current MCA log from SAL and copy it into the OS log buffer. + * + * Inputs : info_type (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE}) + * Outputs : size(total record length) + * *buffer (ptr to error record) + * + */ +static u64 +ia64_log_queue(int sal_info_type, int virq) +{ + sal_log_record_header_t *log_buffer; + u64 total_len = 0; + int s; + sal_queue_entry_t *e; + unsigned long flags; + + IA64_LOG_LOCK(sal_info_type); + + /* Get the process state information */ + log_buffer = IA64_LOG_NEXT_BUFFER(sal_info_type); + + total_len = ia64_sal_get_state_info(sal_info_type, (u64 *)log_buffer); + + if (total_len) { + int queue_type; + + spin_lock_irqsave(sal_queue_lock, flags); + + if (sal_info_type == SAL_INFO_TYPE_MCA + virq == VIRQ_MCA_CMC) + queue_type = SAL_INFO_TYPE_CMC; + else + queue_type = sal_info_type; + + e = xmalloc(sal_queue_entry_t); + e-cpuid = smp_processor_id(); +
[Xen-ia64-devel] [PATCH 4/12]MCA handler support for Xen/ia64 TAKE 2
[4/12] Add binding of virq/ipi to irq.[mca-irq_ia64.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Tue Sep 12 11:43:22 2006 -0600 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Fri Sep 22 09:26:49 2006 +0900 @@ -241,9 +241,15 @@ static DEFINE_PER_CPU(int, timer_irq) = static DEFINE_PER_CPU(int, timer_irq) = -1; static DEFINE_PER_CPU(int, ipi_irq) = -1; static DEFINE_PER_CPU(int, resched_irq) = -1; +static DEFINE_PER_CPU(int, cmc_irq) = -1; +static DEFINE_PER_CPU(int, cmcp_irq) = -1; +static DEFINE_PER_CPU(int, cpep_irq) = -1; static char timer_name[NR_CPUS][15]; static char ipi_name[NR_CPUS][15]; static char resched_name[NR_CPUS][15]; +static char cmc_name[NR_CPUS][15]; +static char cmcp_name[NR_CPUS][15]; +static char cpep_name[NR_CPUS][15]; struct saved_irq { unsigned int irq; @@ -323,6 +329,33 @@ xen_register_percpu_irq (unsigned int ir break; case IA64_SPURIOUS_INT_VECTOR: break; + case IA64_CMC_VECTOR: + sprintf(cmc_name[cpu], %s%d, action-name, cpu); + ret = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu, + action-handler, action-flags, + cmc_name[cpu], action-dev_id); + per_cpu(cmc_irq,cpu) = ret; + printk(KERN_INFO register VIRQ_MCA_CMC (%s) to xen irq (%d)\n, cmc_name[cpu], ret); + break; + case IA64_CMCP_VECTOR: + sprintf(cmcp_name[cpu], %s%d, action-name, cpu); + ret = bind_ipi_to_irqhandler(CMCP_VECTOR, cpu, + action-handler, action-flags, + cmcp_name[cpu], action-dev_id); + per_cpu(cmcp_irq,cpu) = ret; + printk(KERN_INFO register CMCP_VECTOR (%s) to xen irq (%d)\n, cmcp_name[cpu], ret); + break; + case IA64_CPEP_VECTOR: + sprintf(cpep_name[cpu], %s%d, action-name, cpu); + ret = bind_ipi_to_irqhandler(CPEP_VECTOR, cpu, + action-handler, action-flags, + cpep_name[cpu], action-dev_id); + per_cpu(cpep_irq,cpu) = ret; + printk(KERN_INFO register CPEP_VECTOR (%s) to xen irq (%d)\n, cpep_name[cpu], ret); + break; + case IA64_CPE_VECTOR: + printk(KERN_WARNING register IA64_CPE_VECTOR IGNORED\n); + break; default: printk(KERN_WARNING Percpu irq %d is unsupported by xen!\n, irq); break; @@ -373,6 +406,18 @@ unbind_evtchn_callback(struct notifier_b if (action == CPU_DEAD) { /* Unregister evtchn. */ + if (per_cpu(cpep_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cpep_irq, cpu), NULL); + per_cpu(cpep_irq, cpu) = -1; + } + if (per_cpu(cmcp_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cmcp_irq, cpu), NULL); + per_cpu(cmcp_irq, cpu) = -1; + } + if (per_cpu(cmc_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cmc_irq, cpu), NULL); + per_cpu(cmc_irq, cpu) = -1; + } if (per_cpu(ipi_irq,cpu) = 0) { unbind_from_irqhandler (per_cpu(ipi_irq, cpu), NULL); per_cpu(ipi_irq, cpu) = -1; @@ -503,6 +548,12 @@ ia64_send_ipi (int cpu, int vector, int case IA64_IPI_RESCHEDULE: irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR]; break; + case IA64_CMCP_VECTOR: + irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR]; + break; + case IA64_CPEP_VECTOR: + irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR]; + break; default: printk(KERN_WARNINGUnsupported IPI type 0x%x\n, vector); irq = 0; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 2/12]MCA handler support for Xen/ia64 TAKE 2
[2/12] Add percpu data physical addr mca_asm.S [mca-mca_asm.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Fri Sep 22 09:26:49 2006 +0900 @@ -24,6 +24,9 @@ #include asm/processor.h #include asm/mca_asm.h #include asm/mca.h +#ifdef XEN +#include asm/vhpt.h +#endif /* XEN */ /* * When we get a machine check, the kernel stack pointer is no longer @@ -50,8 +53,7 @@ */ #ifdef XEN #define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \ - movl_tmp=THIS_CPU(ia64_sal_to_os_handoff_state_addr);; \ - tpa _tmp=_tmp;; \ + GET_THIS_PADDR(_tmp, ia64_sal_to_os_handoff_state_addr);; \ ld8 _tmp=[_tmp];; \ st8 [_tmp]=r1,0x08;;\ st8 [_tmp]=r8,0x08;;\ @@ -72,6 +74,7 @@ st8 [_tmp]=r12,0x08;; \ st8 [_tmp]=r17,0x08;; \ st8 [_tmp]=r18,0x08 +#endif /* XEN */ /* * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec) @@ -101,6 +104,24 @@ * imots_sal_check_ra=Return address to location within SAL_CHECK * */ +#ifdef XEN +#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ + movltmp=IA64_MCA_COLD_BOOT; \ + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; \ + ld8 sal_to_os_handoff=[sal_to_os_handoff];; \ + movlos_to_sal_handoff=ia64_os_to_sal_handoff_state;;\ + dep os_to_sal_handoff = 0, os_to_sal_handoff, 60, 4;; \ + /*DATA_VA_TO_PA(os_to_sal_handoff);;*/ \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],48;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + movltmp=IA64_MCA_SAME_CONTEXT;; \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],-8;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff];; \ + st8 [os_to_sal_handoff]=tmp;; +#else /* XEN */ #define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ movltmp=IA64_MCA_COLD_BOOT; \ movlsal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \ @@ -114,13 +135,13 @@ st8 [os_to_sal_handoff]=tmp,8;; \ ld8 tmp=[sal_to_os_handoff];; \ st8 [os_to_sal_handoff]=tmp;; +#endif /* XEN */ #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] -#endif /* XEN */ .global ia64_os_mca_dispatch .global ia64_os_mca_dispatch_end #ifndef XEN @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#defineSET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0;; \ + adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ +1: add r4 = r6, r2;\ + mov r5=cr.lid;; \ + adds r7 = 1, r7;\ + ld8 r4 = [r4];; \ + cmp.ne p6, p7 = r5, r4; \ + cmp4.lt p8, p9 = NR_CPUS-1, r7; \ +(p7) br.cond.dpnt 3f;\ + adds r6 = 16, r6; \ +(p9) br.cond.sptk 1b;\ +2: br 2b;; /* Endless loop on error*/ \ +3: add r4 = r6, r3;; \ + ld8 r4 = [r4];; \ + mov ar.k3=r4 +#endif
[Xen-ia64-devel] [PATCH 3/12]MCA handler support for Xen/ia64 TAKE 2
[3/12] Fix GET_THIS_PADDR and define log queue struct.[mca-header.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/include/asm-ia64/xenmca.h --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/xen/include/asm-ia64/xenmca.h Fri Sep 22 09:28:04 2006 +0900 @@ -0,0 +1,34 @@ +/* + * File: xenmca.h + * Purpose:Machine check handling specific defines for Xen + * + * Copyright (C) 2006 FUJITSU LTD. ([EMAIL PROTECTED]) + */ + +#ifndef _ASM_IA64_XENMCA_H +#define _ASM_IA64_XENMCA_H + +#ifndef__ASSEMBLER__ +#include linux/list.h +#include asm/sal.h + +typedef struct sal_queue_entry_t { + int cpuid; + int sal_info_type; + unsigned int vector; + unsigned int virq; + unsigned int length; + struct list_head list; +} sal_queue_entry_t; + +extern struct list_head sal_queue[]; + +struct ia64_mca_tlb_info { + u64 cr_lid; + u64 percpu_paddr; +}; + +extern struct ia64_mca_tlb_info ia64_mca_tlb_list[]; +#endif /* __ASSEMBLER__ */ + +#endif /* _ASM_IA64_XENMCA_H */ diff -r 3e4fa8b5b245 xen/include/asm-ia64/linux-xen/asm/mca_asm.h --- a/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Fri Sep 22 09:26:49 2006 +0900 @@ -59,8 +59,8 @@ #ifdef XEN #define GET_THIS_PADDR(reg, var) \ - movlreg = THIS_CPU(var) \ - tpa reg = reg + mov reg = IA64_KR(PER_CPU_DATA);; \ + addlreg = THIS_CPU(var) - PERCPU_ADDR, reg #else #define GET_THIS_PADDR(reg, var) \ mov reg = IA64_KR(PER_CPU_DATA);; \ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 5/12]MCA handler support for Xen/ia64 TAKE 2
[5/12] Define MCA interrupt vector.[mca-irq.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 linux-2.6-xen-sparse/include/asm-ia64/irq.h --- a/linux-2.6-xen-sparse/include/asm-ia64/irq.h Tue Sep 12 11:43:22 2006 -0600 +++ b/linux-2.6-xen-sparse/include/asm-ia64/irq.h Fri Sep 22 09:26:49 2006 +0900 @@ -42,7 +42,9 @@ #define RESCHEDULE_VECTOR 0 #define IPI_VECTOR 1 -#define NR_IPIS2 +#define CMCP_VECTOR2 +#define CPEP_VECTOR3 +#define NR_IPIS4 #endif /* CONFIG_XEN */ /* diff -r 3e4fa8b5b245 xen/include/asm-ia64/event.h --- a/xen/include/asm-ia64/event.h Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/asm-ia64/event.h Fri Sep 22 09:26:49 2006 +0900 @@ -70,6 +70,8 @@ static inline int arch_virq_is_global(in switch ( virq ) { case VIRQ_ITC: +case VIRQ_MCA_CMC: +case VIRQ_MCA_CPE: rc = 0; break; default: ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 8/12]MCA handler support for Xen/ia64 TAKE 2
[8/12] smpboot support for MCA.[mca-smpboot.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/linux-xen/smpboot.c --- a/xen/arch/ia64/linux-xen/smpboot.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/linux-xen/smpboot.c Fri Sep 22 09:26:49 2006 +0900 @@ -365,9 +365,7 @@ smp_callin (void) smp_setup_percpu_timer(); -#ifndef XEN ia64_mca_cmc_vector_setup();/* Setup vector on AP */ -#endif #ifdef CONFIG_PERFMON pfm_init_percpu(); ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 7/12]MCA handler support for Xen/ia64 TAKE 2
[7/12] Add lid and percpu paddr table.[mca-mm_init.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/xen/mm_init.c --- a/xen/arch/ia64/xen/mm_init.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/xen/mm_init.c Fri Sep 22 09:26:49 2006 +0900 @@ -10,6 +10,11 @@ #include xen/sched.h #include asm/vhpt.h +#include asm/xenmca.h +#include asm/meminit.h +#include asm/page.h + +struct ia64_mca_tlb_info ia64_mca_tlb_list[NR_CPUS]; extern void ia64_tlb_init (void); @@ -105,7 +110,10 @@ ia64_mmu_init (void *my_cpu_data) ia64_mca_tlb_list[cpu].ptce_count[1] = local_cpu_data-ptce_count[1]; ia64_mca_tlb_list[cpu].ptce_stride[0] = local_cpu_data-ptce_stride[0]; ia64_mca_tlb_list[cpu].ptce_stride[1] = local_cpu_data-ptce_stride[1]; -#endif +#else /* XEN */ + ia64_mca_tlb_list[cpu].cr_lid = ia64_getreg(_IA64_REG_CR_LID); + ia64_mca_tlb_list[cpu].percpu_paddr = __pa(my_cpu_data); +#endif /* XEN */ } void ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 10/12]MCA handler support for Xen/ia64 TAKE 2
[10/12] Define VIRQs for MCA.[mca-arch-ia64.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.hTue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/public/arch-ia64.hFri Sep 22 09:26:49 2006 +0900 @@ -39,6 +39,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); /* Arch specific VIRQs definition */ #define VIRQ_ITCVIRQ_ARCH_0 /* V. Virtual itc timer */ + +#defineVIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */ +#define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */ /* Maximum number of virtual CPUs in multi-processor guests. */ /* WARNING: before changing this, check that shared_info fits on a page */ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 6/12]MCA handler support for Xen/ia64 TAKE 2
[6/12] Add sal emulation.[mca-fw_emul.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Fri Sep 22 09:26:49 2006 +0900 @@ -23,6 +23,7 @@ #include linux/efi.h #include asm/pal.h #include asm/sal.h +#include asm/xenmca.h #include public/sched.h #include hpsim_ssc.h @@ -32,6 +33,52 @@ extern unsigned long running_on_sim; +struct sal_mc_params { + u64 param_type; + u64 i_or_m; + u64 i_or_m_val; + u64 timeout; + u64 rz_always; +} sal_mc_params[SAL_MC_PARAM_CPE_INT+1]; + +struct sal_vectors { + u64 vector_type; + u64 handler_addr1; + u64 gp1; + u64 handler_len1; + u64 handler_addr2; + u64 gp2; + u64 handler_len2; +} sal_vectors[SAL_VECTOR_OS_BOOT_RENDEZ+1]; + +struct smp_call_args_t { + u64 type; + u64 ret; + void *data; +}; + +extern spinlock_t sal_queue_lock; + +#if defined(IA64_SAL_DEBUG_INFO) +static const char * const rec_name[] = { MCA, INIT, CMC, CPE }; + +# define IA64_SAL_DEBUG(fmt...)printk(sal_emulator: fmt) +#else +# define IA64_SAL_DEBUG(fmt...) +#endif + +void get_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_get_state_info(arg-type, (u64 *)arg-data); +} + +void clear_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_clear_state_info(arg-type); +} + struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, @@ -102,27 +149,204 @@ sal_emulator (long index, unsigned long } } else - printf(*** CALLED SAL_SET_VECTORS %lu. IGNORED...\n, - in1); + { + if (in1 sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) + BUG(); + sal_vectors[in1].vector_type= in1; + sal_vectors[in1].handler_addr1 = in2; + sal_vectors[in1].gp1= in3; + sal_vectors[in1].handler_len1 = in4; + sal_vectors[in1].handler_addr2 = in5; + sal_vectors[in1].gp2= in6; + sal_vectors[in1].handler_len2 = in7; + } break; case SAL_GET_STATE_INFO: - /* No more info. */ - status = -5; - r9 = 0; + { + sal_queue_entry_t *e; + unsigned long flags; + int size = ia64_sal_get_state_info_size(in1); + static sal_log_record_header_t *record = NULL; + + if (record == NULL) { + unsigned int pageorder; + + pageorder = get_order_from_bytes(size); + record = (sal_log_record_header_t *)alloc_xenheap_pages(pageorder); + } + memset(record, 0, size); + + spin_lock_irqsave(sal_queue_lock, flags); + if (list_empty(sal_queue[in1])) { + sal_log_record_header_t header; + + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) + no sal_queue entry found.\n, rec_name[in1]); + memset(header, 0, sizeof(header)); + if (copy_to_user((void __user *)in3, header, sizeof(header))) { + printk(sal_emulator: SAL_GET_STATE_INFO +can't copy empty header to user: 0x%lx\n, in3); + } + status = -5; + r9 = 0; + spin_unlock_irqrestore(sal_queue_lock, flags); + break; + } + e = list_entry(sal_queue[in1].next, sal_queue_entry_t, list); + + if (e-cpuid == smp_processor_id()) { + if (in1 == e-sal_info_type) { + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) + on current CPU.\n, rec_name[in1]); + } else { + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s = %s) +
[Xen-ia64-devel] [PATCH 9/12]MCA handler support for Xen/ia64 TAKE 2
[9/12] Add MCA offset entry.[mca-asm-offset.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/arch/ia64/asm-offsets.c --- a/xen/arch/ia64/asm-offsets.c Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/arch/ia64/asm-offsets.c Fri Sep 22 09:26:49 2006 +0900 @@ -12,6 +12,7 @@ #include public/xen.h #include asm/tlb.h #include asm/regs.h +#include asm/xenmca.h #define task_struct vcpu @@ -217,4 +218,32 @@ void foo(void) DEFINE(FAST_HYPERPRIVOP_PERFC_OFS, offsetof (struct perfcounter, fast_hyperprivop)); DEFINE(FAST_REFLECT_PERFC_OFS, offsetof (struct perfcounter, fast_reflect)); #endif + + BLANK(); + DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_base)); + DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_count)); + DEFINE(IA64_CPUINFO_PTCE_STRIDE_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_stride)); + + BLANK(); + DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET, + offsetof (struct ia64_mca_cpu, proc_state_dump)); + DEFINE(IA64_MCA_CPU_STACK_OFFSET, + offsetof (struct ia64_mca_cpu, stack)); + DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET, + offsetof (struct ia64_mca_cpu, stackframe)); + DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET, + offsetof (struct ia64_mca_cpu, rbstore)); + + DEFINE(IA64_DOMAIN_SHARED_INFO_OFFSET, + offsetof (struct domain, shared_info)); + DEFINE(IA64_DOMAIN_SHARED_INFO_VA_OFFSET, + offsetof (struct domain, arch.shared_info_va)); + + BLANK(); + DEFINE(IA64_MCA_TLB_INFO_SIZE, sizeof (struct ia64_mca_tlb_info)); + DEFINE(IA64_MCA_PERCPU_OFFSET, + offsetof (struct ia64_mca_tlb_info, percpu_paddr)); } ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 12/12]MCA handler support for Xen/ia64 TAKE 2
[12/12] Fix conflicts of typedef of UINT64 and BOOLEAN.[mca-typedef.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/include/acpi/actypes.h --- a/xen/include/acpi/actypes.hTue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/acpi/actypes.hFri Sep 22 09:26:49 2006 +0900 @@ -103,12 +103,18 @@ typedef COMPILER_DEPENDENT_UINT64 * 64-bit type definitions */ typedef unsigned char UINT8; +#ifndef__TYPEDEF_BOOLEAN__ +#define__TYPEDEF_BOOLEAN__ typedef unsigned char BOOLEAN; +#endif /* __TYPEDEF_BOOLEAN__ */ typedef unsigned short UINT16; typedef int INT32; typedef unsigned intUINT32; typedef COMPILER_DEPENDENT_INT64INT64; +#ifndef__TYPEDEF_UINT64__ +#define__TYPEDEF_UINT64__ typedef COMPILER_DEPENDENT_UINT64 UINT64; +#endif /* __TYPEDEF_UINT64__ */ /*! [End] no source code translation !*/ diff -r 3e4fa8b5b245 xen/include/asm-ia64/vcpu.h --- a/xen/include/asm-ia64/vcpu.h Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/asm-ia64/vcpu.h Fri Sep 22 09:26:49 2006 +0900 @@ -10,9 +10,15 @@ #include asm/ia64_int.h #include xen/types.h #include public/xen.h +#ifndef__TYPEDEF_UINT64__ +#define__TYPEDEF_UINT64__ typedefunsigned long UINT64; +#endif /* __TYPEDEF_UINT64__ */ typedefunsigned int UINT; +#ifndef__TYPEDEF_BOOLEAN__ +#define__TYPEDEF_BOOLEAN__ typedefint BOOLEAN; +#endif /* __TYPEDEF_BOOLEAN__ */ struct vcpu; typedefstruct vcpu VCPU; typedef cpu_user_regs_t REGS; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 11/12]MCA handler support for Xen/ia64 TAKE 2
[11/12] Add softirq handle for MCA.[mca-softirq.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: Kazuhiro Suzuki [EMAIL PROTECTED] diff -r 3e4fa8b5b245 xen/include/xen/softirq.h --- a/xen/include/xen/softirq.h Tue Sep 12 11:43:22 2006 -0600 +++ b/xen/include/xen/softirq.h Fri Sep 22 09:26:49 2006 +0900 @@ -10,7 +10,13 @@ #define PAGE_SCRUB_SOFTIRQ5 #define DOMAIN_SHUTDOWN_FINALISE_SOFTIRQ 6 #define TRACE_SOFTIRQ 7 +#ifdef __ia64__ +#define CMC_DISABLE_SOFTIRQ 8 +#define CMC_ENABLE_SOFTIRQ9 +#define NR_SOFTIRQS 10 +#else /* __ia64__ */ #define NR_SOFTIRQS 8 +#endif /* __ia64__ */ #ifndef __ASSEMBLY__ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 0/12][RFC]MCA handler support for Xen/ia64
Hi, all The following patches add MCA support for xen/ia64. We implemented based on the following design memo we have already posted. http://lists.xensource.com/archives/html/xen-ia64-devel/2006-07/msg00166.html We have already tested MCA uncorrectable error handler, but correctable error(CMC/CPE) handlers not yet. We posted for comments and evaluation. We added two softirq handles in xen/include/xen/softirq.h in order to use `cpumask_raise_softirq' instead of `schedule_work' in xen/arch/ia64/linux-xen/mca.c.[11/12 mca-typdef.patch] We wonder how to do because this is common part header file, so we cannot add softirq handle without asking. If we include both vcpu.h and acpi.h, then we get typedef conflict error messages from compiler as follows. vcpu.h:15: error: redefinition of typedef 'UINT64' actypes.h:116: error: previous declaration of 'UINT64' was here vcpu.h:20: error: conflicting types for 'BOOLEAN' actypes.h:108: error: previous declaration of 'BOOLEAN' was here We modified vcpu.h and actypes.h like this.[12/12 mca-typdef.patch] #ifndef __TYPEDEF_UINT64__ #define __TYPEDEF_UINT64__ typedef unsigned long UINT64; #endif/* __TYPEDEF_UINT64__ */ typedef unsigned int UINT; #ifndef __TYPEDEF_BOOLEAN__ #define __TYPEDEF_BOOLEAN__ typedef int BOOLEAN; #endif/* __TYPEDEF_BOOLEAN__ */ Please give us comments. MCA for Xen/ia64 may not work under influence of the copy_from/to_guest problem. As a result, it is likely to fail in the collection of the log. So we expect this problem will be solved. Thanks, You, Kan, and Kaz ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 3/12][RFC]MCA handler support for Xen/ia64
[3/12] Fix GET_THIS_PADDR and define log queue struct.[mca-header.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/include/asm-ia64/linux-xen/asm/mca_asm.h --- a/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/asm-ia64/linux-xen/asm/mca_asm.h Wed Sep 06 14:02:42 2006 +0900 @@ -59,8 +59,8 @@ #ifdef XEN #define GET_THIS_PADDR(reg, var) \ - movlreg = THIS_CPU(var) \ - tpa reg = reg + mov reg = IA64_KR(PER_CPU_DATA);; \ + addlreg = THIS_CPU(var) - PERCPU_ADDR, reg #else #define GET_THIS_PADDR(reg, var) \ mov reg = IA64_KR(PER_CPU_DATA);; \ diff -r 685bf9b75eb1 xen/include/asm-ia64/xenmca.h --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/xen/include/asm-ia64/xenmca.h Wed Sep 06 14:02:42 2006 +0900 @@ -0,0 +1,35 @@ +/* + * File: xenmca.h + * Purpose:Machine check handling specific defines for Xen + * + * Copyright (C) 2006 FUJITSU LTD. ([EMAIL PROTECTED]) + */ + +#ifndef _ASM_IA64_XENMCA_H +#define _ASM_IA64_XENMCA_H + +#ifndef__ASSEMBLER__ +#include linux/list.h +#include asm/sal.h + +typedef struct sal_queue_entry_t { + int cpuid; + int sal_info_type; + unsigned int vector; + unsigned int virq; + unsigned int length; + struct list_head list; +} sal_queue_entry_t; + +extern struct list_head sal_queue[]; + +struct ia64_mca_tlb_info { + u64 cr_lid; + u64 percpu_paddr; +}; + +extern struct ia64_mca_tlb_info ia64_mca_tlb_list[]; +#endif /* __ASSEMBLER__ */ + +#endif /* _ASM_IA64_XENMCA_H */ + ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 2/12][RFC]MCA handler support for Xen/ia64
[2/12] Add percpu data pysical addr mca_asm.S [mca-mca_asm.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/arch/ia64/linux-xen/mca_asm.S --- a/xen/arch/ia64/linux-xen/mca_asm.S Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Wed Sep 06 15:58:57 2006 +0900 @@ -24,6 +24,9 @@ #include asm/processor.h #include asm/mca_asm.h #include asm/mca.h +#ifdef XEN +#include asm/vhpt.h +#endif /* XEN */ /* * When we get a machine check, the kernel stack pointer is no longer @@ -50,8 +53,7 @@ */ #ifdef XEN #define SAL_TO_OS_MCA_HANDOFF_STATE_SAVE(_tmp) \ - movl_tmp=THIS_CPU(ia64_sal_to_os_handoff_state_addr);; \ - tpa _tmp=_tmp;; \ + GET_THIS_PADDR(_tmp, ia64_sal_to_os_handoff_state_addr);; \ ld8 _tmp=[_tmp];; \ st8 [_tmp]=r1,0x08;;\ st8 [_tmp]=r8,0x08;;\ @@ -72,6 +74,7 @@ st8 [_tmp]=r12,0x08;; \ st8 [_tmp]=r17,0x08;; \ st8 [_tmp]=r18,0x08 +#endif /* XEN */ /* * OS_MCA_TO_SAL_HANDOFF_STATE (SAL 3.0 spec) @@ -101,6 +104,24 @@ * imots_sal_check_ra=Return address to location within SAL_CHECK * */ +#ifdef XEN +#define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ + movltmp=IA64_MCA_COLD_BOOT; \ + GET_THIS_PADDR(r2,ia64_sal_to_os_handoff_state_addr);; \ + ld8 sal_to_os_handoff=[sal_to_os_handoff];; \ + movlos_to_sal_handoff=ia64_os_to_sal_handoff_state;;\ + dep os_to_sal_handoff = 0, os_to_sal_handoff, 60, 4;; \ + /*DATA_VA_TO_PA(os_to_sal_handoff);;*/ \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],48;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + movltmp=IA64_MCA_SAME_CONTEXT;; \ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff],-8;;\ + st8 [os_to_sal_handoff]=tmp,8;; \ + ld8 tmp=[sal_to_os_handoff];; \ + st8 [os_to_sal_handoff]=tmp;; +#else /* XEN */ #define COLD_BOOT_HANDOFF_STATE(sal_to_os_handoff,os_to_sal_handoff,tmp)\ movltmp=IA64_MCA_COLD_BOOT; \ movlsal_to_os_handoff=__pa(ia64_sal_to_os_handoff_state); \ @@ -114,13 +135,13 @@ st8 [os_to_sal_handoff]=tmp,8;; \ ld8 tmp=[sal_to_os_handoff];; \ st8 [os_to_sal_handoff]=tmp;; +#endif /* XEN */ #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] -#endif /* XEN */ .global ia64_os_mca_dispatch .global ia64_os_mca_dispatch_end #ifndef XEN @@ -132,7 +153,40 @@ .text .align 16 -#ifndef XEN +#ifdef XEN +/* + * void set_per_cpu_data(void) + * { + * int i; + * for (i = 0; i 64; i++) { + * if (ia64_mca_tlb_list[i].cr_lid == ia64_getreg(_IA64_REG_CR_LID)) { + * ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_mca_tlb_list[i].percpu_paddr); + * return; + * } + * } + * while(1); // Endless loop on error + * } + */ +#defineSET_PER_CPU_DATA() \ + LOAD_PHYSICAL(p0,r2,ia64_mca_tlb_list);;\ + mov r7 = r0;\ + mov r6 = r0;; \ + adds r3 = IA64_MCA_PERCPU_OFFSET, r2; \ +1: add r4 = r6, r2;\ + mov r5=cr.lid;; \ + adds r7 = 1, r7;\ + ld8 r4 = [r4];; \ + cmp.ne p6, p7 = r5, r4; \ + cmp4.lt p8, p9 = NR_CPUS-1, r7; \ +(p7) br.cond.dpnt 3f;\ + adds r6 = 16, r6; \ +(p9) br.cond.sptk 1b;\ +2: br 2b;; /* Endless loop on error*/ \ +3: add r4 = r6, r3;; \ + ld8 r4 = [r4];; \ + mov ar.k3=r4 +#endif
[Xen-ia64-devel] [PATCH 5/12][RFC]MCA handler support for Xen/ia64
[5/12] Define MCA interrupt vector.[mca-irq.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 linux-2.6-xen-sparse/include/asm-ia64/irq.h --- a/linux-2.6-xen-sparse/include/asm-ia64/irq.h Mon Sep 04 14:48:03 2006 -0600 +++ b/linux-2.6-xen-sparse/include/asm-ia64/irq.h Wed Sep 06 15:59:47 2006 +0900 @@ -42,7 +42,9 @@ #define RESCHEDULE_VECTOR 0 #define IPI_VECTOR 1 -#define NR_IPIS2 +#define CMCP_VECTOR2 +#define CPEP_VECTOR3 +#define NR_IPIS4 #endif /* CONFIG_XEN */ /* diff -r 685bf9b75eb1 xen/include/asm-ia64/event.h --- a/xen/include/asm-ia64/event.h Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/asm-ia64/event.h Wed Sep 06 14:02:42 2006 +0900 @@ -70,6 +70,8 @@ static inline int arch_virq_is_global(in switch ( virq ) { case VIRQ_ITC: +case VIRQ_MCA_CMC: +case VIRQ_MCA_CPE: rc = 0; break; default: ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 4/12][RFC]MCA handler support for Xen/ia64
[4/12] Add binding of virq/ipi to irq.[mca-irq_ia64.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Mon Sep 04 14:48:03 2006 -0600 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Wed Sep 06 14:02:42 2006 +0900 @@ -241,9 +241,15 @@ static DEFINE_PER_CPU(int, timer_irq) = static DEFINE_PER_CPU(int, timer_irq) = -1; static DEFINE_PER_CPU(int, ipi_irq) = -1; static DEFINE_PER_CPU(int, resched_irq) = -1; +static DEFINE_PER_CPU(int, cmc_irq) = -1; +static DEFINE_PER_CPU(int, cmcp_irq) = -1; +static DEFINE_PER_CPU(int, cpep_irq) = -1; static char timer_name[NR_CPUS][15]; static char ipi_name[NR_CPUS][15]; static char resched_name[NR_CPUS][15]; +static char cmc_name[NR_CPUS][15]; +static char cmcp_name[NR_CPUS][15]; +static char cpep_name[NR_CPUS][15]; struct saved_irq { unsigned int irq; @@ -323,6 +329,33 @@ xen_register_percpu_irq (unsigned int ir break; case IA64_SPURIOUS_INT_VECTOR: break; + case IA64_CMC_VECTOR: + sprintf(cmc_name[cpu], %s%d, action-name, cpu); + ret = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu, + action-handler, action-flags, + cmc_name[cpu], action-dev_id); + per_cpu(cmc_irq,cpu) = ret; + printk(KERN_INFO register VIRQ_MCA_CMC (%s) to xen irq (%d)\n, cmc_name[cpu], ret); + break; + case IA64_CMCP_VECTOR: + sprintf(cmcp_name[cpu], %s%d, action-name, cpu); + ret = bind_ipi_to_irqhandler(CMCP_VECTOR, cpu, + action-handler, action-flags, + cmcp_name[cpu], action-dev_id); + per_cpu(cmcp_irq,cpu) = ret; + printk(KERN_INFO register CMCP_VECTOR (%s) to xen irq (%d)\n, cmcp_name[cpu], ret); + break; + case IA64_CPEP_VECTOR: + sprintf(cpep_name[cpu], %s%d, action-name, cpu); + ret = bind_ipi_to_irqhandler(CPEP_VECTOR, cpu, + action-handler, action-flags, + cpep_name[cpu], action-dev_id); + per_cpu(cpep_irq,cpu) = ret; + printk(KERN_INFO register CPEP_VECTOR (%s) to xen irq (%d)\n, cpep_name[cpu], ret); + break; + case IA64_CPE_VECTOR: + printk(KERN_WARNING register IA64_CPE_VECTOR IGNORED\n); + break; default: printk(KERN_WARNING Percpu irq %d is unsupported by xen!\n, irq); break; @@ -373,6 +406,18 @@ unbind_evtchn_callback(struct notifier_b if (action == CPU_DEAD) { /* Unregister evtchn. */ + if (per_cpu(cpep_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cpep_irq, cpu), NULL); + per_cpu(cpep_irq, cpu) = -1; + } + if (per_cpu(cmcp_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cmcp_irq, cpu), NULL); + per_cpu(cmcp_irq, cpu) = -1; + } + if (per_cpu(cmc_irq,cpu) = 0) { + unbind_from_irqhandler (per_cpu(cmc_irq, cpu), NULL); + per_cpu(cmc_irq, cpu) = -1; + } if (per_cpu(ipi_irq,cpu) = 0) { unbind_from_irqhandler (per_cpu(ipi_irq, cpu), NULL); per_cpu(ipi_irq, cpu) = -1; @@ -503,6 +548,12 @@ ia64_send_ipi (int cpu, int vector, int case IA64_IPI_RESCHEDULE: irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR]; break; + case IA64_CMCP_VECTOR: + irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR]; + break; + case IA64_CPEP_VECTOR: + irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR]; + break; default: printk(KERN_WARNINGUnsupported IPI type 0x%x\n, vector); irq = 0; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 7/12][RFC]MCA handler support for Xen/ia64
[7/12] Add lid and percpu paddr table.[mca-mm_init.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/arch/ia64/xen/mm_init.c --- a/xen/arch/ia64/xen/mm_init.c Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/arch/ia64/xen/mm_init.c Wed Sep 06 14:02:42 2006 +0900 @@ -10,6 +10,11 @@ #include xen/sched.h #include asm/vhpt.h +#include asm/xenmca.h +#include asm/meminit.h +#include asm/page.h + +struct ia64_mca_tlb_info ia64_mca_tlb_list[NR_CPUS]; extern void ia64_tlb_init (void); @@ -105,7 +110,10 @@ ia64_mmu_init (void *my_cpu_data) ia64_mca_tlb_list[cpu].ptce_count[1] = local_cpu_data-ptce_count[1]; ia64_mca_tlb_list[cpu].ptce_stride[0] = local_cpu_data-ptce_stride[0]; ia64_mca_tlb_list[cpu].ptce_stride[1] = local_cpu_data-ptce_stride[1]; -#endif +#else /* XEN */ + ia64_mca_tlb_list[cpu].cr_lid = ia64_getreg(_IA64_REG_CR_LID); + ia64_mca_tlb_list[cpu].percpu_paddr = __pa(my_cpu_data); +#endif /* XEN */ } void ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 12/12][RFC]MCA handler support for Xen/ia64
[12/12] Fix conflicts of typedef of UINT64 and BOOLEAN.[mca-typedef.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/include/acpi/actypes.h --- a/xen/include/acpi/actypes.hMon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/acpi/actypes.hWed Sep 06 14:02:42 2006 +0900 @@ -103,12 +103,18 @@ typedef COMPILER_DEPENDENT_UINT64 * 64-bit type definitions */ typedef unsigned char UINT8; +#ifndef__TYPEDEF_BOOLEAN__ +#define__TYPEDEF_BOOLEAN__ typedef unsigned char BOOLEAN; +#endif /* __TYPEDEF_BOOLEAN__ */ typedef unsigned short UINT16; typedef int INT32; typedef unsigned intUINT32; typedef COMPILER_DEPENDENT_INT64INT64; +#ifndef__TYPEDEF_UINT64__ +#define__TYPEDEF_UINT64__ typedef COMPILER_DEPENDENT_UINT64 UINT64; +#endif /* __TYPEDEF_UINT64__ */ /*! [End] no source code translation !*/ diff -r 685bf9b75eb1 xen/include/asm-ia64/vcpu.h --- a/xen/include/asm-ia64/vcpu.h Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/asm-ia64/vcpu.h Wed Sep 06 14:11:38 2006 +0900 @@ -10,9 +10,15 @@ #include asm/ia64_int.h #include xen/types.h #include public/xen.h +#ifndef__TYPEDEF_UINT64__ +#define__TYPEDEF_UINT64__ typedefunsigned long UINT64; +#endif /* __TYPEDEF_UINT64__ */ typedefunsigned int UINT; +#ifndef__TYPEDEF_BOOLEAN__ +#define__TYPEDEF_BOOLEAN__ typedefint BOOLEAN; +#endif /* __TYPEDEF_BOOLEAN__ */ struct vcpu; typedefstruct vcpu VCPU; typedef cpu_user_regs_t REGS; ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 10/12][RFC]MCA handler support for Xen/ia64
[10/12] Define VIRQs for MCA.[mca-arch-ia64.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.hMon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/public/arch-ia64.hWed Sep 06 14:02:42 2006 +0900 @@ -39,6 +39,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); /* Arch specific VIRQs definition */ #define VIRQ_ITCVIRQ_ARCH_0 /* V. Virtual itc timer */ + +#defineVIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */ +#define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */ /* Maximum number of virtual CPUs in multi-processor guests. */ /* WARNING: before changing this, check that shared_info fits on a page */ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 9/12][RFC]MCA handler support for Xen/ia64
[9/12] Add MCA offset.[mca-asm-offset.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/arch/ia64/asm-offsets.c --- a/xen/arch/ia64/asm-offsets.c Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/arch/ia64/asm-offsets.c Wed Sep 06 14:03:52 2006 +0900 @@ -12,6 +12,7 @@ #include public/xen.h #include asm/tlb.h #include asm/regs.h +#include asm/xenmca.h #define task_struct vcpu @@ -217,4 +218,32 @@ void foo(void) DEFINE(FAST_HYPERPRIVOP_PERFC_OFS, offsetof (struct perfcounter, fast_hyperprivop)); DEFINE(FAST_REFLECT_PERFC_OFS, offsetof (struct perfcounter, fast_reflect)); #endif + + BLANK(); + DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_base)); + DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_count)); + DEFINE(IA64_CPUINFO_PTCE_STRIDE_OFFSET, + offsetof (struct cpuinfo_ia64, ptce_stride)); + + BLANK(); + DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET, + offsetof (struct ia64_mca_cpu, proc_state_dump)); + DEFINE(IA64_MCA_CPU_STACK_OFFSET, + offsetof (struct ia64_mca_cpu, stack)); + DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET, + offsetof (struct ia64_mca_cpu, stackframe)); + DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET, + offsetof (struct ia64_mca_cpu, rbstore)); + + DEFINE(IA64_DOMAIN_SHARED_INFO_OFFSET, + offsetof (struct domain, shared_info)); + DEFINE(IA64_DOMAIN_SHARED_INFO_VA_OFFSET, + offsetof (struct domain, arch.shared_info_va)); + + BLANK(); + DEFINE(IA64_MCA_TLB_INFO_SIZE, sizeof (struct ia64_mca_tlb_info)); + DEFINE(IA64_MCA_PERCPU_OFFSET, + offsetof (struct ia64_mca_tlb_info, percpu_paddr)); } ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 6/12][RFC]MCA handler support for Xen/ia64
[6/12] Add sal emulation.[mca-fw_emul.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Wed Sep 06 14:06:30 2006 +0900 @@ -23,6 +23,7 @@ #include linux/efi.h #include asm/pal.h #include asm/sal.h +#include asm/xenmca.h #include public/sched.h #include hpsim_ssc.h @@ -32,6 +33,52 @@ extern unsigned long running_on_sim; +struct sal_mc_params { + u64 param_type; + u64 i_or_m; + u64 i_or_m_val; + u64 timeout; + u64 rz_always; +} sal_mc_params[SAL_MC_PARAM_CPE_INT+1]; + +struct sal_vectors { + u64 vector_type; + u64 handler_addr1; + u64 gp1; + u64 handler_len1; + u64 handler_addr2; + u64 gp2; + u64 handler_len2; +} sal_vectors[SAL_VECTOR_OS_BOOT_RENDEZ+1]; + +struct smp_call_args_t { + u64 type; + u64 ret; + void *data; +}; + +extern spinlock_t sal_queue_lock; + +#if defined(IA64_SAL_DEBUG_INFO) +static const char * const rec_name[] = { MCA, INIT, CMC, CPE }; + +# define IA64_SAL_DEBUG(fmt...)printk(sal_emulator: fmt) +#else +# define IA64_SAL_DEBUG(fmt...) +#endif + +void get_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_get_state_info(arg-type, (u64 *)arg-data); +} + +void clear_state_info_on(void *data) { + struct smp_call_args_t *arg = data; + + arg-ret = ia64_sal_clear_state_info(arg-type); +} + struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, @@ -102,27 +149,199 @@ sal_emulator (long index, unsigned long } } else - printf(*** CALLED SAL_SET_VECTORS %lu. IGNORED...\n, - in1); + { + if (in1 sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) + BUG(); + sal_vectors[in1].vector_type= in1; + sal_vectors[in1].handler_addr1 = in2; + sal_vectors[in1].gp1= in3; + sal_vectors[in1].handler_len1 = in4; + sal_vectors[in1].handler_addr2 = in5; + sal_vectors[in1].gp2= in6; + sal_vectors[in1].handler_len2 = in7; + } break; case SAL_GET_STATE_INFO: - /* No more info. */ - status = -5; - r9 = 0; + { + sal_queue_entry_t *e; + unsigned long flags; + int size = ia64_sal_get_state_info_size(in1); + static sal_log_record_header_t *record = NULL; + + if (record == NULL) { + unsigned int pageorder; + + pageorder = get_order_from_bytes(size); + record = (sal_log_record_header_t *)alloc_xenheap_pages(pageorder); + } + memset(record, 0, size); + + spin_lock_irqsave(sal_queue_lock, flags); + if (list_empty(sal_queue[in1])) { + sal_log_record_header_t header; + + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) + no sal_queue entry found.\n, rec_name[in1]); + memset(header, 0, sizeof(header)); + if (copy_to_user((void __user *)in3, header, sizeof(header))) { + printk(sal_emulator: SAL_GET_STATE_INFO +can't copy empty header to user: 0x%lx\n, in3); + } + status = -5; + r9 = 0; + spin_unlock_irqrestore(sal_queue_lock, flags); + break; + } + e = list_entry(sal_queue[in1].next, sal_queue_entry_t, list); + + spin_unlock_irqrestore(sal_queue_lock, flags); + + if (e-cpuid == smp_processor_id()) { + if (in1 == e-sal_info_type) { + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s) + on current CPU.\n, rec_name[in1]); + } else { + IA64_SAL_DEBUG(SAL_GET_STATE_INFO(%s = %s
[Xen-ia64-devel] [PATCH 8/12][RFC]MCA handler support for Xen/ia64
[8/12] smpboot support for MCA.[mca-smpboot.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/arch/ia64/linux-xen/smpboot.c --- a/xen/arch/ia64/linux-xen/smpboot.c Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/arch/ia64/linux-xen/smpboot.c Wed Sep 06 14:02:42 2006 +0900 @@ -365,9 +365,7 @@ smp_callin (void) smp_setup_percpu_timer(); -#ifndef XEN ia64_mca_cmc_vector_setup();/* Setup vector on AP */ -#endif #ifdef CONFIG_PERFMON pfm_init_percpu(); ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 11/12][RFC]MCA handler support for Xen/ia64
[11/12] Add softirq handle for MCA.[mca-softirq.patch] Signed-off-by: Yutaka Ezaki [EMAIL PROTECTED] Signed-off-by: Masaki Kanno [EMAIL PROTECTED] Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -r 685bf9b75eb1 xen/include/xen/softirq.h --- a/xen/include/xen/softirq.h Mon Sep 04 14:48:03 2006 -0600 +++ b/xen/include/xen/softirq.h Wed Sep 06 14:02:42 2006 +0900 @@ -10,7 +10,13 @@ #define PAGE_SCRUB_SOFTIRQ5 #define DOMAIN_SHUTDOWN_FINALISE_SOFTIRQ 6 #define TRACE_SOFTIRQ 7 +#ifdef __ia64__ +#define CMC_DISABLE_SOFTIRQ 8 +#define CMC_ENABLE_SOFTIRQ9 +#define NR_SOFTIRQS 10 +#else /* __ia64__ */ #define NR_SOFTIRQS 8 +#endif /* __ia64__ */ #ifndef __ASSEMBLY__ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 0/3] Sample implementation of Xenoprof for ia64
Hi, all The following patches provide the function of Xenoprof for ia64. I ported perfmon2 which handles performance counter overflow interrupt, to hypervisor. This is a sample implementation, so there is a limitation that SMP system is not supported. I want to support SMP in the future, but I think that some ingenuity are necessary to support SMP system, because current implementation of oprofiled is not considered about XEN. I appreciate any comments. Here is a result of opreport command: CPU: Itanium 2, speed 1595 MHz (estimated) Counted CPU_CYCLES events (CPU Cycles) with a unit mask of 0x00 (No unit mask) count 100 CPU_CYCLES:100...| samples| %| -- 13674 99.0798 vmlinux-2.6.16.13-xenoprof 66 0.4782 xen 23 0.1667 libc-2.3.4.so 15 0.1087 bash 10 0.0725 ld-2.3.4.so 4 0.0290 EUC-JP.so 3 0.0217 oprofile 3 0.0217 emacs 2 0.0145 oprofiled 1 0.0072 sendmail.sendmail Thanks, KAZ ___ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
[Xen-ia64-devel] [PATCH 3/3] Sample implementation of Xenoprof for ia64
patch for oprofile-0.9.1 which oprofile-0.9.1-xen.patch has already been applied Signed-off-by: SUZUKI Kazuhiro [EMAIL PROTECTED] diff -Nur oprofile-0.9.1-xen/daemon/opd_events.c oprofile-0.9.1-xenoprof/daemon/opd_events.c --- oprofile-0.9.1-xen/daemon/opd_events.c 2005-05-03 00:06:57.0 +0900 +++ oprofile-0.9.1-xenoprof/daemon/opd_events.c 2006-07-03 14:37:28.0 +0900 @@ -88,6 +88,7 @@ = event-count = event-um = 0; event-kernel = 1; event-user = 1; + event-domain = 1; return; } @@ -111,6 +112,7 @@ event-um = copy_ulong(c, ':'); event-kernel = copy_ulong(c, ':'); event-user = copy_ulong(c, ','); + event-domain = xenimage != NULL; ++cur; } diff -Nur oprofile-0.9.1-xen/daemon/opd_events.h oprofile-0.9.1-xenoprof/daemon/opd_events.h --- oprofile-0.9.1-xen/daemon/opd_events.h 2005-05-03 00:06:58.0 +0900 +++ oprofile-0.9.1-xenoprof/daemon/opd_events.h 2006-06-07 13:32:38.0 +0900 @@ -24,6 +24,7 @@ unsigned long um; unsigned long kernel; unsigned long user; + unsigned long domain; }; /* needed for opd_perfmon.c */ diff -Nur oprofile-0.9.1-xen/daemon/opd_perfmon.c oprofile-0.9.1-xenoprof/daemon/opd_perfmon.c --- oprofile-0.9.1-xen/daemon/opd_perfmon.c 2004-12-13 08:26:35.0 +0900 +++ oprofile-0.9.1-xenoprof/daemon/opd_perfmon.c2006-07-03 14:10:55.0 +0900 @@ -33,6 +33,7 @@ #ifdef HAVE_SCHED_SETAFFINITY #include sched.h #endif +#include mntent.h extern op_cpu cpu_type; @@ -241,6 +242,7 @@ */ #define PMC_MANDATORY (1UL 23) #define PMC_USER (1UL 3) +#define PMC_DOMAIN (1UL 2) #define PMC_KERNEL (1UL 0) for (i = 0; i op_nr_counters opd_events[i].name; ++i) { struct opd_event * event = opd_events[i]; @@ -252,6 +254,8 @@ : (pc[i].reg_value = ~PMC_USER); (event-kernel) ? (pc[i].reg_value |= PMC_KERNEL) : (pc[i].reg_value = ~PMC_KERNEL); + (event-domain) ? (pc[i].reg_value |= PMC_DOMAIN) + : (pc[i].reg_value = ~PMC_DOMAIN); pc[i].reg_value = ~(0xff 8); pc[i].reg_value |= ((event-value 0xff) 8); pc[i].reg_value = ~(0xf 16); @@ -381,6 +385,101 @@ } +/* + * We get # of online CPUs from /proc/processor, + * because patches/linux-2.6.16.13/xen-hotplug.patch does + * not work correctlly. + */ +# define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ + do \ +{ \ + (RESULT) = 0;\ + /* Read all lines and count the lines starting with the string \ +processor. We don't have to fear extremely long lines since \ +the kernel will not generate them. 8192 bytes are really \ +enough. */\ + while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != 0)\ + if (strncmp (BUFFER, processor, 9) == 0) \ + ++(RESULT); \ +} \ + while (0) + +static const char path_proc[] = /proc; + +static const char * +get_proc_path (char *buffer, size_t bufsize) +{ + struct mntent mount_point; + struct mntent *entry; + char *result = NULL; + char *copy_result; + FILE *fp; + + /* First find the mount point of the proc filesystem. */ + fp = setmntent (_PATH_MOUNTED, r); + if (fp == NULL) +fp = setmntent (_PATH_MNTTAB, r); + if (fp != NULL) +{ + /* We don't need locking. */ + while ((entry = getmntent_r (fp, mount_point, buffer, bufsize)) +!= NULL) + if (strcmp (mount_point.mnt_type, proc) == 0) + { + result = mount_point.mnt_dir; + break; + } + endmntent (fp); +} + + /* If we haven't found anything this is generally a bad sign but we + handle it gracefully. We return what is hopefully the right + answer (/proc) but we don't remember this. This will enable + programs which started before the system is fully running to + adjust themselves. */ + if (result == NULL) +return path_proc; + + /* Make a copy we can keep around. */ + copy_result = strdup (result); + if (copy_result == NULL) +return result; + + return copy_result; +} + +int get_nprocs (void) +{ + FILE *fp; + char buffer[8192]; + const char *proc_path; + int result = 1; + + /* XXX Here will come a test for the new system call. */ + + /* Get mount point of proc filesystem. */ + proc_path = get_proc_path (buffer