Skip to contentSkip to conversation

kvm-userspace build and compat fixes

PATCH In review Eduardo Habkost 2 participants 7 messages Jan 23, 2009 – Jan 26, 2009 KVM

lore
Share & tools
lore
#0 lore raw

cover kvm-userspace build and compat fixes

Hi, Avi,

These are some build and compat fixes for kvm-userspace. They also apply to the maint/2.6.29 branch.

Signature · 1 line
Eduardo
#1 lore raw

PATCH 1/3 kvm: qemu: don't fail building when pc-bios dir is empty

The '[ -f "$file" ] && install' command will make the return code of the command to be non-zero, making 'make' abort. Use shell 'if' construct instead.

This patch also applies to the maint/2.6.29 branch.

---
 qemu/Makefile |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
qemu/Makefile +3 -2
index 648b849..fe675a9 100644
@@ -242,8 +242,9 @@ endif
 ifneq ($(BLOBS),)
 	mkdir -p "$(DESTDIR)$(datadir)"
 	set -e; for x in $(BLOBS); do \
-		[ -f $(SRC_PATH)/pc-bios/$$x ] && \
-		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
+		if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
+			$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
+		fi \
 	done
 endif
 ifndef CONFIG_WIN32
Signature · 1 line
1.6.1
#5 lore raw

PATCH 2/3 Use native anon_inodes on RHEL5 if available

In reply to Eduardo Habkost

Seom RHEL5 kernel versions include anon_inodes. Detect this case and use the native anon_inodes implementation when available.

This patch also applies to the maint/2.6.29 branch.

---
 kernel/anon_inodes.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
kernel/anon_inodes.c +10 -3
index 510303f..135adae 100644
@@ -21,7 +21,14 @@
 
 #include <asm/uaccess.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+/* anon_inodes on RHEL >= 5.2 is equivalent to 2.6.27 version */
+#ifdef RHEL_RELEASE_CODE
+#  if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,2)) && defined(CONFIG_ANON_INODES)
+#    define RHEL_ANON_INODES
+#  endif
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) && !defined(RHEL_ANON_INODES)
 
 static struct vfsmount *anon_inode_mnt __read_mostly;
 static struct inode *anon_inode_inode;
@@ -228,7 +235,7 @@ void kvm_exit_anon_inodes(void)
 
 #undef anon_inode_getfd
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) && !defined(RHEL_ANON_INODES)
 
 int kvm_anon_inode_getfd(const char *name,
 			 const struct file_operations *fops,
@@ -245,7 +252,7 @@ int kvm_anon_inode_getfd(const char *name,
 	return fd;
 }
 
-#elif LINUX_VERSION_CODE == KERNEL_VERSION(2,6,26)
+#elif LINUX_VERSION_CODE == KERNEL_VERSION(2,6,26) && !defined(RHEL_ANON_INODES)
 
 int kvm_anon_inode_getfd(const char *name,
 			 const struct file_operations *fops,
Signature · 1 line
1.6.1
#6 lore raw

PATCH 3/3 compat code fixes for RHEL5 kernels

In reply to Eduardo Habkost

From: Andrea Arcangeli <[email protected]>

Compat code for some RHEL5 kernel versions.

This patch also applies to the maint/2.6.29 branch.

[ehabkost: changed pagefault_* to check for RHEL < 5.2 instead of RHEL <= 5.2] [ehabkost: changed __aligned to check for RHEL <= 5.2 && !defined(__aligned)]

---
 kernel/external-module-compat-comm.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/external-module-compat-comm.h +6 -0
index 981dc96..7f4d591 100644
@@ -250,6 +250,7 @@ static inline void blahblah(void)
 
 /* pagefault_enable(), page_fault_disable() - 2.6.20 */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2)
 
 static inline void pagefault_disable(void)
 {
@@ -276,6 +277,9 @@ static inline void pagefault_enable(void)
 	preempt_check_resched();
 }
 
+#else
+#include <linux/uaccess.h>
+#endif
 #endif
 
 /* vm ops ->fault() was introduced in 2.6.23. */
@@ -405,8 +409,10 @@ static inline ktime_t ktime_get(void)
 
 /* __aligned arrived in 2.6.21 */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
+#if !defined(RHEL_RELEASE_CODE) || (RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(5,2) && !defined(__aligned))
 #define __aligned(x) __attribute__((__aligned__(x)))
 #endif
+#endif
 
 #include <linux/mm.h>
 
Signature · 1 line
1.6.1
#2 lore raw

Re: [PATCH 1/3] kvm: qemu: don't fail building when pc-bios dir is empty

In reply to Eduardo Habkost
Quoted 5 lines · Eduardo Habkost

The '[ -f "$file" ] && install' command will make the return code of the command to be non-zero, making 'make' abort. Use shell 'if' construct instead.

This patch also applies to the maint/2.6.29 branch.

Hi Eduardo,

Can you send this one to qemu upstream please?

Applied the other two.

#3 lore raw

Re: [PATCH 1/3] kvm: qemu: don't fail building when pc-bios dir is empty

Quoted 10 lines · Marcelo Tosatti
Quoted 5 lines · Eduardo Habkost

The '[ -f "$file" ] && install' command will make the return code of the command to be non-zero, making 'make' abort. Use shell 'if' construct instead.

This patch also applies to the maint/2.6.29 branch.

Hi Eduardo,

Can you send this one to qemu upstream please?

qemu upstream doesn't have the '[ -f "$file" ]' conditional, so the fix applies only to the kvm tree.

Maybe we could have the conditional (after fixing it) on qemu upstream, but I am not sure about that.

Signature · 1 line
Eduardo
#4 lore raw

Re: [PATCH 1/3] kvm: qemu: don't fail building when pc-bios dir is empty

Quoted 5 lines · Eduardo Habkost

qemu upstream doesn't have the '[ -f "$file" ]' conditional, so the fix applies only to the kvm tree.

Maybe we could have the conditional (after fixing it) on qemu upstream, but I am not sure about that.

Oh, sorry. Applied.