Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp98343rwn; Wed, 7 Sep 2022 13:07:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6AQeMV+bzi+7gDxUoFy9n2WWXM5GnWJ+gf6GRRQAykWm8ht6/8hDfoQ7RUuevgXn5dv0+F X-Received: by 2002:a05:6402:5193:b0:43e:1d52:fd70 with SMTP id q19-20020a056402519300b0043e1d52fd70mr4382675edd.150.1662581243162; Wed, 07 Sep 2022 13:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662581243; cv=none; d=google.com; s=arc-20160816; b=PUDVFMDGK5sTlH2qhs9rjYg46YQH9y6Q4/H+dI/rjvV9+QdXtSxKAtkGt37b31SptY uV/27bmWtO1QoQCqnvL+7Bmqtm5oLN9UUTYOYCf4awE9p3lE08lulrAYzbi5M63orRTj i4iOio9zF3HTD64Y6H7PpBRl3xfcu/KtQyEI3cOqzo0VRvwq4O6CDVkF+Y3+1uy+i9eN FmFisYSb9pm2Gd2voZQEuHmiYHqykq4IwnRMHLpNbqxgEXLjEP6rsQTdE/PUJ1SMeT9r HnaipE6gyn5mpnW/NB2hA9VcpLGg52HuSMnE7uVkVvpgT5rRcjoYKZnWx8gQmlzz7hXy AOkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GBE+biC3BCVtLnvxM8rbQdAjsqNcMIb/uQ0V5L2pCw4=; b=NcxUfwGJs1ornZLX1aH/ECfNqLULc7jp0eSgePIMTRlDOI+USpgVnWp69zatmULeWj oc2ESbIRL3PUebR6QzF74SIBYVWGqOHRlS9ZFJ+ZBxBkuvbihQLv6dhLkmQtNCgxjhtQ EVpHfLg4XqEbTKFvQ7ShDFRKPokLn7ZTXriDE+ee9O7ion2+/tzN+djGZYv2aOxNrBEk n1HPn69APENzHsZ9ME0KCsHa3JR39ZiDaCxwBeCTXeKuREInmi9NpOZaNOLC2XZBCScl guUC9J1LWJy5TLVn4ILTswvKioEhZInhzyU/odc/zJLfxlYHaCfXkaPki1HlEVDbOJcL L47Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402358600b00446c0ce86ddsi14900495edc.424.2022.09.07.13.06.58; Wed, 07 Sep 2022 13:07:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbiIGT6o (ORCPT + 99 others); Wed, 7 Sep 2022 15:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiIGT6n (ORCPT ); Wed, 7 Sep 2022 15:58:43 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3642AA5992; Wed, 7 Sep 2022 12:58:41 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 287JlHCp027774; Wed, 7 Sep 2022 14:47:17 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 287JlFIx027773; Wed, 7 Sep 2022 14:47:15 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 7 Sep 2022 14:47:15 -0500 From: Segher Boessenkool To: Florian Weimer Cc: Menglong Dong , Nick Desaulniers , kuba@kernel.org, miguel.ojeda.sandonis@gmail.com, ojeda@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, asml.silence@gmail.com, imagedong@tencent.com, luiz.von.dentz@intel.com, vasily.averin@linux.dev, jk@codeconstruct.com.au, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kernel test robot , linux-toolchains Subject: Re: [PATCH net-next v4] net: skb: prevent the split of kfree_skb_reason() by gcc Message-ID: <20220907194715.GK25951@gate.crashing.org> References: <20220818165838.GM25951@gate.crashing.org> <20220819152157.GO25951@gate.crashing.org> <871qt86711.fsf@oldenburg.str.redhat.com> <87edwo65lw.fsf@oldenburg.str.redhat.com> <20220906153046.GD25951@gate.crashing.org> <87zgfbnh81.fsf@oldenburg.str.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zgfbnh81.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Wed, Sep 07, 2022 at 08:59:26PM +0200, Florian Weimer wrote: > * Segher Boessenkool: > > > On Tue, Sep 06, 2022 at 02:37:47PM +0200, Florian Weimer wrote: > >> > On Mon, Aug 22, 2022 at 4:01 PM Florian Weimer wrote: > >> > I did some research on the 'sibcalls' you mentioned above. Feel like > >> > It's a little similar to 'inline', and makes the callee use the same stack > >> > frame with the caller, which obviously will influence the result of > >> > '__builtin_return_address'. > > > > Sibling calls are essentially calls that can be replaced by jumps (aka > > "tail call"), without needing a separate entry point to the callee. > > > > Different targets can have a slightly different implementation and > > definition of what exactly is a sibling call, but that's the gist. > > > >> > Hmm......but I'm not able to find any attribute to disable this optimization. > >> > Do you have any ideas? > >> > >> Unless something changed quite recently, GCC does not allow disabling > >> the optimization with a simple attribute (which would have to apply to > >> function pointers as well, not functions). > > > > It isn't specified what a sibling call exactly *is*, certainly not on C > > level (only in the generated machine code), and the details differs per > > target. > > Sure, but GCC already disables this optimization in a generic fashion > for noreturn calls. It should be possible to do the same based another > function attribute. My point is that disabling sibling calls does not necessarily do what you really want, certainly not on all targets. Many targets have their own frame optimisations and prologue/epilogue optimisations as well. But you can just do void f(void) __attribute__((optimize("no-optimize-sibling-calls"))); (in my previous example), and that works: it disables the (generic) sibling call optimisation. This may or may not do what you actually want though. Segher