From: Michael Ellerman <mpe@ellerman.id.au>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: kernel test robot <lkp@intel.com>,
linuxppc-dev@lists.ozlabs.org,
Nicholas Piggin <npiggin@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: Fix signature of pfn_to_kaddr()
Date: Fri, 10 Nov 2023 17:16:52 +1100 [thread overview]
Message-ID: <87bkc28757.fsf@mail.lhotse> (raw)
In-Reply-To: <CACRpkdbL1mfcAz9sPn89UGSQ6tb=jF6nRYAwp9Qz8zLXLLU_UA@mail.gmail.com>
Linus Walleij <linus.walleij@linaro.org> writes:
> On Tue, Nov 7, 2023 at 6:57 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
>> I'm struggling to connect the removal of const with those bug reports.
>> It looks like all those warnings are about 0xc000000000000000 being
>> outside the range of unsigned long when building 32-bit.
>
> Aha right. I wonder what actually causes that.
It is the 32-bit VDSO being built:
VDSO32C arch/powerpc/kernel/vdso/vgettimeofday-32.o
In file included from <built-in>:4:
In file included from /home/michael/linux/lib/vdso/gettimeofday.c:5:
In file included from ../include/vdso/datapage.h:137:
In file included from ../arch/powerpc/include/asm/vdso/gettimeofday.h:7:
../arch/powerpc/include/asm/page.h:230:9: warning: result of comparison of constant 13835058055282163712 with expression of type 'unsigned long' is always true [-Wtautological-constant-out-of-range-compare]
230 | return __pa(kaddr) >> PAGE_SHIFT;
| ^~~~~~~~~~~
../arch/powerpc/include/asm/page.h:217:37: note: expanded from macro '__pa'
217 | VIRTUAL_WARN_ON((unsigned long)(x) < PAGE_OFFSET); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
../arch/powerpc/include/asm/page.h:202:73: note: expanded from macro 'VIRTUAL_WARN_ON'
202 | #define VIRTUAL_WARN_ON(x) WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) && (x))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
../arch/powerpc/include/asm/bug.h:88:25: note: expanded from macro 'WARN_ON'
88 | int __ret_warn_on = !!(x); \
| ^
Which is a bit of a frankenstein, because we're building 32-bit VDSO
code for a 64-bit kernel, and using some of the kernel headers for that.
So the warning is correct, we are doing a tautological comparison.
Except that we're not actually using that code in the VDSO, it's just
included in the VDSO because it needs PAGE_SHIFT.
Anyway none of that is your fault, you just had the misfortune of
touching page.h :)
I think I see a way to clean it up. Will send a patch.
cheers
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] powerpc: Fix signature of pfn_to_kaddr()
Date: Fri, 10 Nov 2023 17:16:52 +1100 [thread overview]
Message-ID: <87bkc28757.fsf@mail.lhotse> (raw)
In-Reply-To: <CACRpkdbL1mfcAz9sPn89UGSQ6tb=jF6nRYAwp9Qz8zLXLLU_UA@mail.gmail.com>
Linus Walleij <linus.walleij@linaro.org> writes:
> On Tue, Nov 7, 2023 at 6:57 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
>> I'm struggling to connect the removal of const with those bug reports.
>> It looks like all those warnings are about 0xc000000000000000 being
>> outside the range of unsigned long when building 32-bit.
>
> Aha right. I wonder what actually causes that.
It is the 32-bit VDSO being built:
VDSO32C arch/powerpc/kernel/vdso/vgettimeofday-32.o
In file included from <built-in>:4:
In file included from /home/michael/linux/lib/vdso/gettimeofday.c:5:
In file included from ../include/vdso/datapage.h:137:
In file included from ../arch/powerpc/include/asm/vdso/gettimeofday.h:7:
../arch/powerpc/include/asm/page.h:230:9: warning: result of comparison of constant 13835058055282163712 with expression of type 'unsigned long' is always true [-Wtautological-constant-out-of-range-compare]
230 | return __pa(kaddr) >> PAGE_SHIFT;
| ^~~~~~~~~~~
../arch/powerpc/include/asm/page.h:217:37: note: expanded from macro '__pa'
217 | VIRTUAL_WARN_ON((unsigned long)(x) < PAGE_OFFSET); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
../arch/powerpc/include/asm/page.h:202:73: note: expanded from macro 'VIRTUAL_WARN_ON'
202 | #define VIRTUAL_WARN_ON(x) WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) && (x))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
../arch/powerpc/include/asm/bug.h:88:25: note: expanded from macro 'WARN_ON'
88 | int __ret_warn_on = !!(x); \
| ^
Which is a bit of a frankenstein, because we're building 32-bit VDSO
code for a 64-bit kernel, and using some of the kernel headers for that.
So the warning is correct, we are doing a tautological comparison.
Except that we're not actually using that code in the VDSO, it's just
included in the VDSO because it needs PAGE_SHIFT.
Anyway none of that is your fault, you just had the misfortune of
touching page.h :)
I think I see a way to clean it up. Will send a patch.
cheers
next prev parent reply other threads:[~2023-11-10 6:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 13:44 [PATCH] powerpc: Fix signature of pfn_to_kaddr() Linus Walleij
2023-11-06 13:44 ` Linus Walleij
2023-11-07 5:57 ` Michael Ellerman
2023-11-07 5:57 ` Michael Ellerman
2023-11-07 8:06 ` Linus Walleij
2023-11-07 8:06 ` Linus Walleij
2023-11-10 6:16 ` Michael Ellerman [this message]
2023-11-10 6:16 ` Michael Ellerman
2023-11-08 19:24 ` Christophe Leroy
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=87bkc28757.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=npiggin@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.