From: Roman Zippel <zippel@linux-m68k.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert.Uytterhoeven@sonycom.com, linux-kernel@vger.kernel.org,
Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH 1/4] introduce explicit signed/unsigned 64bit divide
Date: Fri, 14 Mar 2008 18:45:09 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.0803141839080.1791@scrub.home> (raw)
In-Reply-To: <20080313133459.8d7d870d.akpm@linux-foundation.org>
Hi,
On Thu, 13 Mar 2008, Andrew Morton wrote:
> I think what happened was that [patch 3/4] fixed this up. Of course,
> that patch doesn't apply on this updated [1/4]. I _could_ just take the
> old [1/4] (I think), but I don't know if that wouild be bisection-friendly.
>
> Anyway, please redo&resend? Thanks.
Done.
> Please have a think about that code in arch/x86/kvm/i8254.c too. It is
> painful to see remote subsystems (re)implementing generic infrastructure.
> Can KVM use existing code? Should we hoist what KVM has done there into
> generic code? Did it have to use a(nother bleeding) macro?
Looker closer at it, div64_u64() seems to be a bit overkill, as the
divisor is a 32bit value, so the following should do the same job (only
compile tested):
u64 muldiv64(u64 a, u32 b, u32 c)
{
union {
u64 ll;
struct {
u32 low, high;
};
} u, res, rl, rh;
u.ll = a;
rl.ll = (u64)b * u.low;
rh.ll = (u64)b * u.high;
rh.ll += rl.high;
res.high = div_u64_rem(rh.ll, c, &rl.high);
res.low = div_u64(rl.ll, c);
return res.ll;
}
Moving it to a more generic location shouldn't be a big problem.
bye, Roman
next prev parent reply other threads:[~2008-03-14 17:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 0:22 [PATCH 0/4] [RFC] cleanup 64bit divide API zippel
2008-03-13 0:22 ` [PATCH 1/4] introduce explicit signed/unsigned 64bit divide zippel
2008-03-13 10:13 ` Geert Uytterhoeven
2008-03-13 14:59 ` Roman Zippel
2008-03-13 20:34 ` Andrew Morton
2008-03-14 17:45 ` Roman Zippel [this message]
2008-03-13 0:22 ` [PATCH 2/4] convert a few do_div user zippel
2008-03-18 20:10 ` Jörg-Volker Peetz
2008-03-13 0:22 ` [PATCH 3/4] rename div64_64 to div64_u64 zippel
2008-03-13 0:22 ` [PATCH 4/4] remove div_long_long_rem zippel
2008-03-13 0:22 ` [PATCH 5/4] 2.6.25-rc5-mm1 specifc div64_u64 fixes zippel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0803141839080.1791@scrub.home \
--to=zippel@linux-m68k.org \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=akpm@linux-foundation.org \
--cc=avi@qumranet.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®