Re: [Xen-ia64-devel] RE: [PATCH 0/5] fix fpswa and related issues.

2008-12-11 Thread Alex Williamson
On Thu, 2008-12-11 at 11:05 +0900, Isaku Yamahata wrote:
 
 Just to make sure. Is fpswa.efi installed in hvm domain?
 You can also confirm it by dh command in efi shell.

Argh, that was it.  I loaded fpswa.efi into my EFI partition after the
tests started failing, but I didn't have it in the right location for
elilo to pick it up automatically.  Running load fpswa.efi makes it
work, and copying fpswa.efi to \efi\intel firmware\fpswa.efi also works.
I'll add your panic fix and let it run for a while, seems like it's
running well now.  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] RE: [PATCH 0/5] fix fpswa and related issues.

2008-12-11 Thread Alex Williamson
On Thu, 2008-12-11 at 09:04 -0700, Alex Williamson wrote:
 On Thu, 2008-12-11 at 11:05 +0900, Isaku Yamahata wrote:
  
  Just to make sure. Is fpswa.efi installed in hvm domain?
  You can also confirm it by dh command in efi shell.
 
 Argh, that was it.  I loaded fpswa.efi into my EFI partition after the
 tests started failing, but I didn't have it in the right location for
 elilo to pick it up automatically.  Running load fpswa.efi makes it
 work, and copying fpswa.efi to \efi\intel firmware\fpswa.efi also works.
 I'll add your panic fix and let it run for a while, seems like it's
 running well now.  Thanks,

One other comment on the patches, I'd recommend removing both instances
of this:

printk(ia64_handle_reflection: handling FP trap\n);

from ia64_handle_reflection().  If we're properly handling the trap,
this is just unnecessary noise.  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] RE: [PATCH 0/5] fix fpswa and related issues.

2008-12-11 Thread Isaku Yamahata
On Thu, Dec 11, 2008 at 09:07:15AM -0700, Alex Williamson wrote:
 On Thu, 2008-12-11 at 09:04 -0700, Alex Williamson wrote:
  On Thu, 2008-12-11 at 11:05 +0900, Isaku Yamahata wrote:
   
   Just to make sure. Is fpswa.efi installed in hvm domain?
   You can also confirm it by dh command in efi shell.
  
  Argh, that was it.  I loaded fpswa.efi into my EFI partition after the
  tests started failing, but I didn't have it in the right location for
  elilo to pick it up automatically.  Running load fpswa.efi makes it
  work, and copying fpswa.efi to \efi\intel firmware\fpswa.efi also works.
  I'll add your panic fix and let it run for a while, seems like it's
  running well now.  Thanks,

Thank you for testing. I'll commit my patches with some clean up.


 One other comment on the patches, I'd recommend removing both instances
 of this:
 
 printk(ia64_handle_reflection: handling FP trap\n);
 
 from ia64_handle_reflection().  If we're properly handling the trap,
 this is just unnecessary noise.  Thanks,

Agreed. It should be quietened somehow.

-- 
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 0/5] fix fpswa and related issues.

2008-12-11 Thread Zhang, Xiantao
Isaku Yamahata wrote:
 On Thu, Dec 11, 2008 at 09:07:15AM -0700, Alex Williamson wrote:
 On Thu, 2008-12-11 at 09:04 -0700, Alex Williamson wrote:
 On Thu, 2008-12-11 at 11:05 +0900, Isaku Yamahata wrote:
 
 Just to make sure. Is fpswa.efi installed in hvm domain?
 You can also confirm it by dh command in efi shell.
 
 Argh, that was it.  I loaded fpswa.efi into my EFI partition after
 the tests started failing, but I didn't have it in the right
 location for elilo to pick it up automatically.  Running load
 fpswa.efi makes it work, and copying fpswa.efi to \efi\intel
 firmware\fpswa.efi also works. I'll add your panic fix and let it
 run for a while, seems like it's running well now.  Thanks,
 
 Thank you for testing. I'll commit my patches with some clean up.
 
 
 One other comment on the patches, I'd recommend removing both
 instances of this: 
 
 printk(ia64_handle_reflection: handling FP trap\n);
 
 from ia64_handle_reflection().  If we're properly handling the trap,
 this is just unnecessary noise.  Thanks,
 
 Agreed. It should be quietened somehow.

Good news indeed! 
Xiantao
___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


Re: [Xen-ia64-devel] RE: [PATCH 0/5] fix fpswa and related issues.

2008-12-11 Thread Alex Williamson
On Fri, 2008-12-12 at 10:22 +0900, Isaku Yamahata wrote:
 Thank you for testing. I'll commit my patches with some clean up.

Testing update; I've had 2 PV domains, 2 HVM domains, and dom0 all
running the test program for over 10 hours.  Everything looks good.
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 00/15] ia64/pv_ops, xen: more paravirtualization. TAKE 3

2008-12-11 Thread Isaku Yamahata

This patch set is intended for the next merge window. They are just
enhancements of the already merged patches or ia64 porting from x86
paravirt techniques and that their quality is enough for merge.

This patch set is for more paravirtualization on ia64/xen domU.
This patch set does
- remove existing warnings
- paravirtualize fsys call (fsys.S) by multi compile
- paravirtualize gate page (gate.S) by multi compile
- support save/restore
  For this purpose, the followings needs to be paravirtualized
  - ar.itc instruction 
  - sched_clock()
  This is because timer may changed before/after saving/restoring.

For convenience the working full source is available from
http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/
branch: ia64-pv-ops-2008dec12-xen-ia64-optimized-domu

For the status of this patch series
http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge

thanks,

Changes from take2
- two patches to remove warnings.
- rebased to 2.6.28-rc8

Changes from take 1
- refreshed to 2.6.28-rc6
  no essential change.


Diffstat:
 arch/ia64/include/asm/native/inst.h   |   13 ++
 arch/ia64/include/asm/native/patchlist.h  |   38 +++
 arch/ia64/include/asm/native/pvchk_inst.h |8 ++
 arch/ia64/include/asm/paravirt.h  |   57 ++
 arch/ia64/include/asm/timex.h |1 +
 arch/ia64/include/asm/xen/inst.h  |   24 
 arch/ia64/include/asm/xen/interface.h |9 ++
 arch/ia64/include/asm/xen/minstate.h  |   11 ++-
 arch/ia64/include/asm/xen/patchlist.h |   38 +++
 arch/ia64/include/asm/xen/privop.h|2 +
 arch/ia64/kernel/Makefile |   36 +-
 arch/ia64/kernel/Makefile.gate|   27 +
 arch/ia64/kernel/asm-offsets.c|2 +
 arch/ia64/kernel/entry.S  |4 +-
 arch/ia64/kernel/fsys.S   |   35 +++---
 arch/ia64/kernel/gate.S   |  171 +++--
 arch/ia64/kernel/gate.lds.S   |   17 ++--
 arch/ia64/kernel/head.S   |4 +-
 arch/ia64/kernel/ivt.S|2 +-
 arch/ia64/kernel/paravirt.c   |1 +
 arch/ia64/kernel/paravirt_patchlist.c |   78 +
 arch/ia64/kernel/paravirt_patchlist.h |   28 +
 arch/ia64/kernel/patch.c  |   48 ++---
 arch/ia64/kernel/time.c   |   12 ++
 arch/ia64/kernel/vmlinux.lds.S|6 +
 arch/ia64/mm/init.c   |8 +-
 arch/ia64/scripts/pvcheck.sed |1 +
 arch/ia64/xen/Kconfig |1 +
 arch/ia64/xen/Makefile|   18 +++-
 arch/ia64/xen/gate-data.S |3 +
 arch/ia64/xen/time.c  |   48 
 arch/ia64/xen/xen_pv_ops.c|  132 +-
 32 files changed, 719 insertions(+), 164 deletions(-)

___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 01/15] ia64: remove warnings.

2008-12-11 Thread Isaku Yamahata
this patch removes the following warnings.

   CC  arch/ia64/kernel/patch.o
 /linux-2.6/arch/ia64/kernel/patch.c: In function 'ia64_patch_vtop':
 /linux-2.6/arch/ia64/kernel/patch.c:112: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast
 /linux-2.6/arch/ia64/kernel/patch.c: In function 'ia64_patch_rse':
 /linux-2.6/arch/ia64/kernel/patch.c:135: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast
 /linux-2.6/arch/ia64/kernel/patch.c: In function 'ia64_patch_mckinley_e9':
 /linux-2.6/arch/ia64/kernel/patch.c:166: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast
 /linux-2.6/arch/ia64/kernel/patch.c:166: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast
 /linux-2.6/arch/ia64/kernel/patch.c: In function 'patch_fsyscall_table':
 /linux-2.6/arch/ia64/kernel/patch.c:202: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast
 /linux-2.6/arch/ia64/kernel/patch.c: In function 'patch_brl_fsys_bubble_down':
 /linux-2.6/arch/ia64/kernel/patch.c:220: warning: passing argument 1 of 
 'paravirt_fc' makes integer from pointer without a cast

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/kernel/patch.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index b83b2c5..5660069 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -108,7 +108,7 @@ ia64_patch_vtop (unsigned long start, unsigned long end)
 
/* replace virtual address with corresponding physical address: 
*/
ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip)));
-   ia64_fc((void *) ip);
+   ia64_fc(ip);
++offp;
}
ia64_sync_i();
@@ -131,7 +131,7 @@ ia64_patch_rse (unsigned long start, unsigned long end)
 
b = (u64 *)(ip  -16);
b[1] = ~0xf80L;
-   ia64_fc((void *) ip);
+   ia64_fc(ip);
++offp;
}
ia64_sync_i();
@@ -162,7 +162,7 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long 
end)
wp[1] = 0x008400688200UL;
wp[2] = 0x0001UL; /* nop.m 0; nop.i 0; nop.i 0 */
wp[3] = 0x00040200UL;
-   ia64_fc(wp); ia64_fc(wp + 2);
+   ia64_fc((unsigned long)wp); ia64_fc((unsigned long)(wp + 2));
++offp;
}
ia64_sync_i();
@@ -179,7 +179,7 @@ patch_fsyscall_table (unsigned long start, unsigned long 
end)
while (offp  (s32 *) end) {
ip = (u64) ia64_imva((char *) offp + *offp);
ia64_patch_imm64(ip, (u64) fsyscall_table);
-   ia64_fc((void *) ip);
+   ia64_fc(ip);
++offp;
}
ia64_sync_i();
@@ -197,7 +197,7 @@ patch_brl_fsys_bubble_down (unsigned long start, unsigned 
long end)
ip = (u64) offp + *offp;
ia64_patch_imm60((u64) ia64_imva((void *) ip),
 (u64) (fsys_bubble_down - (ip  -16)) / 16);
-   ia64_fc((void *) ip);
+   ia64_fc(ip);
++offp;
}
ia64_sync_i();
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 02/15] __initdata and const cannot be always a happy pair, as gcc-4.3.3 gives

2008-12-11 Thread Isaku Yamahata
  arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type 
conflict
  arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type 
conflict

This patch simply removes const from data with __initdata.

Signed-off-by: Takashi Iwai ti...@suse.de
---
 arch/ia64/xen/xen_pv_ops.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index 04cd123..5d491d9 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
xen_setup_vcpu_info_placement();
 }
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static struct pv_init_ops xen_init_ops __initdata = {
.banner = xen_banner,
 
.reserve_memory = xen_reserve_memory,
@@ -260,7 +260,7 @@ xen_intrin_local_irq_restore(unsigned long mask)
xen_rsm_i();
 }
 
-static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+static struct pv_cpu_ops xen_cpu_ops __initdata = {
.fc = xen_fc,
.thash  = xen_thash,
.get_cpuid  = xen_get_cpuid,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, 
u32 val)
HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, apic_op);
 }
 
-static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
+static struct pv_iosapic_ops xen_iosapic_ops __initdata = {
.pcat_compat_init = xen_pcat_compat_init,
.__get_irq_chip = xen_iosapic_get_irq_chip,
 
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 03/15] ia64/pv_ops: add hooks to paravirtualize fsyscall implementation.

2008-12-11 Thread Isaku Yamahata
Add two hooks, paravirt_get_fsyscall_table() and
paravirt_get_fsys_bubble_doen() to paravirtualize fsyscall implementation.
This patch just add the hooks fsyscall and don't paravirtualize it.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/native/inst.h |3 +++
 arch/ia64/include/asm/paravirt.h|   15 +++
 arch/ia64/kernel/Makefile   |4 ++--
 arch/ia64/kernel/fsys.S |   17 +
 arch/ia64/kernel/patch.c|   26 +++---
 arch/ia64/mm/init.c |2 +-
 6 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/arch/ia64/include/asm/native/inst.h 
b/arch/ia64/include/asm/native/inst.h
index 0a1026c..5e4e151 100644
--- a/arch/ia64/include/asm/native/inst.h
+++ b/arch/ia64/include/asm/native/inst.h
@@ -30,6 +30,9 @@
 #define __paravirt_work_processed_syscall_target \
ia64_work_processed_syscall
 
+#define paravirt_fsyscall_table
ia64_native_fsyscall_table
+#define paravirt_fsys_bubble_down  ia64_native_fsys_bubble_down
+
 #ifdef CONFIG_PARAVIRT_GUEST_ASM_CLOBBER_CHECK
 # define PARAVIRT_POISON   0xdeadbeefbaadf00d
 # define CLOBBER(clob) \
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index 2bf3636..56f69f9 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -22,6 +22,21 @@
 #ifndef __ASM_PARAVIRT_H
 #define __ASM_PARAVIRT_H
 
+#ifndef __ASSEMBLY__
+/**
+ * fsys related addresses
+ */
+struct pv_fsys_data {
+   unsigned long *fsyscall_table;
+   void *fsys_bubble_down;
+};
+
+extern struct pv_fsys_data pv_fsys_data;
+
+unsigned long *paravirt_get_fsyscall_table(void);
+char *paravirt_get_fsys_bubble_down(void);
+#endif
+
 #ifdef CONFIG_PARAVIRT_GUEST
 
 #define PARAVIRT_HYPERVISOR_TYPE_DEFAULT   0
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index c381ea9..1ab150e 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -111,9 +111,9 @@ include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
 clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
 
 #
-# native ivt.S and entry.S
+# native ivt.S, entry.S and fsys.S
 #
-ASM_PARAVIRT_OBJS = ivt.o entry.o
+ASM_PARAVIRT_OBJS = ivt.o entry.o fsys.o
 define paravirtualized_native
 AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_NATIVE
 AFLAGS_pvchk-sed-$(1) += -D__IA64_ASM_PARAVIRTUALIZED_PVCHECK
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index c1625c7..788319f 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -25,6 +25,7 @@
 #include asm/unistd.h
 
 #include entry.h
+#include paravirt_inst.h
 
 /*
  * See Documentation/ia64/fsys.txt for details on fsyscalls.
@@ -602,7 +603,7 @@ ENTRY(fsys_fallback_syscall)
mov r26=ar.pfs
 END(fsys_fallback_syscall)
/* FALL THROUGH */
-GLOBAL_ENTRY(fsys_bubble_down)
+GLOBAL_ENTRY(paravirt_fsys_bubble_down)
.prologue
.altrp b6
.body
@@ -640,7 +641,7 @@ GLOBAL_ENTRY(fsys_bubble_down)
 *
 * PSR.BE : already is turned off in __kernel_syscall_via_epc()
 * PSR.AC : don't care (kernel normally turns PSR.AC on)
-* PSR.I  : already turned off by the time fsys_bubble_down gets
+* PSR.I  : already turned off by the time paravirt_fsys_bubble_down 
gets
 *  invoked
 * PSR.DFL: always 0 (kernel never turns it on)
 * PSR.DFH: don't care --- kernel never touches f32-f127 on its own
@@ -650,7 +651,7 @@ GLOBAL_ENTRY(fsys_bubble_down)
 * PSR.DB : don't care --- kernel never enables kernel-level
 *  breakpoints
 * PSR.TB : must be 0 already; if it wasn't zero on entry to
-*  __kernel_syscall_via_epc, the branch to fsys_bubble_down
+*  __kernel_syscall_via_epc, the branch to 
paravirt_fsys_bubble_down
 *  will trigger a taken branch; the taken-trap-handler then
 *  converts the syscall into a break-based system-call.
 */
@@ -741,14 +742,14 @@ GLOBAL_ENTRY(fsys_bubble_down)
nop.m 0
 (p8)   br.call.sptk.many b6=b6 // B(ignore return address)
br.cond.spnt ia64_trace_syscall // B
-END(fsys_bubble_down)
+END(paravirt_fsys_bubble_down)
 
.rodata
.align 8
-   .globl fsyscall_table
+   .globl paravirt_fsyscall_table
 
-   data8 fsys_bubble_down
-fsyscall_table:
+   data8 paravirt_fsys_bubble_down
+paravirt_fsyscall_table:
data8 fsys_ni_syscall
data8 0 // exit // 1025
data8 0 // read
@@ -1033,4 +1034,4 @@ fsyscall_table:
 
// fill in zeros for the remaining entries
.zero:
-   .space 

[Xen-ia64-devel] [PATCH 04/15] ia64/pv_ops/xen: preliminary to paravirtualizing fsys.S for xen.

2008-12-11 Thread Isaku Yamahata
This is a preliminary patch to paravirtualizing fsys.S.
compile fsys.S twice one for native and one for xen, and switch
them at run tine.
Later fsys.S will be paravirtualized.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/xen/inst.h |3 +++
 arch/ia64/xen/Makefile   |2 +-
 arch/ia64/xen/xen_pv_ops.c   |   14 ++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/ia64/include/asm/xen/inst.h b/arch/ia64/include/asm/xen/inst.h
index 19c2ae1..e8e01b2 100644
--- a/arch/ia64/include/asm/xen/inst.h
+++ b/arch/ia64/include/asm/xen/inst.h
@@ -33,6 +33,9 @@
 #define __paravirt_work_processed_syscall_target \
xen_work_processed_syscall
 
+#define paravirt_fsyscall_tablexen_fsyscall_table
+#define paravirt_fsys_bubble_down  xen_fsys_bubble_down
+
 #define MOV_FROM_IFA(reg)  \
movl reg = XSI_IFA; \
;;  \
diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
index 0ad0224..b4ca2e6 100644
--- a/arch/ia64/xen/Makefile
+++ b/arch/ia64/xen/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_IA64_GENERIC) += machvec.o
 AFLAGS_xenivt.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN
 
 # xen multi compile
-ASM_PARAVIRT_MULTI_COMPILE_SRCS = ivt.S entry.S
+ASM_PARAVIRT_MULTI_COMPILE_SRCS = ivt.S entry.S fsys.S
 ASM_PARAVIRT_OBJS = $(addprefix xen-,$(ASM_PARAVIRT_MULTI_COMPILE_SRCS:.S=.o))
 obj-y += $(ASM_PARAVIRT_OBJS)
 define paravirtualized_xen
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index 5d491d9..46b418a 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -24,6 +24,7 @@
 #include linux/irq.h
 #include linux/kernel.h
 #include linux/pm.h
+#include linux/unistd.h
 
 #include asm/xen/hypervisor.h
 #include asm/xen/xencomm.h
@@ -166,6 +167,18 @@ static struct pv_init_ops xen_init_ops __initdata = {
 };
 
 /***
+ * pv_fsys_data
+ * addresses for fsys
+ */
+
+extern unsigned long xen_fsyscall_table[NR_syscalls];
+extern char xen_fsys_bubble_down[];
+struct pv_fsys_data xen_fsys_data __initdata = {
+   .fsyscall_table = (unsigned long *)xen_fsyscall_table,
+   .fsys_bubble_down = (void *)xen_fsys_bubble_down,
+};
+
+/***
  * pv_cpu_ops
  * intrinsics hooks.
  */
@@ -355,6 +368,7 @@ xen_setup_pv_ops(void)
xen_info_init();
pv_info = xen_info;
pv_init_ops = xen_init_ops;
+   pv_fsys_data = xen_fsys_data;
pv_cpu_ops = xen_cpu_ops;
pv_iosapic_ops = xen_iosapic_ops;
pv_irq_ops = xen_irq_ops;
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 05/15] ia64/pv_ops: paravirtualize fsys.S.

2008-12-11 Thread Isaku Yamahata
paravirtualize fsys.S.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/kernel/fsys.S |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 788319f..3544d75 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -419,7 +419,7 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 
- *set
mov r17=(1  (SIGKILL - 1)) | (1  (SIGSTOP - 1))
;;
 
-   rsm psr.i   // mask interrupt delivery
+   RSM_PSR_I(p0, r18, r19) // mask interrupt delivery
mov ar.ccv=0
andcm r14=r14,r17   // filter out SIGKILL  SIGSTOP
 
@@ -492,7 +492,7 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 
- *set
 #ifdef CONFIG_SMP
st4.rel [r31]=r0// release the lock
 #endif
-   ssm psr.i
+   SSM_PSR_I(p0, p9, r31)
;;
 
srlz.d  // ensure psr.i is set again
@@ -514,7 +514,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
 #ifdef CONFIG_SMP
st4.rel [r31]=r0// release the lock
 #endif
-   ssm psr.i
+   SSM_PSR_I(p0, p9, r17)
;;
srlz.d
br.sptk.many fsys_fallback_syscall  // with signal pending, do the 
heavy-weight syscall
@@ -522,7 +522,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3)
 #ifdef CONFIG_SMP
 .lock_contention:
/* Rather than spinning here, fall back on doing a heavy-weight 
syscall.  */
-   ssm psr.i
+   SSM_PSR_I(p0, p9, r17)
;;
srlz.d
br.sptk.many fsys_fallback_syscall
@@ -593,11 +593,11 @@ ENTRY(fsys_fallback_syscall)
adds r17=-1024,r15
movl r14=sys_call_table
;;
-   rsm psr.i
+   RSM_PSR_I(p0, r26, r27)
shladd r18=r17,3,r14
;;
ld8 r18=[r18]   // load normal (heavy-weight) 
syscall entry-point
-   mov r29=psr // read psr (12 cyc load 
latency)
+   MOV_FROM_PSR(p0, r29, r26)  // read psr (12 cyc load 
latency)
mov r27=ar.rsc
mov r21=ar.fpsr
mov r26=ar.pfs
@@ -735,7 +735,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)
mov rp=r14  // I0   set the real return addr
and r3=_TIF_SYSCALL_TRACEAUDIT,r3   // A
;;
-   ssm psr.i   // M2   we're on kernel stacks 
now, reenable irqs
+   SSM_PSR_I(p0, p6, r22)  // M2   we're on kernel stacks 
now, reenable irqs
cmp.eq p8,p0=r3,r0  // A
 (p10)  br.cond.spnt.many ia64_ret_from_syscall // Breturn if bad 
call-frame or r15 is a NaT
 
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 06/15] ia64/pv_ops/pvchecker: support mov = ar.itc paravirtualization

2008-12-11 Thread Isaku Yamahata
add suport for mov = ar.itc to pvchecker.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/native/pvchk_inst.h |5 +
 arch/ia64/scripts/pvcheck.sed |1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/include/asm/native/pvchk_inst.h 
b/arch/ia64/include/asm/native/pvchk_inst.h
index b8e6eb1..13b289e 100644
--- a/arch/ia64/include/asm/native/pvchk_inst.h
+++ b/arch/ia64/include/asm/native/pvchk_inst.h
@@ -180,6 +180,11 @@
IS_PRED_IN(pred)\
IS_RREG_OUT(reg)\
IS_RREG_CLOB(clob)
+#define MOV_FROM_ITC(pred, pred_clob, reg, clob)   \
+   IS_PRED_IN(pred)\
+   IS_PRED_CLOB(pred_clob) \
+   IS_RREG_OUT(reg)\
+   IS_RREG_CLOB(clob)
 #define MOV_TO_IFA(reg, clob)  \
IS_RREG_IN(reg) \
IS_RREG_CLOB(clob)
diff --git a/arch/ia64/scripts/pvcheck.sed b/arch/ia64/scripts/pvcheck.sed
index ba66ac2..e59809a 100644
--- a/arch/ia64/scripts/pvcheck.sed
+++ b/arch/ia64/scripts/pvcheck.sed
@@ -17,6 +17,7 @@ s/mov.*=.*cr\.iip/.warning \cr.iip should not used 
directly\/g
 s/mov.*=.*cr\.ivr/.warning \cr.ivr should not used directly\/g
 s/mov.*=[^\.]*psr/.warning \psr should not used directly\/g  # avoid ar.fpsr
 s/mov.*=.*ar\.eflags/.warning \ar.eflags should not used directly\/g
+s/mov.*=.*ar\.itc.*/.warning \ar.itc should not used directly\/g
 s/mov.*cr\.ifa.*=.*/.warning \cr.ifa should not used directly\/g
 s/mov.*cr\.itir.*=.*/.warning \cr.itir should not used directly\/g
 s/mov.*cr\.iha.*=.*/.warning \cr.iha should not used directly\/g
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 07/15] ia64/pv_ops: paravirtualize mov = ar.itc.

2008-12-11 Thread Isaku Yamahata
paravirtualize mov reg = ar.itc.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/native/inst.h |5 +
 arch/ia64/kernel/entry.S|4 ++--
 arch/ia64/kernel/fsys.S |4 ++--
 arch/ia64/kernel/ivt.S  |2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/include/asm/native/inst.h 
b/arch/ia64/include/asm/native/inst.h
index 5e4e151..ad59fc6 100644
--- a/arch/ia64/include/asm/native/inst.h
+++ b/arch/ia64/include/asm/native/inst.h
@@ -77,6 +77,11 @@
 (pred) mov reg = psr   \
CLOBBER(clob)
 
+#define MOV_FROM_ITC(pred, pred_clob, reg, clob)   \
+(pred) mov reg = ar.itc\
+   CLOBBER(clob)   \
+   CLOBBER_PRED(pred_clob)
+
 #define MOV_TO_IFA(reg, clob)  \
mov cr.ifa = reg\
CLOBBER(clob)
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d435f4a..c5709c6 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -735,7 +735,7 @@ GLOBAL_ENTRY(__paravirt_leave_syscall)
 __paravirt_work_processed_syscall:
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
adds r2=PT(LOADRS)+16,r12
-(pUStk)mov.m r22=ar.itc// fetch time at leave
+   MOV_FROM_ITC(pUStk, p9, r22, r19)   // fetch time at leave
adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
;;
 (p6)   ld4 r31=[r18]   // load 
current_thread_info()-flags
@@ -984,7 +984,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
.pred.rel.mutex pUStk,pKStk
MOV_FROM_PSR(pKStk, r22, r29)   // M2 read PSR now that interrupts are 
disabled
-(pUStk)mov.m r22=ar.itc// M  fetch time at leave
+   MOV_FROM_ITC(pUStk, p9, r22, r29)   // M  fetch time at leave
nop.i 0
;;
 #else
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 3544d75..3567d54 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -280,7 +280,7 @@ ENTRY(fsys_gettimeofday)
 (p9)   cmp.eq p13,p0 = 0,r30   // if mmio_ptr, clear p13 jitter control
;;
.pred.rel.mutex p8,p9
-(p8)   mov r2 = ar.itc // CPU_TIMER. 36 clocks latency!!!
+   MOV_FROM_ITC(p8, p6, r2, r10)   // CPU_TIMER. 36 clocks latency!!!
 (p9)   ld8 r2 = [r30]  // MMIO_TIMER. Could also have latency issues..
 (p13)  ld8 r25 = [r19] // get itc_lastcycle value
ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec
@@ -684,7 +684,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)
;;
mov ar.rsc=0// M2   set enforced lazy mode, 
pl 0, LE, loadrs=0
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
-   mov.m r30=ar.itc// Mget cycle for accounting
+   MOV_FROM_ITC(p0, p6, r30, r23)  // Mget cycle for accounting
 #else
nop.m 0
 #endif
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index f675d8e..ec9a5fd 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -804,7 +804,7 @@ ENTRY(break_fault)
 ///
st1 [r16]=r0// M2|3 clear 
current-thread.on_ustack flag
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
-   mov.m r30=ar.itc// Mget cycle for accounting
+   MOV_FROM_ITC(p0, p14, r30, r18) // Mget cycle for accounting
 #else
mov b6=r30  // I0   setup syscall handler 
branch reg early
 #endif
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 08/15] ia64/pv_ops/xen: paravirtualize read/write ar.itc and ar.itm

2008-12-11 Thread Isaku Yamahata
paravirtualize ar.itc and ar.itm in order to support save/restore.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/xen/inst.h  |   21 +
 arch/ia64/include/asm/xen/interface.h |9 
 arch/ia64/include/asm/xen/minstate.h  |   11 -
 arch/ia64/include/asm/xen/privop.h|2 +
 arch/ia64/kernel/asm-offsets.c|2 +
 arch/ia64/xen/xen_pv_ops.c|   80 -
 6 files changed, 123 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/include/asm/xen/inst.h b/arch/ia64/include/asm/xen/inst.h
index e8e01b2..90537dc 100644
--- a/arch/ia64/include/asm/xen/inst.h
+++ b/arch/ia64/include/asm/xen/inst.h
@@ -113,6 +113,27 @@
 .endm
 #define MOV_FROM_PSR(pred, reg, clob)  __MOV_FROM_PSR pred, reg, clob
 
+/* assuming ar.itc is read with interrupt disabled. */
+#define MOV_FROM_ITC(pred, pred_clob, reg, clob)   \
+(pred) movl clob = XSI_ITC_OFFSET; \
+   ;;  \
+(pred) ld8 clob = [clob];  \
+(pred) mov reg = ar.itc;   \
+   ;;  \
+(pred) add reg = reg, clob;\
+   ;;  \
+(pred) movl clob = XSI_ITC_LAST;   \
+   ;;  \
+(pred) ld8 clob = [clob];  \
+   ;;  \
+(pred) cmp.geu.unc pred_clob, p0 = clob, reg;  \
+   ;;  \
+(pred_clob)add reg = 1, clob;  \
+   ;;  \
+(pred) movl clob = XSI_ITC_LAST;   \
+   ;;  \
+(pred) st8 [clob] = reg
+
 
 #define MOV_TO_IFA(reg, clob)  \
movl clob = XSI_IFA;\
diff --git a/arch/ia64/include/asm/xen/interface.h 
b/arch/ia64/include/asm/xen/interface.h
index f00fab4..e951e74 100644
--- a/arch/ia64/include/asm/xen/interface.h
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -209,6 +209,15 @@ struct mapped_regs {
unsigned long krs[8];   /* kernel registers */
unsigned long tmp[16];  /* temp registers
   (e.g. for hyperprivops) */
+
+   /* itc paravirtualization
+* vAR.ITC = mAR.ITC + itc_offset
+* itc_last is one which was lastly passed to
+* the guest OS in order to prevent it from
+* going backwords.
+*/
+   unsigned long itc_offset;
+   unsigned long itc_last;
};
};
 };
diff --git a/arch/ia64/include/asm/xen/minstate.h 
b/arch/ia64/include/asm/xen/minstate.h
index 4d92d9b..c57fa91 100644
--- a/arch/ia64/include/asm/xen/minstate.h
+++ b/arch/ia64/include/asm/xen/minstate.h
@@ -1,3 +1,12 @@
+
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING
+/* read ar.itc in advance, and use it before leaving bank 0 */
+#define XEN_ACCOUNT_GET_STAMP  \
+   MOV_FROM_ITC(pUStk, p6, r20, r2);
+#else
+#define XEN_ACCOUNT_GET_STAMP
+#endif
+
 /*
  * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
  * the minimum state necessary that allows us to turn psr.ic back
@@ -123,7 +132,7 @@
;;  
\
 .mem.offset 0,0; st8.spill [r16]=r2,16;
\
 .mem.offset 8,0; st8.spill [r17]=r3,16;
\
-   ACCOUNT_GET_STAMP   
\
+   XEN_ACCOUNT_GET_STAMP   
\
adds r2=IA64_PT_REGS_R16_OFFSET,r1; 
\
;;  
\
EXTRA;  
\
diff --git a/arch/ia64/include/asm/xen/privop.h 
b/arch/ia64/include/asm/xen/privop.h
index 71ec754..2261dda 100644
--- a/arch/ia64/include/asm/xen/privop.h
+++ b/arch/ia64/include/asm/xen/privop.h
@@ -55,6 +55,8 @@
 #define XSI_BANK1_R16  (XSI_BASE + XSI_BANK1_R16_OFS)
 #define XSI_BANKNUM(XSI_BASE + XSI_BANKNUM_OFS)
 #define XSI_IHA(XSI_BASE + XSI_IHA_OFS)
+#define XSI_ITC_OFFSET (XSI_BASE + XSI_ITC_OFFSET_OFS)
+#define 

[Xen-ia64-devel] [PATCH 09/15] ia64/pv_ops/pv_time_ops: add sched_clock hook.

2008-12-11 Thread Isaku Yamahata
add sched_clock() hook to paravirtualize sched_clock().
ia64 sched_clock() is based on ar.itc which isn't stable
on virtualized environment because vcpu may move around on
pcpus. So it needs paravirtualization.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/paravirt.h |7 +++
 arch/ia64/include/asm/timex.h|1 +
 arch/ia64/kernel/head.S  |4 ++--
 arch/ia64/kernel/paravirt.c  |1 +
 arch/ia64/kernel/time.c  |   12 
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index 56f69f9..a73e77a 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -225,6 +225,8 @@ struct pv_time_ops {
int (*do_steal_accounting)(unsigned long *new_itm);
 
void (*clocksource_resume)(void);
+
+   unsigned long long (*sched_clock)(void);
 };
 
 extern struct pv_time_ops pv_time_ops;
@@ -242,6 +244,11 @@ paravirt_do_steal_accounting(unsigned long *new_itm)
return pv_time_ops.do_steal_accounting(new_itm);
 }
 
+static inline unsigned long long paravirt_sched_clock(void)
+{
+   return pv_time_ops.sched_clock();
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #else
diff --git a/arch/ia64/include/asm/timex.h b/arch/ia64/include/asm/timex.h
index 4e03cfe..86c7db8 100644
--- a/arch/ia64/include/asm/timex.h
+++ b/arch/ia64/include/asm/timex.h
@@ -40,5 +40,6 @@ get_cycles (void)
 }
 
 extern void ia64_cpu_local_tick (void);
+extern unsigned long long ia64_native_sched_clock (void);
 
 #endif /* _ASM_IA64_TIMEX_H */
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 59301c4..01e410e 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1050,7 +1050,7 @@ END(ia64_delay_loop)
  * except that the multiplication and the shift are done with 128-bit
  * intermediate precision so that we can produce a full 64-bit result.
  */
-GLOBAL_ENTRY(sched_clock)
+GLOBAL_ENTRY(ia64_native_sched_clock)
addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
mov.m r9=ar.itc // fetch cycle-counter  
(35 cyc)
;;
@@ -1066,7 +1066,7 @@ GLOBAL_ENTRY(sched_clock)
;;
shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
br.ret.sptk.many rp
-END(sched_clock)
+END(ia64_native_sched_clock)
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
 GLOBAL_ENTRY(cycle_to_cputime)
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c
index 9f14c16..6bc33a6 100644
--- a/arch/ia64/kernel/paravirt.c
+++ b/arch/ia64/kernel/paravirt.c
@@ -366,4 +366,5 @@ ia64_native_do_steal_accounting(unsigned long *new_itm)
 
 struct pv_time_ops pv_time_ops = {
.do_steal_accounting = ia64_native_do_steal_accounting,
+   .sched_clock = ia64_native_sched_clock,
 };
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 65c10a4..6f6ca42 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -50,6 +50,18 @@ EXPORT_SYMBOL(last_cli_ip);
 #endif
 
 #ifdef CONFIG_PARAVIRT
+/* We need to define a real function for sched_clock, to override the
+   weak default version */
+unsigned long long sched_clock(void)
+{
+return paravirt_sched_clock();
+}
+#else
+unsigned long long
+sched_clock(void) __attribute__((alias(ia64_native_sched_clock)));
+#endif
+
+#ifdef CONFIG_PARAVIRT
 static void
 paravirt_clocksource_resume(void)
 {
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 10/15] ia64/pv_ops/xen/pv_time_ops: implement sched_clock.

2008-12-11 Thread Isaku Yamahata
paravirtualize sched_clock.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/xen/Kconfig |1 +
 arch/ia64/xen/time.c  |   48 
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/xen/Kconfig b/arch/ia64/xen/Kconfig
index f1683a2..48839da 100644
--- a/arch/ia64/xen/Kconfig
+++ b/arch/ia64/xen/Kconfig
@@ -8,6 +8,7 @@ config XEN
depends on PARAVIRT  MCKINLEY  IA64_PAGE_SIZE_16KB  EXPERIMENTAL
select XEN_XENCOMM
select NO_IDLE_HZ
+   select HAVE_UNSTABLE_SCHED_CLOCK
 
# those are required to save/restore.
select ARCH_SUSPEND_POSSIBLE
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index d15a94c..c85d319 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -175,10 +175,58 @@ static void xen_itc_jitter_data_reset(void)
} while (unlikely(ret != lcycle));
 }
 
+/* based on xen_sched_clock() in arch/x86/xen/time.c. */
+/*
+ * This relies on HAVE_UNSTABLE_SCHED_CLOCK. If it can't be defined,
+ * something similar logic should be implemented here.
+ */
+/*
+ * Xen sched_clock implementation.  Returns the number of unstolen
+ * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
+ * states.
+ */
+static unsigned long long xen_sched_clock(void)
+{
+   struct vcpu_runstate_info runstate;
+
+   unsigned long long now;
+   unsigned long long offset;
+   unsigned long long ret;
+
+   /*
+* Ideally sched_clock should be called on a per-cpu basis
+* anyway, so preempt should already be disabled, but that's
+* not current practice at the moment.
+*/
+   preempt_disable();
+
+   /*
+* both ia64_native_sched_clock() and xen's runstate are
+* based on mAR.ITC. So difference of them makes sense.
+*/
+   now = ia64_native_sched_clock();
+
+   get_runstate_snapshot(runstate);
+
+   WARN_ON(runstate.state != RUNSTATE_running);
+
+   offset = 0;
+   if (now  runstate.state_entry_time)
+   offset = now - runstate.state_entry_time;
+   ret = runstate.time[RUNSTATE_blocked] +
+   runstate.time[RUNSTATE_running] +
+   offset;
+
+   preempt_enable();
+
+   return ret;
+}
+
 struct pv_time_ops xen_time_ops __initdata = {
.init_missing_ticks_accounting  = xen_init_missing_ticks_accounting,
.do_steal_accounting= xen_do_steal_accounting,
.clocksource_resume = xen_itc_jitter_data_reset,
+   .sched_clock= xen_sched_clock,
 };
 
 /* Called after suspend, to resume time.  */
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 12/15] ia64/pv_ops/xen: define xen specific gate page.

2008-12-11 Thread Isaku Yamahata
define xen specific gate page.
At this phase bits in the gate page is same to native.
At the next phase, it will be paravirtualized.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/xen/patchlist.h |   38 +
 arch/ia64/kernel/vmlinux.lds.S|6 +
 arch/ia64/xen/Makefile|   16 +-
 arch/ia64/xen/gate-data.S |3 ++
 arch/ia64/xen/xen_pv_ops.c|   32 +++
 5 files changed, 94 insertions(+), 1 deletions(-)
 create mode 100644 arch/ia64/include/asm/xen/patchlist.h
 create mode 100644 arch/ia64/xen/gate-data.S

diff --git a/arch/ia64/include/asm/xen/patchlist.h 
b/arch/ia64/include/asm/xen/patchlist.h
new file mode 100644
index 000..eae944e
--- /dev/null
+++ b/arch/ia64/include/asm/xen/patchlist.h
@@ -0,0 +1,38 @@
+/**
+ * arch/ia64/include/asm/xen/patchlist.h
+ *
+ * Copyright (c) 2008 Isaku Yamahata yamahata at valinux co jp
+ *VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#define __paravirt_start_gate_fsyscall_patchlist   \
+   __xen_start_gate_fsyscall_patchlist
+#define __paravirt_end_gate_fsyscall_patchlist \
+   __xen_end_gate_fsyscall_patchlist
+#define __paravirt_start_gate_brl_fsys_bubble_down_patchlist   \
+   __xen_start_gate_brl_fsys_bubble_down_patchlist
+#define __paravirt_end_gate_brl_fsys_bubble_down_patchlist \
+   __xen_end_gate_brl_fsys_bubble_down_patchlist
+#define __paravirt_start_gate_vtop_patchlist   \
+   __xen_start_gate_vtop_patchlist
+#define __paravirt_end_gate_vtop_patchlist \
+   __xen_end_gate_vtop_patchlist
+#define __paravirt_start_gate_mckinley_e9_patchlist\
+   __xen_start_gate_mckinley_e9_patchlist
+#define __paravirt_end_gate_mckinley_e9_patchlist  \
+   __xen_end_gate_mckinley_e9_patchlist
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 10a7d47..92ae7e8 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -201,6 +201,12 @@ SECTIONS
  __start_gate_section = .;
  *(.data.gate)
  __stop_gate_section = .;
+#ifdef CONFIG_XEN
+ . = ALIGN(PAGE_SIZE);
+ __xen_start_gate_section = .;
+ *(.data.gate.xen)
+ __xen_stop_gate_section = .;
+#endif
}
   . = ALIGN(PAGE_SIZE);/* make sure the gate page doesn't 
expose
 * kernel data
diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
index b4ca2e6..94f0d8e 100644
--- a/arch/ia64/xen/Makefile
+++ b/arch/ia64/xen/Makefile
@@ -3,10 +3,24 @@
 #
 
 obj-y := hypercall.o xenivt.o xensetup.o xen_pv_ops.o irq_xen.o \
-hypervisor.o xencomm.o xcom_hcall.o grant-table.o time.o suspend.o
+hypervisor.o xencomm.o xcom_hcall.o grant-table.o time.o suspend.o \
+gate-data.o
 
 obj-$(CONFIG_IA64_GENERIC) += machvec.o
 
+# The gate DSO image is built using a special linker script.
+include $(srctree)/arch/ia64/kernel/Makefile.gate
+
+# tell compiled for xen
+CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_XEN
+
+# use same file of native.
+$(obj)/gate.o: $(src)/../kernel/gate.S FORCE
+   $(call if_changed_dep,as_o_S)
+$(obj)/gate.lds: $(src)/../kernel/gate.lds.S FORCE
+   $(call if_changed_dep,cpp_lds_S)
+
+
 AFLAGS_xenivt.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN
 
 # xen multi compile
diff --git a/arch/ia64/xen/gate-data.S b/arch/ia64/xen/gate-data.S
new file mode 100644
index 000..7d4830a
--- /dev/null
+++ b/arch/ia64/xen/gate-data.S
@@ -0,0 +1,3 @@
+   .section .data.gate.xen, aw
+
+   .incbin arch/ia64/xen/gate.so
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index e83ede7..eda13a8 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -179,6 +179,37 @@ struct pv_fsys_data xen_fsys_data __initdata = {
 };
 
 /***
+ * pv_patchdata
+ * patchdata addresses
+ */
+
+#define DECLARE(name)  \
+   

[Xen-ia64-devel] [PATCH 11/15] ia64/pv_ops: gate page paravirtualization.

2008-12-11 Thread Isaku Yamahata
paravirtualize gate page by allowing each pv_ops instances
to define its own gate page.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/native/patchlist.h |   38 ++
 arch/ia64/include/asm/paravirt.h |   35 +
 arch/ia64/kernel/Makefile|   32 ++--
 arch/ia64/kernel/Makefile.gate   |   27 ++
 arch/ia64/kernel/gate.lds.S  |   17 ---
 arch/ia64/kernel/paravirt_patchlist.c|   78 ++
 arch/ia64/kernel/paravirt_patchlist.h|   28 +++
 arch/ia64/kernel/patch.c |   12 ++--
 arch/ia64/mm/init.c  |6 ++-
 9 files changed, 230 insertions(+), 43 deletions(-)
 create mode 100644 arch/ia64/include/asm/native/patchlist.h
 create mode 100644 arch/ia64/kernel/Makefile.gate
 create mode 100644 arch/ia64/kernel/paravirt_patchlist.c
 create mode 100644 arch/ia64/kernel/paravirt_patchlist.h

diff --git a/arch/ia64/include/asm/native/patchlist.h 
b/arch/ia64/include/asm/native/patchlist.h
new file mode 100644
index 000..be16ca9
--- /dev/null
+++ b/arch/ia64/include/asm/native/patchlist.h
@@ -0,0 +1,38 @@
+/**
+ * arch/ia64/include/asm/native/inst.h
+ *
+ * Copyright (c) 2008 Isaku Yamahata yamahata at valinux co jp
+ *VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#define __paravirt_start_gate_fsyscall_patchlist   \
+   __ia64_native_start_gate_fsyscall_patchlist
+#define __paravirt_end_gate_fsyscall_patchlist \
+   __ia64_native_end_gate_fsyscall_patchlist
+#define __paravirt_start_gate_brl_fsys_bubble_down_patchlist   \
+   __ia64_native_start_gate_brl_fsys_bubble_down_patchlist
+#define __paravirt_end_gate_brl_fsys_bubble_down_patchlist \
+   __ia64_native_end_gate_brl_fsys_bubble_down_patchlist
+#define __paravirt_start_gate_vtop_patchlist   \
+   __ia64_native_start_gate_vtop_patchlist
+#define __paravirt_end_gate_vtop_patchlist \
+   __ia64_native_end_gate_vtop_patchlist
+#define __paravirt_start_gate_mckinley_e9_patchlist\
+   __ia64_native_start_gate_mckinley_e9_patchlist
+#define __paravirt_end_gate_mckinley_e9_patchlist  \
+   __ia64_native_end_gate_mckinley_e9_patchlist
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index a73e77a..fc433f6 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -35,6 +35,41 @@ extern struct pv_fsys_data pv_fsys_data;
 
 unsigned long *paravirt_get_fsyscall_table(void);
 char *paravirt_get_fsys_bubble_down(void);
+
+/**
+ * patchlist addresses for gate page
+ */
+enum pv_gate_patchlist {
+   PV_GATE_START_FSYSCALL,
+   PV_GATE_END_FSYSCALL,
+
+   PV_GATE_START_BRL_FSYS_BUBBLE_DOWN,
+   PV_GATE_END_BRL_FSYS_BUBBLE_DOWN,
+
+   PV_GATE_START_VTOP,
+   PV_GATE_END_VTOP,
+
+   PV_GATE_START_MCKINLEY_E9,
+   PV_GATE_END_MCKINLEY_E9,
+};
+
+struct pv_patchdata {
+   unsigned long start_fsyscall_patchlist;
+   unsigned long end_fsyscall_patchlist;
+   unsigned long start_brl_fsys_bubble_down_patchlist;
+   unsigned long end_brl_fsys_bubble_down_patchlist;
+   unsigned long start_vtop_patchlist;
+   unsigned long end_vtop_patchlist;
+   unsigned long start_mckinley_e9_patchlist;
+   unsigned long end_mckinley_e9_patchlist;
+
+   void *gate_section;
+};
+
+extern struct pv_patchdata pv_patchdata;
+
+unsigned long paravirt_get_gate_patchlist(enum pv_gate_patchlist type);
+void *paravirt_get_gate_section(void);
 #endif
 
 #ifdef CONFIG_PARAVIRT_GUEST
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 1ab150e..8dc9df8 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -5,7 +5,7 @@
 extra-y:= head.o init_task.o vmlinux.lds
 
 obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o 
irq_ia64.o  \
-irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o 
ptrace.o sal.o 

[Xen-ia64-devel] [PATCH 14/15] ia64/pv_ops: paravirtualize gate.S.

2008-12-11 Thread Isaku Yamahata
paravirtualize gate.S.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/native/inst.h   |5 +
 arch/ia64/include/asm/native/pvchk_inst.h |3 +++
 arch/ia64/kernel/gate.S   |   17 +
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/include/asm/native/inst.h 
b/arch/ia64/include/asm/native/inst.h
index ad59fc6..d2d46ef 100644
--- a/arch/ia64/include/asm/native/inst.h
+++ b/arch/ia64/include/asm/native/inst.h
@@ -166,6 +166,11 @@
 #define RSM_PSR_DT \
rsm psr.dt
 
+#define RSM_PSR_BE_I(clob0, clob1) \
+   rsm psr.be | psr.i  \
+   CLOBBER(clob0)  \
+   CLOBBER(clob1)
+
 #define SSM_PSR_DT_AND_SRLZ_I  \
ssm psr.dt  \
;;  \
diff --git a/arch/ia64/include/asm/native/pvchk_inst.h 
b/arch/ia64/include/asm/native/pvchk_inst.h
index 13b289e..8d72962 100644
--- a/arch/ia64/include/asm/native/pvchk_inst.h
+++ b/arch/ia64/include/asm/native/pvchk_inst.h
@@ -251,6 +251,9 @@
IS_RREG_CLOB(clob2)
 #define RSM_PSR_DT \
nop 0
+#define RSM_PSR_BE_I(clob0, clob1) \
+   IS_RREG_CLOB(clob0) \
+   IS_RREG_CLOB(clob1)
 #define SSM_PSR_DT_AND_SRLZ_I  \
nop 0
 #define BSW_0(clob0, clob1, clob2) \
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
index c957228..cf5e0a1 100644
--- a/arch/ia64/kernel/gate.S
+++ b/arch/ia64/kernel/gate.S
@@ -13,6 +13,7 @@
 #include asm/sigcontext.h
 #include asm/system.h
 #include asm/unistd.h
+#include paravirt_inst.h
 
 /*
  * We can't easily refer to symbols inside the kernel.  To avoid full runtime 
relocation,
@@ -323,7 +324,7 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
epc // Bcauses split-issue
 }
;;
-   rsm psr.be | psr.i  // M2 (5 cyc to srlz.d)
+   RSM_PSR_BE_I(r20, r22)  // M2 (5 cyc to srlz.d)
LOAD_FSYSCALL_TABLE(r14)// X
;;
mov r16=IA64_KR(CURRENT)// M2 (12 cyc)
@@ -331,7 +332,7 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
mov r19=NR_syscalls-1   // A
;;
lfetch [r18]// M0|1
-   mov r29=psr // M2 (12 cyc)
+   MOV_FROM_PSR(p0, r29, r8)   // M2 (12 cyc)
// If r17 is a NaT, p6 will be zero
cmp.geu p6,p7=r19,r17   // A(sysnr  0  sysnr  
1024+NR_syscalls)?
;;
@@ -347,7 +348,7 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
 (p6)   tbit.z.unc p8,p0=r18,0  // I0 (dual-issues with mov 
b7=r18!)
nop.i 0
;;
-(p8)   ssm psr.i
+   SSM_PSR_I(p8, p14, r25)
 (p6)   mov b7=r18  // I0
 (p8)   br.dptk.many b7 // B
 
@@ -368,9 +369,17 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
 #else
BRL_COND_FSYS_BUBBLE_DOWN(p6)
 #endif
-   ssm psr.i
+   SSM_PSR_I(p0, p14, r10)
mov r10=-1
 (p10)  mov r8=EINVAL
 (p9)   mov r8=ENOSYS
FSYS_RETURN
+
+#ifdef CONFIG_PARAVIRT
+   /*
+* padd to make the size of this symbol constant
+* independent of paravirtualization.
+*/
+   .align PAGE_SIZE / 8
+#endif
 END(__kernel_syscall_via_epc)
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 15/15] ia64/pv_ops/xen/gate.S: xen gate page paravirtualization

2008-12-11 Thread Isaku Yamahata
xen gate page paravirtualization

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/xen/inst.h |4 
 arch/ia64/xen/Makefile   |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/include/asm/xen/inst.h b/arch/ia64/include/asm/xen/inst.h
index 90537dc..c53a476 100644
--- a/arch/ia64/include/asm/xen/inst.h
+++ b/arch/ia64/include/asm/xen/inst.h
@@ -386,6 +386,10 @@
 #define RSM_PSR_DT \
XEN_HYPER_RSM_PSR_DT
 
+#define RSM_PSR_BE_I(clob0, clob1) \
+   RSM_PSR_I(p0, clob0, clob1);\
+   rum psr.be
+
 #define SSM_PSR_DT_AND_SRLZ_I  \
XEN_HYPER_SSM_PSR_DT
 
diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
index 94f0d8e..e6f4a0a 100644
--- a/arch/ia64/xen/Makefile
+++ b/arch/ia64/xen/Makefile
@@ -13,6 +13,7 @@ include $(srctree)/arch/ia64/kernel/Makefile.gate
 
 # tell compiled for xen
 CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_XEN
+AFLAGS_gate.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN 
-D__IA64_GATE_PARAVIRTUALIZED_XEN
 
 # use same file of native.
 $(obj)/gate.o: $(src)/../kernel/gate.S FORCE
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 4/5] ia64/pv_ops/binary patch: define paravirt_dv_serialize_data() and suppress false positive warning.

2008-12-11 Thread Isaku Yamahata
define paravirt_dv_serialize_data() and insert it to suppress
false positive warnings.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/paravirt_privop.h |6 ++
 arch/ia64/kernel/efi.c  |1 +
 arch/ia64/kvm/vtlb.c|2 ++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/include/asm/paravirt_privop.h 
b/arch/ia64/include/asm/paravirt_privop.h
index 76d6a69..4e40e62 100644
--- a/arch/ia64/include/asm/paravirt_privop.h
+++ b/arch/ia64/include/asm/paravirt_privop.h
@@ -118,6 +118,12 @@ void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch 
*cpu_asm_switch);
 
 #endif /* CONFIG_PARAVIRT */
 
+#if defined(CONFIG_PARAVIRT)  defined(ASM_SUPPORTED)
+#define paravirt_dv_serialize_data()   ia64_dv_serialize_data()
+#else
+#define paravirt_dv_serialize_data()   /* nothing */
+#endif
+
 /* these routines utilize privilege-sensitive or performance-sensitive
  * privileged instructions so the code must be replaced with
  * paravirtualized versions */
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index efaff15..7ef80e8 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -456,6 +456,7 @@ efi_map_pal_code (void)
 GRANULEROUNDDOWN((unsigned long) pal_vaddr),
 pte_val(pfn_pte(__pa(pal_vaddr)  PAGE_SHIFT, PAGE_KERNEL)),
 IA64_GRANULE_SHIFT);
+   paravirt_dv_serialize_data();
ia64_set_psr(psr);  /* restore psr */
 }
 
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index e22b933..500c878 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -210,6 +210,7 @@ void thash_vhpt_insert(struct kvm_vcpu *v, u64 pte, u64 
itir, u64 va, int type)
phy_pte  = ~PAGE_FLAGS_RV_MASK;
psr = ia64_clear_ic();
ia64_itc(type, va, phy_pte, itir_ps(itir));
+   paravirt_dv_serialize_data();
ia64_set_psr(psr);
}
 
@@ -464,6 +465,7 @@ int thash_purge_and_insert(struct kvm_vcpu *v, u64 pte, u64 
itir,
phy_pte  = ~PAGE_FLAGS_RV_MASK;
psr = ia64_clear_ic();
ia64_itc(type, ifa, phy_pte, ps);
+   paravirt_dv_serialize_data();
ia64_set_psr(psr);
}
if (!(pteVTLB_PTE_IO))
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 0/5] ia64/pv_ops, xen: binary patch optimization TAKE 2

2008-12-11 Thread Isaku Yamahata
This patch set is intended for the next merge window. They are just
enhancements of the already merged patches or ia64 porting from x86
paravirt techniques and that their quality is enough for merge.


This patch set is for binary patch optimization for paravirt_ops.
The binary patch optimization is important on native case because
the paravirt_ops overhead can be reduced by converting indirect 
call into in-place execution or direct call.

The patch series does
- The first patch imports helper functions which themselves doesn't
  interesting things.
- The second patch replaces the indirect function calls with a special
  call written in gcc extended inline asm and introduces native methods.
- The third patch introduces binary patch for kernel modules.
- The forth patch suppress false positive warnings which were caused by
  the previous patches.
- The last patch implements xen methods.


For convenience the working full source is available from
http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/
branch: ia64-pv-ops-2008dec12-xen-ia64-optimized-domu-binary-patch

For the status of this patch series
http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge

thanks,

changes from take 1:
- no essential change from the last one
- rebased to 2.6.28-rc8
- don't use cmp_inst_t. define and use ia64_inst_t, instead.
- improve some assebmly code.

Diffstat:
 arch/ia64/include/asm/intrinsics.h  |6 +-
 arch/ia64/include/asm/module.h  |6 +
 arch/ia64/include/asm/paravirt.h|8 +
 arch/ia64/include/asm/paravirt_patch.h  |  143 +++
 arch/ia64/include/asm/paravirt_privop.h |  347 -
 arch/ia64/include/asm/xen/inst.h|4 +
 arch/ia64/include/asm/xen/privop.h  |4 +
 arch/ia64/kernel/Makefile   |3 +-
 arch/ia64/kernel/efi.c  |1 +
 arch/ia64/kernel/module.c   |   32 ++
 arch/ia64/kernel/paravirt.c |  520 -
 arch/ia64/kernel/paravirt_patch.c   |  514 
 arch/ia64/kernel/paravirtentry.S|   99 -
 arch/ia64/kernel/setup.c|1 +
 arch/ia64/kernel/vmlinux.lds.S  |   24 ++
 arch/ia64/kvm/vtlb.c|2 +
 arch/ia64/xen/Makefile  |1 +
 arch/ia64/xen/hypercall.S   |2 +
 arch/ia64/xen/xen_pv_ops.c  |  665 +++
 19 files changed, 2357 insertions(+), 25 deletions(-)

___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 3/5] ia64/pv_ops/bp/module: support binary patching for kernel module.

2008-12-11 Thread Isaku Yamahata
support binary patching for kernel module.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/module.h |6 ++
 arch/ia64/kernel/module.c  |   32 
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/include/asm/module.h b/arch/ia64/include/asm/module.h
index d2da61e..908eaef 100644
--- a/arch/ia64/include/asm/module.h
+++ b/arch/ia64/include/asm/module.h
@@ -16,6 +16,12 @@ struct mod_arch_specific {
struct elf64_shdr *got; /* global offset table */
struct elf64_shdr *opd; /* official procedure descriptors */
struct elf64_shdr *unwind;  /* unwind-table section */
+#ifdef CONFIG_PARAVIRT
+   struct elf64_shdr *paravirt_bundles;
+   /* paravirt_alt_bundle_patch table */
+   struct elf64_shdr *paravirt_insts;
+   /* paravirt_alt_inst_patch table */
+#endif
unsigned long gp;   /* global-pointer for module */
 
void *core_unw_table;   /* core unwind-table cookie returned by 
unwinder */
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index aaa7d90..34fe425 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -446,6 +446,14 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr 
*sechdrs, char *secstrings,
mod-arch.opd = s;
else if (strcmp(.IA_64.unwind, secstrings + s-sh_name) == 0)
mod-arch.unwind = s;
+#ifdef CONFIG_PARAVIRT
+   else if (strcmp(.paravirt_bundles,
+   secstrings + s-sh_name) == 0)
+   mod-arch.paravirt_bundles = s;
+   else if (strcmp(.paravirt_insts,
+   secstrings + s-sh_name) == 0)
+   mod-arch.paravirt_insts = s;
+#endif
 
if (!mod-arch.core_plt || !mod-arch.init_plt || !mod-arch.got || 
!mod-arch.opd) {
printk(KERN_ERR %s: sections missing\n, mod-name);
@@ -921,6 +929,30 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr 
*sechdrs, struct module *mo
DEBUGP(%s: init: entry=%p\n, __func__, mod-init);
if (mod-arch.unwind)
register_unwind_table(mod);
+#ifdef CONFIG_PARAVIRT
+if (mod-arch.paravirt_bundles) {
+struct paravirt_patch_site_bundle *start =
+(struct paravirt_patch_site_bundle *)
+mod-arch.paravirt_bundles-sh_addr;
+struct paravirt_patch_site_bundle *end =
+(struct paravirt_patch_site_bundle *)
+(mod-arch.paravirt_bundles-sh_addr +
+ mod-arch.paravirt_bundles-sh_size);
+
+paravirt_patch_apply_bundle(start, end);
+}
+if (mod-arch.paravirt_insts) {
+struct paravirt_patch_site_inst *start =
+(struct paravirt_patch_site_inst *)
+mod-arch.paravirt_insts-sh_addr;
+struct paravirt_patch_site_inst *end =
+(struct paravirt_patch_site_inst *)
+(mod-arch.paravirt_insts-sh_addr +
+ mod-arch.paravirt_insts-sh_size);
+
+paravirt_patch_apply_inst(start, end);
+}
+#endif
return 0;
 }
 
-- 
1.6.0.2


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


[Xen-ia64-devel] [PATCH 1/5] ia64/pv_op/binarypatch: add helper functions to support binary patching for paravirt_ops.

2008-12-11 Thread Isaku Yamahata
add helper functions to support binary patching for paravirt_ops.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/paravirt_patch.h |  143 +
 arch/ia64/kernel/paravirt_patch.c  |  514 
 arch/ia64/kernel/paravirtentry.S   |   56 
 arch/ia64/kernel/vmlinux.lds.S |   24 ++
 4 files changed, 737 insertions(+), 0 deletions(-)
 create mode 100644 arch/ia64/include/asm/paravirt_patch.h
 create mode 100644 arch/ia64/kernel/paravirt_patch.c

diff --git a/arch/ia64/include/asm/paravirt_patch.h 
b/arch/ia64/include/asm/paravirt_patch.h
new file mode 100644
index 000..23d4fbf
--- /dev/null
+++ b/arch/ia64/include/asm/paravirt_patch.h
@@ -0,0 +1,143 @@
+/**
+ * Copyright (c) 2008 Isaku Yamahata yamahata at valinux co jp
+ *VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __ASM_PARAVIRT_PATCH_H
+#define __ASM_PARAVIRT_PATCH_H
+
+#ifdef __ASSEMBLY__
+
+   .section .paravirt_branches, a
+   .previous
+#define PARAVIRT_PATCH_SITE_BR(type)   \
+   {   \
+   [1:] ;  \
+   br.cond.sptk.many 2f ;  \
+   nop.b 0 ;   \
+   nop.b 0;; ; \
+   } ; \
+   2:  \
+   .xdata8 .paravirt_branches, 1b, type
+
+#else
+
+#include linux/stringify.h
+#include asm/intrinsics.h
+
+/* for binary patch */
+struct paravirt_patch_site_bundle {
+   void*sbundle;
+   void*ebundle;
+   unsigned long   type;
+};
+
+/* label means the beginning of new bundle */
+#define paravirt_alt_bundle(instr, privop) \
+   \t998:\n  \
+   \t instr \n \
+   \t999:\n  \
+   \t.pushsection .paravirt_bundles, \a\\n \
+   \t.popsection\n   \
+   \t.xdata8 \.paravirt_bundles\, 998b, 999b,  \
+   __stringify(privop) \n
+
+
+struct paravirt_patch_bundle_elem {
+   const void  *sbundle;
+   const void  *ebundle;
+   unsigned long   type;
+};
+
+
+struct paravirt_patch_site_inst {
+   unsigned long   stag;
+   unsigned long   etag;
+   unsigned long   type;
+};
+
+#define paravirt_alt_inst(instr, privop)   \
+   \t[998:]\n\
+   \t instr \n \
+   \t[999:]\n\
+   \t.pushsection .paravirt_insts, \a\\n   \
+   \t.popsection\n   \
+   \t.xdata8 \.paravirt_insts\, 998b, 999b,\
+   __stringify(privop) \n
+
+struct paravirt_patch_site_branch {
+   unsigned long   tag;
+   unsigned long   type;
+};
+
+struct paravirt_patch_branch_target {
+   const void  *entry;
+   unsigned long   type;
+};
+
+void
+__paravirt_patch_apply_branch(
+   unsigned long tag, unsigned long type,
+   const struct paravirt_patch_branch_target *entries,
+   unsigned int nr_entries);
+
+void
+paravirt_patch_reloc_br(unsigned long tag, const void *target);
+
+void
+paravirt_patch_reloc_brl(unsigned long tag, const void *target);
+
+
+#ifdef ASM_SUPPORTED
+unsigned long
+ia64_native_patch_bundle(void *sbundle, void *ebundle, unsigned long type);
+
+unsigned long
+__paravirt_patch_apply_bundle(void *sbundle, void *ebundle, unsigned long type,
+ const struct paravirt_patch_bundle_elem *elems,
+ unsigned long nelems,
+ const struct paravirt_patch_bundle_elem **found);
+
+void
+paravirt_patch_apply_bundle(const struct paravirt_patch_site_bundle *start,
+   const struct 

[Xen-ia64-devel] [PATCH 5/5] ia64/pv_ops/bp/xen: implemented binary patchable pv_cpu_ops.

2008-12-11 Thread Isaku Yamahata
implemented xen binary patch for pv_cpu_ops.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/xen/privop.h |4 +
 arch/ia64/xen/hypercall.S  |2 +
 arch/ia64/xen/xen_pv_ops.c |  665 
 3 files changed, 671 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/include/asm/xen/privop.h 
b/arch/ia64/include/asm/xen/privop.h
index 2261dda..e5fbaee 100644
--- a/arch/ia64/include/asm/xen/privop.h
+++ b/arch/ia64/include/asm/xen/privop.h
@@ -82,8 +82,10 @@ extern unsigned long xen_thash(unsigned long addr);
 extern unsigned long xen_get_cpuid(int index);
 extern unsigned long xen_get_pmd(int index);
 
+#ifndef ASM_SUPPORTED
 extern unsigned long xen_get_eflag(void);  /* see xen_ia64_getreg */
 extern void xen_set_eflag(unsigned long);  /* see xen_ia64_setreg */
+#endif
 
 //
 /* Instructions paravirtualized for performance */
@@ -108,6 +110,7 @@ extern void xen_set_eflag(unsigned long);   /* see 
xen_ia64_setreg */
 #define xen_get_virtual_pend() \
(*(((uint8_t *)XEN_MAPPEDREGS-interrupt_mask_addr) - 1))
 
+#ifndef ASM_SUPPORTED
 /* Although all privileged operations can be left to trap and will
  * be properly handled by Xen, some are frequent enough that we use
  * hyperprivops for performance. */
@@ -125,6 +128,7 @@ extern void xen_set_rr0_to_rr4(unsigned long val0, unsigned 
long val1,
   unsigned long val4);
 extern void xen_set_kr(unsigned long index, unsigned long val);
 extern void xen_ptcga(unsigned long addr, unsigned long size);
+#endif /* !ASM_SUPPORTED */
 
 #endif /* !__ASSEMBLY__ */
 
diff --git a/arch/ia64/xen/hypercall.S b/arch/ia64/xen/hypercall.S
index 45e02bb..e32dae4 100644
--- a/arch/ia64/xen/hypercall.S
+++ b/arch/ia64/xen/hypercall.S
@@ -9,6 +9,7 @@
 #include asm/intrinsics.h
 #include asm/xen/privop.h
 
+#ifdef __INTEL_COMPILER
 /*
  * Hypercalls without parameter.
  */
@@ -72,6 +73,7 @@ GLOBAL_ENTRY(xen_set_rr0_to_rr4)
br.ret.sptk.many rp
;;
 END(xen_set_rr0_to_rr4)
+#endif
 
 GLOBAL_ENTRY(xen_send_ipi)
mov r14=r32
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
index eda13a8..7833226 100644
--- a/arch/ia64/xen/xen_pv_ops.c
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -154,6 +154,13 @@ xen_post_smp_prepare_boot_cpu(void)
xen_setup_vcpu_info_placement();
 }
 
+#ifdef ASM_SUPPORTED
+static unsigned long __init_or_module
+xen_patch_bundle(void *sbundle, void *ebundle, unsigned long type);
+#endif
+static void __init
+xen_patch_branch(unsigned long tag, unsigned long type);
+
 static struct pv_init_ops xen_init_ops __initdata = {
.banner = xen_banner,
 
@@ -164,6 +171,10 @@ static struct pv_init_ops xen_init_ops __initdata = {
.arch_setup_nomca = xen_arch_setup_nomca,
 
.post_smp_prepare_boot_cpu = xen_post_smp_prepare_boot_cpu,
+#ifdef ASM_SUPPORTED
+   .patch_bundle = xen_patch_bundle,
+#endif
+   .patch_branch = xen_patch_branch,
 };
 
 /***
@@ -214,6 +225,7 @@ static struct pv_patchdata xen_patchdata __initdata = {
  * intrinsics hooks.
  */
 
+#ifndef ASM_SUPPORTED
 static void
 xen_set_itm_with_offset(unsigned long val)
 {
@@ -381,6 +393,410 @@ xen_intrin_local_irq_restore(unsigned long mask)
else
xen_rsm_i();
 }
+#else
+#define __DEFINE_FUNC(name, code)  \
+   extern const char xen_ ## name ## _direct_start[];  \
+   extern const char xen_ ## name ## _direct_end[];\
+   asm (.align 32\n  \
+.proc xen_ #name \n\
+xen_ #name :\n \
+xen_ #name _direct_start:\n\
+code   \
+xen_ #name _direct_end:\n  \
+br.cond.sptk.many b6\n   \
+.endp xen_ #name \n)
+
+#define DEFINE_VOID_FUNC0(name, code)  \
+   extern void \
+   xen_ ## name (void);\
+   __DEFINE_FUNC(name, code)
+
+#define DEFINE_VOID_FUNC1(name, code)  \
+   extern void \
+   xen_ ## name (unsigned long arg);   \
+   __DEFINE_FUNC(name, code)
+
+#define DEFINE_VOID_FUNC2(name, code)  \
+   extern void \
+   xen_ ## name (unsigned long arg0,   \
+ unsigned long arg1);  \
+   __DEFINE_FUNC(name, code)
+
+#define DEFINE_FUNC0(name, code)   \
+   extern unsigned long\
+   xen_ ## name (void);\
+   

[Xen-ia64-devel] [PATCH 2/5] ia64/pv_ops: implement binary patching optimization for native.

2008-12-11 Thread Isaku Yamahata
implement binary patching optimization for pv_cpu_ops.
With this optimization, indirect call for pv_cpu_ops methods can be
converted into inline execution or direct call.

Signed-off-by: Isaku Yamahata yamah...@valinux.co.jp
---
 arch/ia64/include/asm/intrinsics.h  |6 +-
 arch/ia64/include/asm/paravirt.h|8 +
 arch/ia64/include/asm/paravirt_privop.h |  341 -
 arch/ia64/kernel/Makefile   |3 +-
 arch/ia64/kernel/paravirt.c |  520 ++-
 arch/ia64/kernel/paravirtentry.S|   43 ++--
 arch/ia64/kernel/setup.c|1 +
 7 files changed, 897 insertions(+), 25 deletions(-)

diff --git a/arch/ia64/include/asm/intrinsics.h 
b/arch/ia64/include/asm/intrinsics.h
index a3e44a5..fbe2ad9 100644
--- a/arch/ia64/include/asm/intrinsics.h
+++ b/arch/ia64/include/asm/intrinsics.h
@@ -201,7 +201,11 @@ extern long ia64_cmpxchg_called_with_bad_pointer (void);
 
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_PARAVIRT)  defined(__KERNEL__)
-#define IA64_INTRINSIC_API(name)   pv_cpu_ops.name
+#ifdef ASM_SUPPORTED
+# define IA64_INTRINSIC_API(name)  paravirt_ ## name
+#else
+# define IA64_INTRINSIC_API(name)  pv_cpu_ops.name
+#endif
 #define IA64_INTRINSIC_MACRO(name) paravirt_ ## name
 #else
 #define IA64_INTRINSIC_API(name)   ia64_native_ ## name
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index fc433f6..2eb0a98 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -118,6 +118,14 @@ struct pv_init_ops {
int (*arch_setup_nomca)(void);
 
void (*post_smp_prepare_boot_cpu)(void);
+
+#ifdef ASM_SUPPORTED
+   unsigned long (*patch_bundle)(void *sbundle, void *ebundle,
+ unsigned long type);
+   unsigned long (*patch_inst)(unsigned long stag, unsigned long etag,
+   unsigned long type);
+#endif
+   void (*patch_branch)(unsigned long tag, unsigned long type);
 };
 
 extern struct pv_init_ops pv_init_ops;
diff --git a/arch/ia64/include/asm/paravirt_privop.h 
b/arch/ia64/include/asm/paravirt_privop.h
index 33c8e55..76d6a69 100644
--- a/arch/ia64/include/asm/paravirt_privop.h
+++ b/arch/ia64/include/asm/paravirt_privop.h
@@ -60,12 +60,18 @@ extern unsigned long ia64_native_getreg_func(int regnum);
 /* Instructions paravirtualized for performance */
 //
 
+#ifndef ASM_SUPPORTED
+#define paravirt_ssm_i()   pv_cpu_ops.ssm_i()
+#define paravirt_rsm_i()   pv_cpu_ops.rsm_i()
+#define __paravirt_getreg()pv_cpu_ops.getreg()
+#endif
+
 /* mask for ia64_native_ssm/rsm() must be constant.(i constraing).
  * static inline function doesn't satisfy it. */
 #define paravirt_ssm(mask) \
do {\
if ((mask) == IA64_PSR_I)   \
-   pv_cpu_ops.ssm_i(); \
+   paravirt_ssm_i();   \
else\
ia64_native_ssm(mask);  \
} while (0)
@@ -73,7 +79,7 @@ extern unsigned long ia64_native_getreg_func(int regnum);
 #define paravirt_rsm(mask) \
do {\
if ((mask) == IA64_PSR_I)   \
-   pv_cpu_ops.rsm_i(); \
+   paravirt_rsm_i();   \
else\
ia64_native_rsm(mask);  \
} while (0)
@@ -86,7 +92,7 @@ extern unsigned long ia64_native_getreg_func(int regnum);
if ((reg) == _IA64_REG_IP)  \
res = ia64_native_getreg(_IA64_REG_IP); \
else\
-   res = pv_cpu_ops.getreg(reg);   \
+   res = __paravirt_getreg(reg);   \
res;\
})
 
@@ -121,4 +127,333 @@ void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch 
*cpu_asm_switch);
IA64_PARAVIRT_ASM_FUNC(work_processed_syscall)
 #define ia64_leave_kernel  IA64_PARAVIRT_ASM_FUNC(leave_kernel)
 
+
+#if defined(CONFIG_PARAVIRT)
+/**
+ * binary patching infrastructure
+ */
+#define PARAVIRT_PATCH_TYPE_FC 1
+#define PARAVIRT_PATCH_TYPE_THASH  2
+#define PARAVIRT_PATCH_TYPE_GET_CPUID  3
+#define PARAVIRT_PATCH_TYPE_GET_PMD4
+#define PARAVIRT_PATCH_TYPE_PTCGA  5
+#define PARAVIRT_PATCH_TYPE_GET_RR 6
+#define PARAVIRT_PATCH_TYPE_SET_RR 7
+#define PARAVIRT_PATCH_TYPE_SET_RR0_TO_RR4 8
+#define PARAVIRT_PATCH_TYPE_SSM_I