kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 04/12] Fix build without CONFIG_MMU_NOTIFIER
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (2 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 01/12] Provide schedule_hrtimeout for pre-2.6.28 kernels Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 external-module-compat-comm.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index 8f56f11..fd3aab7 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -1004,3 +1004,9 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
 int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
 #endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#ifndef CONFIG_MMU_NOTIFIER
+struct mmu_notifier {};
+#endif
+#endif


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/12] Drop now unused config.kbuild
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (5 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 02/12] Use DESTDIR consitently on installation Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 10/12] Add compat version of hlist_del_init_rcu Jan Kiszka
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

This was used to carry CONFIG_KVM_TRACE into the build. We no longer
have such switches, so drop the infrastructure. We can easily
reintroduce it once required.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 .gitignore |    1 -
 Makefile   |    3 +--
 configure  |    3 ---
 x86/Kbuild |    4 ----
 4 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2089ca6..5c46f86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@
 .*.cmd
 *.ko
 *.mod.c
-config.kbuild
 config.mak
 modules.order
 Module.symvers
diff --git a/Makefile b/Makefile
index 8420d11..f406e3d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,4 @@
 include config.mak
-include config.kbuild
 
 ARCH_DIR = $(if $(filter $(ARCH),x86_64 i386),x86,$(ARCH))
 ARCH_CONFIG := $(shell echo $(ARCH_DIR) | tr '[:lower:]' '[:upper:]')
@@ -72,4 +71,4 @@ clean:
 	$(MAKE) -C $(KERNELDIR) M=`pwd` $@
 
 distclean: clean
-	rm -f config.kbuild config.mak include/asm include-compat/asm
+	rm -f config.mak include/asm include-compat/asm
diff --git a/configure b/configure
index 83b509c..7122d40 100755
--- a/configure
+++ b/configure
@@ -129,6 +129,3 @@ AR=$cross_prefix$ar
 DEPMOD_VERSION=$depmod_version
 KVM_VERSION=$(kvm_version)
 EOF
-
-cat <<EOF > config.kbuild
-EOF
diff --git a/x86/Kbuild b/x86/Kbuild
index 3499593..fad05d5 100644
--- a/x86/Kbuild
+++ b/x86/Kbuild
@@ -1,7 +1,3 @@
-# trick to get the kvm-specific CONFIG_KVM_* definitions,
-# because the kernel source tree won't have them
-include $(obj)/../config.kbuild
-
 obj-m := kvm.o kvm-intel.o kvm-amd.o
 kvm-objs := kvm_main.o x86.o mmu.o emulate.o ../anon_inodes.o irq.o i8259.o \
 	 lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o irq_comm.o \


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/12] Add udev rule
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (3 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 04/12] Fix build without CONFIG_MMU_NOTIFIER Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 13:19   ` Michael Tokarev
                     ` (2 more replies)
  2009-10-19 10:59 ` [PATCH 02/12] Use DESTDIR consitently on installation Jan Kiszka
                   ` (7 subsequent siblings)
  12 siblings, 3 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Ported from OpenSUSE: Provide an udev rule that not only sets the group
of /dev/kvm but also triggers automatic loading of the kernel modules
during boot.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 Makefile             |    1 +
 scripts/65-kvm.rules |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 scripts/65-kvm.rules

diff --git a/Makefile b/Makefile
index 8314833..8614449 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,7 @@ install:
 		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
 	done
 	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
+	install -m 644 -D scripts/65-kvm.rules $(DESTDIR)/etc/udev/rules.d/65-kvm.rules
 
 tmpspec = .tmp.kvm-kmod.spec
 
diff --git a/scripts/65-kvm.rules b/scripts/65-kvm.rules
new file mode 100644
index 0000000..857b08c
--- /dev/null
+++ b/scripts/65-kvm.rules
@@ -0,0 +1,2 @@
+KERNEL=="kvm", MODE="0660", GROUP="kvm"
+ACTION=="add|change", SUBSYSTEM=="dmi", KERNEL=="id", RUN+="/bin/sh -c 'grep -q vmx /proc/cpuinfo && /sbin/modprobe kvm-intel; grep -q svm /proc/cpuinfo && /sbin/modprobe kvm-amd'"


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 01/12] Provide schedule_hrtimeout for pre-2.6.28 kernels
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
  2009-10-19 10:59 ` [PATCH 08/12] Cleanup unused CONFIG_KVM_TRACE control Jan Kiszka
  2009-10-19 10:59 ` [PATCH 05/12] Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 04/12] Fix build without CONFIG_MMU_NOTIFIER Jan Kiszka
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 external-module-compat-comm.h |    4 +++
 external-module-compat.c      |   59 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index de8ab23..8f56f11 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -1000,3 +1000,7 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
 	return 0;
 }
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
+#endif
diff --git a/external-module-compat.c b/external-module-compat.c
index 6b69127..327fa6b 100644
--- a/external-module-compat.c
+++ b/external-module-compat.c
@@ -409,3 +409,62 @@ unsigned kvm_get_tsc_khz(void)
 }
 
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+
+static enum hrtimer_restart kvm_hrtimer_wakeup(struct hrtimer *timer)
+{
+	struct hrtimer_sleeper *t =
+		container_of(timer, struct hrtimer_sleeper, timer);
+	struct task_struct *task = t->task;
+
+	t->task = NULL;
+	if (task)
+		wake_up_process(task);
+
+	return HRTIMER_NORESTART;
+}
+
+int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode)
+{
+	struct hrtimer_sleeper t;
+
+	/*
+	 * Optimize when a zero timeout value is given. It does not
+	 * matter whether this is an absolute or a relative time.
+	 */
+	if (expires && !expires->tv64) {
+		__set_current_state(TASK_RUNNING);
+		return 0;
+	}
+
+	/*
+	 * A NULL parameter means "inifinte"
+	 */
+	if (!expires) {
+		schedule();
+		__set_current_state(TASK_RUNNING);
+		return -EINTR;
+	}
+
+	hrtimer_init(&t.timer, CLOCK_MONOTONIC, mode);
+	t.timer.expires = *expires;
+
+	t.timer.function = kvm_hrtimer_wakeup;
+	t.task = current;
+
+	hrtimer_start(&t.timer, t.timer.expires, mode);
+	if (!hrtimer_active(&t.timer))
+		t.task = NULL;
+
+	if (likely(t.task))
+		schedule();
+
+	hrtimer_cancel(&t.timer);
+
+	__set_current_state(TASK_RUNNING);
+
+	return !t.task ? 0 : -EINTR;
+}
+
+#endif


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/12] Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
  2009-10-19 10:59 ` [PATCH 08/12] Cleanup unused CONFIG_KVM_TRACE control Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 01/12] Provide schedule_hrtimeout for pre-2.6.28 kernels Jan Kiszka
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 external-module-compat-comm.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index fd3aab7..2892ace 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -957,7 +957,7 @@ static inline int kvm_eventfd_signal(struct eventfd_ctx *ctx, int n)
 /* vma_kernel_pagesize, exported since 2.6.32 */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 
-#ifdef CONFIG_HUGETLB_PAGE
+#if defined(CONFIG_HUGETLB_PAGE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
 static inline
 unsigned long kvm_vma_kernel_pagesize(struct vm_area_struct *vma)
 {
@@ -970,7 +970,7 @@ unsigned long kvm_vma_kernel_pagesize(struct vm_area_struct *vma)
 
 	return 1UL << (hstate->order + PAGE_SHIFT);
 }
-#else /* !CONFIG_HUGETLB_SIZE */
+#else /* !CONFIG_HUGETLB_SIZE || <= 2.6.26 */
 #define kvm_vma_kernel_pagesize(v) PAGE_SIZE
 #endif
 


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/12] Add compat version of hlist_del_init_rcu
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (6 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 09/12] Drop now unused config.kbuild Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 06/12] Add compat version of native_read_tsc Jan Kiszka
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 external-module-compat-comm.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index a8f8a2f..cec117b 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -1003,3 +1003,13 @@ int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
 struct mmu_notifier {};
 #endif
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+static inline void hlist_del_init_rcu(struct hlist_node *n)
+{
+	if (!hlist_unhashed(n)) {
+		__hlist_del(n);
+		n->pprev = NULL;
+	}
+}
+#endif


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/12] Add compat version of native_read_tsc
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (7 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 10/12] Add compat version of hlist_del_init_rcu Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 07/12] Define X86_FEATURE_GBPAGES if missing Jan Kiszka
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 x86/external-module-compat.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index 2545ce9..a1a21a5 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -90,6 +90,13 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
 	return EAX_EDX_VAL(val, low, high);
 }
 
+static inline unsigned long long native_read_tsc(void)
+{
+	unsigned long long val;
+	asm volatile("rdtsc" : "=A" (val));
+	return val;
+}
+
 #endif
 
 #endif


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PULL REQUEST] kvm-kmod
@ 2009-10-19 10:59 Jan Kiszka
  2009-10-19 10:59 ` [PATCH 08/12] Cleanup unused CONFIG_KVM_TRACE control Jan Kiszka
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

The following changes since commit bf860c9b3aa0803ee98d096b33a3ab72f576d79e:
  Jan Kiszka (1):
        Update source link

are available in the git repository at:

  git://git.kiszka.org/kvm-kmod.git queue

Jan Kiszka (12):
      Provide schedule_hrtimeout for pre-2.6.28 kernels
      Use DESTDIR consitently on installation
      Add udev rule
      Fix build without CONFIG_MMU_NOTIFIER
      Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels
      Add compat version of native_read_tsc
      Define X86_FEATURE_GBPAGES if missing
      Cleanup unused CONFIG_KVM_TRACE control
      Drop now unused config.kbuild
      Add compat version of hlist_del_init_rcu
      x86: Install compat wrapper for thread_struct.debugreg
      Update source link

 .gitignore                    |    1 -
 Makefile                      |   16 ++++-------
 configure                     |    9 ------
 external-module-compat-comm.h |   31 +++++++++++++++------
 external-module-compat.c      |   59 +++++++++++++++++++++++++++++++++++++++++
 linux-2.6                     |    2 +-
 scripts/65-kvm.rules          |    2 +
 sync                          |    2 +
 x86/Kbuild                    |    4 ---
 x86/external-module-compat.h  |   17 ++++++++++++
 x86/preempt.c                 |   16 +++-------
 11 files changed, 114 insertions(+), 45 deletions(-)
 create mode 100644 scripts/65-kvm.rules

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 07/12] Define X86_FEATURE_GBPAGES if missing
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (8 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 06/12] Add compat version of native_read_tsc Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 12/12] Update source link Jan Kiszka
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 x86/external-module-compat.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index a1a21a5..7056aa1 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -165,6 +165,10 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
 #define X86_FEATURE_FXSR_OPT  (1*32+25)
 #endif
 
+#ifndef X86_FEATURE_GBPAGES
+#define X86_FEATURE_GBPAGES	(1*32+26) /* GB pages */
+#endif
+
 #ifndef X86_FEATURE_SSSE3
 #define X86_FEATURE_SSSE3	(4*32+ 9) /* Supplemental SSE-3 */
 #endif


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/12] Cleanup unused CONFIG_KVM_TRACE control
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 05/12] Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels Jan Kiszka
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 Makefile                      |    6 +-----
 configure                     |    6 ------
 external-module-compat-comm.h |    7 -------
 3 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 8614449..8420d11 100644
--- a/Makefile
+++ b/Makefile
@@ -19,10 +19,6 @@ rpmrelease = devel
 
 LINUX = ./linux-2.6
 
-ifeq ($(EXT_CONFIG_KVM_TRACE),y)
-module_defines += -DEXT_CONFIG_KVM_TRACE=y
-endif
-
 all:: prerequisite
 #	include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
 	$(MAKE) -C $(KERNELDIR) M=`pwd` \
@@ -31,7 +27,7 @@ all:: prerequisite
 			-Iinclude2 -I$(KERNELSOURCEDIR)/include -I$(KERNELSOURCEDIR)/arch/${ARCH_DIR}/include, \
 			-Iarch/${ARCH_DIR}/include) -I`pwd`/include-compat -I`pwd`/${ARCH_DIR} \
 		-include include/linux/autoconf.h \
-		-include `pwd`/$(ARCH_DIR)/external-module-compat.h $(module_defines)" \
+		-include `pwd`/$(ARCH_DIR)/external-module-compat.h" \
 		"$$@"
 
 include $(MAKEFILE_PRE)
diff --git a/configure b/configure
index 533313e..83b509c 100755
--- a/configure
+++ b/configure
@@ -7,7 +7,6 @@ ld=ld
 objcopy=objcopy
 ar=ar
 want_module=1
-kvm_trace=
 cross_prefix=
 arch=`uname -m`
 # don't use uname if kerneldir is set
@@ -25,7 +24,6 @@ usage() {
 	Options include:
 	    --arch=ARCH            architecture to compile for ($arch)
 	    --cross-prefix=PREFIX  prefix for cross compile
-	    --with-kvm-trace       Enable kvm_trace
 	    --kerneldir=DIR        kernel build directory ($kerneldir)
             --help                 this helpful text
 EOF
@@ -49,9 +47,6 @@ while [[ "$1" = -* ]]; do
 	--with-patched-kernel)
 	    want_module=
 	    ;;
-	--with-kvm-trace)
-	    kvm_trace=y
-	    ;;
 	--arch)
 	    arch="$arg"
 	    ;;
@@ -136,5 +131,4 @@ KVM_VERSION=$(kvm_version)
 EOF
 
 cat <<EOF > config.kbuild
-EXT_CONFIG_KVM_TRACE=$kvm_trace
 EOF
diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index 2892ace..a8f8a2f 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -18,13 +18,6 @@
 #include <linux/hrtimer.h>
 #include <asm/bitops.h>
 
-/* Override CONFIG_KVM_TRACE */
-#ifdef EXT_CONFIG_KVM_TRACE
-#  define CONFIG_KVM_TRACE 1
-#else
-#  undef CONFIG_KVM_TRACE
-#endif
-
 /*
  * 2.6.16 does not have GFP_NOWAIT
  */


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/12] Use DESTDIR consitently on installation
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (4 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 09/12] Drop now unused config.kbuild Jan Kiszka
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Apply DESTDIR also on old module renaming and depmod.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 37a14e1..8314833 100644
--- a/Makefile
+++ b/Makefile
@@ -49,11 +49,11 @@ sync:
 install:
 	mkdir -p $(DESTDIR)/$(INSTALLDIR)
 	cp $(ARCH_DIR)/*.ko $(DESTDIR)/$(INSTALLDIR)
-	for i in $(ORIGMODDIR)/drivers/kvm/*.ko \
-		 $(ORIGMODDIR)/arch/$(ARCH_DIR)/kvm/*.ko; do \
+	for i in $(DESTDIR)/$(ORIGMODDIR)/drivers/kvm/*.ko \
+		 $(DESTDIR)/$(ORIGMODDIR)/arch/$(ARCH_DIR)/kvm/*.ko; do \
 		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
 	done
-	/sbin/depmod -a $(DEPMOD_VERSION)
+	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
 
 tmpspec = .tmp.kvm-kmod.spec
 


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/12] x86: Install compat wrapper for thread_struct.debugreg
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (10 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 12/12] Update source link Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 19:37 ` [PULL REQUEST] kvm-kmod Marcelo Tosatti
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

preempt.c already has one, now x86.c need it too. Generalize it and make
it more robust against potential naming conflicts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 sync                         |    2 ++
 x86/external-module-compat.h |    6 ++++++
 x86/preempt.c                |   16 +++++-----------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/sync b/sync
index 8868e6d..da5c218 100755
--- a/sync
+++ b/sync
@@ -133,6 +133,8 @@ def __hack(data):
             line = '\t{ struct page *mapped_page;\n' + sub(r'\);', ', &mapped_page);', line)
         if match('nested_svm_unmap(.*);'):
             line = sub(r'\);', ', mapped_page); }', line)
+        if match(r'->thread.debugreg[0-7]'):
+            line = sub(r'->thread.debugreg([0-7])', r'->thread.kvm_compat_debugreg(\1)', line)
         w(line)
         if match(r'\tkvm_init_debug'):
             w('\thrtimer_kallsyms_resolve();')
diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index 7056aa1..b32e68e 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -571,6 +571,12 @@ static inline unsigned long kvm_get_desc_limit(const struct kvm_desc_struct *des
 
 #endif
 
+#if !defined(CONFIG_X86_64) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
+#define kvm_compat_debugreg(x) debugreg[x]
+#else
+#define kvm_compat_debugreg(x) debugreg##x
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
 
 struct mtrr_var_range {
diff --git a/x86/preempt.c b/x86/preempt.c
index 3112879..440060b 100644
--- a/x86/preempt.c
+++ b/x86/preempt.c
@@ -13,17 +13,11 @@ static LIST_HEAD(pn_list);
 			       current->pid, raw_smp_processor_id());	\
 	} while (0)
 
-#if !defined(CONFIG_X86_64) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
-#define debugreg(x) debugreg[x]
-#else
-#define debugreg(x) debugreg##x
-#endif
-
 static void preempt_enable_sched_out_notifiers(void)
 {
 	asm volatile ("mov %0, %%db0" : : "r"(schedule));
 	asm volatile ("mov %0, %%db7" : : "r"(0x701ul));
-	current->thread.debugreg(7) = 0ul;
+	current->thread.kvm_compat_debugreg(7) = 0ul;
 #ifdef TIF_DEBUG
 	clear_tsk_thread_flag(current, TIF_DEBUG);
 #endif
@@ -33,8 +27,8 @@ static void preempt_enable_sched_in_notifiers(void * addr)
 {
 	asm volatile ("mov %0, %%db0" : : "r"(addr));
 	asm volatile ("mov %0, %%db7" : : "r"(0x701ul));
-	current->thread.debugreg(0) = (unsigned long) addr;
-	current->thread.debugreg(7) = 0x701ul;
+	current->thread.kvm_compat_debugreg(0) = (unsigned long) addr;
+	current->thread.kvm_compat_debugreg(7) = 0x701ul;
 #ifdef TIF_DEBUG
 	set_tsk_thread_flag(current, TIF_DEBUG);
 #endif
@@ -48,7 +42,7 @@ static void __preempt_disable_notifiers(void)
 static void preempt_disable_notifiers(void)
 {
 	__preempt_disable_notifiers();
-	current->thread.debugreg(7) = 0ul;
+	current->thread.kvm_compat_debugreg(7) = 0ul;
 #ifdef TIF_DEBUG
 	clear_tsk_thread_flag(current, TIF_DEBUG);
 #endif
@@ -235,7 +229,7 @@ static void do_disable(void *blah)
 #ifdef TIF_DEBUG
 	if (!test_tsk_thread_flag(current, TIF_DEBUG))
 #else
-	if (!current->thread.debugreg(7))
+	if (!current->thread.kvm_compat_debugreg(7))
 #endif
 		__preempt_disable_notifiers();
 }


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/12] Update source link
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (9 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 07/12] Define X86_FEATURE_GBPAGES if missing Jan Kiszka
@ 2009-10-19 10:59 ` Jan Kiszka
  2009-10-19 10:59 ` [PATCH 11/12] x86: Install compat wrapper for thread_struct.debugreg Jan Kiszka
  2009-10-19 19:37 ` [PULL REQUEST] kvm-kmod Marcelo Tosatti
  12 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 10:59 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 linux-2.6 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/linux-2.6 b/linux-2.6
index 8fdcaf6..f3ed8d8 160000
--- a/linux-2.6
+++ b/linux-2.6
@@ -1 +1 @@
-Subproject commit 8fdcaf60d3e7d96450f3ae05c56f1046327fb3fe
+Subproject commit f3ed8d802756ab5f412080dcc23e95b7f894a7b5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
@ 2009-10-19 13:19   ` Michael Tokarev
  2009-10-19 13:25     ` Jan Kiszka
  2009-10-19 13:28   ` Luca Tettamanti
  2009-10-19 14:25   ` Anthony Liguori
  2 siblings, 1 reply; 21+ messages in thread
From: Michael Tokarev @ 2009-10-19 13:19 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

Jan Kiszka wrote:
> Ported from OpenSUSE: Provide an udev rule that not only sets the group
> of /dev/kvm but also triggers automatic loading of the kernel modules
> during boot.
> 
[]
> diff --git a/Makefile b/Makefile
> index 8314833..8614449 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -54,6 +54,7 @@ install:
>  		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
>  	done
>  	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
> +	install -m 644 -D scripts/65-kvm.rules $(DESTDIR)/etc/udev/rules.d/65-kvm.rules

Ugh.  I wonder why kernel does not load all the hardware
modules this way still.

And why people think that whole world is udev.

Can we avoid this mess please?

/mjt

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 13:19   ` Michael Tokarev
@ 2009-10-19 13:25     ` Jan Kiszka
  0 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 13:25 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Avi Kivity, Marcelo Tosatti, kvm@vger.kernel.org

Michael Tokarev wrote:
> Jan Kiszka wrote:
>> Ported from OpenSUSE: Provide an udev rule that not only sets the group
>> of /dev/kvm but also triggers automatic loading of the kernel modules
>> during boot.
>>
> []
>> diff --git a/Makefile b/Makefile
>> index 8314833..8614449 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -54,6 +54,7 @@ install:
>>  		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
>>  	done
>>  	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
>> +	install -m 644 -D scripts/65-kvm.rules $(DESTDIR)/etc/udev/rules.d/65-kvm.rules
> 
> Ugh.  I wonder why kernel does not load all the hardware
> modules this way still.
> 
> And why people think that whole world is udev.

Well, there are n ways to skin this cat. One alternative is to setup a
runlevel script - far more unhandy IMHO. Another one is to add the
fitting module to the distro-specific list of automatically loaded
modules - even more unhandy.

> 
> Can we avoid this mess please?

If you have a cleaner suggestion, I'm all ears!

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
  2009-10-19 13:19   ` Michael Tokarev
@ 2009-10-19 13:28   ` Luca Tettamanti
  2009-10-19 13:34     ` Jan Kiszka
  2009-10-19 14:25   ` Anthony Liguori
  2 siblings, 1 reply; 21+ messages in thread
From: Luca Tettamanti @ 2009-10-19 13:28 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Mon, Oct 19, 2009 at 12:59 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> Ported from OpenSUSE: Provide an udev rule that not only sets the group
> of /dev/kvm but also triggers automatic loading of the kernel modules
> during boot.

Loading kvm used to block other virtualization software from using VMX
(I don't recall if it was also true for amd); is this still the case?

Luca

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 13:28   ` Luca Tettamanti
@ 2009-10-19 13:34     ` Jan Kiszka
  0 siblings, 0 replies; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 13:34 UTC (permalink / raw)
  To: Luca Tettamanti; +Cc: Avi Kivity, Marcelo Tosatti, kvm@vger.kernel.org

Luca Tettamanti wrote:
> On Mon, Oct 19, 2009 at 12:59 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> Ported from OpenSUSE: Provide an udev rule that not only sets the group
>> of /dev/kvm but also triggers automatic loading of the kernel modules
>> during boot.
> 
> Loading kvm used to block other virtualization software from using VMX
> (I don't recall if it was also true for amd); is this still the case?

While I can't imagine that anyone wants to use anything else than KVM:
No, this was resolved recently, and kvm-kmod is now referring to a
version that includes these patches.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
  2009-10-19 13:19   ` Michael Tokarev
  2009-10-19 13:28   ` Luca Tettamanti
@ 2009-10-19 14:25   ` Anthony Liguori
  2009-10-19 14:36     ` Jan Kiszka
  2 siblings, 1 reply; 21+ messages in thread
From: Anthony Liguori @ 2009-10-19 14:25 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

Jan Kiszka wrote:
> Ported from OpenSUSE: Provide an udev rule that not only sets the group
> of /dev/kvm but also triggers automatic loading of the kernel modules
> during boot.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
>  Makefile             |    1 +
>  scripts/65-kvm.rules |    2 ++
>  2 files changed, 3 insertions(+), 0 deletions(-)
>  create mode 100644 scripts/65-kvm.rules
>
> diff --git a/Makefile b/Makefile
> index 8314833..8614449 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -54,6 +54,7 @@ install:
>  		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
>  	done
>  	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
> +	install -m 644 -D scripts/65-kvm.rules $(DESTDIR)/etc/udev/rules.d/65-kvm.rules
>   

I believe F12 is installing it 666.  If we think it's safe, it's 
probably the right thing to do.

Regards,

Anthony Liguori


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 14:25   ` Anthony Liguori
@ 2009-10-19 14:36     ` Jan Kiszka
  2009-10-19 15:04       ` Anthony Liguori
  0 siblings, 1 reply; 21+ messages in thread
From: Jan Kiszka @ 2009-10-19 14:36 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Avi Kivity, Marcelo Tosatti, kvm@vger.kernel.org

Anthony Liguori wrote:
> Jan Kiszka wrote:
>> Ported from OpenSUSE: Provide an udev rule that not only sets the group
>> of /dev/kvm but also triggers automatic loading of the kernel modules
>> during boot.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>>  Makefile             |    1 +
>>  scripts/65-kvm.rules |    2 ++
>>  2 files changed, 3 insertions(+), 0 deletions(-)
>>  create mode 100644 scripts/65-kvm.rules
>>
>> diff --git a/Makefile b/Makefile
>> index 8314833..8614449 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -54,6 +54,7 @@ install:
>>  		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
>>  	done
>>  	/sbin/depmod -a $(DEPMOD_VERSION) -b $(DESTDIR)
>> +	install -m 644 -D scripts/65-kvm.rules $(DESTDIR)/etc/udev/rules.d/65-kvm.rules
>>   
> 
> I believe F12 is installing it 666.  If we think it's safe, it's 
> probably the right thing to do.

Err, you mean /dev/kvm, not this rules file, right?

Well, in theory it should be safe, but I would currently leave this
decision to the person finally building a package out of kvm-kmod or
doing some post-install adjustment on a concrete system. Better safe
than sorry, specifically as kvm-kmod may contain the latest bleeding edge.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/12] Add udev rule
  2009-10-19 14:36     ` Jan Kiszka
@ 2009-10-19 15:04       ` Anthony Liguori
  0 siblings, 0 replies; 21+ messages in thread
From: Anthony Liguori @ 2009-10-19 15:04 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm@vger.kernel.org

Jan Kiszka wrote:
> Anthony Liguori wrote:
>   
>>
>> I believe F12 is installing it 666.  If we think it's safe, it's 
>> probably the right thing to do.
>>     
>
> Err, you mean /dev/kvm, not this rules file, right?
>   

Yeah, not enough caffeine yet..

> Well, in theory it should be safe, but I would currently leave this
> decision to the person finally building a package out of kvm-kmod or
> doing some post-install adjustment on a concrete system. Better safe
> than sorry, specifically as kvm-kmod may contain the latest bleeding edge.
>   

Sure, but I think distros should be more conservative than upstream.  If 
we're uncomfortable making it 666, then certainly a distro shouldn't do 
that on it's own.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PULL REQUEST] kvm-kmod
  2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
                   ` (11 preceding siblings ...)
  2009-10-19 10:59 ` [PATCH 11/12] x86: Install compat wrapper for thread_struct.debugreg Jan Kiszka
@ 2009-10-19 19:37 ` Marcelo Tosatti
  12 siblings, 0 replies; 21+ messages in thread
From: Marcelo Tosatti @ 2009-10-19 19:37 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, kvm

On Mon, Oct 19, 2009 at 12:59:24PM +0200, Jan Kiszka wrote:
> The following changes since commit bf860c9b3aa0803ee98d096b33a3ab72f576d79e:
>   Jan Kiszka (1):
>         Update source link
> 
> are available in the git repository at:
> 
>   git://git.kiszka.org/kvm-kmod.git queue
> 
> Jan Kiszka (12):
>       Provide schedule_hrtimeout for pre-2.6.28 kernels
>       Use DESTDIR consitently on installation
>       Add udev rule
>       Fix build without CONFIG_MMU_NOTIFIER
>       Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels
>       Add compat version of native_read_tsc
>       Define X86_FEATURE_GBPAGES if missing
>       Cleanup unused CONFIG_KVM_TRACE control
>       Drop now unused config.kbuild
>       Add compat version of hlist_del_init_rcu
>       x86: Install compat wrapper for thread_struct.debugreg
>       Update source link

Pushed, thanks.


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-10-19 19:37 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19 10:59 [PULL REQUEST] kvm-kmod Jan Kiszka
2009-10-19 10:59 ` [PATCH 08/12] Cleanup unused CONFIG_KVM_TRACE control Jan Kiszka
2009-10-19 10:59 ` [PATCH 05/12] Fix kvm_vma_kernel_pagesize for pre-2.6.27 kernels Jan Kiszka
2009-10-19 10:59 ` [PATCH 01/12] Provide schedule_hrtimeout for pre-2.6.28 kernels Jan Kiszka
2009-10-19 10:59 ` [PATCH 04/12] Fix build without CONFIG_MMU_NOTIFIER Jan Kiszka
2009-10-19 10:59 ` [PATCH 03/12] Add udev rule Jan Kiszka
2009-10-19 13:19   ` Michael Tokarev
2009-10-19 13:25     ` Jan Kiszka
2009-10-19 13:28   ` Luca Tettamanti
2009-10-19 13:34     ` Jan Kiszka
2009-10-19 14:25   ` Anthony Liguori
2009-10-19 14:36     ` Jan Kiszka
2009-10-19 15:04       ` Anthony Liguori
2009-10-19 10:59 ` [PATCH 02/12] Use DESTDIR consitently on installation Jan Kiszka
2009-10-19 10:59 ` [PATCH 09/12] Drop now unused config.kbuild Jan Kiszka
2009-10-19 10:59 ` [PATCH 10/12] Add compat version of hlist_del_init_rcu Jan Kiszka
2009-10-19 10:59 ` [PATCH 06/12] Add compat version of native_read_tsc Jan Kiszka
2009-10-19 10:59 ` [PATCH 07/12] Define X86_FEATURE_GBPAGES if missing Jan Kiszka
2009-10-19 10:59 ` [PATCH 12/12] Update source link Jan Kiszka
2009-10-19 10:59 ` [PATCH 11/12] x86: Install compat wrapper for thread_struct.debugreg Jan Kiszka
2009-10-19 19:37 ` [PULL REQUEST] kvm-kmod Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).