Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728368

Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the restore_c_regs_and_iret label)

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the restore_c_regs_and_iret label)
Date 2017-09-07 20:50 +0200
Message-ID <una2d-3SJ-9@gated-at.bofh.it> (permalink)
References <un9fT-3ll-73@gated-at.bofh.it> <un9IR-3K0-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Sep 7, 2017 at 11:25 AM, Vishwanath Pai <vpai@akamai.com> wrote:
> On 09/07/2017 01:51 PM, Linus Torvalds wrote:
>>
>> But honestly, that math is odd in other ways too (is that "r-1"
>> _supposed_ to underflow to -1 for large 'user' counts?), so somebody
>> needs to look at that logic.
>
> Sorry about the build failure, we have already queued up a fix for this:
> https://patchwork.ozlabs.org/patch/810772/

Note: that patch has *exactly* the issue I was talking about above.

Doing that

    if (user > 0xFFFFFFFFULL)
        return 0;

is different from the old code, which used to result in a zero in the
divide, and then

    r = (r - 1) << 4;

would cause it to return a large value.

So the patch in question doesn't just fix the build error, it
completely changes the semantics of the function too.

I *think* the new behavior is likely what you want, but these kinds of
things should be _described_.

Also, even with the patch, we have garbage:

    0xFFFFFFFFULL / (u32)user

why is that sub-expression pointlessly doing a 64-bit divide with a
32-bit number? The compiler is hopefully smart enough to point things
out, but that "ULL" really is _wrong_ there, and could cause a stupid
compiler to still do a 64-bit divide (although hopefully the simpler
version that is 64/32).

So please clarify both the correct behavior _and_ the actual typing of
the divide, ok?

                 Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove the  restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 20:00 +0200
  Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 20:30 +0200
    Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 20:50 +0200
      Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 22:20 +0200
        Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-07 22:50 +0200
          Re: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) Vishwanath Pai <vpai@akamai.com> - 2017-09-07 23:30 +0200
        RE: xt_hashlimig build error (was Re: [RFC 01/17] x86/asm/64: Remove  the restore_c_regs_and_iret label) "Lubashev, Igor" <ilubashe@akamai.com> - 2017-09-07 22:50 +0200

csiph-web