Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp90866iof; Sun, 5 Jun 2022 22:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygfosW+x4Ff3KR7QfMZcXFbpmgcZnkPHhAtGffivxdJsmMCf2g1EpXLwnPg4MfGFUTA4dE X-Received: by 2002:a17:903:32c4:b0:167:6e6f:204b with SMTP id i4-20020a17090332c400b001676e6f204bmr7875420plr.117.1654491879545; Sun, 05 Jun 2022 22:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654491879; cv=none; d=google.com; s=arc-20160816; b=umOjtqRrXQ1xJW8fu/JEdGqvw5TxXfiZc7FzMBjxdbyZp9qUswBnU0Kcyg0pchQS8t VF8ggN1M6ryKYnupy5MsMCBALEn1wWLwvGgKSq/tCfeJI+/qRptQcraT2h/6NNOnzmz5 6JzYQ22VzPUS6myjO6ZxAmqBfxQlyNTEBpBCqryqFnBkapRrtEcT0VPjqO4H5OX8f6GW mlKZCuMUcPchFPeCMQWpcQsm5nkqsjIpgNW95ewB8OQ3cxA/b1BvaxysKQDayRsItAYM CIfi69qhMi3A0q/QKNQ5QJgMZMOWpXQxv9CvMIUU4gWQBZy9Df6IYfeb3x+uzP9GUMPd o7Og== 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=trTQR6/qmHbTlyde/rCm8sSQSJS5wB9n1+cCV0e7RK0=; b=lVeGcJwm0J/fhlEIbuWiSyKX97ZuLYHCBe1UODbiB9b6fgIEp44xKxyZeH0PpC1heO I3M8FPg8sFZ6/cwgOvNFDdMfLwXbhFMncCrpQWlt5sXI2e4he4E6WjDM6bIvuQPxTpqg wSAh1Kp2gWjHABBgsliuqB6cZuyyeossaPTIn6CldvByehS9r5IfVE+mNMnwPbQgKNTn bjS3SKBaaQRQTQ1LFy5t+JtqC48wqhXb7vWCbL3auGgK7PfJ3qsczCJsahD4z4sLcFe3 AuPBkc/5kVdI0Jz5vN/54OqbTNVOiensL2/liC4PKBh5vXQDax13P/NJJx/OTvMo35FS 8EsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZAEQlvgb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x13-20020a170902ec8d00b00166031e366dsi6462202plg.175.2022.06.05.22.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZAEQlvgb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7AE77117671; Sun, 5 Jun 2022 21:13:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233191AbiFCF5c (ORCPT + 99 others); Fri, 3 Jun 2022 01:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbiFCF53 (ORCPT ); Fri, 3 Jun 2022 01:57:29 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A683713CFB for ; Thu, 2 Jun 2022 22:57:28 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id o29-20020a05600c511d00b00397697f172dso4531333wms.0 for ; Thu, 02 Jun 2022 22:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=trTQR6/qmHbTlyde/rCm8sSQSJS5wB9n1+cCV0e7RK0=; b=ZAEQlvgbKN0qmgFxrTlMgeUTBFJXXFKPGvElq+AAseoFgNf59kxTsxHeEbxmFDnMHf yqCgrHtHA67lNq4umZptjzUyVwVGgy4bf9VrDrNdLXNQ3zUE+/2buWyY254UiuESAryW ZER1hri8yIHaeqDwdfKZxWq2F/8nbyO/A+X9MpIT4A7JkizxtVv9QISQ9ba5RH9fp2Hk mQoWAhv2rWQOFueFLIjRj8RQyoqodVdB/rGuRkR570sXIwoOa7SX6LO3VOC9T10N5NVZ GZYUCjeWl5+yLn2TdQXE95+Wqz/Lz/AbtnWmgI7r6gdrWAm8HYZqdzkWF+hxaM9VH50v TtUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=trTQR6/qmHbTlyde/rCm8sSQSJS5wB9n1+cCV0e7RK0=; b=12rwgTbs8QAMMGy74Vi8LzfwU0aemuIOVZFRArE3dIPS8FTJl7RgHxBS2YPL7lPYDe kQjfHIsTLXsu2kEVGan+tQPlZ9sX7sXo66tylQzMp3s133SJ67NBkFOGEHvQMLohhWXf apEtOqoEOlTnPWOJ3CLG2GpEPUjrCRej40c2PATmaV7OIBr4JhFKghisv96h21DO+IVa Ps65ZbpIx/Slwlos8PMbLtcVHQ9pV2Mxm47wuvxBPP2P+dB6yl7fhTluEWU4LJwpXWYQ DojSkZxb4+YYY7eB2JstgznhDpF1FKt7EZ8KOhtJhm8MZBq84AqAG3+0h3znGOAQgv9G Y2sA== X-Gm-Message-State: AOAM5314QUeUDDmLnKZbgji7MTvaz8qiUQ+3YFz5KKVrbSqinV1KflUy aSkUygaCer/nQvW9diyHMHaCBDRzhpH6FQB1ngwC3Q== X-Received: by 2002:a7b:c015:0:b0:397:3685:5148 with SMTP id c21-20020a7bc015000000b0039736855148mr6967957wmb.174.1654235846995; Thu, 02 Jun 2022 22:57:26 -0700 (PDT) MIME-Version: 1.0 References: <20220603055156.2830463-1-irogers@google.com> In-Reply-To: <20220603055156.2830463-1-irogers@google.com> From: Ian Rogers Date: Thu, 2 Jun 2022 22:57:13 -0700 Message-ID: Subject: Re: [PATCH v2] libbpf: Fix is_pow_of_2 To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yuze Chi Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Thu, Jun 2, 2022 at 10:52 PM Ian Rogers wrote: > > From: Yuze Chi > > Move the correct definition from linker.c into libbpf_internal.h. > Sorry I missed this: Fixes: 0087a681fa8c ("libbpf: Automatically fix up BPF_MAP_TYPE_RINGBUF size, if necessary") Thanks, Ian > Reported-by: Yuze Chi > Signed-off-by: Yuze Chi > Signed-off-by: Ian Rogers > --- > tools/lib/bpf/libbpf.c | 5 ----- > tools/lib/bpf/libbpf_internal.h | 5 +++++ > tools/lib/bpf/linker.c | 5 ----- > 3 files changed, 5 insertions(+), 10 deletions(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 3f4f18684bd3..346f941bb995 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -4954,11 +4954,6 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) > > static void bpf_map__destroy(struct bpf_map *map); > > -static bool is_pow_of_2(size_t x) > -{ > - return x && (x & (x - 1)); > -} > - > static size_t adjust_ringbuf_sz(size_t sz) > { > __u32 page_sz = sysconf(_SC_PAGE_SIZE); > diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h > index 4abdbe2fea9d..ef5d975078e5 100644 > --- a/tools/lib/bpf/libbpf_internal.h > +++ b/tools/lib/bpf/libbpf_internal.h > @@ -580,4 +580,9 @@ struct bpf_link * usdt_manager_attach_usdt(struct usdt_manager *man, > const char *usdt_provider, const char *usdt_name, > __u64 usdt_cookie); > > +static inline bool is_pow_of_2(size_t x) > +{ > + return x && (x & (x - 1)) == 0; > +} > + > #endif /* __LIBBPF_LIBBPF_INTERNAL_H */ > diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c > index 9aa016fb55aa..85c0fddf55d1 100644 > --- a/tools/lib/bpf/linker.c > +++ b/tools/lib/bpf/linker.c > @@ -697,11 +697,6 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, > return err; > } > > -static bool is_pow_of_2(size_t x) > -{ > - return x && (x & (x - 1)) == 0; > -} > - > static int linker_sanity_check_elf(struct src_obj *obj) > { > struct src_sec *sec; > -- > 2.36.1.255.ge46751e96f-goog >