From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A9C3ECAAA1 for ; Tue, 6 Sep 2022 12:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237156AbiIFMiA (ORCPT ); Tue, 6 Sep 2022 08:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239732AbiIFMh6 (ORCPT ); Tue, 6 Sep 2022 08:37:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D502225E87 for ; Tue, 6 Sep 2022 05:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662467877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NwavP4bpJ5RCOsyXBh4N8THSIxStyZegdjcyZhUquBU=; b=HSM1vJnoyWpCDNHo/iU4kQKQEiG9QSQcN2fO5jQdiqn6guOgdMD07Z6Ap0FN5aOuuDKYSc SIew0bhtxNFFvcTTvSPjmIoRE46ZweZlwC6gejhE+cCLdlhRSpngxpaaPCPEQjRWs9MiYv zzG6H87glJMJ1QZhxGCwc9rEER+7pgI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-15-xyxTHjOaPfqDg-3_GN9Jlw-1; Tue, 06 Sep 2022 08:37:56 -0400 X-MC-Unique: xyxTHjOaPfqDg-3_GN9Jlw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EF72101A54E; Tue, 6 Sep 2022 12:37:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 968181121314; Tue, 6 Sep 2022 12:37:49 +0000 (UTC) From: Florian Weimer To: Menglong Dong Cc: Segher Boessenkool , 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 References: <20220816032846.2579217-1-imagedong@tencent.com> <20220818165838.GM25951@gate.crashing.org> <20220819152157.GO25951@gate.crashing.org> <871qt86711.fsf@oldenburg.str.redhat.com> Date: Tue, 06 Sep 2022 14:37:47 +0200 In-Reply-To: (Menglong Dong's message of "Wed, 24 Aug 2022 00:23:02 +0800") Message-ID: <87edwo65lw.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Menglong Dong: > Hello, > > On Mon, Aug 22, 2022 at 4:01 PM Florian Weimer wrote: >> >> * Menglong Dong: >> >> > /* >> > * Used by functions that use '__builtin_return_address'. These function >> > * don't want to be splited or made inline, which can make >> > * the '__builtin_return_address' got unexpected address. >> > */ >> > #define __fix_address noinline __noclone >> >> You need something on the function *declaration* as well, to inhibit >> sibcalls. >> > > 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'. > > 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). asm ("") barriers that move out a call out of the tail position are supposed to prevent the optimization. Thanks, Florian