aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-04-03 16:03:11 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-04-03 16:03:11 +0000
commite2850253db53b8c3719ba210667626637f177cc4 (patch)
tree81146398351759aacd9ce96ad6788161e5a0ba0c
parent360c648fb8178bbe59713e49c9dffa87d2f4005c (diff)
downloadxen-e2850253db53b8c3719ba210667626637f177cc4.tar.gz
xen-e2850253db53b8c3719ba210667626637f177cc4.tar.bz2
xen-e2850253db53b8c3719ba210667626637f177cc4.zip
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'.
-rw-r--r--xen/Rules.mk8
-rw-r--r--xen/arch/i386/Rules.mk3
-rw-r--r--xen/arch/i386/irq.c8
-rw-r--r--xen/common/Makefile4
-rw-r--r--xen/common/keyhandler.c12
-rw-r--r--xen/common/memory.c24
-rw-r--r--xen/include/xen/perfc.h20
-rw-r--r--xen/include/xen/shadow.h4
8 files changed, 62 insertions, 21 deletions
diff --git a/xen/Rules.mk b/xen/Rules.mk
index da2d24cdda..237bbbd6e1 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -36,6 +36,14 @@ HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
+ifneq ($(debug),y)
+CFLAGS += -DNDEBUG
+endif
+
+ifeq ($(nperfc),y)
+CFLAGS += -DNPERFC
+endif
+
ifeq ($(nodev),y)
CFLAGS += -DNO_DEVICES_IN_XEN
CFLAGS := $(subst -Werror,,$(CFLAGS))
diff --git a/xen/arch/i386/Rules.mk b/xen/arch/i386/Rules.mk
index 7a72c83789..b2a30bffee 100644
--- a/xen/arch/i386/Rules.mk
+++ b/xen/arch/i386/Rules.mk
@@ -9,8 +9,7 @@ MONITOR_BASE := 0xFC500000
LOAD_BASE := 0x00100000
CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -O3
CFLAGS += -iwithprefix include -Wall -Werror -DMONITOR_BASE=$(MONITOR_BASE)
-CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__ -DNDEBUG
-#CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__
+CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__
CFLAGS += -Wno-pointer-arith -Wredundant-decls -m32
TARGET_CPU := i686
CFLAGS += -march=$(TARGET_CPU)
diff --git a/xen/arch/i386/irq.c b/xen/arch/i386/irq.c
index f09590b7a2..4c50bb592d 100644
--- a/xen/arch/i386/irq.c
+++ b/xen/arch/i386/irq.c
@@ -476,15 +476,17 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs)
* handled by some other CPU. (or is disabled)
*/
int irq = regs.orig_eax & 0xff; /* high bits used in ret_from_ code */
- int cpu = smp_processor_id();
irq_desc_t *desc = irq_desc + irq;
struct irqaction * action;
unsigned int status;
- u32 cc_start, cc_end;
+#ifndef NPERFC
+ int cpu = smp_processor_id();
+ u32 cc_start, cc_end;
perfc_incra(irqs, cpu);
rdtscl(cc_start);
+#endif
spin_lock(&desc->lock);
desc->handler->ack(irq);
@@ -550,6 +552,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs)
desc->handler->end(irq);
spin_unlock(&desc->lock);
+#ifndef NPERFC
rdtscl(cc_end);
if ( !action || (!(action->flags & SA_NOPROFILE)) )
@@ -560,6 +563,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs)
printk("Long interrupt %08x -> %08x\n", cc_start, cc_end);
#endif
}
+#endif /* NPERFC */
return 1;
}
diff --git a/xen/common/Makefile b/xen/common/Makefile
index aa35bdb405..c660a8b24b 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -1,6 +1,10 @@
include $(BASEDIR)/Rules.mk
+ifeq ($(nperfc),y)
+OBJS := $(subst perfc.o,,$(OBJS))
+endif
+
default: $(OBJS)
$(LD) $(LDARCHFLAGS) -r -o common.o $(OBJS)
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 2f6a38417c..92248bcca6 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -104,11 +104,13 @@ void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs)
read_unlock_irqrestore(&tasklist_lock, flags);
}
-extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
-extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs);
extern void dump_runq(u_char key, void *dev_id, struct pt_regs *regs);
extern void print_sched_histo(u_char key, void *dev_id, struct pt_regs *regs);
extern void reset_sched_histo(u_char key, void *dev_id, struct pt_regs *regs);
+#ifndef NPERFC
+extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
+extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs);
+#endif
#ifndef NDEBUG
void reaudit_pages(u_char key, void *dev_id, struct pt_regs *regs);
void audit_all_pages(u_char key, void *dev_id, struct pt_regs *regs);
@@ -128,12 +130,14 @@ void initialize_keytable(void)
add_key_handler('h', show_handlers, "show this message");
add_key_handler('l', print_sched_histo, "print sched latency histogram");
add_key_handler('L', reset_sched_histo, "reset sched latency histogram");
- add_key_handler('p', perfc_printall, "print performance counters");
- add_key_handler('P', perfc_reset, "reset performance counters");
add_key_handler('q', do_task_queues, "dump task queues + guest state");
add_key_handler('r', dump_runq, "dump run queues");
add_key_handler('B', kill_dom0, "reboot machine gracefully");
add_key_handler('R', halt_machine, "reboot machine ungracefully");
+#ifndef NPERFC
+ add_key_handler('p', perfc_printall, "print performance counters");
+ add_key_handler('P', perfc_reset, "reset performance counters");
+#endif
#ifndef NDEBUG
add_key_handler('m', reaudit_pages, "re-audit pages");
add_key_handler('M', audit_all_pages, "audit all pages");
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 90c96c0ea5..c632b946c6 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -164,7 +164,7 @@ static void free_l1_table(struct pfn_info *page);
static int mod_l2_entry(l2_pgentry_t *, l2_pgentry_t, unsigned long);
static int mod_l1_entry(l1_pgentry_t *, l1_pgentry_t);
-/* frame table size and its size in pages */
+/* Frame table and its size in pages. */
struct pfn_info *frame_table;
unsigned long frame_table_size;
unsigned long max_page;
@@ -770,17 +770,19 @@ void free_page_type(struct pfn_info *page, unsigned int type)
(get_shadow_status(&current->mm,
page-frame_table) & PSH_shadowed) )
{
- /* using 'current-mm' is safe because page type changes only
- occur within the context of the currently running domain as
- pagetable pages can not be shared across domains. The one
- exception is when destroying a domain. However, we get away
- with this as there's no way the current domain can have this
- mfn shadowed, so we won't get here... Phew! */
-
+ /*
+ * Using 'current->mm' is safe and correct because page-table pages
+ * are not shared across domains. Updates to such pages' types are
+ * thus only done within the context of the owning domain. The one
+ * exception is when destroying a domain; however, this is not a
+ * problem as the currently-executing domain will not have this
+ * MFN shadowed, and at domain end-of-day we explicitly unshadow
+ * everything so that nothing will get left lying around.
+ */
unshadow_table( page-frame_table, type );
put_shadow_status(&current->mm);
}
- return;
+ break;
case PGT_l2_page_table:
free_l2_table(page);
@@ -791,7 +793,7 @@ void free_page_type(struct pfn_info *page, unsigned int type)
unshadow_table( page-frame_table, type );
put_shadow_status(&current->mm);
}
- return;
+ break;
default:
BUG();
@@ -1150,7 +1152,7 @@ int do_update_va_mapping(unsigned long page_nr,
perfc_incrc(shadow_update_va_fail);
}
- check_pagetable( p, p->mm.pagetable, "va" ); /* debug */
+ check_pagetable(p, p->mm.pagetable, "va"); /* debug */
}
deferred_ops = percpu_info[cpu].deferred_ops;
diff --git a/xen/include/xen/perfc.h b/xen/include/xen/perfc.h
index 0f84c266dc..5396be9c06 100644
--- a/xen/include/xen/perfc.h
+++ b/xen/include/xen/perfc.h
@@ -2,6 +2,8 @@
#ifndef __XEN_PERFC_H__
#define __XEN_PERFC_H__
+#ifndef NPERFC
+
#include <asm/atomic.h>
/*
@@ -65,4 +67,22 @@ extern struct perfcounter_t perfcounters;
#define perfc_addc(x,y) atomic_add((y), &perfcounters.x[smp_processor_id()])
#define perfc_adda(x,y,z) atomic_add((z), &perfcounters.x[y])
+#else /* !NPERFC */
+
+#define perfc_value(x) ((void)0)
+#define perfc_valuec(x) ((void)0)
+#define perfc_valuea(x,y) ((void)0)
+#define perfc_set(x,v) ((void)0)
+#define perfc_setc(x,v) ((void)0)
+#define perfc_seta(x,y,v) ((void)0)
+#define perfc_incr(x) ((void)0)
+#define perfc_decr(x) ((void)0)
+#define perfc_incrc(x) ((void)0)
+#define perfc_incra(x,y) ((void)0)
+#define perfc_add(x,y) ((void)0)
+#define perfc_addc(x,y) ((void)0)
+#define perfc_adda(x,y,z) ((void)0)
+
+#endif /* !NPERFC */
+
#endif /* __XEN_PERFC_H__ */
diff --git a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h
index f5c0d5327a..c8dce72676 100644
--- a/xen/include/xen/shadow.h
+++ b/xen/include/xen/shadow.h
@@ -525,9 +525,9 @@ static inline void shadow_mk_pagetable( struct mm_struct *mm )
#if SHADOW_DEBUG
-extern int check_pagetable( struct mm_struct *m, pagetable_t pt, char *s );
+extern int check_pagetable(struct mm_struct *m, pagetable_t pt, char *s);
#else
-#define check_pagetable( m, pt, s )
+#define check_pagetable(m, pt, s) ((void)0)
#endif