Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1896068pxb; Sat, 21 Nov 2020 01:51:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqsjAbpwfiJTlt4Q5Sw7lUk0WQgMm7pPSMZYjQJGbUACDxnpiJBK7jU79nr8tFlopXPSmk X-Received: by 2002:a17:906:3ecf:: with SMTP id d15mr10039452ejj.297.1605952264062; Sat, 21 Nov 2020 01:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605952264; cv=none; d=google.com; s=arc-20160816; b=cYcFwHoZfCUOk4IGTsvs6YCeowqSzGjOVRAYgiew2JxTYQQ3Xj+4eSCO4u16M6meg7 iRX4I60C5miT6w0hZRwiNPXPPS2vEKrXuHGiqHmWQ+jDafNurqworJySls69YtpS1XDW njPt2gxrVPORpFfuDAy0rcYAJQ5fw48S+VT/FT2jgBsi3+iChedKbAR+8AH06IBIK0gM IzTTLQyote5T/NKTGFI7IsfqF7416j1tEzurPBvFuDk/wOVRmDWqiXsWGxgZGixOBPXZ 9Uh7LfYXC31HaQKkIFcR2LWatR3HXKqGXfDYiyOF1KINjd5kEj5Z4maK4GYaiFs3Q3rP 72mQ== 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=BQiLNTLnW3SLtn0YsnDFKEJnLKO+RrQeEC1pO6DUX3I=; b=ZGMr7zACk567e40wSynn38YnhHGh8hIcaW3oVqfSoWLSzgzyXOvhld3PgqJqODUkOp Qw7EiFSw+lx/yuoyDmCxrdgQByjrqPqIzzoSYDrWaFnwTdxdWr4ii7ROL+RlkMQr2pey gg4mUwoFuH0CHf59TLxpFIqeuhr43c9+El02tZAULrBeM2HagK6jPbki1XVi/X1LoXCd GR1ALPFPTr1ayuyUvtxJ8QpnnYQEA5J5XP25MHgNA/oNrW3cHcXUlYEioGDffl3RuVM3 h0iil/9NMauFMEVzChnYOPOY0IHm4fIlmEIX4uDBl5QTpiOpf6z6b1boGp+SHZn84iy9 yFRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NDK1nLAg; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si3219092ejp.666.2020.11.21.01.50.40; Sat, 21 Nov 2020 01:51:04 -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=@google.com header.s=20161025 header.b=NDK1nLAg; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbgKUJs7 (ORCPT + 99 others); Sat, 21 Nov 2020 04:48:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727378AbgKUJs6 (ORCPT ); Sat, 21 Nov 2020 04:48:58 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3278C061A4A for ; Sat, 21 Nov 2020 01:48:57 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id u19so16986813lfr.7 for ; Sat, 21 Nov 2020 01:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BQiLNTLnW3SLtn0YsnDFKEJnLKO+RrQeEC1pO6DUX3I=; b=NDK1nLAguE/ieGaWEY+FmLBnFzKQ+keiUbLA87fRWbeoBl0TUnxoIWidngljNw3njr T9o8cTivwQ/PNTS8SRA8GGOH3lhovcdXa7KS3UtRt1obJiBdyCZZl9Xlfw4rzkmyGOTd uLGvEZ1QZa5J6Tp8nfw/NzJd+K1nkbMjtRkcCChOxm0B7P2+fVxhLjJYZYL3Q7DkFqaR T3AKSwfY5cZnPoVzlZ66HzscshjnesEaQzqHuuFTVW0GRzwo5rZ75HFGKONmKLB103Am QO3KboK3J0HYVm4pMpi2LzNDqw5WjPohXcC1BMna74BqabedOAZCTbSZTqUHiUTJ5sWr xRZA== 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=BQiLNTLnW3SLtn0YsnDFKEJnLKO+RrQeEC1pO6DUX3I=; b=N5is0ZY1ulbNpGKTXEcsD5yDu3TcFry3y3ghIJZtTytCcbwYKQOHRMcLUKXy0cI05r S4N7JunpjMXaqRxjbsrbvsGu3CQx1x4bBeWnCnH0w9AUIqkPkgaf4Xdqk17Q8ZHoWzM6 JzILp4stPPLGdOtVWeFX52DGF0mWOq+0w0e92tFXzppi3dlQVZGtzcRRGkB5vJAA2dJY 4sPaJAWp0CJ2AHt8xZUd4WTLkWXZow2vkt91UEoD3PVTMU58uJoHyyIKDjTIKCelCRfO 8iACkRgQ6b4Jkm7hLAMSUG/DE783vFFspupk/ueSNHpP+WskXY8Xm27QZ9wgbl2tRMCe y9Ug== X-Gm-Message-State: AOAM532P0d4QkZ1xWI586+Xfa91W1ViuKNtqyjqRW0xMKQepeTwGKevJ EME38C5v7GaFrXDE9mjfno9rc7lXFM8BImjPMZeOdg== X-Received: by 2002:a05:6512:110a:: with SMTP id l10mr9769828lfg.167.1605952135886; Sat, 21 Nov 2020 01:48:55 -0800 (PST) MIME-Version: 1.0 References: <20201119085022.3606135-1-davidgow@google.com> In-Reply-To: From: David Gow Date: Sat, 21 Nov 2020 17:48:44 +0800 Message-ID: Subject: Re: [RFC PATCH] bpf: preload: Fix build error when O= is set To: Andrii Nakryiko Cc: Alexei Starovoitov , Daniel Borkmann , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Networking , bpf , open list , Brendan Higgins , Masami Hiramatsu , linux-um Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 21, 2020 at 3:38 PM Andrii Nakryiko wrote: > > On Thu, Nov 19, 2020 at 12:51 AM David Gow wrote: > > > > If BPF_PRELOAD is enabled, and an out-of-tree build is requested with > > make O=, compilation seems to fail with: > > > > tools/scripts/Makefile.include:4: *** O=.kunit does not exist. Stop. > > make[4]: *** [../kernel/bpf/preload/Makefile:8: kernel/bpf/preload/libbpf.a] Error 2 > > make[3]: *** [../scripts/Makefile.build:500: kernel/bpf/preload] Error 2 > > make[2]: *** [../scripts/Makefile.build:500: kernel/bpf] Error 2 > > make[2]: *** Waiting for unfinished jobs.... > > make[1]: *** [.../Makefile:1799: kernel] Error 2 > > make[1]: *** Waiting for unfinished jobs.... > > make: *** [Makefile:185: __sub-make] Error 2 > > > > By the looks of things, this is because the (relative path) O= passed on > > the command line is being passed to the libbpf Makefile, which then > > can't find the directory. Given OUTPUT= is being passed anyway, we can > > work around this by explicitly setting an empty O=, which will be > > ignored in favour of OUTPUT= in tools/scripts/Makefile.include. > > Strange, but I can't repro it. I use make O= all the > time with no issues. I just tried specifically with a make O=.build, > where .build is inside Linux repo, and it still worked fine. See also > be40920fbf10 ("tools: Let O= makes handle a relative path with -C > option") which was supposed to address such an issue. So I'm wondering > what exactly is causing this problem. > [+ linux-um list] Hmm... From a quick check, I can't reproduce this on x86, so it's possibly a UML-specific issue. The problem here seems to be that $PWD is, for whatever reason, equal to the srcdir on x86, but not on UML. In general, $PWD behaves pretty weirdly -- I don't fully understand it -- but if I add a tactical "PWD := $(shell pwd)" or use $(CURDIR) instead, the issue shows up on x86 as well. I guess this is because PWD only gets updated when set by a shell or something, and UML does this somewhere? Thoughts? Cheers, -- David > > > > Signed-off-by: David Gow > > --- > > > > Hi all, > > > > I'm not 100% sure this is the correct fix here -- it seems to work for > > me, and makes some sense, but let me know if there's a better way. > > > > One other thing worth noting is that I've been hitting this with > > make allyesconfig on ARCH=um, but there's a comment in the Kconfig > > suggesting that, because BPF_PRELOAD depends on !COMPILE_TEST, that > > maybe it shouldn't be being built at all. I figured that it was worth > > trying to fix this anyway. > > > > Cheers, > > -- David > > > > > > kernel/bpf/preload/Makefile | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/bpf/preload/Makefile b/kernel/bpf/preload/Makefile > > index 23ee310b6eb4..39848d296097 100644 > > --- a/kernel/bpf/preload/Makefile > > +++ b/kernel/bpf/preload/Makefile > > @@ -5,7 +5,7 @@ LIBBPF_A = $(obj)/libbpf.a > > LIBBPF_OUT = $(abspath $(obj)) > > > > $(LIBBPF_A): > > - $(Q)$(MAKE) -C $(LIBBPF_SRCS) OUTPUT=$(LIBBPF_OUT)/ $(LIBBPF_OUT)/libbpf.a > > + $(Q)$(MAKE) -C $(LIBBPF_SRCS) O= OUTPUT=$(LIBBPF_OUT)/ $(LIBBPF_OUT)/libbpf.a > > > > userccflags += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi \ > > -I $(srctree)/tools/lib/ -Wno-unused-result > > -- > > 2.29.2.454.gaff20da3a2-goog > >