[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] various hacks for batching mode and stats gathering
ChangeSet 1.1244, 2005/03/10 18:12:10+00:00, rneugeba@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx various hacks for batching mode and stats gathering Signed-off-by: michael.fetterman@xxxxxxxxxxxx linux-2.6.10-xen-sparse/arch/xen/Kconfig | 31 +++ linux-2.6.10-xen-sparse/arch/xen/i386/kernel/Makefile | 2 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/entry.S | 10 - linux-2.6.10-xen-sparse/arch/xen/i386/kernel/syscall_stats.c | 91 ++++++++++ linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c | 3 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h | 9 linux-2.6.10-xen-sparse/mm/memory.c | 50 +++++ tools/misc/Makefile | 2 tools/misc/cpuperf/cpuperf.c | 2 tools/misc/xc_shadow.c | 70 +++++++ 10 files changed, 264 insertions(+), 6 deletions(-) diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/Kconfig b/linux-2.6.10-xen-sparse/arch/xen/Kconfig --- a/linux-2.6.10-xen-sparse/arch/xen/Kconfig 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/Kconfig 2005-04-05 12:06:59 -04:00 @@ -115,8 +115,37 @@ space. Odds are that you want to say N here. config XEN_WRITABLE_PAGETABLES - bool + bool "writable page tables" default y + +config XEN_SYSCALL_STATS + bool "system call statistics" + default n + +config XEN_DEBUG_NO_MMU_BATCHING + bool "Disables batching on MMU updates" + default n + help + This does a hypercall per PTE update + we only use this for benchmarking + enable only if you know what you are doing + +config XEN_BATCH_MODE1 + bool "A variant of writable pagetable using the batch interface" + default n + help + default is no batching and minor mods for some batching + we only use this for benchmarking + enable only if you know what you are doing + +config XEN_BATCH_MODE2 + bool "forward port of 2.4 batching" + default n + help + default is batching + flushes where 2.4 had them + we only use this for benchmarking + enable only if you know what you are doing + config XEN_SCRUB_PAGES bool "Scrub memory before freeing it to Xen" diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/Makefile b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/Makefile --- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/Makefile 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/Makefile 2005-04-05 12:06:59 -04:00 @@ -43,6 +43,8 @@ c-obj-$(CONFIG_EFI) += efi.o efi_stub.o c-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +c-obj-$(CONFIG_XEN_SYSCALL_STATS) += syscall_stats.o + EXTRA_AFLAGS := -traditional c-obj-$(CONFIG_SCx200) += scx200.o diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/entry.S b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/entry.S --- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/entry.S 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/entry.S 2005-04-05 12:06:59 -04:00 @@ -280,7 +280,10 @@ jnz syscall_trace_entry cmpl $(nr_syscalls), %eax jae syscall_badsys - call *sys_call_table(,%eax,4) +#ifdef CONFIG_XEN_SYSCALL_STATS + lock incl syscall_stats(,%eax,4) +#endif + call *sys_call_table(,%eax,4) movl %eax,EAX(%esp) cli movl TI_flags(%ebp), %ecx @@ -305,7 +308,10 @@ cmpl $(nr_syscalls), %eax jae syscall_badsys syscall_call: - call *sys_call_table(,%eax,4) +#ifdef CONFIG_XEN_SYSCALL_STATS + lock incl syscall_stats(,%eax,4) +#endif + call *sys_call_table(,%eax,4) movl %eax,EAX(%esp) # store the return value syscall_exit: XEN_BLOCK_EVENTS(%esi) # make sure we don't miss an interrupt diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/syscall_stats.c b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/syscall_stats.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/syscall_stats.c 2005-04-05 12:06:59 -04:00 @@ -0,0 +1,91 @@ +/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- + **************************************************************************** + * (C) 2005 - Rolf Neugebauer - Intel Research Cambridge + **************************************************************************** + * + * File: syscall_stats.c + * Author: Rolf Neugebauer (rolf.neugebauer@xxxxxxxxx) + * Date: Mar 2005 + * + * Description: add a proc interface to get per system call stats + */ + + +#include <linux/config.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#include <asm/unistd.h> + +unsigned long syscall_stats[NR_syscalls]; +static unsigned char foobar[4]; + +/* a write just resests the counter */ +static ssize_t syscall_write(struct file *f, const char *data, + size_t size, loff_t *pos) +{ + printk("resetting syscall stats\n"); + memset(&syscall_stats, 0, sizeof(syscall_stats)); + return size; +} + +static int show_syscall(struct seq_file *m, void *v) +{ + int i; + for ( i=0; i<NR_syscalls; i++ ) + { + seq_printf(m, "%lu ", syscall_stats[i]); + } + seq_printf(m, "\n"); + return 0; +} + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + return *pos == 0 ? foobar : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return c_start(m, pos); +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +static struct seq_operations syscall_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_syscall, +}; + +static int syscall_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &syscall_op); +} + +static struct file_operations proc_syscall_operations = { + open: syscall_open, + read: seq_read, + write: syscall_write, + llseek: seq_lseek, + release: seq_release, +}; + + +static struct proc_dir_entry *entry; + +static int __init syscall_stats_init(void) +{ + printk("Initialising syscall stats.\n"); + + entry = create_proc_entry("syscalls", 0777, NULL); + if (entry) + entry->proc_fops = &proc_syscall_operations; + else + printk("Unable to create /proc/syscalls.\n"); + return 0; +} +subsys_initcall(syscall_stats_init); diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c --- a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c 2005-04-05 12:06:59 -04:00 @@ -133,6 +133,9 @@ per_cpu(update_queue[idx], cpu).ptr = virt_to_machine(ptr); per_cpu(update_queue[idx], cpu).val = val; increment_index(); +#ifdef CONFIG_XEN_DEBUG_NO_MMU_BATCHING + __flush_page_update_queue(); +#endif spin_unlock_irqrestore(&update_lock, flags); } diff -Nru a/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h b/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h --- a/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h 2005-04-05 12:06:59 -04:00 @@ -36,7 +36,16 @@ #endif #define set_pte_atomic(pteptr, pteval) set_pte(pteptr, pteval) #else +#if defined(CONFIG_XEN_DEBUG_NO_MMU_BATCHING) +#define set_pte(pteptr, pteval)\ + set_pte_batched(pteptr, pteval) +#elif defined(CONFIG_XEN_BATCH_MODE) +#define set_pte(pteptr, pteval)({\ + set_pte_batched(pteptr, pteval);\ + _flush_page_update_queue();}) +#else #define set_pte(pteptr, pteval) (*(pteptr) = pteval) +#endif #define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval) #endif /* diff -Nru a/linux-2.6.10-xen-sparse/mm/memory.c b/linux-2.6.10-xen-sparse/mm/memory.c --- a/linux-2.6.10-xen-sparse/mm/memory.c 2005-04-05 12:06:59 -04:00 +++ b/linux-2.6.10-xen-sparse/mm/memory.c 2005-04-05 12:06:59 -04:00 @@ -218,6 +218,11 @@ * dst->page_table_lock is held on entry and exit, * but may be dropped within pmd_alloc() and pte_alloc_map(). */ +#ifdef CONFIG_XEN_BATCH_MODE1 +#undef set_pte +#define set_pte(pteptr, pteval)\ + set_pte_batched(pteptr, pteval); +#endif int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma) { @@ -354,8 +359,11 @@ cond_resched_lock(&dst->page_table_lock); cont_copy_pmd_range: src_pmd++; - dst_pmd++; + dst_pmd++; } while ((unsigned long)src_pmd & PMD_TABLE_MASK); +#ifdef CONFIG_XEN_BATCH_MODE1 + _flush_page_update_queue(); +#endif } out_unlock: spin_unlock(&src->page_table_lock); @@ -445,9 +453,19 @@ free_swap_and_cache(pte_to_swp_entry(pte)); pte_clear(ptep); } +#ifdef CONFIG_XEN_BATCH_MODE1 + _flush_page_update_queue(); +#endif pte_unmap(ptep-1); } +#ifdef CONFIG_XEN_BATCH_MODE1 +#undef set_pte +#define set_pte(pteptr, pteval)\ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |