Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp582962pxb; Fri, 8 Jan 2021 12:27:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvsR268K4NKMZ6Vzc/+dpw1jA4u+Zh3hB3jUxVF6EiM6sLDxau1Z5ZSXO8BFm+I7veXGs0 X-Received: by 2002:a17:907:c01:: with SMTP id ga1mr3609890ejc.488.1610137653775; Fri, 08 Jan 2021 12:27:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610137653; cv=none; d=google.com; s=arc-20160816; b=c4EKD4izZ7kq0nwgKLth1ybhUY5G+MI3iYpvsGozBvnRdtX/c8eBmyNF43O+mZe9NQ CBPP0eMkcvAKsUPLNVHLfXimm5+pG2gEdV4KSEiVPOU+tDeb9PjkK0MV0JrAJR7x9XMn aoIgCugueRNmPgD0a/8Qtk0DNEs4Ragf4PIJhlVLwCejTFaKeh2S5KumMN3STBBEghxw 3EQ3kMuz6XzdKrgQ2RvKlod7JDEVvyCXkKycW41mSct6U0HO+T78sJm3IRBpkgJLP70j mQuCvVn0yRRp19zMu28UDsADyH3JvDjQ6wBgFxGa9s8xtSweeijr3zs8cwlDbEPtwSvY Jucw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oyFWoz9ZBkG/9fD01WqqQ9V3Wvlu3oAY5p/OWrRVFXo=; b=b8FQh6qUJIiRpUbqPVjr/t9ootsfPt6Gip4DpgjuyTj5IurnZj/myhO2XeJBXyM2M4 KVQsCwD1D6CXqrE8hUWYkYQgm8i3LotF2+k0OklUq5DAwOJ3c19ybRQGVG5tN8jj7qN/ YRyx6byE+jGOmsAhjtHOW/oi8suzfyfTl6T4189J4+lxUUk2mVb0Hoyw0yblkuGcf4bZ eW8VL13tct2loJY5WnYK6Hl1OWkZwk+r5PyemdJf3DburOtrRBjBc2YSSUDLeJwsm7q1 rpwd3BKjvM+uMu06A5cVOlMtJ752aGwdB+dhhld9hDkQO4MIpNXo0s5KB0iYA1hSDw1p 6CGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbnADsDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si3858915ejw.117.2021.01.08.12.27.10; Fri, 08 Jan 2021 12:27:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbnADsDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729062AbhAHU0O (ORCPT + 99 others); Fri, 8 Jan 2021 15:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729022AbhAHU0O (ORCPT ); Fri, 8 Jan 2021 15:26:14 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A09C2C061380; Fri, 8 Jan 2021 12:25:33 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id u203so10532960ybb.2; Fri, 08 Jan 2021 12:25:33 -0800 (PST) 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:content-transfer-encoding; bh=oyFWoz9ZBkG/9fD01WqqQ9V3Wvlu3oAY5p/OWrRVFXo=; b=fbnADsDJ3KhVD4fmLtswJOHo1oKMXPr5yqaCIqvaoFlYpBGADBzkxspbX5GZcqKTzN tEVRJhsoYVK0LkVHxSjxaZfzWZZGS0eWN4ecP1DQFIKpDe1wuuhuHDgKcp4D5AiBPXhO PT+apN5bGYChrLfK53aVgBaiBASumbs8hYcYD8VaF+y2lEfuZsI2Wv1BAutiiTja94rP hBle6sjaD9tv+qmvIA6ssOQGltGf0W5sZBMXvXQZEL4tn6bJqxoGtDcSMZO8jm0KhHRt fF30qzQltd1yvF6RWCI8H74eR9qWjejdw2TntXhKdbQ5/lhy8+DMejyRq6INe/IUBCr/ LIqw== 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:content-transfer-encoding; bh=oyFWoz9ZBkG/9fD01WqqQ9V3Wvlu3oAY5p/OWrRVFXo=; b=qqtFoBH1Q+rTz3eFhAyRR/QulJgOGqO9I7N8c3qtbfNBRqtON7z2quJBczxbtgPQXj grPGYPzAKg4I3C8pUYFB+1tpTG9ncunxw/h3TO7A5YpVduYK30WEGlkltS/bYe0aw85i 8qMFx63/DSQeoArlXDexQM15kVNvKS6Rhv/lCX7S6+VVcLT5c2Xo9qvFwc7hkv3x60AD C0mJjM5NrTfrtCEYIDSugiE2O4a05hLi4A/SFDgbYmxgQ11i3GPwMoUXpWe8yZXD0sPp MGMsmDS/57lJot9fcsUNtiZIxtOcqqxGKXxWwdLv0GLTJtDjfWPxzZ4AMOOMEpOUFmeU qUBg== X-Gm-Message-State: AOAM531xtojrIFMaLyx4yKX32V8BBrtOmyTAJCteqR15LuYtlw2gGaQw oLVUWi+Szn4ChsP5ZHOPqEUMjfJ05o2hIuK6lJM= X-Received: by 2002:a25:c7c6:: with SMTP id w189mr7920774ybe.403.1610137533031; Fri, 08 Jan 2021 12:25:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrii Nakryiko Date: Fri, 8 Jan 2021 12:25:22 -0800 Message-ID: Subject: Re: [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading To: =?UTF-8?B?5b2t5rWpKFJpY2hhcmQp?= Cc: "ast@kernel.org" , "andrii@kernel.org" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 7, 2021 at 6:08 PM =E5=BD=AD=E6=B5=A9(Richard) wrote: > > struct bpf_object *obj is not used in bpf_object__probe_loading, so we > can remove it. > > Signed-off-by: Peng Hao > --- It causes no harm, no performance cost, and no maintenance issues. I consider eventually allowing to have a per-bpf_object log callback (as opposed to current global one), so at that time I'd need to re-add struct bpf_object back to this. Which means just unnecessary code churn. So thanks for the patch, there is nothing wrong with it, but I'll leave this code as is for now. Thanks! > tools/lib/bpf/libbpf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 313034117070..17d90779f09a 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -3685,7 +3685,7 @@ int bpf_map__resize(struct bpf_map *map, __u32 max_= entries) > } > > static int > -bpf_object__probe_loading(struct bpf_object *obj) > +bpf_object__probe_loading(void) > { > struct bpf_load_program_attr attr; > char *cp, errmsg[STRERR_BUFSIZE]; > @@ -7258,7 +7258,7 @@ int bpf_object__load_xattr(struct bpf_object_load_a= ttr *attr) > return -EINVAL; > } > > - err =3D bpf_object__probe_loading(obj); > + err =3D bpf_object__probe_loading(); > err =3D err ? : bpf_object__load_vmlinux_btf(obj); > err =3D err ? : bpf_object__resolve_externs(obj, obj->kconfig); > err =3D err ? : bpf_object__sanitize_and_load_btf(obj); > -- > 2.18.4