From: Matthias Kaehlcke <mka@chromium.org>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Simon Horman <simon.horman@netronome.com>,
Dirk van der Merwe <dirk.vandermerwe@netronome.com>,
oss-drivers@netronome.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Renato Golin <renato.golin@linaro.org>,
Manoj Gupta <manojgupta@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Doug Anderson <dianders@chromium.org>
Subject: Re: [PATCH] nfp: convert nfp_eth_set_bit_config() into a macro
Date: Wed, 4 Oct 2017 10:42:15 -0700 [thread overview]
Message-ID: <20171004174215.GM173745@google.com> (raw)
In-Reply-To: <20171003145000.53683e21@cakuba>
El Tue, Oct 03, 2017 at 02:50:00PM -0700 Jakub Kicinski ha dit:
> On Tue, 3 Oct 2017 13:05:46 -0700, Matthias Kaehlcke wrote:
> > nfp_eth_set_bit_config() is marked as __always_inline to allow gcc to
> > identify the 'mask' parameter as known to be constant at compile time,
> > which is required to use the FIELD_GET() macro.
> >
> > The forced inlining does the trick for gcc, but for kernel builds with
> > clang it results in undefined symbols:
> >
> > drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.o: In function
> > `__nfp_eth_set_aneg':
> > drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c:(.text+0x787):
> > undefined reference to `__compiletime_assert_492'
> > drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c:(.text+0x7b1):
> > undefined reference to `__compiletime_assert_496'
> >
> > These __compiletime_assert_xyx() calls would have been optimized away if
> > the compiler had seen 'mask' as a constant.
> >
> > Convert nfp_eth_set_bit_config() into a macro, which allows both gcc and
> > clang to identify 'mask' as a compile time constant.
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
>
> :(
>
> Is there no chance of fixing the constant propagation in the compiler?
LLVM developers are reluctant and would like us kernel folks to
evaluate possible alternatives for the affected code first:
https://bugs.llvm.org/show_bug.cgi?id=4898
Given that this doesn't seem to be a widespread issue in the kernel
personally I would consider the conversion to a macro in this case an
acceptable solution, though it is definitely ugly. However I'm not the
owner of the driver or the subsystem, so my opinion doesn't really
carry much weight here ;-)
Any ideas about other, less ugly alternatives?
Matthias
next prev parent reply other threads:[~2017-10-04 17:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 20:05 [PATCH] nfp: convert nfp_eth_set_bit_config() into a macro Matthias Kaehlcke
2017-10-03 21:50 ` Jakub Kicinski
2017-10-04 17:42 ` Matthias Kaehlcke [this message]
2017-10-04 17:44 ` David Miller
[not found] ` <CAAMbb05G=HBQweiWqYva_9zTnQqAcwMhJ0yYBUi26T04YA4CxQ@mail.gmail.com>
2017-10-04 18:17 ` Jakub Kicinski
2017-10-04 18:44 ` Matthias Kaehlcke
2017-10-24 16:56 ` Matthias Kaehlcke
2017-10-24 17:03 ` Jakub Kicinski
2017-10-24 17:13 ` Matthias Kaehlcke
2017-10-04 18:07 ` Joe Perches
2017-10-04 18:49 ` Matthias Kaehlcke
2017-10-04 22:22 ` Jakub Kicinski
2017-10-04 23:16 ` Matthias Kaehlcke
2017-10-04 23:25 ` Jakub Kicinski
2017-10-05 0:38 ` Manoj Gupta
2017-10-05 0:56 ` Jakub Kicinski
2017-10-05 1:50 ` Manoj Gupta
2017-10-05 2:06 ` Jakub Kicinski
2017-10-05 2:13 ` Manoj Gupta
2017-10-09 17:29 ` Matthias Kaehlcke
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=20171004174215.GM173745@google.com \
--to=mka@chromium.org \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=dirk.vandermerwe@netronome.com \
--cc=groeck@chromium.org \
--cc=jakub.kicinski@netronome.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manojgupta@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=renato.golin@linaro.org \
--cc=simon.horman@netronome.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 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).