Received: by 10.223.164.202 with SMTP id h10csp2199708wrb; Fri, 24 Nov 2017 07:18:02 -0800 (PST) X-Google-Smtp-Source: AGs4zMbagYm8fOjpJOHGsUDSqMwtCF1oWkCi4V0o/qJTCIdXxfxYdvIpTkzc1aHZHNh+r1rARtmY X-Received: by 10.84.235.65 with SMTP id g1mr27974404plt.13.1511536682446; Fri, 24 Nov 2017 07:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511536682; cv=none; d=google.com; s=arc-20160816; b=qurKCCI1H4JyJCZ/WQhcvWqVoWBz4zW9qmE4oA7Er6wd5QbM6uBdLVaY871Zy8Nvyv IxHTRhPWM4pSSF/q3SzpKjLW6DBbjq0jJKsc9GZ8F0KzE7CGsm1FUH22YAD91uJCnR53 PuByLBniJHndYSOHISzQBxQz/JadsVtk0f6UcmrkPFXy5UUHiaZq1xL2wLdEE6nEAO76 xtGrFTErv3Brd1nCf11hMvtPoOSYsA3Lp57PKg5KkmXgYVL+OTHVGmv3+99vDP60c26I 42ttIVRqJA4K4MFCw/t29eBlkcPIUfwl3shqwjdf6OgcpraSWkppkCzurp633POBTHGm ZVHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=iahQnbDjBFO/dLp9UV9zSzsPgvoSJ+jxBYdDeEVJXuM=; b=DR1lf6jaGXugDwSlIT0C7Q9LBWo6v3MVAiXOFNhcx48YOBOZj0YdFlPwRRLWNuDbOU nDOMTtd4nrxvgVWAvWoke7r7Eo48P8utWNsihj98w5RU0uahGU1ez/oyPjZ0scmIg4Kl COuri49XaZPzJ/D9Vae69mEm5+DnHhsPkz+ODUkvqA0JdKJiHnW27goHnLsr9+ag5Vyw ty1hoquSV/lZ8mht+QesyENWyxZp6wmjToqygbqgXoe6TmfxOEfFmBc996kn5BeziYzW z+r2jsC1B2/2iNYWPF7Ns8/tKGUjMj8bdjWheww+Ubb12TJiU78YTKcCULPB5t5RBl/4 h61Q== ARC-Authentication-Results: i=1; mx.google.com; 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 j24si533913pfh.372.2017.11.24.07.17.50; Fri, 24 Nov 2017 07:18:02 -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; 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 S1753561AbdKXPRB (ORCPT + 77 others); Fri, 24 Nov 2017 10:17:01 -0500 Received: from www62.your-server.de ([213.133.104.62]:34187 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261AbdKXPRA (ORCPT ); Fri, 24 Nov 2017 10:17:00 -0500 Received: from [83.76.181.94] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1eIFim-0002Uy-TD; Fri, 24 Nov 2017 16:16:52 +0100 Subject: Re: perf test LLVM & clang 6 failing To: Arnaldo Carvalho de Melo , Wang Nan Cc: Alexei Starovoitov , Adrian Hunter , David Ahern , Jiri Olsa , Ingo Molnar , Namhyung Kim , Linux Kernel Mailing List , yhs@fb.com References: <20171124144717.GO8789@kernel.org> From: Daniel Borkmann Message-ID: <7cd16670-37c9-21f5-21c8-d50385ebc951@iogearbox.net> Date: Fri, 24 Nov 2017 16:16:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171124144717.GO8789@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.2/24069/Fri Nov 24 10:07:34 2017) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ +Yonghong ] On 11/24/2017 03:47 PM, Arnaldo Carvalho de Melo wrote: > FYI, just noticed, recently updated clang to version 6, from its > upstream git repo. Do you recall what was your LLVM version prior to this where it was working fine? (Wild guess from below would be the BPF inline asm support that was added recently to LLVM (2865ab6996) vs asm() used in headers included in the stdin header causing trouble due to arch mixup?) > root@jouet ~]# perf test -v LLVM > 37: LLVM search and compile : > 37.1: Basic BPF llvm compile : > --- start --- > test child forked, pid 5255 > Kernel build dir is set to /lib/modules/4.14.0+/build > set env: KBUILD_DIR=/lib/modules/4.14.0+/build > unset env: KBUILD_OPTS > include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h > set env: NR_CPUS=4 > set env: LINUX_VERSION_CODE=0x40e00 > set env: CLANG_EXEC=/usr/local/bin/clang > set env: CLANG_OPTIONS=-xc > set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h > set env: WORKING_DIR=/lib/modules/4.14.0+/build > set env: CLANG_SOURCE=- > llvm compiling command template: echo '/* > * bpf-script-example.c > * Test basic LLVM building > */ > #ifndef LINUX_VERSION_CODE > # error Need LINUX_VERSION_CODE > # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' > #endif > #define BPF_ANY 0 > #define BPF_MAP_TYPE_ARRAY 2 > #define BPF_FUNC_map_lookup_elem 1 > #define BPF_FUNC_map_update_elem 2 > > static void *(*bpf_map_lookup_elem)(void *map, void *key) = > (void *) BPF_FUNC_map_lookup_elem; > static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int flags) = > (void *) BPF_FUNC_map_update_elem; > > struct bpf_map_def { > unsigned int type; > unsigned int key_size; > unsigned int value_size; > unsigned int max_entries; > }; > > #define SEC(NAME) __attribute__((section(NAME), used)) > struct bpf_map_def SEC("maps") flip_table = { > .type = BPF_MAP_TYPE_ARRAY, > .key_size = sizeof(int), > .value_size = sizeof(int), > .max_entries = 1, > }; > > SEC("func=SyS_epoll_wait") > int bpf_func__SyS_epoll_wait(void *ctx) > { > int ind =0; > int *flag = bpf_map_lookup_elem(&flip_table, &ind); > int new_flag; > if (!flag) > return 0; > /* flip flag and store back */ > new_flag = !*flag; > bpf_map_update_elem(&flip_table, &ind, &new_flag, BPF_ANY); > return new_flag; > } > char _license[] SEC("license") = "GPL"; > int _version SEC("version") = LINUX_VERSION_CODE; > ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o - > test child finished with 0 > ---- end ---- > LLVM search and compile subtest 0: Ok > 37.2: kbuild searching : > --- start --- > test child forked, pid 5728 > Kernel build dir is set to /lib/modules/4.14.0+/build > set env: KBUILD_DIR=/lib/modules/4.14.0+/build > unset env: KBUILD_OPTS > include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h > set env: NR_CPUS=4 > set env: LINUX_VERSION_CODE=0x40e00 > set env: CLANG_EXEC=/usr/local/bin/clang > set env: CLANG_OPTIONS=-xc > set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h > set env: WORKING_DIR=/lib/modules/4.14.0+/build > set env: CLANG_SOURCE=- > llvm compiling command template: echo '/* > * bpf-script-test-kbuild.c > * Test include from kernel header > */ > #ifndef LINUX_VERSION_CODE > # error Need LINUX_VERSION_CODE > # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig' > #endif > #define SEC(NAME) __attribute__((section(NAME), used)) > > #include > #include > > SEC("func=vfs_llseek") > int bpf_func__vfs_llseek(void *ctx) > { > return 0; > } > > char _license[] SEC("license") = "GPL"; > int _version SEC("version") = LINUX_VERSION_CODE; > ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o - > In file included from :12: > In file included from /home/acme/git/linux/arch/x86/include/uapi/asm/ptrace.h:5: > In file included from /home/acme/git/linux/include/linux/compiler.h:237: > In file included from /home/acme/git/linux/arch/x86/include/asm/barrier.h:5: > In file included from /home/acme/git/linux/arch/x86/include/asm/alternative.h:10: > /home/acme/git/linux/arch/x86/include/asm/asm.h:145:50: error: unknown register name 'esp' in asm > register unsigned long current_stack_pointer asm(_ASM_SP); > ^ > /home/acme/git/linux/arch/x86/include/asm/asm.h:44:18: note: expanded from macro '_ASM_SP' > #define _ASM_SP __ASM_REG(sp) > ^ > /home/acme/git/linux/arch/x86/include/asm/asm.h:27:32: note: expanded from macro '__ASM_REG' > #define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg) > ^ > /home/acme/git/linux/arch/x86/include/asm/asm.h:18:29: note: expanded from macro '__ASM_SEL_RAW' > # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a) > ^ > /home/acme/git/linux/arch/x86/include/asm/asm.h:11:32: note: expanded from macro '__ASM_FORM_RAW' > # define __ASM_FORM_RAW(x) #x > ^ > :4:1: note: expanded from here > "esp" > ^ > 1 error generated. > ERROR: unable to compile - > Hint: Check error message shown above. > Hint: You can also pre-compile it into .o using: > clang -target bpf -O2 -c - > with proper -I and -D options. > Failed to compile test case: 'kbuild searching' > test child finished with -1 > ---- end ---- > LLVM search and compile subtest 1: FAILED! > 37.3: Compile source for BPF prologue generation : > --- force skipped --- > LLVM search and compile subtest 2: Skip > 37.4: Compile source for BPF relocation : > --- force skipped --- > LLVM search and compile subtest 3: Skip > [root@jouet ~]# clang -v > clang version 6.0.0 (http://llvm.org/git/clang.git 56cc8f8880db2ebc433eeb6b6a707c101467a186) (http://llvm.org/git/llvm.git 3656d83960a4f3fedf6d8f19043abf52379f78c3) > Target: x86_64-unknown-linux-gnu > Thread model: posix > InstalledDir: /usr/local/bin > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/7 > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/7 > Candidate multilib: .;@m64 > Candidate multilib: 32;@m32 > Selected multilib: .;@m64 > [root@jouet ~]# > From 1584959210990306928@xxx Fri Nov 24 14:48:12 +0000 2017 X-GM-THRID: 1584959210990306928 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread