Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp670947lql; Mon, 11 Mar 2024 13:52:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWoed+PAQZXexmDXUYNlL8mtL6s3wOVU2CkH4oF1k8evvRPpvIfWEu0V4agbN6FA5SNRti1+HvpOu/D0tbgGDwW093L/8K2HIS4cU8Jhw== X-Google-Smtp-Source: AGHT+IFr7fKhRKs3Nzw2xa0eVMS7Pwqrai3qwB4oOjxDFcHNUSKZdB861p0JqUi7Qon91j9cN3iV X-Received: by 2002:a50:bac6:0:b0:567:ff9a:d5e0 with SMTP id x64-20020a50bac6000000b00567ff9ad5e0mr5721482ede.29.1710190343613; Mon, 11 Mar 2024 13:52:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710190343; cv=pass; d=google.com; s=arc-20160816; b=UARFLyEMdzZLOAaRhf9S3GKY4LNQ/E2hF3NxFSmGXOtEovhv4okjj7LFZrX+gOYml6 VhkdGIscAxpAZHMvYwglPTbtUHCE6B8DdoPoYte8u7WOPFuHyOWfeA7w08OmPc1GQYue SSqhxyem80OlG0oDVxuB5IwSulvSrBEzHCREIpRIe1F+OfJnx2kX5bHxZ230komjfYWE BjQNpX7C3NBTMxr7Bkx42UrGbnhbKci7p1yGSXU7LwO1UieTXWLxFZjfugKkFZ9cnFBC a/hDmC6+ghM0VgfYYJKqYiYxMwaMLgEClBu8FnIt1trFNZzTxAEIqqI8HQB21NluVEpM xQWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=dd981U9xN2VeJ5yKqoYAGms3X6oq3hxLcufVnnlsh9s=; fh=MHyQPwr4CaOo7AY8W0XOBbgZZi19QLDlM/5EgPEmg7A=; b=qbfiOqXhSsZEDZDTQ+Zh30TlJ6Dgkw7vaxt5gp9kcexDJuaIBwnPE3IkndZG2VzGqi TxJ1p46JiTpSNx8+Ac+MaM248VryqL+vdClMFA0wsRr/SF9dSiH2JMQvtabWvVRt0XvQ 8PMHXoNI+GF6ydp708iWK6jKnFIHiclkPSUTF1ulfckpqGsb78N/H1c2jM0a7crnPRjZ DIqWj9f3kKxtivCmE1uPUfSS8A7mAgIOdjr+y2GfQUxcjCZzzS6HIFDspjElNauI97th hpZ7wNMqlgTxyNY4sDuctmjG0DddURvECBpvi7dF0YcO/T5Um4i6qQRGWBQKsl/QG5Eh cfhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hARHJHvt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fj17-20020a0564022b9100b00567f8c8b3fdsi2924000edb.275.2024.03.11.13.52.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 13:52:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hARHJHvt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 302B41F21C8F for ; Mon, 11 Mar 2024 20:52:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2979E56B79; Mon, 11 Mar 2024 20:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hARHJHvt" Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DA2243AAC; Mon, 11 Mar 2024 20:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710190325; cv=none; b=NnvQJoB1EbU+fzwNSALBjvELsu8qv9VO+SxlYdYDRly6V/3L/GsxWxkwlsos/CUz6Cd0QE0aUtS1k9hIdtjf2XyieJ97Sz7t5yK6ea+fwtrWR1WitOU3/t0qS9FUYJQ6j8MbzdoP6tcTtBPiMP1SVizq8YD7KyQ2SSNjmrSrex8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710190325; c=relaxed/simple; bh=ByUIPZ47pKYggMFQ2m6tctWjj7DYdv9nhhKxwYcw3UI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LrIoCnnSUBKYCIwPjxjs4ushdVrJXNFEEsd6G0b4lEHTBC03YcxUEbJPjOfqsbLpq5WjnyUJ378asCLmSqVzdbEhDaB0fyYmOYaC5BxajdZC0Ec2ViaQfLf0KttWu5ZppQieXLOnICTaDfas7bq2dJ+LYYw8tZEo1mhCllJUVQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hARHJHvt; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-29aa91e173dso3332025a91.0; Mon, 11 Mar 2024 13:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710190322; x=1710795122; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dd981U9xN2VeJ5yKqoYAGms3X6oq3hxLcufVnnlsh9s=; b=hARHJHvtO737bqTwyz5cg0hA6e4j2p8yu7kDcJCBs4t+YWcppX0ASRrMknh4fV7Y6Z Dss5OEVuHQ8WZ1mR3Yjf4rDuK3aQmjKKIqhshXXm4LJcmA+2r1eruvwGKCGBTPSc6VLj Bv8aW/0Mo7TW792qRJu3WUR8fDcrUFv2gqinqU6Wl8AC6q4tOHFbhvKnoMHMq+X5ePVE BA11BRQjlrpd/9rdIb09X44q6y6jBXZWS/7/7kGVz6x7fHn7tEbrT3tI3BU47AKhMLqT y9HZq0n25TyObQvIXQMvT+nR4gBwUHcZSEirDJX8/u8YxTWJlNojXtW9DX3nzGYiUyZW Q0eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710190322; x=1710795122; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dd981U9xN2VeJ5yKqoYAGms3X6oq3hxLcufVnnlsh9s=; b=NbhijlJZd2ZU4E0sFDIPllG42CvxZdrXgm/u+glXLpgsX1nRWbdgTz/UNLwbjzPvBX NY210+hm30TQ50jCU/v1b0DAkp6YOWAObT8GcjIUNxLBvm00nZ8VR1qfOZOvM6ggUuAe TUfz3desXGtkkkz/aYsxIWvNfHVI108kypWYowK2aczu90ay5+AtaT9+QsM9BA1FclfI a27rORLAcsZe/asASTunQos6w0+s7cWHmPHsn5hOEruD4WUcRE42B1NvjaHBfgyC6iRm 3jMOprw2ELmtFPljpVfsisFwSbCPvzbny9fxQkswLEUEu4bYKLwwJFhYL4QOOR5Pm/8t dATA== X-Forwarded-Encrypted: i=1; AJvYcCWc6Y2UhhcH4A1sw02tIt4uD7jMjnBQqXu3R4KYrPVN43SLPRBafZKCJ/xGKjpkLUQRu8S91sh0aGEpEbWbYdB/DE68JHlQWLTTrn3kWw6FMTOa6jzsdVp7OQSguqPWZM3kQiZX5hZcLrn489Bt5ExpzsTq+YYl1JY0q1ALdFKC2STCdVKv+q7nu/DbFh21tKXWqcsGGEmFJCQCOspQ81KP63cu/0p53sGe88uXwnMCxyqe1HrqJIQX2NfXM1fejwwb0uIPfE8MgeSCC2HNAZMYo0CXHyVT+OasV/8m7tedV4nKTqwRyc1CnEaLfZ+8gUdbH7KVbcc= X-Gm-Message-State: AOJu0YwThJrmvk04hJJZhgs5DVjAbJGNS0aS1MyxZGtLfpKLGvJwL9uR yHmUlm9A4HWKIj3ve+K7GaTw2/bbcEH2vzy3x5m40cgkOyT6VO8CJuWkACmDtyQNuZMnLL02KM7 9MiPypxLF1BX7fxLTLYrc6LSIafI= X-Received: by 2002:a17:90a:390c:b0:29b:a509:30aa with SMTP id y12-20020a17090a390c00b0029ba50930aamr112253pjb.14.1710190321684; Mon, 11 Mar 2024 13:52:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240310020509.647319-1-irogers@google.com> <20240310020509.647319-3-irogers@google.com> In-Reply-To: From: Andrii Nakryiko Date: Mon, 11 Mar 2024 13:51:49 -0700 Message-ID: Subject: Re: [PATCH v1 02/13] libbpf: Make __printf define conditional To: Ian Rogers Cc: Arnd Bergmann , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Adrian Hunter , Paolo Bonzini , Shuah Khan , Kees Cook , "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , Liam Howlett , Miguel Ojeda , Will Deacon , Mark Brown , David Laight , "Michael S. Tsirkin" , Shunsuke Mie , Yafang Shao , Kui-Feng Lee , James Clark , Nick Forrington , Leo Yan , German Gomez , Rob Herring , John Garry , Sean Christopherson , Anup Patel , Fuad Tabba , Andrew Jones , Chao Peng , Haibo Xu , Peter Xu , Vishal Annapurve , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 11, 2024 at 11:54=E2=80=AFAM Ian Rogers wr= ote: > > On Mon, Mar 11, 2024 at 10:49=E2=80=AFAM Andrii Nakryiko > wrote: > > > > On Sat, Mar 9, 2024 at 6:05=E2=80=AFPM Ian Rogers = wrote: > > > > > > libbpf depends upon linux/err.h which has a linux/compiler.h > > > dependency. In the kernel includes, as opposed to the tools version, > > > linux/compiler.h includes linux/compiler_attributes.h which defines > > > __printf. As the libbpf.c __printf definition isn't guarded by an > > > ifndef, this leads to a duplicate definition compilation error when > > > trying to update the tools/include/linux/compiler.h. Fix this by > > > adding the missing ifndef. > > > > > > Signed-off-by: Ian Rogers > > > --- > > > tools/lib/bpf/libbpf.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > > index afd09571c482..2152360b4b18 100644 > > > --- a/tools/lib/bpf/libbpf.c > > > +++ b/tools/lib/bpf/libbpf.c > > > @@ -66,7 +66,9 @@ > > > */ > > > #pragma GCC diagnostic ignored "-Wformat-nonliteral" > > > > > > -#define __printf(a, b) __attribute__((format(printf, a, b))) > > > +#ifndef __printf > > > +# define __printf(a, b) __attribute__((format(printf, a, b))) > > > > styling nit: don't add spaces between # and define, please > > > > overall LGTM > > > > Acked-by: Andrii Nakryiko > > > > Two questions, though. > > > > 1. It seems like just dropping #define __printf in libbpf.c compiles > > fine (I checked both building libbpf directly, and BPF selftest, and > > perf, and bpftool directly, all of them built fine). So we can > > probably just drop this. I'll need to add __printf on Github, but > > that's fine. > > > > 2. Logistics. Which tree should this patch go through? Can I land it > > in bpf-next or it's too much inconvenience for you? > > Thanks Andrii, > > dropping the #define (1) sgtm but the current compiler.h will fail to > build libbpf.c without the later compiler.h update in this series. > This causes another logistic issue for your point 2. Presumably if > this patch goes through bpf-next, the first patch "tools bpf: > Synchronize bpf.h with kernel uapi version" should also go through the > bpf-next. > That's what I'm saying, it seems to work without your patches already. At least on bpf-next/master. But it's ok, let's keep it and just add #ifndef guard, that will make my life easier when syncing to Github later one. Then the patch can go through other trees and eventually make it into bpf-next and then Github. So please keep my ack for #ifndef version, thanks. > Thanks, > Ian > > > > > +#endif > > > > > > static struct bpf_map *bpf_object__add_map(struct bpf_object *obj); > > > static bool prog_is_subprog(const struct bpf_object *obj, const stru= ct bpf_program *prog); > > > -- > > > 2.44.0.278.ge034bb2e1d-goog > > >