From 41a06d4961f51af4ec4799aaee202c744584f31e Mon Sep 17 00:00:00 2001 From: Jia He Date: Thu, 2 Apr 2020 09:54:47 +0800 Subject: [PATCH] build: Add "pmu=off" to default cpu_features option The user sometimes doesn't care about pmu usage(e.g. perf tool profiling). But pmu will cost significant overhead on boot time and virtualization context switch. E.g. on arm64, if guest pmu is enabled, kvm should save and restore all PMU registers when guest/host switching. for dmesg comparision: Before: [ 0.007620] bus: 'platform': driver_probe_device: matched device pmu with driver armv8-pmu [ 0.007622] bus: 'platform': really_probe: probing driver armv8-pmu with device pmu [ 0.036282] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available [ 0.036285] driver: 'armv8-pmu': driver_bound: bound to device 'pmu' [ 0.036295] bus: 'platform': really_probe: bound device pmu to driver armv8-pmu After: [ 0.007935] bus: 'platform': driver_probe_device: matched device alarmtimer with driver alarmtimer [ 0.007937] bus: 'platform': really_probe: probing driver alarmtimer with device alarmtimer [ 0.007940] driver: 'alarmtimer': driver_bound: bound to device 'alarmtimer' [ 0.007944] bus: 'platform': really_probe: bound device alarmtimer to driver alarmtimer Because s390 doest support "pmu=off", keep the default CPUFEATURES to be "" instead of "pmu=off". Fixes: #2576 Signed-off-by: Jia He --- Makefile | 2 ++ arch/amd64-options.mk | 1 + arch/arm64-options.mk | 1 + arch/ppc64le-options.mk | 2 ++ arch/s390x-options.mk | 1 + 5 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 14a0ea4799..416d678a9d 100644 --- a/Makefile +++ b/Makefile @@ -398,6 +398,7 @@ USER_VARS += KERNELTYPE_ACRN USER_VARS += KERNELTYPE_CLH USER_VARS += FIRMWAREPATH USER_VARS += MACHINEACCELERATORS +USER_VARS += CPUFEATURES USER_VARS += DEFMACHINETYPE_CLH USER_VARS += KERNELPARAMS USER_VARS += LIBEXECDIR @@ -604,6 +605,7 @@ $(GENERATED_FILES): %: %.in $(MAKEFILE_LIST) VERSION .git-commit -e "s|@INITRDPATH@|$(INITRDPATH)|g" \ -e "s|@FIRMWAREPATH@|$(FIRMWAREPATH)|g" \ -e "s|@MACHINEACCELERATORS@|$(MACHINEACCELERATORS)|g" \ + -e "s|@CPUFEATURES@|$(CPUFEATURES)|g" \ -e "s|@FIRMWAREPATH_CLH@|$(FIRMWAREPATH_CLH)|g" \ -e "s|@DEFMACHINETYPE_CLH@|$(DEFMACHINETYPE_CLH)|g" \ -e "s|@KERNELPARAMS@|$(KERNELPARAMS)|g" \ diff --git a/arch/amd64-options.mk b/arch/amd64-options.mk index 7bfc5ff97f..b04acb8f73 100644 --- a/arch/amd64-options.mk +++ b/arch/amd64-options.mk @@ -8,6 +8,7 @@ MACHINETYPE := pc KERNELPARAMS := MACHINEACCELERATORS := +CPUFEATURES := pmu=off QEMUCMD := qemu-system-x86_64 diff --git a/arch/arm64-options.mk b/arch/arm64-options.mk index f8c62c3711..02227d2e85 100644 --- a/arch/arm64-options.mk +++ b/arch/arm64-options.mk @@ -8,6 +8,7 @@ MACHINETYPE := virt KERNELPARAMS := MACHINEACCELERATORS := +CPUFEATURES := pmu=off QEMUCMD := qemu-system-aarch64 diff --git a/arch/ppc64le-options.mk b/arch/ppc64le-options.mk index a309ca51db..480f936e5d 100644 --- a/arch/ppc64le-options.mk +++ b/arch/ppc64le-options.mk @@ -8,5 +8,7 @@ MACHINETYPE := pseries KERNELPARAMS := MACHINEACCELERATORS := +CPUFEATURES := pmu=off + KERNELTYPE := uncompressed #This architecture must use an uncompressed kernel. QEMUCMD := qemu-system-ppc64le diff --git a/arch/s390x-options.mk b/arch/s390x-options.mk index 3256e46288..f54c064572 100644 --- a/arch/s390x-options.mk +++ b/arch/s390x-options.mk @@ -8,5 +8,6 @@ MACHINETYPE := s390-ccw-virtio KERNELPARAMS := MACHINEACCELERATORS := +CPUFEATURES := QEMUCMD := qemu-system-s390x