Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1500665ybc; Tue, 12 Nov 2019 23:02:13 -0800 (PST) X-Google-Smtp-Source: APXvYqz0T3EnVxITilmkBkY1R2Ifq4gWaZk9rfTTL51AbVL9WwuLYJrJDG2KgPUkMTAnSVKHq3Db X-Received: by 2002:a17:907:20b8:: with SMTP id pw24mr1282788ejb.28.1573628533110; Tue, 12 Nov 2019 23:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573628533; cv=none; d=google.com; s=arc-20160816; b=UcS60WOdoQChMlmA70Cu+TT1QAYIwTmKCaOqHyH00ZKtf+6ERhbYnnPYbSufrrJJRw WsEt3IthmoBL6cHfiiYlD0WsYFvShLRbme56NrHHynL9KLpLZJVtWp8xyuuEOGKsK0QC X7UWXGaXEO+m06hrh5JxdAzatEXLzkwBhzKv0ZyS7Bh7RHiWiDyliAVCtM/cmQAB4sus ixTur1eFtMdvpNP3Y7S7E5i28PXSs7gNmAoLgu4h3ZoO8PAPK1O+Xq0NGiuzd2+cralb /W+cEaprI5I8BR3l8Itvco5L66TTO3GQcYG5huKhq71l/Eocut6ahbe2f7GsL8qrVVJS qUzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=byHb37rnBYBfqef4BLf0fmIb0zqlNb4FnaUPBW8GooY=; b=n1XKomk/MShB4k/QFz/RyHJ1cyCfi4sOdQmWihnxfglbghuEdoLoHTaxrBPZJnrc7o Ydz6dVilrgrdCI1ox4Zh+63uhmbq2guH0jQownSFvDF8i1+TLcrw6Iras2devPQo7VHt L33EonRxQNhQajngoO7WMOHB2WyNG3YL8TY6T1y5tBuB9sCJcEPJWJ0PZoM4RzTn732/ KhWYDIdv8D9UT+QLepbAdNtW4RzmnkX63TwbnWPwSGy9c1nodv2DvDovc1MWPPBrzEDO +QBE8JISJXJLLP1JNEriGc+SOOqbErZcaBlOvODoiwXULmiTqSoc9012GtHNH460ozR0 OoVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uwXSpZN8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b28si775541edn.230.2019.11.12.23.01.49; Tue, 12 Nov 2019 23:02:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uwXSpZN8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbfKMG6N (ORCPT + 99 others); Wed, 13 Nov 2019 01:58:13 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:54831 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbfKMG6M (ORCPT ); Wed, 13 Nov 2019 01:58:12 -0500 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (authenticated) by conssluserg-02.nifty.com with ESMTP id xAD6vw7r003047; Wed, 13 Nov 2019 15:57:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com xAD6vw7r003047 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1573628279; bh=byHb37rnBYBfqef4BLf0fmIb0zqlNb4FnaUPBW8GooY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uwXSpZN8NUc3GyzgQBlE4/70/YKIXTmhaJYu2ul5EMO8sXLA0CrZYhqRTAskePU/R I8l70R3yGk94gchriFFqfJz3zcYq6JfVM0wtsXimIjPHoxKjjFab7HuyikBw1c7keA 15toF60dyqTX1NpfM1soQywhewTDMPqrP1syuH5Zi1cr++AWthGUmKRHZoSR/BPcXh CmrC/XYd3UZL3qokDCLoPlOHU+mTIoCctXCd4yD+xH1pf5WKdGd91PkwXcueI75q7w eHeHe1w558JWLNMjWClw1XQsjQ5opE1BVt7bIwYrKyTeJXGG0q5xvUbat+T1FKUDZ+ ex3Mg8oqynmVQ== X-Nifty-SrcIP: [209.85.217.45] Received: by mail-vs1-f45.google.com with SMTP id k15so679155vsp.2; Tue, 12 Nov 2019 22:57:58 -0800 (PST) X-Gm-Message-State: APjAAAUt+lX8ClEa6Ndi+l9LxVC05BbpLg0pfiDQ2DeLJz1gh2tRlJkY PW6ntd04ZKMIQe1JwVe5XrUtTQstxMrpL+kfmKw= X-Received: by 2002:a67:d31b:: with SMTP id a27mr985586vsj.215.1573628277943; Tue, 12 Nov 2019 22:57:57 -0800 (PST) MIME-Version: 1.0 References: <1da2db04-da6a-cedb-e85a-6ded68dada82@163.com> <20191112123125.GD17835@willie-the-truck> <32a3b660-f4d2-268e-2206-d50073298c0c@iogearbox.net> <021e7b46-047e-d381-9dca-bd61db08e4f8@163.com> In-Reply-To: <021e7b46-047e-d381-9dca-bd61db08e4f8@163.com> From: Masahiro Yamada Date: Wed, 13 Nov 2019 15:57:22 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Question about "asm/rwonce.h: No such file or directory" To: Xiao Yang Cc: Daniel Borkmann , Will Deacon , linux-arch , Linux Kernel Mailing List , Alexei Starovoitov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 13, 2019 at 2:52 PM Xiao Yang wrote: > > On 11/13/19 1:28 PM, Masahiro Yamada wrote: > > On Wed, Nov 13, 2019 at 12:13 AM Daniel Borkmann wrote: > >> On 11/12/19 1:50 PM, Masahiro Yamada wrote: > >>> On Tue, Nov 12, 2019 at 9:31 PM Will Deacon wrote: > >>>> [+lkml, Masahiro, Alexei and Daniel] > >>>> > >>>> On Tue, Nov 12, 2019 at 04:56:39PM +0800, Xiao Yang wrote: > >>>>> With your patch[1], I alway get the following error when building > >>>>> tools/bpf: > >>>> In case people want to reproduce this, my branch is here: > >>>> > >>>> https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=lto > >>>> > >>>>> ---------------------------------------------------------------------------------- > >>>>> > >>>>> make -C tools/bpf/ > >>>>> make: Entering directory > >>>>> '/usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/tools/bpf' > >>>>> > >>>>> Auto-detecting system features: > >>>>> ... libbfd: [ on ] > >>>>> ... disassembler-four-args: [ OFF ] > >>>>> > >>>>> CC bpf_jit_disasm.o > >>>>> CC bpf_dbg.o > >>>>> In file included from > >>>>> /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/include/uapi/linux/filter.h:9:0, > >>>>> from > >>>>> /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/tools/bpf/bpf_dbg.c:41: > >>>>> /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/include/linux/compiler.h:247:24: > >>>>> fatal error: asm/rwonce.h: No such file or directory > >>>>> #include > >>>>> ^ > >>>>> compilation terminated. > >>>>> Makefile:61: recipe for target 'bpf_dbg.o' failed > >>>>> make: *** [bpf_dbg.o] Error 1 > >>>>> make: *** Waiting for unfinished jobs.... > >>>>> make: Leaving directory > >>>>> > >>>>> ---------------------------------------------------------------------------------- > >>>>> > >>>>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=lto&id=642a312d47ceb54603630d9d04f5052f3b46d9a3 > >>>>> > >>>>> It seems that include/linux/compiler.h cannot find the asm/rwonce.h because > >>>>> tools/bpf/Makefile doesn't include arch/*/include/generated/asm/rwonce.h. > >>>> The problem with referring to the generated files is that they don't exist > >>>> unless you've configured the main source directory. The real problem here > >>>> seems to be that tools/bpf/ refers directly to header files in the kernel > >>>> sources without any understanding of kbuild, and therefore mandatory-y > >>>> headers simply don't exist when it goes looking for them. > >> Hmm, I am puzzled why that is. :/ I think there are two options, i) remove it > >> from CFLAGS like below (at least this doesn't let the build fail in my case > >> but requires linux headers to be installed) or ii) add a copy of filter.h to > >> tools/include/uapi/linux/filter.h so the few tools can just reuse it. We do have > >> bpf_common.h and bpf.h there already. > >> > >> diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile > >> index 5d1995fd369c..08dfd289174c 100644 > >> --- a/tools/bpf/Makefile > >> +++ b/tools/bpf/Makefile > >> @@ -10,7 +10,6 @@ MAKE = make > >> INSTALL ?= install > >> > >> CFLAGS += -Wall -O2 > >> -CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include > >> > >> # This will work when bpf is built in tools env. where srctree > >> # isn't set and when invoked from selftests build, where srctree > >> > > > > I think this is the most sane fix > > to include the linux/filter.h in the system. > > > > (probably, it is located in /usr/include/linux/filter.h) > > Hi Masahiro, > > Is it correct for include/linux/compiler.h to include ? Sorry, I really do not understand what you are doing. include/linux/compiler.h is only for kernel-space. Shrug if a user-land program includes it. > On x86_64 arch, asm/rwonce.h is generated in > ./arch/x86/include/generated/ directory and compiler.h cannot find it. > > Best Regards, > > XIao Yang > > > > > > -- Best Regards Masahiro Yamada