Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4624610rwb; Tue, 6 Sep 2022 10:03:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6SAv/SJqTELRf9sEQ9YK4KH4cUxJeofX9+4TE0sld+gCcBdcthAliQpXfZ3KUYfzTck+PX X-Received: by 2002:a17:90b:b06:b0:200:aff0:2e68 with SMTP id bf6-20020a17090b0b0600b00200aff02e68mr1154035pjb.159.1662483782972; Tue, 06 Sep 2022 10:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662483782; cv=none; d=google.com; s=arc-20160816; b=eIjYi+1Q0dZaNCYBswKNhXL+OGro0+5qulyoQHejDwzLihV5oR/Wg4aq3OVtXOJGxL BNM4b0Cne+fVnJmlXUDpCaytjTVSsjtjFGdGjCYSq0xVKo82J14VxrXSPO0/HYDZ546n pdJGZWOljocA2wNcjG+f+O459Ht2U02t3+smxNoRBdSNzpP1LylJhJjvKVy6fZTlbCSd zD7++VjyGkhkpqBnZF1BttIJUJki6gkpyPn1mT8KxRFuiVCp06XX47QJ0YLiSIyyzga5 FmHZYBOA5jaQaMD+QxzHDgQGGXI69DqSM6pGHhiyNH4QY51p1rZpEJj95y/uWfOwMOgk 66UQ== 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=dN9qkR28ZFOYUMlCn9/vRLGy0rmB2vad18mnoMlwY08=; b=lfAaHOuI/6EG79LlUMdy9YBFZqzVJAsVUFbi9vqeg4N0jY+shwb3b9sa8CGhnvv/vr 0rhb6djhNiue4W9+DpUfRjdIJaJd7oVDfYw1h0AHubd4rgc/3NmNWYMMj4e4euc69MSf 8SN+ll8ZWNLwDHwXwbz8+jujEmBkFM15qMLyt7HhYMvqzWbL9ou+1Oo1xwA5qLl6PLnt nWd8XxcPKzeN5MWM6ArJt46BQRPkJJhQw7Bt9hSUemteQ/I9sbxvTqpeKGdEbFfBxxk+ Hv0HYUyo/MzvwVLb/sBCuWtc6OdidWkRgWjCjeMDJUHdxk4PDJlmfx5Pu38tdrDpJmnE tOPg== 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 kk14-20020a17090b4a0e00b001fde61b869esi20564088pjb.149.2022.09.06.10.02.49; Tue, 06 Sep 2022 10:03:01 -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 S230083AbiIFQOf (ORCPT + 99 others); Tue, 6 Sep 2022 12:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbiIFQOM (ORCPT ); Tue, 6 Sep 2022 12:14:12 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DBF869E8BA; Tue, 6 Sep 2022 08:41:45 -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 286FUmmV027329; Tue, 6 Sep 2022 10:30:48 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 286FUlxp027324; Tue, 6 Sep 2022 10:30:47 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 6 Sep 2022 10:30:47 -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: <20220906153046.GD25951@gate.crashing.org> References: <20220816032846.2579217-1-imagedong@tencent.com> <20220818165838.GM25951@gate.crashing.org> <20220819152157.GO25951@gate.crashing.org> <871qt86711.fsf@oldenburg.str.redhat.com> <87edwo65lw.fsf@oldenburg.str.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87edwo65lw.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 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. > asm ("") barriers that move > out a call out of the tail position are supposed to prevent the > optimization. Not just "supposed": they work 100%. The asm has to stay after the function call by the fundamental rules of C (the function call having a sequence point, and the asm a side effect). void g(void); void f(void) { g(); // This can not be optimised to a jump... asm(""); // ... because it has to stay before this. } Segher