Skip to contentSkip to conversation

External module compatibility for hrtimer_expires_remaining

PATCH In review Alexander Graf 2 participants 5 messages Jan 22, 2009 – Feb 4, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 External module compatibility for hrtimer_expires_remaining

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining, which is not available on my 2.6.27 kernel.

This patch adds a backwards compatibility layer for it.

---
 kernel/external-module-compat-comm.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
kernel/external-module-compat-comm.h +11 -0
index 981dc96..634f717 100644
@@ -501,6 +501,17 @@ struct timespec kvm_ns_to_timespec(const s64 nsec);
 
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+
+#define hrtimer_expires_remaining kvm_hrtimer_expires_remaining
+
+static inline ktime_t kvm_hrtimer_expires_remaining(const struct hrtimer *timer)
+{
+	return ktime_sub(timer->expires, timer->base->get_time());
+}
+
+#endif
+
 /* work_struct lost the 'data' field in 2.6.20 */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
 
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 7 lines · Alexander Graf

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining, which is not available on my 2.6.27 kernel.

This patch adds a backwards compatibility layer for it.

I just saw that you did one yourself that doesn't work for me. Is the #define reversed?

Alex

#2 lore raw
Quoted 5 lines · Alexander Graf
Quoted 3 lines · Alexander Graf

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining, which is not available on my 2.6.27 kernel.

Quoted 9 lines
Quoted 5 lines

This patch adds a backwards compatibility layer for it.

I just saw that you did one yourself that doesn't work for me. Is the #define reversed?

See also my change to hack-module.awk. Did you 'make sync' again?

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 5 lines · Avi Kivity
Quoted 4 lines · Alexander Graf
Quoted 3 lines · Alexander Graf

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining, which is not available on my 2.6.27 kernel.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This patch adds a backwards compatibility layer for it.

I just saw that you did one yourself that doesn't work for me. Is the #define reversed?

See also my change to hack-module.awk. Did you 'make sync' again?

On a freshly git pull'ed checkout with a 2.6.27 host kernel:

/dev/shm/x/kvm-userspace/kernel/x86/lapic.c: In function ‘apic_get_tmcct’:
/dev/shm/x/kvm-userspace/kernel/x86/lapic.c:570: error: implicit declaration of function ‘hrtimer_expires_remaining’ /dev/shm/x/kvm-userspace/kernel/x86/lapic.c:570: error: incompatible types in assignment

I'd say the problem is the

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)

which should be 2.6.28, right?

Alex

#4 lore raw
Quoted 27 lines · Alexander Graf
Quoted 7 lines · Avi Kivity
Quoted 5 lines · Alexander Graf
Quoted 3 lines · Alexander Graf

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining, which is not available on my 2.6.27 kernel.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

This patch adds a backwards compatibility layer for it.

I just saw that you did one yourself that doesn't work for me. Is the #define reversed?

See also my change to hack-module.awk. Did you 'make sync' again?

On a freshly git pull'ed checkout with a 2.6.27 host kernel:

/dev/shm/x/kvm-userspace/kernel/x86/lapic.c: In function ‘apic_get_tmcct’:
/dev/shm/x/kvm-userspace/kernel/x86/lapic.c:570: error: implicit declaration of function ‘hrtimer_expires_remaining’ /dev/shm/x/kvm-userspace/kernel/x86/lapic.c:570: error: incompatible types in assignment

Quoted 6 lines

I'd say the problem is the

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)

which should be 2.6.28, right?

You're right -- will fix.

Signature · 1 line
error compiling committee.c: too many arguments to function