Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4391179pxt; Wed, 11 Aug 2021 05:08:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5u+YBXX/sUkurN16/BtZUUnuWCpfPN++U1tZyaXTw9xS4f5u0nEwoBxVMU2PQ+OxMlxBY X-Received: by 2002:a17:906:2bd0:: with SMTP id n16mr3292948ejg.132.1628683698433; Wed, 11 Aug 2021 05:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683698; cv=none; d=google.com; s=arc-20160816; b=e/u5QiNWx5hqRb92vl1uw3GDqfX08YJb8EVEMzXxq+r2jwkmMIBDh0Hl8bzohYc+Iw SjoB9JJPj/u8uo+ox5UwdzK2l9pAo76ftV+HFTV35jQY054ROYB50pdLOoCOUdxfWg2L UBSQm44Vazedlvf/+L7W8xJ1xrxP7t0v6ldarOQebAwm6M2rWuB3f8GpU/jMYwQSUE8L cZS1EGmI5Zekq5ZnKVnWr9MFhl2Vixp0ZN4KIhuaqqFe1D4WT69qV4GFKMLaL3MeAxLy N4V2aITMK5EP56xtN4gopweAQQzyrhuBM/rGme8maRhiOa9eRmJjyPe3Sypt3txxzg8n cfPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=DnrUUhs9d/NQwIxtLGBh6Otm1ldtOTYeYBWlYRbI7PA=; b=1CAMlszWmRg7tQbLde9zp+ioajp9Zb9ylHt02TKzOjfr6CTRn8081bXM77tFeW3uao AMl2DkqImSnVbfXdQKARKmqOlO+CgdgQsAsyIJosMf/V3/Tm22Jr10Shconb9IUVhMD5 VDjyHB24vQa0AN4asQgR/e1El0HsBTaDSx/RsFL/+xMliQcwixLggeyj87H64vmoUoY8 ijcVfxw1rWHgsgrAznDbQrJ7ngSqP3tmLrTh5L1mOUjU+ykB9gM94/Fsy1A3quPEnzaF 5/aqOiqBi1zS0OrZDQXCc4agRw5fJBgAkR3dhHGjMCP/uZPCprDc0HPfXiYj1ZC3yeFf Ly7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tptwbMa9; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb42si5241526ejc.233.2021.08.11.05.07.48; Wed, 11 Aug 2021 05:08:18 -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=@linaro.org header.s=google header.b=tptwbMa9; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237486AbhHKMG1 (ORCPT + 99 others); Wed, 11 Aug 2021 08:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237453AbhHKMG0 (ORCPT ); Wed, 11 Aug 2021 08:06:26 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A369C0613D3 for ; Wed, 11 Aug 2021 05:06:03 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id i13so2515286ilm.11 for ; Wed, 11 Aug 2021 05:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DnrUUhs9d/NQwIxtLGBh6Otm1ldtOTYeYBWlYRbI7PA=; b=tptwbMa9rqzpyUbqtHw71jjBwHiNvLpTl2RM4D8dM7QARsMRBNo1wEPDo37r2TvSsD Nt+6JUBJkRD+/90JuC9BZ/QuMQuWi0v6HflD3FJ1crdizwMHkO2dVd0kg50NIaarWsc0 J88Vl0QMpoby/FWgGA2bk7/pZ3i25J4RImaKhT/4pSMvA93Prlrr3wi68rXGAGljOrmb L3n6Z9rGRPnGcIX0v3/55nnmV7Q5oZ1qfJ6/pMnnubAVHPNPu/5cx8UO7bQrqHaSaZQ5 6dDjhAXqnN8uAvelpR4yxDCOOiv74AKukOMpjXijDd2YkgY3GuOAFCovOWkK0hv4FHJw GQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DnrUUhs9d/NQwIxtLGBh6Otm1ldtOTYeYBWlYRbI7PA=; b=seUfIKuaw5JuvxDTwN8g889VWx+mjLMJy99ysjdHCutV9fjVzAptN4w5xB/YT9UdG2 1CnjF+E3/Ao5ojBBwcrsqDkLbprRiI3/e4rLsnqieu73W4b0W9TiI/+btxTtSmOMnQAg HsHdubKr/zbpWjg5c11Q08XFfa/vWWC4sU3Hm0MvR0VAfodq9qpZ7zN+pXZm10Otg5z/ B6SPAkK4lITSvXeL1q3Owrvr/xdYYR1OOYld/An/uG10xbzsrlfFNZLuxa065ib9NEN4 FhNRgyXxZttUyQp274EgUjSNXzJX+JaaOMxZkJm6PG8x3TscqHtiuL6LXbCIOdkeMHl3 ROeQ== X-Gm-Message-State: AOAM531sTv07t9tRM3CGdDrnoIaUgfUfjU/MbTCPZZzVj8DHod+5xXlw C4B9Qw51sJC4VtWv7ile7SCYDLEGnUIFqA== X-Received: by 2002:a92:d987:: with SMTP id r7mr232956iln.303.1628683562526; Wed, 11 Aug 2021 05:06:02 -0700 (PDT) Received: from [172.22.22.26] (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.googlemail.com with ESMTPSA id w4sm14345324ior.2.2021.08.11.05.06.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Aug 2021 05:06:02 -0700 (PDT) Subject: Re: [PATCH net-next] net: ipa: always inline ipa_aggr_granularity_val() To: Leon Romanovsky 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 References: <20210810160213.2257424-1-elder@linaro.org> From: Alex Elder Message-ID: Date: Wed, 11 Aug 2021 07:06:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/11/21 7:02 AM, Leon Romanovsky wrote: > 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. 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 > > Thanks > >> >> return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; >> } >> -- >> 2.27.0 >>