Re: [kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
Hi Hollis and Avi, I run into a compile problem with libkvm when compiling kvm-49. It caused the compile problem mentioned in my email yesterday. It has to with the line in libkvm/Makefile CFLAGS += -I $(KERNELDIR)/include when compiling kvm-49 (git or snapshot), this include points to my resident kernel's version of kvm.h instead of the local one copied with make sync LINUX=kvm git repo). in kvm-48, KERNELDIR points to the kvm-userspace/kernel/ directory (under the git repo), but in the more recent versions it changes to /lib/modules/2.6.22.9-61.fc6/build/include. Here are the compiles from kvm-48 (kvmctl.c) and 49 (libkvm.c) respectively, kvm-48: gcc -m64 -I /home/cam/research/KVM/Sakwatamau/kvm-48/kernel/include -MMD -MF ./.kvmctl.d -g -fomit-frame-pointer -Wall -fno-stack-protector -c -o kvmctl.o kvmctl.c kvm-49: cc -MMD -MF ./.libkvm.d -g -fomit-frame-pointer -Wall -fno-stack-protector -I /lib/modules/2.6.22.9-61.fc6/build/include -c -o libkvm.o libkvm.c what is KERNELDIR supposed to point to - the install location for the modules or the location of kernel source? When configuring, I tried setting --kerneldir to the repo copy, but that didn't work. Thanks, Cam Hollis Blanchard wrote: Move libkvm into its own directory. No functional changes. Signed-off-by: Hollis Blanchard [EMAIL PROTECTED] --- I've build-tested this pretty thoroughly on x86(32). Changes from v1: update libkvm.h #include guard macro. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -5,16 +5,17 @@ DESTDIR= rpmrelease = devel -.PHONY: kernel user qemu bios clean +.PHONY: kernel user libkvm qemu bios clean -all: $(if $(WANT_MODULE), kernel) user qemu +all: $(if $(WANT_MODULE), kernel) user libkvm qemu kcmd = $(if $(WANT_MODULE),,@\#) -qemu kernel user: +qemu kernel user libkvm: $(MAKE) -C $@ -qemu: user +qemu: libkvm +user: libkvm bios: $(MAKE) -C $@ @@ -41,7 +42,7 @@ install-rpm: install: $(kcmd)make -C kernel DESTDIR=$(DESTDIR) install - make -C user DESTDIR=$(DESTDIR) install + make -C libkvm DESTDIR=$(DESTDIR) install make -C qemu DESTDIR=$(DESTDIR) install tmpspec = .tmp.kvm.spec @@ -59,6 +60,7 @@ srpm: sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec $(tmpspec) tar czf SOURCES/kvm.tar.gz qemu tar czf SOURCES/user.tar.gz user + tar czf SOURCES/libkvm.tar.gz libkvm tar czf SOURCES/kernel.tar.gz kernel tar czf SOURCES/scripts.tar.gz scripts cp Makefile configure kvm_stat SOURCES @@ -66,7 +68,7 @@ srpm: $(RM) $(tmpspec) clean: - for i in $(if $(WANT_MODULE), kernel) user qemu; do \ + for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \ make -C $$i clean; \ done rm -f config.mak user/config.mak diff --git a/configure b/configure --- a/configure +++ b/configure @@ -108,8 +108,8 @@ fi #configure qemu (cd qemu; ./configure --target-list=$target_exec \ ---disable-kqemu --extra-cflags=-I $PWD/../user $qemu_cflags \ ---extra-ldflags=-L $PWD/../user $qemu_ldflags \ +--disable-kqemu --extra-cflags=-I $PWD/../libkvm $qemu_cflags \ +--extra-ldflags=-L $PWD/../libkvm $qemu_ldflags \ --enable-kvm --kernel-path=$libkvm_kerneldir \ ${enable_alsa:+--enable-alsa} \ ${disable_vnc_tls:+--disable-vnc-tls} \ diff --git a/libkvm/Makefile b/libkvm/Makefile new file mode 100644 --- /dev/null +++ b/libkvm/Makefile @@ -0,0 +1,37 @@ +include ../config.mak +include config-$(ARCH).mak + +# cc-option +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) +cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ + /dev/null 21; then echo $(1); else echo $(2); fi ;) + +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall +CFLAGS += $(call cc-option, -fno-stack-protector, ) +CFLAGS += $(call cc-option, -fno-stack-protector-all, ) +CFLAGS += -I $(KERNELDIR)/include + +LDFLAGS += $(CFLAGS) + +CXXFLAGS = $(autodepend-flags) + +autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d + + +all: libkvm.a + +libkvm.a: libkvm.o + $(AR) rcs $@ $^ + +install: + install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h + install -D $(KERNELDIR)/include/linux/kvm.h \ + $(DESTDIR)/$(PREFIX)/include/linux/kvm.h + install -D $(KERNELDIR)/include/linux/kvm_para.h \ + $(DESTDIR)/$(PREFIX)/include/linux/kvm_para.h + install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a + +-include .*.d + +clean: + $(RM) *.o *.a .*.d diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak new file mode 100644 --- /dev/null +++ b/libkvm/config-i386.mak @@ -0,0 +1,2 @@ + +LIBDIR := /lib diff --git a/libkvm/config-x86_64.mak b/libkvm/config-x86_64.mak new file mode 100644 --- /dev/null +++ b/libkvm/config-x86_64.mak @@ -0,0 +1,2 @@
Re: [kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
I think the KERNELDIR change is a red herring: you probably ran configure with different arguments. I notice that the kvm-49 build line below is missing -m64. Try this: diff --git a/libkvm/config-x86_64.mak b/libkvm/config-x86_64.mak --- a/libkvm/config-x86_64.mak +++ b/libkvm/config-x86_64.mak @@ -1,2 +1,5 @@ LIBDIR := /lib64 + +CFLAGS += -m64 +CFLAGS += -D__x86_64__ -- Hollis Blanchard IBM Linux Technology Center On Wed, 2007-10-31 at 10:09 -0600, Cam Macdonell wrote: Hi Hollis and Avi, I run into a compile problem with libkvm when compiling kvm-49. It caused the compile problem mentioned in my email yesterday. It has to with the line in libkvm/Makefile CFLAGS += -I $(KERNELDIR)/include when compiling kvm-49 (git or snapshot), this include points to my resident kernel's version of kvm.h instead of the local one copied with make sync LINUX=kvm git repo). in kvm-48, KERNELDIR points to the kvm-userspace/kernel/ directory (under the git repo), but in the more recent versions it changes to /lib/modules/2.6.22.9-61.fc6/build/include. Here are the compiles from kvm-48 (kvmctl.c) and 49 (libkvm.c) respectively, kvm-48: gcc -m64 -I /home/cam/research/KVM/Sakwatamau/kvm-48/kernel/include -MMD -MF ./.kvmctl.d -g -fomit-frame-pointer -Wall -fno-stack-protector -c -o kvmctl.o kvmctl.c kvm-49: cc -MMD -MF ./.libkvm.d -g -fomit-frame-pointer -Wall -fno-stack-protector -I /lib/modules/2.6.22.9-61.fc6/build/include -c -o libkvm.o libkvm.c what is KERNELDIR supposed to point to - the install location for the modules or the location of kernel source? When configuring, I tried setting --kerneldir to the repo copy, but that didn't work. Thanks, Cam Hollis Blanchard wrote: Move libkvm into its own directory. No functional changes. Signed-off-by: Hollis Blanchard [EMAIL PROTECTED] --- I've build-tested this pretty thoroughly on x86(32). Changes from v1: update libkvm.h #include guard macro. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -5,16 +5,17 @@ DESTDIR= rpmrelease = devel -.PHONY: kernel user qemu bios clean +.PHONY: kernel user libkvm qemu bios clean -all: $(if $(WANT_MODULE), kernel) user qemu +all: $(if $(WANT_MODULE), kernel) user libkvm qemu kcmd = $(if $(WANT_MODULE),,@\#) -qemu kernel user: +qemu kernel user libkvm: $(MAKE) -C $@ -qemu: user +qemu: libkvm +user: libkvm bios: $(MAKE) -C $@ @@ -41,7 +42,7 @@ install-rpm: install: $(kcmd)make -C kernel DESTDIR=$(DESTDIR) install - make -C user DESTDIR=$(DESTDIR) install + make -C libkvm DESTDIR=$(DESTDIR) install make -C qemu DESTDIR=$(DESTDIR) install tmpspec = .tmp.kvm.spec @@ -59,6 +60,7 @@ srpm: sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec $(tmpspec) tar czf SOURCES/kvm.tar.gz qemu tar czf SOURCES/user.tar.gz user + tar czf SOURCES/libkvm.tar.gz libkvm tar czf SOURCES/kernel.tar.gz kernel tar czf SOURCES/scripts.tar.gz scripts cp Makefile configure kvm_stat SOURCES @@ -66,7 +68,7 @@ srpm: $(RM) $(tmpspec) clean: - for i in $(if $(WANT_MODULE), kernel) user qemu; do \ + for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \ make -C $$i clean; \ done rm -f config.mak user/config.mak diff --git a/configure b/configure --- a/configure +++ b/configure @@ -108,8 +108,8 @@ fi #configure qemu (cd qemu; ./configure --target-list=$target_exec \ ---disable-kqemu --extra-cflags=-I $PWD/../user $qemu_cflags \ ---extra-ldflags=-L $PWD/../user $qemu_ldflags \ +--disable-kqemu --extra-cflags=-I $PWD/../libkvm $qemu_cflags \ +--extra-ldflags=-L $PWD/../libkvm $qemu_ldflags \ --enable-kvm --kernel-path=$libkvm_kerneldir \ ${enable_alsa:+--enable-alsa} \ ${disable_vnc_tls:+--disable-vnc-tls} \ diff --git a/libkvm/Makefile b/libkvm/Makefile new file mode 100644 --- /dev/null +++ b/libkvm/Makefile @@ -0,0 +1,37 @@ +include ../config.mak +include config-$(ARCH).mak + +# cc-option +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) +cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ + /dev/null 21; then echo $(1); else echo $(2); fi ;) + +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall +CFLAGS += $(call cc-option, -fno-stack-protector, ) +CFLAGS += $(call cc-option, -fno-stack-protector-all, ) +CFLAGS += -I $(KERNELDIR)/include + +LDFLAGS += $(CFLAGS) + +CXXFLAGS = $(autodepend-flags) + +autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d + + +all: libkvm.a + +libkvm.a: libkvm.o + $(AR) rcs $@ $^ + +install: + install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h + install -D $(KERNELDIR)/include/linux/kvm.h \ +
Re: [kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
Hollis Blanchard wrote: I think the KERNELDIR change is a red herring: you probably ran configure with different arguments. Hi Hollis, The only one I run with is --prefix. It seems Avi latest patches fix the problem (although I'm not sure how): With Avi's latest changes, this now the compile line for libkvm.o. gcc -MMD -MF ./.libkvm.d -g -fomit-frame-pointer -Wall -fno-stack-protector -I /compsci/brule7/cshome/cam/research/KVM/kvm-userspace/kernel/include -c -o libkvm.o libkvm.c Thanks for your reply, Cam I notice that the kvm-49 build line below is missing -m64. Try this: diff --git a/libkvm/config-x86_64.mak b/libkvm/config-x86_64.mak --- a/libkvm/config-x86_64.mak +++ b/libkvm/config-x86_64.mak @@ -1,2 +1,5 @@ LIBDIR := /lib64 + +CFLAGS += -m64 +CFLAGS += -D__x86_64__ - 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/ ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
Cam Macdonell wrote: Hi Hollis and Avi, I run into a compile problem with libkvm when compiling kvm-49. It caused the compile problem mentioned in my email yesterday. It has to with the line in libkvm/Makefile CFLAGS += -I $(KERNELDIR)/include when compiling kvm-49 (git or snapshot), this include points to my resident kernel's version of kvm.h instead of the local one copied with make sync LINUX=kvm git repo). in kvm-48, KERNELDIR points to the kvm-userspace/kernel/ directory (under the git repo), but in the more recent versions it changes to /lib/modules/2.6.22.9-61.fc6/build/include. Here are the compiles from kvm-48 (kvmctl.c) and 49 (libkvm.c) respectively, kvm-48: gcc -m64 -I /home/cam/research/KVM/Sakwatamau/kvm-48/kernel/include -MMD -MF ./.kvmctl.d -g -fomit-frame-pointer -Wall -fno-stack-protector -c -o kvmctl.o kvmctl.c kvm-49: cc -MMD -MF ./.libkvm.d -g -fomit-frame-pointer -Wall -fno-stack-protector -I /lib/modules/2.6.22.9-61.fc6/build/include -c -o libkvm.o libkvm.c what is KERNELDIR supposed to point to - the install location for the modules or the location of kernel source? I committed a patch from Uri that fixes this. -- Any sufficiently difficult bug is indistinguishable from a feature. - 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/ ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
Hollis Blanchard wrote: Move libkvm into its own directory. No functional changes. Applied, thanks. -- Any sufficiently difficult bug is indistinguishable from a feature. - 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/ ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] [RESEND] Move libkvm (v2)
Move libkvm into its own directory. No functional changes. Signed-off-by: Hollis Blanchard [EMAIL PROTECTED] --- I've build-tested this pretty thoroughly on x86(32). Changes from v1: update libkvm.h #include guard macro. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -5,16 +5,17 @@ DESTDIR= rpmrelease = devel -.PHONY: kernel user qemu bios clean +.PHONY: kernel user libkvm qemu bios clean -all: $(if $(WANT_MODULE), kernel) user qemu +all: $(if $(WANT_MODULE), kernel) user libkvm qemu kcmd = $(if $(WANT_MODULE),,@\#) -qemu kernel user: +qemu kernel user libkvm: $(MAKE) -C $@ -qemu: user +qemu: libkvm +user: libkvm bios: $(MAKE) -C $@ @@ -41,7 +42,7 @@ install-rpm: install: $(kcmd)make -C kernel DESTDIR=$(DESTDIR) install - make -C user DESTDIR=$(DESTDIR) install + make -C libkvm DESTDIR=$(DESTDIR) install make -C qemu DESTDIR=$(DESTDIR) install tmpspec = .tmp.kvm.spec @@ -59,6 +60,7 @@ srpm: sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec $(tmpspec) tar czf SOURCES/kvm.tar.gz qemu tar czf SOURCES/user.tar.gz user + tar czf SOURCES/libkvm.tar.gz libkvm tar czf SOURCES/kernel.tar.gz kernel tar czf SOURCES/scripts.tar.gz scripts cp Makefile configure kvm_stat SOURCES @@ -66,7 +68,7 @@ srpm: $(RM) $(tmpspec) clean: - for i in $(if $(WANT_MODULE), kernel) user qemu; do \ + for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \ make -C $$i clean; \ done rm -f config.mak user/config.mak diff --git a/configure b/configure --- a/configure +++ b/configure @@ -108,8 +108,8 @@ fi #configure qemu (cd qemu; ./configure --target-list=$target_exec \ ---disable-kqemu --extra-cflags=-I $PWD/../user $qemu_cflags \ ---extra-ldflags=-L $PWD/../user $qemu_ldflags \ +--disable-kqemu --extra-cflags=-I $PWD/../libkvm $qemu_cflags \ +--extra-ldflags=-L $PWD/../libkvm $qemu_ldflags \ --enable-kvm --kernel-path=$libkvm_kerneldir \ ${enable_alsa:+--enable-alsa} \ ${disable_vnc_tls:+--disable-vnc-tls} \ diff --git a/libkvm/Makefile b/libkvm/Makefile new file mode 100644 --- /dev/null +++ b/libkvm/Makefile @@ -0,0 +1,37 @@ +include ../config.mak +include config-$(ARCH).mak + +# cc-option +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) +cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ + /dev/null 21; then echo $(1); else echo $(2); fi ;) + +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall +CFLAGS += $(call cc-option, -fno-stack-protector, ) +CFLAGS += $(call cc-option, -fno-stack-protector-all, ) +CFLAGS += -I $(KERNELDIR)/include + +LDFLAGS += $(CFLAGS) + +CXXFLAGS = $(autodepend-flags) + +autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d + + +all: libkvm.a + +libkvm.a: libkvm.o + $(AR) rcs $@ $^ + +install: + install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h + install -D $(KERNELDIR)/include/linux/kvm.h \ + $(DESTDIR)/$(PREFIX)/include/linux/kvm.h + install -D $(KERNELDIR)/include/linux/kvm_para.h \ + $(DESTDIR)/$(PREFIX)/include/linux/kvm_para.h + install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a + +-include .*.d + +clean: + $(RM) *.o *.a .*.d diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak new file mode 100644 --- /dev/null +++ b/libkvm/config-i386.mak @@ -0,0 +1,2 @@ + +LIBDIR := /lib diff --git a/libkvm/config-x86_64.mak b/libkvm/config-x86_64.mak new file mode 100644 --- /dev/null +++ b/libkvm/config-x86_64.mak @@ -0,0 +1,2 @@ + +LIBDIR := /lib64 diff --git a/user/kvm-abi-10.h b/libkvm/kvm-abi-10.h rename from user/kvm-abi-10.h rename to libkvm/kvm-abi-10.h diff --git a/user/kvmctl.c b/libkvm/libkvm.c rename from user/kvmctl.c rename to libkvm/libkvm.c --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -34,7 +34,7 @@ #include string.h #include errno.h #include sys/ioctl.h -#include kvmctl.h +#include libkvm.h #include kvm-abi-10.h static int kvm_abi = EXPECTED_KVM_API_VERSION; diff --git a/user/kvmctl.h b/libkvm/libkvm.h rename from user/kvmctl.h rename to libkvm/libkvm.h --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -2,8 +2,8 @@ * libkvm API */ -#ifndef KVMCTL_H -#define KVMCTL_H +#ifndef LIBKVM_H +#define LIBKVM_H #include stdint.h diff --git a/qemu/Makefile.target b/qemu/Makefile.target --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -419,7 +419,7 @@ ifdef CONFIG_KVM_KERNEL_INC ifdef CONFIG_KVM_KERNEL_INC CFLAGS += -I $(CONFIG_KVM_KERNEL_INC) LIBS += -lkvm -DEPLIBS += ../user/libkvm.a +DEPLIBS += ../libkvm/libkvm.a endif ifdef CONFIG_VNC_TLS diff --git a/qemu/hw/vga.c b/qemu/hw/vga.c --- a/qemu/hw/vga.c +++ b/qemu/hw/vga.c @@ -1413,7 +1413,7 @@ void vga_invalidate_scanlines(VGAState * #ifdef USE_KVM -#include kvmctl.h +#include libkvm.h extern kvm_context_t kvm_context; static