ia64/xen-unstable
changeset 1274:20a5f571fb14
bitkeeper revision 1.838 (406ee03fYGZuu3lTbdwwYlwJxSLZtw)
shadow.h, perfc.h, memory.c, keyhandler.c, Makefile, irq.c, Rules.mk:
Code and build cleanups. Allow perf counters to be disabled at build time by 'nperfc=y'. Allow debugging to be turned on with 'debug=y'.
shadow.h, perfc.h, memory.c, keyhandler.c, Makefile, irq.c, Rules.mk:
Code and build cleanups. Allow perf counters to be disabled at build time by 'nperfc=y'. Allow debugging to be turned on with 'debug=y'.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Sat Apr 03 16:03:11 2004 +0000 (2004-04-03) |
parents | 9d7daee83fa1 |
children | a15ca0468c7b |
files | xen/Rules.mk xen/arch/i386/Rules.mk xen/arch/i386/irq.c xen/common/Makefile xen/common/keyhandler.c xen/common/memory.c xen/include/xen/perfc.h xen/include/xen/shadow.h |
line diff
1.1 --- a/xen/Rules.mk Fri Apr 02 17:08:47 2004 +0000 1.2 +++ b/xen/Rules.mk Sat Apr 03 16:03:11 2004 +0000 1.3 @@ -36,6 +36,14 @@ HOSTCFLAGS = -Wall -Wstrict-prototypes - 1.4 1.5 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk 1.6 1.7 +ifneq ($(debug),y) 1.8 +CFLAGS += -DNDEBUG 1.9 +endif 1.10 + 1.11 +ifeq ($(nperfc),y) 1.12 +CFLAGS += -DNPERFC 1.13 +endif 1.14 + 1.15 ifeq ($(nodev),y) 1.16 CFLAGS += -DNO_DEVICES_IN_XEN 1.17 CFLAGS := $(subst -Werror,,$(CFLAGS))
2.1 --- a/xen/arch/i386/Rules.mk Fri Apr 02 17:08:47 2004 +0000 2.2 +++ b/xen/arch/i386/Rules.mk Sat Apr 03 16:03:11 2004 +0000 2.3 @@ -9,8 +9,7 @@ MONITOR_BASE := 0xFC500000 2.4 LOAD_BASE := 0x00100000 2.5 CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -O3 2.6 CFLAGS += -iwithprefix include -Wall -Werror -DMONITOR_BASE=$(MONITOR_BASE) 2.7 -CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__ -DNDEBUG 2.8 -#CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__ 2.9 +CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__ 2.10 CFLAGS += -Wno-pointer-arith -Wredundant-decls -m32 2.11 TARGET_CPU := i686 2.12 CFLAGS += -march=$(TARGET_CPU)
3.1 --- a/xen/arch/i386/irq.c Fri Apr 02 17:08:47 2004 +0000 3.2 +++ b/xen/arch/i386/irq.c Sat Apr 03 16:03:11 2004 +0000 3.3 @@ -476,15 +476,17 @@ asmlinkage unsigned int do_IRQ(struct pt 3.4 * handled by some other CPU. (or is disabled) 3.5 */ 3.6 int irq = regs.orig_eax & 0xff; /* high bits used in ret_from_ code */ 3.7 - int cpu = smp_processor_id(); 3.8 irq_desc_t *desc = irq_desc + irq; 3.9 struct irqaction * action; 3.10 unsigned int status; 3.11 3.12 - u32 cc_start, cc_end; 3.13 +#ifndef NPERFC 3.14 + int cpu = smp_processor_id(); 3.15 + u32 cc_start, cc_end; 3.16 3.17 perfc_incra(irqs, cpu); 3.18 rdtscl(cc_start); 3.19 +#endif 3.20 3.21 spin_lock(&desc->lock); 3.22 desc->handler->ack(irq); 3.23 @@ -550,6 +552,7 @@ asmlinkage unsigned int do_IRQ(struct pt 3.24 desc->handler->end(irq); 3.25 spin_unlock(&desc->lock); 3.26 3.27 +#ifndef NPERFC 3.28 rdtscl(cc_end); 3.29 3.30 if ( !action || (!(action->flags & SA_NOPROFILE)) ) 3.31 @@ -560,6 +563,7 @@ asmlinkage unsigned int do_IRQ(struct pt 3.32 printk("Long interrupt %08x -> %08x\n", cc_start, cc_end); 3.33 #endif 3.34 } 3.35 +#endif /* NPERFC */ 3.36 3.37 return 1; 3.38 }
4.1 --- a/xen/common/Makefile Fri Apr 02 17:08:47 2004 +0000 4.2 +++ b/xen/common/Makefile Sat Apr 03 16:03:11 2004 +0000 4.3 @@ -1,6 +1,10 @@ 4.4 4.5 include $(BASEDIR)/Rules.mk 4.6 4.7 +ifeq ($(nperfc),y) 4.8 +OBJS := $(subst perfc.o,,$(OBJS)) 4.9 +endif 4.10 + 4.11 default: $(OBJS) 4.12 $(LD) $(LDARCHFLAGS) -r -o common.o $(OBJS) 4.13
5.1 --- a/xen/common/keyhandler.c Fri Apr 02 17:08:47 2004 +0000 5.2 +++ b/xen/common/keyhandler.c Sat Apr 03 16:03:11 2004 +0000 5.3 @@ -104,11 +104,13 @@ void do_task_queues(u_char key, void *de 5.4 read_unlock_irqrestore(&tasklist_lock, flags); 5.5 } 5.6 5.7 -extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs); 5.8 -extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs); 5.9 extern void dump_runq(u_char key, void *dev_id, struct pt_regs *regs); 5.10 extern void print_sched_histo(u_char key, void *dev_id, struct pt_regs *regs); 5.11 extern void reset_sched_histo(u_char key, void *dev_id, struct pt_regs *regs); 5.12 +#ifndef NPERFC 5.13 +extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs); 5.14 +extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs); 5.15 +#endif 5.16 #ifndef NDEBUG 5.17 void reaudit_pages(u_char key, void *dev_id, struct pt_regs *regs); 5.18 void audit_all_pages(u_char key, void *dev_id, struct pt_regs *regs); 5.19 @@ -128,12 +130,14 @@ void initialize_keytable(void) 5.20 add_key_handler('h', show_handlers, "show this message"); 5.21 add_key_handler('l', print_sched_histo, "print sched latency histogram"); 5.22 add_key_handler('L', reset_sched_histo, "reset sched latency histogram"); 5.23 - add_key_handler('p', perfc_printall, "print performance counters"); 5.24 - add_key_handler('P', perfc_reset, "reset performance counters"); 5.25 add_key_handler('q', do_task_queues, "dump task queues + guest state"); 5.26 add_key_handler('r', dump_runq, "dump run queues"); 5.27 add_key_handler('B', kill_dom0, "reboot machine gracefully"); 5.28 add_key_handler('R', halt_machine, "reboot machine ungracefully"); 5.29 +#ifndef NPERFC 5.30 + add_key_handler('p', perfc_printall, "print performance counters"); 5.31 + add_key_handler('P', perfc_reset, "reset performance counters"); 5.32 +#endif 5.33 #ifndef NDEBUG 5.34 add_key_handler('m', reaudit_pages, "re-audit pages"); 5.35 add_key_handler('M', audit_all_pages, "audit all pages");
6.1 --- a/xen/common/memory.c Fri Apr 02 17:08:47 2004 +0000 6.2 +++ b/xen/common/memory.c Sat Apr 03 16:03:11 2004 +0000 6.3 @@ -164,7 +164,7 @@ static void free_l1_table(struct pfn_inf 6.4 static int mod_l2_entry(l2_pgentry_t *, l2_pgentry_t, unsigned long); 6.5 static int mod_l1_entry(l1_pgentry_t *, l1_pgentry_t); 6.6 6.7 -/* frame table size and its size in pages */ 6.8 +/* Frame table and its size in pages. */ 6.9 struct pfn_info *frame_table; 6.10 unsigned long frame_table_size; 6.11 unsigned long max_page; 6.12 @@ -770,17 +770,19 @@ void free_page_type(struct pfn_info *pag 6.13 (get_shadow_status(¤t->mm, 6.14 page-frame_table) & PSH_shadowed) ) 6.15 { 6.16 - /* using 'current-mm' is safe because page type changes only 6.17 - occur within the context of the currently running domain as 6.18 - pagetable pages can not be shared across domains. The one 6.19 - exception is when destroying a domain. However, we get away 6.20 - with this as there's no way the current domain can have this 6.21 - mfn shadowed, so we won't get here... Phew! */ 6.22 - 6.23 + /* 6.24 + * Using 'current->mm' is safe and correct because page-table pages 6.25 + * are not shared across domains. Updates to such pages' types are 6.26 + * thus only done within the context of the owning domain. The one 6.27 + * exception is when destroying a domain; however, this is not a 6.28 + * problem as the currently-executing domain will not have this 6.29 + * MFN shadowed, and at domain end-of-day we explicitly unshadow 6.30 + * everything so that nothing will get left lying around. 6.31 + */ 6.32 unshadow_table( page-frame_table, type ); 6.33 put_shadow_status(¤t->mm); 6.34 } 6.35 - return; 6.36 + break; 6.37 6.38 case PGT_l2_page_table: 6.39 free_l2_table(page); 6.40 @@ -791,7 +793,7 @@ void free_page_type(struct pfn_info *pag 6.41 unshadow_table( page-frame_table, type ); 6.42 put_shadow_status(¤t->mm); 6.43 } 6.44 - return; 6.45 + break; 6.46 6.47 default: 6.48 BUG(); 6.49 @@ -1150,7 +1152,7 @@ int do_update_va_mapping(unsigned long p 6.50 perfc_incrc(shadow_update_va_fail); 6.51 } 6.52 6.53 - check_pagetable( p, p->mm.pagetable, "va" ); /* debug */ 6.54 + check_pagetable(p, p->mm.pagetable, "va"); /* debug */ 6.55 } 6.56 6.57 deferred_ops = percpu_info[cpu].deferred_ops;
7.1 --- a/xen/include/xen/perfc.h Fri Apr 02 17:08:47 2004 +0000 7.2 +++ b/xen/include/xen/perfc.h Sat Apr 03 16:03:11 2004 +0000 7.3 @@ -2,6 +2,8 @@ 7.4 #ifndef __XEN_PERFC_H__ 7.5 #define __XEN_PERFC_H__ 7.6 7.7 +#ifndef NPERFC 7.8 + 7.9 #include <asm/atomic.h> 7.10 7.11 /* 7.12 @@ -65,4 +67,22 @@ extern struct perfcounter_t perfcounters 7.13 #define perfc_addc(x,y) atomic_add((y), &perfcounters.x[smp_processor_id()]) 7.14 #define perfc_adda(x,y,z) atomic_add((z), &perfcounters.x[y]) 7.15 7.16 +#else /* !NPERFC */ 7.17 + 7.18 +#define perfc_value(x) ((void)0) 7.19 +#define perfc_valuec(x) ((void)0) 7.20 +#define perfc_valuea(x,y) ((void)0) 7.21 +#define perfc_set(x,v) ((void)0) 7.22 +#define perfc_setc(x,v) ((void)0) 7.23 +#define perfc_seta(x,y,v) ((void)0) 7.24 +#define perfc_incr(x) ((void)0) 7.25 +#define perfc_decr(x) ((void)0) 7.26 +#define perfc_incrc(x) ((void)0) 7.27 +#define perfc_incra(x,y) ((void)0) 7.28 +#define perfc_add(x,y) ((void)0) 7.29 +#define perfc_addc(x,y) ((void)0) 7.30 +#define perfc_adda(x,y,z) ((void)0) 7.31 + 7.32 +#endif /* !NPERFC */ 7.33 + 7.34 #endif /* __XEN_PERFC_H__ */
8.1 --- a/xen/include/xen/shadow.h Fri Apr 02 17:08:47 2004 +0000 8.2 +++ b/xen/include/xen/shadow.h Sat Apr 03 16:03:11 2004 +0000 8.3 @@ -525,9 +525,9 @@ static inline void shadow_mk_pagetable( 8.4 8.5 8.6 #if SHADOW_DEBUG 8.7 -extern int check_pagetable( struct mm_struct *m, pagetable_t pt, char *s ); 8.8 +extern int check_pagetable(struct mm_struct *m, pagetable_t pt, char *s); 8.9 #else 8.10 -#define check_pagetable( m, pt, s ) 8.11 +#define check_pagetable(m, pt, s) ((void)0) 8.12 #endif 8.13 8.14