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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 6D89DC56201 for ; Wed, 18 Nov 2020 18:01:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1C1722210 for ; Wed, 18 Nov 2020 18:01:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iLQPC2yR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1C1722210 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 366626B0092; Wed, 18 Nov 2020 13:01:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31A0E6B0098; Wed, 18 Nov 2020 13:01:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22DEB6B0099; Wed, 18 Nov 2020 13:01:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id E4F8E6B0092 for ; Wed, 18 Nov 2020 13:01:30 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 05FE93632 for ; Wed, 18 Nov 2020 18:01:29 +0000 (UTC) X-FDA: 77498306298.16.tiger90_2203a052733c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 66932100E6930 for ; Wed, 18 Nov 2020 18:01:26 +0000 (UTC) X-HE-Tag: tiger90_2203a052733c X-Filterd-Recvd-Size: 7984 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Nov 2020 18:01:25 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id h21so3558165wmb.2 for ; Wed, 18 Nov 2020 10:01:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qZaelr3llq7m4oqmuYmDvVO+YgU0GZBfvCV9/hBsOQo=; b=iLQPC2yR0hpzPWNdhUnY2pH96eZKXDpPSa8N1V3GgmAAKkVGEm+ypAty3yGZ/RB4o6 LSzzcxyDZxUrfDLANP6egFDg2SwJj25TCWsBl/9Zc5fa2by3qw66+5pBYzw4TniTyTR+ PJYX6pO6oqBcmC6llABr4pcJHF3NcQAvE3dGaJohe3nZB88Qo9q0gbOUro/egVSydVuU 5GuBeydL2R++J+TnsLoBJtkNPnMsd3jL6z8K9vnSpSug5AnBHQ8uBhV0PfoF+MwvMnLk JlPT3nBWu1t9d2EIhDkX+lBiHSilmXawkyg0l9ns9jO0PTJC3xVYZZW0UlzTT4zi4WwU VYzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qZaelr3llq7m4oqmuYmDvVO+YgU0GZBfvCV9/hBsOQo=; b=WTLz2He5T6FuRwGZf4KIrK+Pvjk3MvNPF+qkfHTQJ8sWw1dG0LnKbYwO3YM1ZapU2u CZe0q8mviWW3MbLL2v0yY+ZaiFUSsIx2efldAwDi/gpoKSY41IAYg6HRmf3gwDTjjqvC o/BEjWlpCfyjFZ6rA1le7aDJNDm6vJlbjad2KlSvnlrv1gEl0HkslOB2RBaHVAFXkVtd Xwmselckvc6LMdiI4WUYG7h/0hgMp1d5QvzHPtPXEDTOjVDIqRj/5VYzYCasS6mLx2/x OS2rUhnaxKJ3rpMJsiGptwiVNee1JfRymroNO/11dZlC+XwAlnwwCLWobrqPNsHu8US/ ASCA== X-Gm-Message-State: AOAM531qh2C3DK4Z6OqccgCmcyTENEZoBZs5LymRL2YYf52eCWi6XnA1 B5HlRmvNyRbTahrdDrkafuM= X-Google-Smtp-Source: ABdhPJzsxtOZRSr279P2oSEzI8HpF/Ub3a/Gw9bvIGXY3w3iQGFLwle8tBsp4jAHK2uUqSUPB4/Gtg== X-Received: by 2002:a7b:cb09:: with SMTP id u9mr297884wmj.49.1605722484627; Wed, 18 Nov 2020 10:01:24 -0800 (PST) Received: from localhost ([217.111.27.204]) by smtp.gmail.com with ESMTPSA id d13sm10495017wrb.39.2020.11.18.10.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 10:01:23 -0800 (PST) Date: Wed, 18 Nov 2020 19:01:22 +0100 From: Thierry Reding To: "Ayyathurai, Vijayakannan" Cc: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , "kbuild-all@lists.01.org" , lkp , "linux-kernel@vger.kernel.org" , Linux Memory Management List , "kernel@pengutronix.de" , Andy Shevchenko , "Lai, Poey Seng" , "linux-pwm@vger.kernel.org" Subject: Re: [PATCH RFC] pwm: keembay: Fix build failure with -Os Message-ID: <20201118180122.GD3552669@ulmo> References: <202011160303.qi5aRChY-lkp@intel.com> <20201116090804.206286-1-u.kleine-koenig@pengutronix.de> <20201118100627.chgu3tgpt3kuazsv@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JwB53PgKC5A7+0Ej" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.14.7 (2020-08-29) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --JwB53PgKC5A7+0Ej Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 18, 2020 at 05:41:57PM +0000, Ayyathurai, Vijayakannan wrote: > Hi Thierry, >=20 > > From: Uwe Kleine-K=C3=B6nig > > Subject: Re: [PATCH RFC] pwm: keembay: Fix build failure with -Os > >=20 > > [Cc: +=3D linux-pwm which I forgot for the initial submission] > >=20 > > Hello, > >=20 > > On Mon, Nov 16, 2020 at 10:08:04AM +0100, Uwe Kleine-K=C3=B6nig wrote: > > > The driver used this construct: > > > > > > #define KMB_PWM_LEADIN_MASK GENMASK(30, 0) > > > > > > static inline void keembay_pwm_update_bits(struct keembay_pwm > > *priv, u32 mask, > > > u32 val, u32 offset) > > > { > > > u32 buff =3D readl(priv->base + offset); > > > > > > buff =3D u32_replace_bits(buff, val, mask); > > > writel(buff, priv->base + offset); > > > } > > > > > > ... > > > keembay_pwm_update_bits(priv, KMB_PWM_LEADIN_MASK, 0, > > > KMB_PWM_LEADIN_OFFSET(pwm- > > >hwpwm)); > > > > > > With CONFIG_CC_OPTIMIZE_FOR_SIZE the compiler (here: gcc 10.2.0) this > > > triggers: > > > > > > 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(); > > > | ^~~~~~~~~~~~ > > > > > > The compiler doesn't seem to be able to notice that with field being > > > 0x3ffffff the expression > > > > > > if ((field | (field - 1)) & ((field | (field - 1)) + 1)) > > > __bad_mask(); > > > > > > can be optimized away. > > > > > > So use __always_inline and document the problem in a comment to fix > > > this. > > > > > > Reported-by: kernel test robot > > > Signed-off-by: Uwe Kleine-K=C3=B6nig > > > --- > > > Hello, > > > > > > I'm not sure this is the right fix. Maybe the bitfield stuff can be > > > changed somehow to make this problem go away, too? > >=20 > > Note, this patch > >=20 > > Fixes: cdbea243f419 ("pwm: Add PWM driver for Intel Keem Bay") > >=20 > > so this isn't critical for v5.10. > >=20 > > @thierry: If this is ok for you and Vijayakannan, you can squash this > > into the original commit. > >=20 >=20 > I am ok with Uwe approach. > I have compiled the change and tested in Keembay board as well. I'll take that as a Tested-by. Next time, if you go through the trouble of testing a patch, make sure to reply with a: Tested-by: Your Name So that patchwork can pick that up and credit you for it. Thierry --JwB53PgKC5A7+0Ej Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIyBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl+1YXEACgkQ3SOs138+ s6FBEw/3awBAvUnh+nksrSY9JFy+t9mv49y7wgG5OByXye8slDSPF1UbZbQeje51 t0hG8kkiYZM/f7IeTagJq9FNLswpb/2O9MX8hTNNz9dE0NHczjLqyghb8V6IKUUE DC0YYtzI59MdsWmFmgR/lb5BLNwRQf5QoIjDjwUAvfbPHt2JW1hU07m+L8+wcRCf Taq7AER4cCslaobp1U90LUCzwtTvinphEd47+mu2iGvblbJnR2p1Z1FyamDIqAq3 17MpkjJOJijjdk0eQG6IjalVwTjvruOIDruinpT45PGhtjAIQEa4nQKLY/L75HqT 02YUv4vzy+XpyOsrvxurOP2Rpjav52djBPON45f8EAVTJAOeOEQ+GD28r9Dp1cid 74z15Dz34AtLCetycFF3aXI9tKZFz8hZjDoIqiescfa+YhnkiXUxDeVf1AcYM4PL cuqkbmMW2eq3jYLbrxbMNNjvPYHbomq/0CjRViX8tZ5j0ooDSkj+38KEu83Kaf0R OKK8mQiPA50AB8M6nIagN0+nhCcJau1uPKaBPM2cXGQ14wXPTTKcjXIdb2SINYsH XcicIi3Z05puIeIV5E/8D6UQrvuzQi5qnIjfvvO4sWMvxW0lFm1ILgm6R1EbBdRb NVGC1eRYCHG2OG6eYeV/xrCilFePCB8S8kCN1VRrilLZ0SyZMA== =XsP/ -----END PGP SIGNATURE----- --JwB53PgKC5A7+0Ej--