[lkml]   [2012]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] x86: adjust generic_get_mtrr() for 64-bit
    >>> On 06.07.12 at 23:38, Yinghai Lu <> wrote:
    > On Fri, Jul 6, 2012 at 7:14 AM, Jan Beulich <> wrote:
    >> Needing to deal with potentially large memory configurations, the
    >> variables here should be "unsigned long" instead of "unsigned int".
    >> Signed-off-by: Jan Beulich <>
    >> ---
    >> arch/x86/kernel/cpu/mtrr/generic.c | 8 ++++----
    >> 1 file changed, 4 insertions(+), 4 deletions(-)
    >> --- 3.5-rc5/arch/x86/kernel/cpu/mtrr/generic.c
    >> +++ 3.5-rc5-x86-mtrr-generic-types/arch/x86/kernel/cpu/mtrr/generic.c
    >> @@ -514,8 +514,8 @@ generic_get_free_region(unsigned long ba
    >> static void generic_get_mtrr(unsigned int reg, unsigned long *base,
    >> unsigned long *size, mtrr_type *type)
    >> {
    >> - unsigned int mask_lo, mask_hi, base_lo, base_hi;
    >> - unsigned int tmp, hi;
    >> + unsigned long mask_lo, mask_hi, base_lo, base_hi, tmp;
    >> + unsigned int hi;
    > _lo, _hi means we want it as 32bit.
    > or we just change them to u32 to make it more clear ?

    Actually, as I was about to do the adjustment, this isn't correct:
    Both mask_hi and base_hi get shifted left in some calculations
    there, and hence they would require up-casts to unsigned long
    if their type would remain a 32-bit one. Further, mask_lo gets
    or-ed with size_or_mask, which is u64, the result compared
    with tmp (now unsigned long), and the same result also negated
    so the *size (also unsigned long), so needs to be unsigned long
    itself unless we want to introduce another variable.

    That leaves only base_lo as a candidate for remaining 32-bit,
    but for consistency I think it would be better to have them all
    have the same type.

    Consequently I think the patch should remain as is.


     \ /
      Last update: 2012-07-25 10:21    [W:0.023 / U:2.016 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site