Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4389066pxt; Wed, 11 Aug 2021 05:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqxSOIvZxM/EDbXAPFUfpLGw+cAIy1UofW86B94SCkgwIV2QfFS0nzJpOEyYjGxrYVVK7s X-Received: by 2002:a17:906:9a51:: with SMTP id aj17mr3355351ejc.296.1628683544186; Wed, 11 Aug 2021 05:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683544; cv=none; d=google.com; s=arc-20160816; b=M+ybU/wG/SoOAHnXlgpRefwAhVWQ96ZK4lIWlK/knoqLw+HbpWvOXYh/SDqwE58kf8 uq1vyF2I8ctUb7EOgRNQekpASx+HDpCiUSbYP0Tq5TD/SV1SlwHblJSetl3R0rO67Zjp 8f8EKuQmXNeHmkvsQKlK/g7NSEhnI8uvKe5Vnrqw2AOldGJLvMX885E3DJfEyNsJG3yN TWv8R8uGAdXUZ1z+KiewoShhxrJQjBC4aiXEadOqu3GhEe1ksbLmJsyje31CVKM0WCh6 2QlF4XA7gn1JsBvLm8DzhmQguFl7UOBA1pMbb/lo8JTWo2rBosIjgmP47/tvHONFeh4u HGng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yTmtltXkH389DZQuTtZnLdGkYLVSNvXMODuosXle7o0=; b=oFuZhXQ3ZkoHjOIu5zTJ2H18axcphbPljGhiPv6KI8R9LMPwk2B9sXCRJ15vyRDfpz IcI52w90hn2wMvHyHckKpZhC/3a+NBhwAXGXSG1EHnbmKURc+cpU9bjebS7zI+4Oo0cu pRNym2Un7S33uvL3SUb1QiFClYiZCwxSNlLEAnKsJdTlEqRlLPrmxub8/TNOjwE2LlW+ L/E243z8Dm1EL64sLjWmLVxj0elMKGPp5D5bz5ApUSwpPjjUOipRNSaf2dALRqru0ofQ plytpwZcvyalJf0LvHcTPAjsZwtxVf1SX//F7VCes7JYj9znN5bBtkur1vcYKyZb5ovN Yf5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kBMycUB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 22si22675420ejw.427.2021.08.11.05.05.15; Wed, 11 Aug 2021 05:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kBMycUB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237390AbhHKMDG (ORCPT + 99 others); Wed, 11 Aug 2021 08:03:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:48484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbhHKMDG (ORCPT ); Wed, 11 Aug 2021 08:03:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A7D760E93; Wed, 11 Aug 2021 12:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628683362; bh=XHoR5BqMPxzKlhQzjnPDWel87OITrOE6CsKd1mWHcHM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kBMycUB5uB8gsx/uR3qd4MCTSpXUqPaTVF1DVryhH69XBG1S0CDhvpCTt3HjIP70+ t/gza7u4P1GIGyomnOblxMEz0321w6+5Sp8fR3McPnZf4KtiqyVhm9Ykphqo30xH+s 1M/evu3lE1719F0TI++92Sx1B86/6Y5xF04w/BP6D7cGq3q/QUuZDqIe3HaDi28mvn eQUi8PpcsmIKSodxh38vbDk5P9oPefb9mDaItwGBOL/qo/6wcL2/Ewe5b8af14dONp gw2cHlTeWOJoMBIuPg4aZYZnGmAXJoIdSxNVAD1v7HJmF1znvi8D1yVvkpzo0G3qke 3ifLdeo0qnlIA== Date: Wed, 11 Aug 2021 15:02:38 +0300 From: Leon Romanovsky To: Alex Elder Cc: davem@davemloft.net, kuba@kernel.org, bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, lkp@intel.com, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: ipa: always inline ipa_aggr_granularity_val() Message-ID: References: <20210810160213.2257424-1-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210810160213.2257424-1-elder@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 11:02:13AM -0500, Alex Elder wrote: > 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 > Signed-off-by: Alex Elder > --- > > 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(-) > > diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c > index 25bbb456e0078..f90b3521e266b 100644 > --- a/drivers/net/ipa/ipa_main.c > +++ b/drivers/net/ipa/ipa_main.c > @@ -255,9 +255,9 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) > * less than the number of timer ticks in the requested period. 0 is not > * a valid granularity value. > */ > -static u32 ipa_aggr_granularity_val(u32 usec) > +static __always_inline u32 ipa_aggr_granularity_val(u32 usec) > { > - WARN_ON(!usec); > + BUILD_BUG_ON(!usec); 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 > > return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; > } > -- > 2.27.0 >