Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: Use nproc --all for __NR_CPUS__ #12121

Merged
merged 1 commit into from Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bpf/Makefile.bpf
@@ -1,7 +1,7 @@
# Copyright 2017-2020 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

FLAGS := -I$(ROOT_DIR)/bpf/include -I$(ROOT_DIR)/bpf -D__NR_CPUS__=$(shell nproc) -O2 -g
FLAGS := -I$(ROOT_DIR)/bpf/include -I$(ROOT_DIR)/bpf -D__NR_CPUS__=$(shell nproc --all) -O2 -g

CLANG_FLAGS := ${FLAGS} -target bpf -std=gnu89 -nostdinc -emit-llvm
# eBPF verifier enforces unaligned access checks where necessary, so don't
Expand Down
2 changes: 1 addition & 1 deletion bpf/init.sh
Expand Up @@ -278,7 +278,7 @@ function bpf_compile()
-Wno-gnu-variable-sized-type-not-at-end \
-Wdeclaration-after-statement \
-I. -I$DIR -I$LIB -I$LIB/include \
-D__NR_CPUS__=$(nproc) \
-D__NR_CPUS__=$(nproc --all) \
-DENABLE_ARP_RESPONDER=1 \
-DHANDLE_NS=1 \
$EXTRA_OPTS \
Expand Down
4 changes: 2 additions & 2 deletions pkg/datapath/loader/compile.go
Expand Up @@ -23,10 +23,10 @@ import (
"io/ioutil"
"os"
"path"
"runtime"
"sync"

"github.com/cilium/cilium/pkg/command/exec"
"github.com/cilium/cilium/pkg/common"
"github.com/cilium/cilium/pkg/datapath/linux/probes"
"github.com/cilium/cilium/pkg/logging/logfields"
"github.com/cilium/cilium/pkg/option"
Expand Down Expand Up @@ -90,7 +90,7 @@ type directoryInfo struct {

var (
standardCFlags = []string{"-O2", "-target", "bpf", "-std=gnu89",
"-nostdinc", fmt.Sprintf("-D__NR_CPUS__=%d", runtime.NumCPU()),
"-nostdinc", fmt.Sprintf("-D__NR_CPUS__=%d", common.GetNumPossibleCPUs(log)),
"-Wall", "-Wextra", "-Werror", "-Wshadow",
"-Wno-address-of-packed-member",
"-Wno-unknown-warning-option",
Expand Down
2 changes: 1 addition & 1 deletion test/bpf/Makefile
Expand Up @@ -3,7 +3,7 @@

include ../../Makefile.defs

FLAGS := -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=$(shell nproc) -O2
FLAGS := -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=$(shell nproc --all) -O2
FLAGS_CLANG := -Wall -Wextra -Werror -Wshadow -Wno-unused-parameter
FLAGS_CLANG += -Wno-address-of-packed-member
FLAGS_CLANG += -Wno-unknown-warning-option
Expand Down