From: Alex Elder <hidden> Date: 2021-08-10 16:02:46
It isn't required, but all callers of ipa_aggr_granularity_val()
pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
Two of those callers are in ipa_validate_build(), with the result
being passed to BUILD_BUG_ON().
Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
inline ipa_aggr_granularity_val(), so the result of the function is
not constant at compile time, and that leads to build errors.
Define the function with the __always_inline attribute to avoid the
errors. And given that the function is inline, we can switch the
WARN_ON() there to be BUILD_BUG_ON().
Fixes: 5bc5588466a1f ("net: ipa: use WARN_ON() rather than assertions")
Reported-by: kernel test robot <redacted>
Signed-off-by: Alex Elder <redacted>
---
David/Jakub, this fixes a bug in a commit in net-next/master. -Alex
drivers/net/ipa/ipa_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Leon Romanovsky <leon@kernel.org> Date: 2021-08-11 12:02:46
On Tue, Aug 10, 2021 at 11:02:13AM -0500, Alex Elder wrote:
quoted hunk
It isn't required, but all callers of ipa_aggr_granularity_val()
pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
Two of those callers are in ipa_validate_build(), with the result
being passed to BUILD_BUG_ON().
Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
inline ipa_aggr_granularity_val(), so the result of the function is
not constant at compile time, and that leads to build errors.
Define the function with the __always_inline attribute to avoid the
errors. And given that the function is inline, we can switch the
WARN_ON() there to be BUILD_BUG_ON().
Fixes: 5bc5588466a1f ("net: ipa: use WARN_ON() rather than assertions")
Reported-by: kernel test robot <redacted>
Signed-off-by: Alex Elder <redacted>
---
David/Jakub, this fixes a bug in a commit in net-next/master. -Alex
drivers/net/ipa/ipa_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
So what exactly are you checking here if all callers pass same value?
It is in-kernel API, declared as static inside one module. There is no
need to protect from itself.
Thanks
From: Alex Elder <hidden> Date: 2021-08-11 12:06:06
On 8/11/21 7:02 AM, Leon Romanovsky wrote:
On Tue, Aug 10, 2021 at 11:02:13AM -0500, Alex Elder wrote:
quoted
It isn't required, but all callers of ipa_aggr_granularity_val()
pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
Two of those callers are in ipa_validate_build(), with the result
being passed to BUILD_BUG_ON().
Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
inline ipa_aggr_granularity_val(), so the result of the function is
not constant at compile time, and that leads to build errors.
Define the function with the __always_inline attribute to avoid the
errors. And given that the function is inline, we can switch the
WARN_ON() there to be BUILD_BUG_ON().
Fixes: 5bc5588466a1f ("net: ipa: use WARN_ON() rather than assertions")
Reported-by: kernel test robot <redacted>
Signed-off-by: Alex Elder <redacted>
---
David/Jakub, this fixes a bug in a commit in net-next/master. -Alex
drivers/net/ipa/ipa_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
So what exactly are you checking here if all callers pass same value?
It is in-kernel API, declared as static inside one module. There is no
need to protect from itself.
Yeah that's a good point. It can just as well be removed.
I think the check was added before I knew it was only going
to be used with a single constant value. That said, the
point was to check at runtime a required constraint.
I'll post version 2 that simply removes it. Thanks.
-Alex
From: Leon Romanovsky <leon@kernel.org> Date: 2021-08-11 12:12:55
On Wed, Aug 11, 2021 at 07:06:01AM -0500, Alex Elder wrote:
On 8/11/21 7:02 AM, Leon Romanovsky wrote:
quoted
On Tue, Aug 10, 2021 at 11:02:13AM -0500, Alex Elder wrote:
quoted
It isn't required, but all callers of ipa_aggr_granularity_val()
pass a constant value (IPA_AGGR_GRANULARITY) as the usec argument.
Two of those callers are in ipa_validate_build(), with the result
being passed to BUILD_BUG_ON().
Evidently the "sparc64-linux-gcc" compiler (at least) doesn't always
inline ipa_aggr_granularity_val(), so the result of the function is
not constant at compile time, and that leads to build errors.
Define the function with the __always_inline attribute to avoid the
errors. And given that the function is inline, we can switch the
WARN_ON() there to be BUILD_BUG_ON().
Fixes: 5bc5588466a1f ("net: ipa: use WARN_ON() rather than assertions")
Reported-by: kernel test robot <redacted>
Signed-off-by: Alex Elder <redacted>
---
David/Jakub, this fixes a bug in a commit in net-next/master. -Alex
drivers/net/ipa/ipa_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
So what exactly are you checking here if all callers pass same value?
It is in-kernel API, declared as static inside one module. There is no
need to protect from itself.
Yeah that's a good point. It can just as well be removed.
I think the check was added before I knew it was only going
to be used with a single constant value. That said, the
point was to check at runtime a required constraint.
I'll post version 2 that simply removes it. Thanks.