lkml.org 
[lkml]   [2009]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: linux-next: Tree for January 23 (kvm)
(cc mailing lists)

On Wed, 28 Jan 2009 12:26:16 -0200
Marcelo Tosatti <mtosatti@redhat.com> wrote:

> On Wed, Jan 28, 2009 at 11:20:16AM +0100, Alexander Graf wrote:
> >
> > On 28.01.2009, at 10:51, Andrew Morton wrote:
> >
> >> On Fri, 23 Jan 2009 12:34:24 -0800 Randy Dunlap
> >> <randy.dunlap@oracle.com> wrote:
> >>
> >>> Stephen Rothwell wrote:
> >>>> Hi all,
> >>>>
> >>>> News: I will be on leave next week, so there will probably be no
> >>>> linux-next release until Feb 2.
> >>>>
> >>>> Changes since 20090122:
> >>>
> >>>
> >>> kvm changes cause this build error on i386:
> >>>
> >>> when kvm is built as module:
> >>> ERROR: "__moddi3" [arch/x86/kvm/kvm.ko] undefined!
> >>>
> >>> or when kvm is built into the kernel image:
> >>> lapic.c:(.text+0x19276): undefined reference to `__moddi3'
> >>>
> >>>
> >>> I guess it's this line:
> >>> ns = ktime_to_ns(remaining) % apic->timer.period;
> >>>
> >>
> >> dammit, I just spent N minutes hunting down the same thing in
> >> the Jan 26 linux-next :(
> >>
> >
> > Yeah, Clemens Foss posted a real fix on kvm@vger already.

Probably wasn't the best mailing list, as this bug affects all
developers and testers.. But whatever - thanks.

> commit efe4ff38b2bbc3944d0b2c9b6ec669b67cb7acbc
> Author: Clemens Noss <cnoss@gmx.de>
> Date: Mon Jan 26 02:55:16 2009 +0100
>
> KVM: x86: fix "__moddi3 undefined" build failure in lapic.c
>
> use mod_64 from arch/x86/kvm/i8254.c to fix
> ERROR: "__moddi3" [arch/x86/kvm/kvm.ko] undefined!
>
> Signed-off-by: Clemens Noss <cnoss@gmx.de>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index d8adc50..f0b67f2 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -35,6 +35,12 @@
> #include "kvm_cache_regs.h"
> #include "irq.h"
>
> +#ifndef CONFIG_X86_64
> +#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
> +#else
> +#define mod_64(x, y) ((x) % (y))
> +#endif
> +
> #define PRId64 "d"
> #define PRIx64 "llx"
> #define PRIu64 "u"
> @@ -525,7 +531,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
> if (ktime_to_ns(remaining) < 0)
> remaining = ktime_set(0, 0);
>
> - ns = ktime_to_ns(remaining) % apic->timer.period;
> + ns = mod_64(ktime_to_ns(remaining), apic->timer.period);
> tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
>
> return tmcct;

Rather than cooking up a private implementation I think it would be
better to implement a kernel-wide mod64_u64() (?) facility and then to
use that in KVM. There will presumably be other sites which will (or
already do) need such a thing.

However it'll probably be a bit hard, getting the signednesses of the
args and the return value right.



\
 
 \ /
  Last update: 2009-01-28 22:01    [from the cache]
©2003-2011 Jasper Spaans