linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: davidastro <davidastro@hotmail.com>
To: linuxppc-dev@ozlabs.org
Subject: Re: Fix for __div64_32 locks when using some 64 bit numbers
Date: Mon, 23 Mar 2009 10:56:08 -0700 (PDT)	[thread overview]
Message-ID: <22665081.post@talk.nabble.com> (raw)
In-Reply-To: <18887.4715.765245.409925@drongo.ozlabs.ibm.com>


Paul,

You are correct. Since it was such a small piece of code, I didn't use diff
between the kernel I am using (2.6.14) and the newest ones (2.6.28 on the
Linux). Also, I do not know how to look in the kernel files commit history.
I guess the link you gave me might be of some help. 

Thanks for your help


Paul Mackerras wrote:
> 
> davidastro <davidastro@hotmail.com> writes:
> 
>> Basically, the numbers shown above was causing the 64 by 32 bit algorithm
>> to
>> divide by zero making the unit spin and also giving incorrect results.
>> Here is the code as it was before.
> [snip]
>>         cntlzw  r0,r5           # we are shifting the dividend right
>>         li      r10,-1          # to make it < 2^32, and shifting
>>         srw     r10,r10,r0      # the divisor right the same amount,
>>         add     r9,r4,r10       # rounding up (so the estimate cannot
>>         andc    r11,r6,r10      # ever be too large, only too small)
>>         andc    r9,r9,r10      #THIS CODE COULD STORE A ZERO IN r9
>>         or      r11,r5,r11
>>         rotlw   r9,r9,r0
>>         rotlw   r11,r11,r0
> 
> That bug was fixed in October 2005 in commit 344480b99730bfd2, and the
> fix is in v2.6.15-rc1 and all later kernels.  I fixed it a bit
> differently to your suggestion though - see
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=344480b99730bfd205e306d3fd168cdcebe83425
> 
> You must be working from an old kernel tree - which kernel version are
> you using?
> 
> Paul.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/Fix-for-__div64_32-locks-when-using-some-64-bit-numbers-tp22567864p22665081.html
Sent from the linuxppc-dev mailing list archive at Nabble.com.

  reply	other threads:[~2009-03-23 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 21:15 Fix for __div64_32 locks when using some 64 bit numbers davidastro
2009-03-17 23:03 ` Benjamin Herrenschmidt
2009-03-18 15:33   ` davidastro
2009-03-23  4:39     ` Paul Mackerras
2009-03-23 17:56       ` davidastro [this message]
2009-03-20 19:33   ` davidastro
2009-03-21 21:46     ` Benjamin Herrenschmidt

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=22665081.post@talk.nabble.com \
    --to=davidastro@hotmail.com \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).