Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3480401rwo; Mon, 24 Jul 2023 11:38:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbRSiJrT3E2PRFY+P8wg5BRfC81w3LprohCHd8xV6avnii0kxrlFTbLkTd+3Sh1qC3px+T X-Received: by 2002:a17:902:db06:b0:1b6:69dc:44d2 with SMTP id m6-20020a170902db0600b001b669dc44d2mr13761714plx.51.1690223935931; Mon, 24 Jul 2023 11:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690223935; cv=none; d=google.com; s=arc-20160816; b=km2dqZLs3rvdMw5LhK6BSv467+owSRUNgo5FmDlKNT2sKnZ93aM7QQ73S2ObGs7v2R RlcGxYzsft1jfw1C4KlERxsmPPeb3pO2plZum/OKjxU/tmTdkRCMWuIhXGGxq8X29bkH Y8RN4a+WPnaZ8cYTf0zj6/OYoz9m5kNMnj2PXYuoJ/Xc3gnqVPsJ9VdSpn5fo+hrJKI9 pZmRbq3naDY2aswav1wiq+35kq7qKUPaLzvsWhrsic75TN403DnXUDe5jlv7SnkbNFnI jI9eXGlVlikgEXvak8Kev6IFzT+7yiRgfh522lniikjTUrYyzLWmSR5yZp2WX6E653S0 OXng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KKpNqY8f0mYa5U7e/O0Zjuwp+qRiTKpk1WGgmDNW+UA=; fh=UZ8fA+Svg/1OOifRlv4m2cjv78oacBsMY7ZVopViNhE=; b=CUvLM56DShejTYyDpzDiIFGXNPYndB7n+Ld0xeLLh8N5bKCrmFylTg0N0lDgD73Apl IOYOArERY/GfgqHvGXztyAb8MzkvgoyQaJoyE+7QKiHZ+QjZ9ALoVk5T3Kwu0SrNuIiH kySwc/S0G79VqOlr4p/m63tAzPhvkjD+aAKHfQuBSN/fiIrOzi2a0rSH8IYy/yzGBOzv 4G3hZUxCXgqXxj+5X9sU0//9NuYl9BMWzkX1PtkMnaaoe2i0+JlP1zFJqDZfIPUBzU0f DrhxYZsd4g9P6vjpgllUNgfEvhGPd5hucZKEEtjvNyCB9W8inReVevEpBrtlWhWvV5RG s5Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FbvwyX+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902d2ca00b001b8c824e826si10323711plc.533.2023.07.24.11.38.42; Mon, 24 Jul 2023 11:38:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FbvwyX+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbjGXSAj (ORCPT + 99 others); Mon, 24 Jul 2023 14:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbjGXSA0 (ORCPT ); Mon, 24 Jul 2023 14:00:26 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86590172D; Mon, 24 Jul 2023 11:00:25 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2b72161c6e9so71276461fa.0; Mon, 24 Jul 2023 11:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690221624; x=1690826424; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KKpNqY8f0mYa5U7e/O0Zjuwp+qRiTKpk1WGgmDNW+UA=; b=FbvwyX+AsInXMX78Myxy7I9+awMLOiQcB/aIRdDKHB9IxVBEg5p4aQTqtWhvcdzmGC gXuEePJrW9qJYWN2iqHS/bM8pm0aOQNRmXoodpJH3ZzBmy7Ulp4agyjRXtE08EDcZFu0 CEe3zGmNRTnLu9IMtDrJO2EIyO0W3v5PiBZB0I6XIwAhtoegGRf53vnjzXEM9VxpDpWg UR9Qw7n4eDCPAo25RkrP0X5oWad3qMwXFocs41TsLg2HRV7zQPEehY6Tm/9ZCbUF9TCm FOlh2I0gfiOYfSPtO8xkcsvmFrltHWVlfPeHfS4T9zJYDgPWGMuTvDAhE4ndd6ifITj3 iDNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690221624; x=1690826424; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KKpNqY8f0mYa5U7e/O0Zjuwp+qRiTKpk1WGgmDNW+UA=; b=Y/mK3ynXEpSIWcy2Pf7WF/oahX3OGk6mj5+Tg0ICED1JIzSQzYN/f2FEFFiR3FLM1C yN0eie9WKx09GyNTCsG/LFbLe+ko6qkVMAxLBXz1qX+EHW6+X7ozDj5Ws7clyohveOaq up02gOnFWOAoS+oJ7LW0g3t+pkXEKdC5JR9uOQg93sp2I7TvMwcPJxb+rO+AEe8wPLpV MSnfiPt380/e8NGdY7UwdSWPQSF1son2v3SJ+aIMhzskAfpXprYC+qWxW5hu594eEjoE XcKQb9Xxxt4EV4RV2qP09ORzJ3Ce0LrGBPnJVSUsgkBdReYXUC4CAX9ztiPBiYFNeiBA QfnA== X-Gm-Message-State: ABy/qLZ8bMPgDBoxjwdCkL3bBEDtT+Wbr9Va47TA0w38dzgrWp+BvRKh FKblwJkqx9lFf3uLjO4WlKtpwIUSjgUfvFEu+wfy/CYbKOg= X-Received: by 2002:a2e:b54a:0:b0:2b8:3974:60fb with SMTP id a10-20020a2eb54a000000b002b8397460fbmr5269655ljn.3.1690221623453; Mon, 24 Jul 2023 11:00:23 -0700 (PDT) MIME-Version: 1.0 References: <20230722074753.568696-1-arnd@kernel.org> In-Reply-To: From: Alexei Starovoitov Date: Mon, 24 Jul 2023 11:00:11 -0700 Message-ID: Subject: Re: [PATCH] bpf: force inc_active()/dec_active() to be inline functions To: Arnd Bergmann Cc: Yafang Shao , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Hou Tao , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Kumar Kartikeya Dwivedi , bpf , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 23, 2023 at 11:32=E2=80=AFAM Arnd Bergmann wrot= e: > > >> If so, why can't we improve the compiler ? > > > > Agree. > > Sounds like a compiler bug. > > I don't know what you might want to change in the compiler > to avoid this. Compilers are free to decide which functions to > inline in the absence of noinline or always_inline flags. Clearly a compiler bug. Compilers should not produce false positive warnings regardless how inlining went and optimizations performed. > One difference between gcc and clang is that gcc tries to > be smart about warnings by using information from inlining > to produce better warnings, while clang never uses information > across function boundaries for generated warnings, so it won't > find this one, but also would ignore an unconditional use > of the uninitialized variable. > > >> If we have to change the kernel, what about the change below? > > > > To workaround the compiler bug we can simply init flag=3D0 to silence > > the warn, but even that is silly. Passing flag=3D0 into irqrestore is b= uggy. > > Maybe inc_active() could return the flags instead of modifying > the stack variable? that would also result in slightly better > code when it's not inlined. Which gcc are we talking about here that is so buggy?