diff mbox

External module compatibility for hrtimer_expires_remaining

Message ID 1232654745-17842-1-git-send-email-agraf@suse.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Alexander Graf Jan. 22, 2009, 8:05 p.m. UTC
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.

Signed-off-by: Alexander Graf <agraf@suse.de>

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

Comments

Alexander Graf Jan. 22, 2009, 9:20 p.m. UTC | #1
Alexander Graf wrote:
> 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.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>   

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

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Feb. 4, 2009, 2:41 p.m. UTC | #2
Alexander Graf wrote:
> Alexander Graf wrote:
>   
>> 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.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>   
>>     
>
> 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?
Alexander Graf Feb. 4, 2009, 4:17 p.m. UTC | #3
Avi Kivity wrote:
> Alexander Graf wrote:
>> Alexander Graf wrote:
>>> 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.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>
>> 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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Feb. 4, 2009, 5:19 p.m. UTC | #4
Alexander Graf wrote:
> Avi Kivity wrote:
>   
>> Alexander Graf wrote:
>>     
>>> Alexander Graf wrote:
>>>       
>>>> 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.
>>>>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>         
>>> 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?
>   

You're right -- will fix.
diff mbox

Patch

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index 981dc96..634f717 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -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)