Another attempt to Consolidate x86 makefiles & tests
PATCH v2 1/1 Another attempt to Consolidate x86 makefiles & tests
This is the acutally the 3rd attempt.
These patches consolidate the make files & tests in user director for x86. This is to allow other architectures easier integration into the kvm source.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 consolidate x86 user makefiles
# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1193196215 18000
# Node ID 556d8fcfcbd72586111f58a1914210e85a9a9d8a
# Parent 707451c0b5ab24ac40bf29885c1b660201eae203 consolidate x86 user makefiles
This patch removes arch specific make rules for x86 & x86-64 out of the main Makefile. These rules are now moved into config-$(ARCH) and a new file config-x86-common has been created to consolidate common rules amongst x86 & x86-64.
This version takes comments from the list into consideration.
user/Makefile +1 -17
@@ -15,8 +15,7 @@ cc-option = $(shell if $(CC) $(1) -S -o cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -CFLAGS += -I $(KERNELDIR)/include $(autodepend-flags) -g -fomit-frame-pointer \ - -Wall +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall CFLAGS += $(call cc-option, -fno-stack-protector, "") CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
@@ -25,21 +24,6 @@ CXXFLAGS = $(autodepend-flags) CXXFLAGS = $(autodepend-flags) autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d - -all: kvmctl libkvm.a flatfiles - -kvmctl: LDFLAGS += -pthread -lrt - -kvmctl: kvmctl.o main.o - -balloon_ctl: balloon_ctl.o - -libkvm.a: kvmctl.o - $(AR) rcs $@ $^ - -flatfiles-common = test/bootstrap test/vmexit.flat test/smp.flat - -flatfiles: $(flatfiles-common) $(flatfiles) install: install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
user/config-i386.mak +5 -1
@@ -3,5 +3,9 @@ bits = 32 bits = 32 ldarch = elf32-i386 CFLAGS += -m32 +CFLAGS += -D__i386__ +CFLAGS += -I $(KERNELDIR)/include -flatfiles= +flatfile_tests= + +include config-x86-common.mak
user/config-x86-common.mak new file +16 -0
@@ -0,0 +1,16 @@ +#This is a make file with common rules for both x86 & x86-64 + +all: kvmctl libkvm.a flatfiles + +kvmctl: LDFLAGS += -pthread -lrt + +kvmctl: kvmctl.o main.o + +libkvm.a: kvmctl.o + $(AR) rcs $@ $^ + +balloon_ctl: balloon_ctl.o + +flatfiles_tests-common = test/bootstrap test/vmexit.flat test/smp.flat + +flatfiles: $(flatfiles_tests-common) $(flatfile_tests))
user/config-x86_64.mak +5 -1
@@ -3,5 +3,9 @@ bits = 64 bits = 64 ldarch = elf64-x86-64 CFLAGS += -m64 +CFLAGS += -D__x86_64__ +CFLAGS += -I $(KERNELDIR)/include -flatfiles = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat +flatfile_tests = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat + +include config-x86-common.mak
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [kvm-ppc-devel] [PATCH 1 of 2] consolidate x86 user makefiles
Quoted 10 lines · On Tue, 2007-10-23 at 22:26 -0500, jyoung5-r/[email protected].…
This patch removes arch specific make rules for x86 & x86-64 out of the
mainMakefile. These rules are now moved into config-$(ARCH) and a new file config-x86-common has been created to consolidate common rules amongst x86 & x86-64.This version takes comments from the list into consideration.
Signed-off-by Jerone Young <jyoung5-r/[email protected]>
Signature · 9 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move all x86 specific tests to there own directory
In reply to jyoung5-r/[email protected]# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1193196215 18000
# Node ID 1335122fbf8be195a699377c4f86c9ef143bce77
# Parent d6b11d52fe56b21349f5e38c9105026dcf5926b2
Move all x86 specific tests to there own directory.
user/Makefile +12 -22
@@ -2,6 +2,8 @@ include config.mak include config.mak DESTDIR := + +.PHONY: arch_clean clean #make sure env CFLAGS variable is not used CFLAGS =
@@ -15,15 +17,22 @@ cc-option = $(shell if $(CC) $(1) -S -o cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall CFLAGS += $(call cc-option, -fno-stack-protector, "") CFLAGS += $(call cc-option, -fno-stack-protector-all, "") LDFLAGS += $(CFLAGS) -CXXFLAGS = $(autodepend-flags) +CXXFLAGS = $(autodepend-flags) autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d + +kvmctl: LDFLAGS += -pthread -lrt + +kvmctl: $(kvmctl_objs) + +libkvm.a: $(libkvm_objs) + $(AR) rcs $@ $^ install: install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
@@ -36,29 +45,10 @@ install: %.flat: %.o $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^ -test/bootstrap: test/bootstrap.o - $(CC) -nostdlib -o $@ -Wl,-T,bootstrap.lds $^ - %.o: %.S $(CC) $(CFLAGS) -c -nostdlib -o $@ $^ -test/irq.flat: test/print.o - -test/access.flat: $(cstart.o) test/access.o test/printf.o test/print.o \ - test/smp.o - -test/sieve.flat: $(cstart.o) test/sieve.o test/print.o test/vm.o - -test/vmexit.flat: $(cstart.o) test/vmexit.o test/printf.o test/smp.o - -test/test32.flat: test/test32.o - -test/smp.flat: $(cstart.o) test/smp.o test/printf.o test/smptest.o - -test/%.o: CFLAGS += -std=gnu99 -ffreestanding - -include .*.d -clean: +clean: arch_clean $(RM) kvmctl *.o *.a .*.d - $(RM) test/bootstrap test/*.o test/*.flat test/.*.d
user/config-i386.mak +3 -2
@@ -1,11 +1,12 @@ LIBDIR = /lib LIBDIR = /lib -cstart.o = test/cstart.o +TEST_DIR=test/x86 +cstart.o = $(TEST_DIR)/cstart.o bits = 32 ldarch = elf32-i386 CFLAGS += -m32 CFLAGS += -D__i386__ CFLAGS += -I $(KERNELDIR)/include -flatfile_tests= +tests= include config-x86-common.mak
user/config-x86-common.mak +32 -8
@@ -1,16 +1,40 @@ #This is a make file with common rules for both x86 & x86-64 -all: kvmctl libkvm.a flatfiles +all: kvmctl libkvm.a test_cases -kvmctl: LDFLAGS += -pthread -lrt +kvmctl_objs=kvmctl.o main.o -kvmctl: kvmctl.o main.o - -libkvm.a: kvmctl.o - $(AR) rcs $@ $^ +libkvm_objs=kvmctl.o balloon_ctl: balloon_ctl.o -flatfiles_tests-common = test/bootstrap test/vmexit.flat test/smp.flat +tests-common = $(TEST_DIR)/bootstrap \ + $(TEST_DIR)/vmexit.flat \ + $(TEST_DIR)/smp.flat -flatfiles: $(flatfiles_tests-common) $(flatfile_tests)) +test_cases: $(tests-common) $(tests) + +$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding + +$(TEST_DIR)/bootstrap: $(TEST_DIR)/bootstrap.o + $(CC) -nostdlib -o $@ -Wl,-T,bootstrap.lds $^ + +$(TEST_DIR)/irq.flat: $(TEST_DIR)/test/print.o + +$(TEST_DIR)/access.flat: $(cstart.o) $(TEST_DIR)/access.o \ + $(TEST_DIR)/printf.o $(TEST_DIR)/print.o $(TEST_DIR)/smp.o + +$(TEST_DIR)/sieve.flat: $(cstart.o) $(TEST_DIR)/sieve.o \ + $(TEST_DIR)/print.o $(TEST_DIR)/vm.o + +$(TEST_DIR)/vmexit.flat: $(cstart.o) $(TEST_DIR)/vmexit.o \ + $(TEST_DIR)/printf.o $(TEST_DIR)/smp.o + +$(TEST_DIR)/test32.flat: $(TEST_DIR)/test32.o + +$(TEST_DIR)/smp.flat: $(cstart.o) $(TEST_DIR)/smp.o $(TEST_DIR)/printf.o \ + $(TEST_DIR)/smptest.o + +arch_clean: + $(RM) $(TEST_DIR)/bootstrap $(TEST_DIR)/*.o $(TEST_DIR)/*.flat \ + $(TEST_DIR)/.*.d
user/config-x86_64.mak +3 -2
@@ -1,11 +1,12 @@ LIBDIR = /lib64 LIBDIR = /lib64 -cstart.o = test/cstart64.o +TEST_DIR=test/x86 +cstart.o = $(TEST_DIR)/cstart64.o bits = 64 ldarch = elf64-x86-64 CFLAGS += -m64 CFLAGS += -D__x86_64__ CFLAGS += -I $(KERNELDIR)/include -flatfile_tests = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat +tests = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat include config-x86-common.mak
user/main.c +1 -1
@@ -17,7 +17,7 @@#define _GNU_SOURCE#include "kvmctl.h" -#include "test/apic.h" +#include "test/x86/apic.h" #include <stdio.h> #include <unistd.h>
user/test/access.c deleted +0 -367
367 lines not on this page · raw message
user/test/apic.h deleted +0 -14
@@ -1,14 +0,0 @@ -#ifndef SILLY_APIC_H -#define SILLY_APIC_H - -#define APIC_BASE 0x1000 -#define APIC_SIZE 0x100 - -#define APIC_REG_NCPU 0x00 -#define APIC_REG_ID 0x04 -#define APIC_REG_SIPI_ADDR 0x08 -#define APIC_REG_SEND_SIPI 0x0c -#define APIC_REG_IPI_VECTOR 0x10 -#define APIC_REG_SEND_IPI 0x14 - -#endif
user/test/bootstrap.S deleted +0 -137
137 lines not on this page · raw message
user/test/cstart.S deleted +0 -10
@@ -1,10 +0,0 @@ - - -.bss - -.section .init - call main -1: hlt - jmp 1b - -
user/test/cstart64.S deleted +0 -169
169 lines not on this page · raw message
user/test/irq.S deleted +0 -118
118 lines not on this page · raw message
user/test/memtest1.S deleted +0 -44
44 lines not on this page · raw message
user/test/print.S deleted +0 -31
@@ -1,31 +0,0 @@ - -#include "print.h" - -#define PSEUDO_SERIAL_PORT 0xf1 - - -.text - PRINT "boo" - hlt -1: jmp 1b - -.globl print -print: - push %rax - push %rsi - push %rdx - - mov %rdi, %rsi - mov $(PSEUDO_SERIAL_PORT), %edx - -putchar: - cmpb $0, (%rsi) - jz done - outsb - jmp putchar -done: - - pop %rdx - pop %rsi - pop %rax - ret
user/test/print.h deleted +0 -19
@@ -1,19 +0,0 @@ -#ifndef PRINT_H -#define PRINT_H - -.macro PRINT text - -.data - -333: .asciz "\text\n" - -.previous - - push %rdi - lea 333b, %rdi - call print - pop %rdi - -.endm - -#endif
user/test/printf.c deleted +0 -169
169 lines not on this page · raw message
user/test/printf.h deleted +0 -2
@@ -1,2 +0,0 @@ - -int printf (const char *fmt, ...);
user/test/sieve.c deleted +0 -89
89 lines not on this page · raw message
user/test/simple.S deleted +0 -13
@@ -1,13 +0,0 @@ - - .text - - mov $0, %al - mov $10000, %ebx -1: - mov %rbx, %rcx -2: - loop 2b - out %al, $0x80 - inc %al - add $10000, %rbx - jmp 1b
user/test/smp.c deleted +0 -151
151 lines not on this page · raw message
user/test/smp.h deleted +0 -16
@@ -1,16 +0,0 @@ -#ifndef __SMP_H -#define __SMP_H - -struct spinlock { -int v; -}; - -void smp_init (void (*smp_main)(void )); - -int cpu_count (void ); -int smp_id (void ); -void on_cpu (int cpu,void (*function)(void *data),void *data); -void spin_lock (struct spinlock *lock); -void spin_unlock (struct spinlock *lock); - -#endif
user/test/smptest.c deleted +0 -32
@@ -1,32 +0,0 @@ - -#include "smp.h" -#include "printf.h" - -static void ipi_test (void *data) -{ -int n = (long )data; - -printf ("ipi called, cpu %d\n" , n); -if (n !=smp_id ()) -printf ("but wrong cpu %d\n" ,smp_id ()); -} - -static void smp_main (void ) -{ -printf ("smp main %d\n" ,smp_id ()); -while (1 ) - asmvolatile ("hlt" : : :"memory" ); -} - -int main () -{ -int ncpus; -int i; - -smp_init (smp_main); - ncpus =cpu_count (); -printf ("found %d cpus\n" , ncpus); -for (i =0 ; i < ncpus; ++i) -on_cpu (i, ipi_test, (void *)(long )i); -return 0 ; -}
user/test/stringio.S deleted +0 -31
@@ -1,31 +0,0 @@ - -.data - -.macro str name, value - -\name : .long 1f-2f -2: .ascii "\value" -1: -.endm - - str "forward", "forward" - str "backward", "backward" - -.text - - - cld - movl forward, %ecx - lea 4+forward, %rsi - movw $1, %dx - rep outsb - - std - movl backward, %ecx - lea 4+backward-1(%rcx), %rsi - movw $2, %dx - rep outsb - - hlt - -
user/test/test32.S deleted +0 -8
@@ -1,8 +0,0 @@ -.code32 - -.text - -1: - mov $0x12, %al - out %al, $0x80 - jmp 1b
user/test/vm.c deleted +0 -249
249 lines not on this page · raw message
user/test/vm.h deleted +0 -9
@@ -1,9 +0,0 @@ -#ifndef VM_H -#define VM_H - -void setup_vm (); - -void *vmalloc (unsigned long size); -void vfree (void *mem); - -#endif
user/test/vmexit.c deleted +0 -32
@@ -1,32 +0,0 @@ - -#include "printf.h" - -static inline unsigned long long rdtsc () -{ -long long r; - -#ifdef __x86_64__ -unsigned a, d; - - asmvolatile ("rdtsc" :"=a" (a),"=d" (d)); - r = a | ((long long )d <<32 ); -#else - asmvolatile ("rdtsc" :"=A" (r)); -#endif -return r; -} - -#define N (1 << 22) - -int main () -{ -int i; -unsigned long long t1, t2; - - t1 =rdtsc (); -for (i =0 ; i <N ; ++i) - asmvolatile ("cpuid" : : :"eax" ,"ebx" ,"ecx" ,"edx" ); - t2 =rdtsc (); -printf ("vmexit latency: %d\n" , (int )((t2 - t1) /N )); -return 0 ; -}
user/test/x86/access.c new file +367 -0
367 lines not on this page · raw message
user/test/x86/apic.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef SILLY_APIC_H +#define SILLY_APIC_H + +#define APIC_BASE 0x1000 +#define APIC_SIZE 0x100 + +#define APIC_REG_NCPU 0x00 +#define APIC_REG_ID 0x04 +#define APIC_REG_SIPI_ADDR 0x08 +#define APIC_REG_SEND_SIPI 0x0c +#define APIC_REG_IPI_VECTOR 0x10 +#define APIC_REG_SEND_IPI 0x14 + +#endif
user/test/x86/bootstrap.S new file +137 -0
137 lines not on this page · raw message
user/test/x86/cstart.S new file +10 -0
@@ -0,0 +1,10 @@ + + +.bss + +.section .init + call main +1: hlt + jmp 1b + +
user/test/x86/cstart64.S new file +169 -0
169 lines not on this page · raw message
user/test/x86/irq.S new file +118 -0
118 lines not on this page · raw message
user/test/x86/memtest1.S new file +44 -0
44 lines not on this page · raw message
user/test/x86/print.S new file +31 -0
@@ -0,0 +1,31 @@ + +#include "print.h" + +#define PSEUDO_SERIAL_PORT 0xf1 + + +.text + PRINT "boo" + hlt +1: jmp 1b + +.globl print +print: + push %rax + push %rsi + push %rdx + + mov %rdi, %rsi + mov $(PSEUDO_SERIAL_PORT), %edx + +putchar: + cmpb $0, (%rsi) + jz done + outsb + jmp putchar +done: + + pop %rdx + pop %rsi + pop %rax + ret
user/test/x86/print.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef PRINT_H +#define PRINT_H + +.macro PRINT text + +.data + +333: .asciz "\text\n" + +.previous + + push %rdi + lea 333b, %rdi + call print + pop %rdi + +.endm + +#endif
user/test/x86/printf.c new file +169 -0
169 lines not on this page · raw message
user/test/x86/printf.h new file +2 -0
@@ -0,0 +1,2 @@ + +int printf (const char *fmt, ...);
user/test/x86/sieve.c new file +89 -0
64 lines not on this page · raw message
user/test/x86/smp.c new file +151 -0
151 lines not on this page · raw message
user/test/x86/vm.c new file +249 -0
249 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Part of the diff is not shown here. View the raw message.
Re: [kvm-ppc-devel] [PATCH 2 of 2] Move all x86 specific tests to there own directory
Quoted 4 lines · On Tue, 2007-10-23 at 22:26 -0500, jyoung5-r/[email protected].…
Move all x86 specific tests to there own directory.
Signed-off-by Jerone Young <jyoung5-r/[email protected]>
Signature · 9 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Quoted 6 lines · jyoung5-r/[email protected] wrote:
This is the acutally the 3rd attempt.
These patches consolidate the make files & tests in user director for x86. This is to allow other architectures easier integration into the kvm source.
Food fight seems to have died down, so I applied both. But please:
- generate patches with '-M' to detect renames. those file moves would have been much easier on the old eyes.
- make sure your patches don't add trailing whitespace
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 4720DC70.6090607-atKUWr5tajBWk0Htik3J/[email protected]
userspace repositories
Avi, what do you think about breaking the kvm-userspace repository into separate kvm-qemu, kvmctl, and libkvm repositories?
Signature · 9 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: userspace repositories
Quoted 4 lines · Hollis Blanchard
Avi, what do you think about breaking the kvm-userspace repository into separate kvm-qemu, kvmctl, and libkvm repositories?
Firstly, I think kvmctl and libkvm should stay together.
I'm not thrilled about breaking up the repositories even more; it makes bisecting more difficult. Perhaps git's module support can help here.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 4720E312.3060400-atKUWr5tajBWk0Htik3J/[email protected]
Re: userspace repositories
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Hollis Blanchard
Avi, what do you think about breaking the kvm-userspace repository into separate kvm-qemu, kvmctl, and libkvm repositories?
Firstly, I think kvmctl and libkvm should stay together.
Why? As far as I can see, there are currently two independent consumers of libkvm: qemu and kvmctl. At the very least they should live in separate directories.
Also, having libkvm on its own means that only one package has to include kernel headers and deal with that configure mess. The userspace apps really have no need for that...
Signature · 9 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: userspace repositories
Quoted 7 lines · Hollis Blanchard
Quoted 5 lines · Avi Kivity
Quoted 3 lines · Hollis Blanchard
Avi, what do you think about breaking the kvm-userspace repository into separate kvm-qemu, kvmctl, and libkvm repositories?
Quoted 8 lines
Quoted 2 lines
Firstly, I think kvmctl and libkvm should stay together.
Why? As far as I can see, there are currently two independent consumers of libkvm: qemu and kvmctl. At the very least they should live in separate directories.
They're both small, and tied up together. I'd rather support one small package than two small packages.
Agree about separate directories.
Quoted 4 lines
Also, having libkvm on its own means that only one package has to include kernel headers and deal with that configure mess. The userspace apps really have no need for that...
kvmctl is intended to be a small test driver, no more.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/