Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1450511ybc; Tue, 12 Nov 2019 21:53:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzZYkPQX+jikqJ4YHkhUW1oDtYMW7qvt/ACzXCpMl0+n0NPPHso0AIUFzkXeIuemyZaZtqd X-Received: by 2002:a50:91c4:: with SMTP id h4mr1763733eda.36.1573624391793; Tue, 12 Nov 2019 21:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573624391; cv=none; d=google.com; s=arc-20160816; b=ySh3lOHB/vPt0CTyzJxh0aBDEoLTV01epTFqi3Tj0kNLVtnVcPpYUMtXgcqacOiFPX 27Ou42hI2ZE78BlzQ96p0KsrnN7nkvbWaajfacpQMP8+zaWHBwHIVR8nn9KVwPIrG+L5 SECELPfTJ1nfZcGBZUeF0asZReCirpPDpRFPjcGPX7UHYf4tPsSJYWXXDHbq0WlPMQiE +XrReBbNxm/vLm4SrmL+W0mobuGdHy3vrrlLPGm4BYafL45AKbhYMvgF5UZuYTmc6q7/ ca98/jyD9XJZFZ0/8Aq2HX1EjtI8+6f9PtJae98/oW0gA8f5ufFDt9AWcXtn7XmqmRwy Wlvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=nSNBnHfDuOGVTZsa1//WZd8rW2c2XliYAXWmMqzCFUw=; b=JuH5yd3Y37V/Bnu5pTvQe67h2msS2gYut6rySWhU6XsS7ynjUphLBprJitbNDxX3cx iMzZY6Q1jO+akoBnXR7Hs8dFvGBn0VXgmLnqZXa+JPbaYTIowX3IPdkE5cPTtVrqENO6 NLKgf8KS68asEFtrE29BKkhyN6Bi4XeD4dl5B3fF+va874fGDusnFwkrj+KvMS4SxuvR w3a54QXZ7Qd4oPT762aLHdw5QhGAu68TkKg9QPz/12SQb7TpkEoG4qiE0Zn2uDC5XxEG XCZ5J/7ZLHQdsR27MlVC5paq1t3aOowFCxFJDGYzsHDnHE50K/1VgdKREuOenEbW4MxR XitA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=l5OJXQLa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si508845ejf.345.2019.11.12.21.52.46; Tue, 12 Nov 2019 21:53:11 -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=@163.com header.s=s110527 header.b=l5OJXQLa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726010AbfKMFwE (ORCPT + 99 others); Wed, 13 Nov 2019 00:52:04 -0500 Received: from m12-14.163.com ([220.181.12.14]:45254 "EHLO m12-14.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbfKMFwE (ORCPT ); Wed, 13 Nov 2019 00:52:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=nSNBn HfDuOGVTZsa1//WZd8rW2c2XliYAXWmMqzCFUw=; b=l5OJXQLa6t0qqIHUdG+rq PNQKZnueyEMrlFabV/apN1D5AAAgN/05B6/q6Eyr5vPOJC29W0c6r6pzXamUl8pY qiy4f8RAF1zacadyMlmIJX6ioyoWcUzPNgXho45pdhQmVcg5xxDONC4TGh37fZlr /gvIw0slfUKduQxEC4/gKI= Received: from [192.168.1.133] (unknown [112.25.212.39]) by smtp10 (Coremail) with SMTP id DsCowACnr5_mmctdFEfFCg--.555S2; Wed, 13 Nov 2019 13:51:35 +0800 (CST) Subject: Re: Question about "asm/rwonce.h: No such file or directory" To: Masahiro Yamada , Daniel Borkmann Cc: Will Deacon , linux-arch , Linux Kernel Mailing List , Alexei Starovoitov References: <1da2db04-da6a-cedb-e85a-6ded68dada82@163.com> <20191112123125.GD17835@willie-the-truck> <32a3b660-f4d2-268e-2206-d50073298c0c@iogearbox.net> From: Xiao Yang Message-ID: <021e7b46-047e-d381-9dca-bd61db08e4f8@163.com> Date: Wed, 13 Nov 2019 13:51:34 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-CM-TRANSID: DsCowACnr5_mmctdFEfFCg--.555S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGw47AF45Jr43Kry3XF47Jwb_yoWrXr43pa sxCF4xtF4UXFy5JrnFyw17Za4Utw4UKr1YgryUGry8ArnYvr13tr4xur1ruF9xXrWUJw1j yrZrW3y7Ww1UAaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bOSdkUUUUU= X-Originating-IP: [112.25.212.39] X-CM-SenderInfo: 5lfhs5xdqj5xldr6il2tof0z/xtbB0ghsXlUMSxvoNQAAs8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? 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 > >