Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp319183rwa; Sat, 20 Aug 2022 04:32:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6BRrmoxQeHVqfhDbk51NA2UAPV8BvLtPZVFXZ1I3Ym+pp7eCyeTrKazPN1Aa2UuEV2Vf0X X-Received: by 2002:a17:90a:a097:b0:1fb:5bc:7778 with SMTP id r23-20020a17090aa09700b001fb05bc7778mr2179166pjp.209.1660995154667; Sat, 20 Aug 2022 04:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660995154; cv=none; d=google.com; s=arc-20160816; b=S9Yuesa3klItCyiMI680bByA+31+vi7n8sG7RxWquG5ctN7n13ff6pA91KiR2dvPgx 5tVCf4sKhOfot2t3y1QWiqFTE9scBvbCYuYiyO4WP503/0lRuyD9M0ZTFp86D6vWkdfn VnEEvI87v7R0F2OZPAj8+1mWR/xEV0lvRFf8Ak/jWaxca4Hq+YIhoH+7EIMkhoWAUcsq eLnMsUtaVSxv1Hg3aFcdk8EnOfAy1NWqmcRJKrtvCcXVegbCPNaGe+nUj4k4ABysPrfv tkkNmO5VNUcqlpbOmMos91dLrDAU3tCTiWR0h03yXAdaSOkQVB7ZaxDhGnzKS/tJ2aU+ 5LHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8wuUIWdis+xT0hudag4a14ELVYJVIG+o6tLrSegrIoA=; b=kCTrcYuQ0nuGDoePJTFelCVmCs6lyGB4TyLeGS3ZDoh9uKukBGh5Sx+FQoiUmQUGFA OjUWEcFIIpdtSBLRbBE1ZN/QMLl7Tas9S5zXgwe4AtxR736ddoblOHrCXDPSOW5IQzb4 P5I4KkGZF30UQUr0YEm9woMgdOKUwTXdrkdb7N0Jyl7jHpo4CvKzSE1ZSpYha5sUmY0Z qWHF5eORlThyAhk5ywCLMU3TA7SrmQDOm2YHBtAt3bNXVxAq07y+sn23F0G0wpLzOFTw sWCBsuhr7kI/25j0SOkeI7APZHh9RvLfLzmSWkw8tYpOOvOQ1yQUTMUwGzZYuHGtvYt/ 3Vqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=j61CLE6f; 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 e9-20020a656889000000b0041da1e6a990si6469254pgt.174.2022.08.20.04.32.21; Sat, 20 Aug 2022 04:32:34 -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=20210112 header.b=j61CLE6f; 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 S1345714AbiHTLA4 (ORCPT + 99 others); Sat, 20 Aug 2022 07:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345679AbiHTLAy (ORCPT ); Sat, 20 Aug 2022 07:00:54 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFAF57216; Sat, 20 Aug 2022 04:00:53 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id x23so6074792pll.7; Sat, 20 Aug 2022 04:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=8wuUIWdis+xT0hudag4a14ELVYJVIG+o6tLrSegrIoA=; b=j61CLE6fa59pokGfGnMEauJKsM2LM5X8woqRtjVW9NTQ6Y5kpAiWTx96vf7d8dGckw fVo50+VzyS011jwN0OAUbTQRCkqSNls3M0X4N9RiXxlf4W4YutQxMT3ZcBdP5cIHGJUc 8x1JZqcFS7bb/HVnfV/WinwjjsqIJVCjcPRwJE7Wz+R/lOhhOdv0ojp9M4dyFuh5BZzQ C2zBeoXohSc3s/zmDdjcg75DRwMWeLCvUfp/PTXXfxTZ2cCOAXOa0NlhiYeiLyEOHPe4 PDpUKpNCpaRDzu5xzQ5N/WUf6d32QF9drhjvaJLcpwQL0nW2X8iHYD4CgdVCdOMbj47W 8Y7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=8wuUIWdis+xT0hudag4a14ELVYJVIG+o6tLrSegrIoA=; b=wVZVmRT1fwLmhlI4vVW/qdZEftjXNVS+j5XxuPO/0bopENMckTNv+qxEM9h7F9ixms fbD4Zoxvvp/n/qC/Sxl0Mhher5JtO9dsl8kCbLpJAG6esU6TE1Bc+v2152FR0Dk2aUmb 1xEvGyzOlDHPQpFp0dyjccO1EOzPSnIUNq3Tj7Q65/dzLKK7isKX4SyEGo9PoAyLp6kk xzId1rx8A9IB/XXiD4ZsbKgMbIeoO/GCm9aTS4zlzboxOS8UGU8DOttu5mi5E7bcr4is FWh3yKeskCg4pNaVndhDwgyHa0r/+9P5lMn7o3HIK5jqdNCnoQaNzATLqqAOi9tsdTft Fq7Q== X-Gm-Message-State: ACgBeo2kzpvwOyu4I9Lfbsj/bg6rv4xddV3vHKNLSvsAw0c/RcFvZuPi QXEWBylJdg1KbUX3xvHIETIgvbG6+9yd5l3h144= X-Received: by 2002:a17:902:da8f:b0:16f:6b6:eed7 with SMTP id j15-20020a170902da8f00b0016f06b6eed7mr11456056plx.85.1660993253488; Sat, 20 Aug 2022 04:00:53 -0700 (PDT) MIME-Version: 1.0 References: <20220816032846.2579217-1-imagedong@tencent.com> <20220818165838.GM25951@gate.crashing.org> <20220819152157.GO25951@gate.crashing.org> In-Reply-To: <20220819152157.GO25951@gate.crashing.org> From: Menglong Dong Date: Sat, 20 Aug 2022 19:00:41 +0800 Message-ID: Subject: Re: [PATCH net-next v4] net: skb: prevent the split of kfree_skb_reason() by gcc To: Segher Boessenkool Cc: 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 Content-Type: text/plain; charset="UTF-8" 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 Hello, On Fri, Aug 19, 2022 at 11:24 PM Segher Boessenkool wrote: > > Hi! > > On Fri, Aug 19, 2022 at 10:55:42PM +0800, Menglong Dong wrote: > > Thanks for your explanation about the usage of 'noinline' and 'no_icf'! > > I think 'noclone' seems enough in this case? As the function > > 'kfree_skb_reason' we talk about is a global function, I think that the > > compiler has no reason to make it inline, or be merged with another > > function. > > Whether something is inlined is decided per instance (except for > always_inline and noinline functions). Of course the function body has > to be available for anything to be inlined, so barring LTO this can only > happen for function uses in the same source file. Not very likely > indeed, but not entirely impossible either. > I understand it now, the global function is indeed possible to be made inline by the compiler, and 'noinline' seems necessary here too. Maybe I can add a new compiler attribute like this: /* * 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 > A function can be merged if there is another function that does exactly > the same thing. This is unlikely with functions that do some serious > work of course, but it is likely with stub-like functions. > I understand how 'icf'(Identical Code Folding) works now. In the case we talk about, It seems fine even if the function is merged. The only effect of 'icf' is the change of function name, which doesn't affect the result of '__builtin_return_address(0)'. Thanks! Menglong Dong > gl;hf, > > > Segher