From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3A51C63697 for ; Wed, 18 Nov 2020 09:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54EE3221FB for ; Wed, 18 Nov 2020 09:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbgKRJs3 (ORCPT ); Wed, 18 Nov 2020 04:48:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgKRJs2 (ORCPT ); Wed, 18 Nov 2020 04:48:28 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91749C0613D4 for ; Wed, 18 Nov 2020 01:48:28 -0800 (PST) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfK4g-0002p3-IV; Wed, 18 Nov 2020 10:48:26 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kfK4f-0007s8-4o; Wed, 18 Nov 2020 10:48:25 +0100 Date: Wed, 18 Nov 2020 10:48:23 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: "Ayyathurai, Vijayakannan" Cc: Thierry Reding , "kbuild-all@lists.01.org" , lkp , "linux-kernel@vger.kernel.org" , Linux Memory Management List , "kernel@pengutronix.de" , Andy Shevchenko , "Lai, Poey Seng" Subject: Re: [PATCH RFC] pwm: keembay: Fix build failure with -Os Message-ID: <20201118094823.3a4usmbzvkbeaavg@pengutronix.de> References: <202011160303.qi5aRChY-lkp@intel.com> <20201116090804.206286-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="e6qmur6a5afhc4yc" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --e6qmur6a5afhc4yc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 17, 2020 at 05:29:01PM +0000, Ayyathurai, Vijayakannan wrote: > Hi Uwe, >=20 > > From: Uwe Kleine-K=C3=B6nig > > Sent: Monday, 16 November, 2020 5:08 PM > > Subject: [PATCH RFC] pwm: keembay: Fix build failure with -Os > >=20 > > The driver used this construct: > >=20 > > #define KMB_PWM_LEADIN_MASK GENMASK(30, 0) > >=20 > > static inline void keembay_pwm_update_bits(struct keembay_pwm > > *priv, u32 mask, > > u32 val, u32 offset) > > { > > u32 buff =3D readl(priv->base + offset); > >=20 > > buff =3D u32_replace_bits(buff, val, mask); > > writel(buff, priv->base + offset); > > } > >=20 > > ... > > keembay_pwm_update_bits(priv, KMB_PWM_LEADIN_MASK, 0, > > KMB_PWM_LEADIN_OFFSET(pwm- > > >hwpwm)); > >=20 > > With CONFIG_CC_OPTIMIZE_FOR_SIZE the compiler (here: gcc 10.2.0) this > > triggers: > >=20 > > In file included from /home/uwe/gsrc/linux/drivers/pwm/pwm- > > keembay.c:16: > > In function =E2=80=98field_multiplier=E2=80=99, > > inlined from =E2=80=98keembay_pwm_update_bits=E2=80=99 at > > /home/uwe/gsrc/linux/include/linux/bitfield.h:124:17: > > /home/uwe/gsrc/linux/include/linux/bitfield.h:119:3: error: call to > > =E2=80=98__bad_mask=E2=80=99 declared with attribute error: bad bitfiel= d mask > > 119 | __bad_mask(); > > | ^~~~~~~~~~~~ > > In function =E2=80=98field_multiplier=E2=80=99, > > inlined from =E2=80=98keembay_pwm_update_bits=E2=80=99 at > > /home/uwe/gsrc/linux/include/linux/bitfield.h:154:1: > > /home/uwe/gsrc/linux/include/linux/bitfield.h:119:3: error: call to > > =E2=80=98__bad_mask=E2=80=99 declared with attribute error: bad bitfiel= d mask > > 119 | __bad_mask(); > > | ^~~~~~~~~~~~ > >=20 > > The compiler doesn't seem to be able to notice that with field being > > 0x3ffffff the expression > >=20 > > if ((field | (field - 1)) & ((field | (field - 1)) + 1)) > > __bad_mask(); > >=20 > > can be optimized away. > >=20 > > So use __always_inline and document the problem in a comment to fix > > this. > >=20 > > Reported-by: kernel test robot > > Signed-off-by: Uwe Kleine-K=C3=B6nig >=20 > Thank you for spending time in resolving this build failure. >=20 > I shall prepare and share the next version of patch with your approach. I don't understand this last sentence. IMHO there is currently nothing you have to do for this problem. You can send an Ack however if you want to. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=C3=B6nig = | Industrial Linux Solutions | https://www.pengutronix.de/ | --e6qmur6a5afhc4yc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+07eQACgkQwfwUeK3K 7AlXwAf9HCcjIkTxZugxzljdkpc6g8PIMuarduv7uS3R4yaP6gvzKeGMqm5IMqPw obUrg7bugfRqDiTRGYj0Zq5Ch9X/k0SbDPF1NlkI7SiVWq8MvCtmJw7/U4w8Eifq Zw5KcBNJlacC7lctM5i9HO6KuMzQBnfLZRqaLU6CWQ9off9/mGjJRmsmCfZQaxxJ 3qH7q3vaGzLUa7n4CuMPZXnFFn+0LYSATRp1N2+PLpILMtv5klfxQhGVZBP+39P2 je8sauIryt9Cyfxk1CX1phkHuLDFSR17Mw8d8fYZlYTGyRbIVArtgn+Z7Tqm3Il1 1qGfgaf8Vq+uaJawK/pjxI7WxoPOYQ== =UTaj -----END PGP SIGNATURE----- --e6qmur6a5afhc4yc--