Unverified Commit dec74be4 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!773 Compiler: Add value profile support for kernel.

Merge Pull Request from: @xiongzhou4 
 
Provides value profile support for kernel.
The implementation is based on the existing GCOV feature of the kernel. When the option is opened, the GCOV option `-fprofile-arcs` is changed to `-fprofile-generate`. The latter includes the former and value profile, which can provide more comprehensive feedback directed optimization ability.
The added feature is called  _PGO kernel_ , which can be used to improve the performance of a single application runtime environment.

kernel option(default is n):
CONFIG_PGO_KERNEL=y 
 
Link:https://gitee.com/openeuler/kernel/pulls/773

 

Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parents 866cc5dd 2872514e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -665,7 +665,12 @@ endif # KBUILD_EXTMOD
# Defaults to vmlinux, but the arch makefile usually adds further targets
all: vmlinux

CFLAGS_GCOV	:= -fprofile-arcs -ftest-coverage \
ifeq ($(CONFIG_PGO_KERNEL),y)
CFLAGS_GCOV := -fprofile-generate
else
CFLAGS_GCOV := -fprofile-arcs
endif
CFLAGS_GCOV += -ftest-coverage \
	$(call cc-option,-fno-tree-loop-im) \
	$(call cc-disable-warning,maybe-uninitialized,)
export CFLAGS_GCOV
+1 −0
Original line number Diff line number Diff line
@@ -7075,6 +7075,7 @@ CONFIG_SECTION_MISMATCH_WARN_ONLY=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# CONFIG_PGO_KERNEL is not set
# end of Compile-time checks and compiler options

#
+2 −0
Original line number Diff line number Diff line
@@ -9,3 +9,5 @@ ccflags-y := -D__KVM_VHE_HYPERVISOR__
obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o
obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \
	 ../fpsimd.o ../hyp-entry.o

GCOV_PROFILE_switch.o := n
+6 −1
Original line number Diff line number Diff line
@@ -4,7 +4,12 @@
#

GPROF_OPT += -pg

ifeq ($(CONFIG_PGO_KERNEL),y)
GCOV_OPT += -fprofile-generate -ftest-coverage
else
GCOV_OPT += -fprofile-arcs -ftest-coverage
endif

CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT)
CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT)
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ $(USER_OBJS) $(UNPROFILE_OBJS): \
	CHECKFLAGS := $(patsubst $(NOSTDINC_FLAGS),,$(CHECKFLAGS))

# The stubs can't try to call mcount or update basic block data
ifeq ($(CONFIG_PGO_KERNEL),y)
define unprofile
	$(patsubst -pg,,$(patsubst -fprofile-generate -ftest-coverage,,$(1)))
endef
else
define unprofile
	$(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
endef
endif
Loading