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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C24E9C433E7 for ; Wed, 2 Sep 2020 19:57:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FE3B20767 for ; Wed, 2 Sep 2020 19:57:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AuJthCL6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbgIBT5g (ORCPT ); Wed, 2 Sep 2020 15:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbgIBT50 (ORCPT ); Wed, 2 Sep 2020 15:57:26 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F83FC061244; Wed, 2 Sep 2020 12:57:25 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id h126so470614ybg.4; Wed, 02 Sep 2020 12:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RVwJ81Qtpdk1XpGW5J7CwHz1UYeI3dTDYRrlyLt13sM=; b=AuJthCL6aO4RqJX/kWznJ3sHdv1Crb7oRuz4/AeJwn2AoaSXAPGLZrMwYOAxD6MCTa tuL1MO6QL11N7qKolHCGvr4NB3kp/g+T1E5sI/VwNxfUXWN74CCpoUKV/GaWKnNUXQF+ C1feQ3RSDrL4/VjqkNWuGHTVuao8869fHZJxiyLSEo4b9XM9CdgHd4M+wsOza33RNeiT 96r/pzjG1fEUSBKdo/arM21CEODmy1MRWpTDIJr1zG7CeIuqNgephYuIXJIo3wBFQe4u 9UODwJn8wgptL/nkjdobdvMa75z9+G9VTR2OHAGYQPTvpkH9022eaIE9J2Y5e37IgO8V qiAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RVwJ81Qtpdk1XpGW5J7CwHz1UYeI3dTDYRrlyLt13sM=; b=oJjGw4OB9y6nDyfd6Ra7LpYt84Fx6/GYYrmVeOkhNWgleHG1RqLrVjVr6xd8cH0pjX q/VqkvWZDZhD2OMgrUqYN48NZDBJsBuj9XZITG+ZpwMFDj9qdztfDD3qwIguTDDT4MAq T0mSaTExoZqgOKbhHxNR2TlB7bPUYHQiuWOSVEfRzlJZ3kSXEa3eeNnjwku5hv0ipoGx QnNEVH5vaPnvwEa2tHn25j86kph5oxEBe4gl37TfN3LWmF1cd4G4r6H5MfAoAknoNPdn QDOWD2ZFMY8PFF041nyAJwo1t+Msh2MlxjuFRq/MePEylFUmIOPpARa+OHiUX+aVJmEg HY9w== X-Gm-Message-State: AOAM5336mb6tPs8UiSBQ9s1sVYNcKJInif/gT7/IHmFTXj4z95qfO3ua DSrQP00zYUn/cy0VtHgKHZYLIHCsx1h+vHJOgYU= X-Google-Smtp-Source: ABdhPJzpoTIUFvE14LX/tt+D4kj0VQHFDqttKFYDuoVwCcqEIXZT3of7Y20jbgkuLu+Gl6asJQ1QI5od67fV49gW2ZE= X-Received: by 2002:a5b:44d:: with SMTP id s13mr12423151ybp.403.1599076644849; Wed, 02 Sep 2020 12:57:24 -0700 (PDT) MIME-Version: 1.0 References: <20200901015003.2871861-1-andriin@fb.com> <20200901015003.2871861-8-andriin@fb.com> <20200902054132.y3p3spqt6vzxiy2t@ast-mbp.dhcp.thefacebook.com> In-Reply-To: <20200902054132.y3p3spqt6vzxiy2t@ast-mbp.dhcp.thefacebook.com> From: Andrii Nakryiko Date: Wed, 2 Sep 2020 12:57:14 -0700 Message-ID: Subject: Re: [PATCH v2 bpf-next 07/14] selftests/bpf: add selftest for multi-prog sections and bpf-to-bpf calls To: Alexei Starovoitov Cc: Andrii Nakryiko , bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Sep 1, 2020 at 10:41 PM Alexei Starovoitov wrote: > > On Mon, Aug 31, 2020 at 06:49:56PM -0700, Andrii Nakryiko wrote: > > + > > +__noinline int sub1(int x) > > +{ > > + return x + 1; > > +} > > + > > +static __noinline int sub5(int v); > > + > > +__noinline int sub2(int y) > > +{ > > + return sub5(y + 2); > > +} > > + > > +static __noinline int sub3(int z) > > +{ > > + return z + 3 + sub1(4); > > +} > > + > > +static __noinline int sub4(int w) > > +{ > > + return w + sub3(5) + sub1(6); > > Did you check that asm has these calls? Yeah, I actually did check. All calls are there. > Since sub3 is static the compiler doesn't have to do the call. > 'static noinline' doesn't mean that compiler have to do the call. > It can compute the value and replace a call with a constant. > It only has to keep the body of the function if the address of it > was taken. All these subX() functions are either global or call global function (sub1() is global), which seems to keep Clang from optimizing all this. Clang has to assume the worst case for global functions, probably due to LD_PRELOAD, right?