VIRT-6865: Merge PARAVIRT_TIME_ACCOUNTING support
Subsystems (3)
From: Stefano Stabellini <[email protected]>
This is for the qualcomm-bsp-ghs_8x96autogvmquin44_d7 branch.
My checkout with this change is here:/home/cat/tmontague/linux-kernels/qualcomm-bsp-ghs Feel free to poke around.
Commit message:
This is a combination of 2 commits:
commit 3f8f3fcd92d4c9fdcbf27eab39329c067521cf6a
Author: Stefano Stabellini <[email protected]>
Date: Mon Nov 23 10:33:49 2015 +0000
---
arm64: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops
Introduce CONFIG_PARAVIRT and PARAVIRT_TIME_ACCOUNTING on ARM64. Necessary duplication of paravirt.h and paravirt.c with ARM.
The only paravirt interface supported is pv_time_ops.steal_clock, so no runtime pvops patching needed.
This allows us to make use of steal_account_process_tick for stolen ticks accounting.
---
commit 692afb7fe6c312bcfb3e77913d1efa0cdedec5be
Author: Ingo Molnar <[email protected]>
Date: Thu Feb 2 14:47:27 2017 +0100
---
sched/headers: Prepare header dependency changes, move the <asm/paravirt.h> include to kernel/sched/sched.h
Recent header reorganizations unearthed this hidden dependency:
kernel/sched/core.c:199:25: error: 'paravirt_steal_rq_enabled' undeclared (first use in this function) kernel/sched/core.c:200:11: error: implicit declaration of function 'paravirt_steal_clock' [-Werror=implicit-function-declaration]
So move the asm/paravirt.h include from kernel/sched/cpuclock.c to kernel/sched/sched.h.
( NOTE: We do this change before doing the changes that introduce the build failure,
so the series remains fully bisectable. )
---
--- arch/arm64/Kconfig | 20 ++++++++++++++++++++ arch/arm64/include/asm/paravirt.h | 20 ++++++++++++++++++++ arch/arm64/kernel/paravirt.c | 25 +++++++++++++++++++++++++ kernel/sched/cputime.c | 1 - kernel/sched/sched.h | 4 ++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/include/asm/paravirt.h create mode 100644 arch/arm64/kernel/paravirt.c
arch/arm64/Kconfig +20 -0
@@ -774,6 +774,25 @@ config SECCOMP and the task is only allowed to execute a few safe syscalls defined by each seccomp mode. +config PARAVIRT + bool "Enable paravirtualization code" + help + This changes the kernel so it can modify itself when it is run + under a hypervisor, potentially improving performance significantly + over full virtualization. + +config PARAVIRT_TIME_ACCOUNTING + bool "Paravirtual steal time accounting" + select PARAVIRT + default n + help + Select this option to enable fine granularity task steal time + accounting. Time spent executing other tasks in parallel with + the current vCPU is discounted from the vCPU power. To account for + that, there can be a small performance impact. + + If in doubt, say N here. + config XEN_DOM0 def_bool y depends on XEN
@@ -782,6 +801,7 @@ config XEN bool "Xen guest support on ARM64" depends on ARM64 && OF select SWIOTLB_XEN + select PARAVIRT help Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64.
arch/arm64/include/asm/paravirt.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef _ASM_ARM64_PARAVIRT_H +#define _ASM_ARM64_PARAVIRT_H + +#ifdef CONFIG_PARAVIRT +struct static_key ; +extern struct static_key paravirt_steal_enabled; +extern struct static_key paravirt_steal_rq_enabled; + +struct pv_time_ops { +unsigned long long (*steal_clock)(int cpu); +}; +extern struct pv_time_ops pv_time_ops; + +static inline u64 paravirt_steal_clock (int cpu) +{ +return pv_time_ops.steal_clock (cpu); +} +#endif + +#endif
arch/arm64/kernel/paravirt.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* Copyright (C) 2013 Citrix Systems +* +* Author: Stefano Stabellini <[email protected]> +*/ + +#include <linux/export.h> +#include <linux/jump_label.h> +#include <linux/types.h> +#include <asm/paravirt.h> + +struct static_key paravirt_steal_enabled; +struct static_key paravirt_steal_rq_enabled; + +struct pv_time_ops pv_time_ops; +EXPORT_SYMBOL_GPL (pv_time_ops);
kernel/sched/cputime.c +0 -1
@@ -7,7 +7,6 @@#include <linux/cpufreq_times.h> #include "sched.h" -#ifdef CONFIG_IRQ_TIME_ACCOUNTING /*
kernel/sched/sched.h +4 -0
@@ -10,6 +10,10 @@#include <linux/tick.h> #include <linux/slab.h> +#ifdef CONFIG_PARAVIRT +#include <asm/paravirt.h> +#endif +#include "cpupri.h" #include "cpudeadline.h" #include "cpuacct.h"
Signature · 1 line
2.17.1
Please ignore!
Quoted 210 lines
-----Original Message-----
From: Tim Montague [mailto:[email protected]]
Sent: Friday, August 23, 2019 11:27 AM
To: Chad Page <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; Mike Galbraith <[email protected]>; Peter Zijlstra <[email protected]>; Thomas Gleixner <[email protected]>; [email protected]; Tim Montague <[email protected]>
Subject: VIRT-6865: MergePARAVIRT_TIME_ACCOUNTINGsupportFrom: Stefano Stabellini <[email protected]>
This is for the qualcomm-bsp-ghs_8x96autogvmquin44_d7 branch.
My checkout with this change is here:
/home/cat/tmontague/linux-kernels/qualcomm-bsp-ghsFeel free to poke around.Commit message:
This is a combination of 2 commits:
commit
3f8f3fcd92d4c9fdcbf27eab39329c067521cf6a
Author: Stefano Stabellini <[email protected]>
Date: Mon Nov 23 10:33:49 2015 +0000
---
arm64: introduceCONFIG_PARAVIRT,PARAVIRT_TIME_ACCOUNTINGandpv_time_opsIntroduce
CONFIG_PARAVIRTandPARAVIRT_TIME_ACCOUNTINGon ARM64. Necessary duplication ofparavirt.handparavirt.cwith ARM.The only paravirt interface supported is pv_time_ops.steal_clock, so no runtime pvops patching needed.
This allows us to make use of
steal_account_process_tickfor stolen ticks accounting.Signed-off-by Stefano Stabellini <[email protected]>Acked-by Marc Zyngier <[email protected]>---
commit
692afb7fe6c312bcfb3e77913d1efa0cdedec5be
Author: Ingo Molnar <[email protected]>
Date: Thu Feb 2 14:47:27 2017 +0100
---
sched/headers: Prepare header dependency changes, move the <asm/paravirt.h> include tokernel/sched/sched.hRecent header reorganizations unearthed this hidden dependency:
kernel/sched/core.c:199:25: error: 'paravirt_steal_rq_enabled' undeclared
(first use in this function)
kernel/sched/core.c:200:11: error: implicit declaration of function
'paravirt_steal_clock' [-Werror=implicit-function-declaration]So move the
asm/paravirt.hinclude fromkernel/sched/cpuclock.ctokernel/sched/sched.h.( NOTE: We do this change before doing the changes that introduce the build failure,
so the series remains fully bisectable. )Reported-by kbuild test robot <[email protected]>Acked-by Linus Torvalds <[email protected]>Cc Mike Galbraith <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>---
Signed-off-by Tim Montague <[email protected]>--- arch/arm64/Kconfig | 20 ++++++++++++++++++++ arch/arm64/include/asm/paravirt.h | 20 ++++++++++++++++++++ arch/arm64/kernel/paravirt.c | 25 +++++++++++++++++++++++++ kernel/sched/cputime.c | 1 - kernel/sched/sched.h | 4 ++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/include/asm/paravirt.h create mode 100644 arch/arm64/kernel/paravirt.carch/arm64/Kconfig +20
-0@@ -774,6 +774,25 @@ config SECCOMP and the task is only allowed to execute a few safe syscalls defined by each seccomp mode. +config PARAVIRT + bool "Enable paravirtualization code" + help + This changes the kernel so it can modify itself when it is run + under a hypervisor, potentially improving performance significantly + over full virtualization. + +config PARAVIRT_TIME_ACCOUNTING + bool "Paravirtual steal time accounting" + select PARAVIRT + default n + help + Select this option to enable fine granularity task steal time + accounting. Time spent executing other tasks in parallel with + the current vCPU is discounted from the vCPU power. To account for + that, there can be a small performance impact. + + If in doubt, say N here. + config XEN_DOM0 def_bool y depends on XEN@@ -782,6 +801,7 @@ config XEN bool "Xen guest support on ARM64" depends on ARM64 && OF select SWIOTLB_XEN + select PARAVIRT help Say Y if you want to run Linux in a Virtual Machine on Xen onARM64.
arch/arm64/include/asm/paravirt.h new file +20
-0@@ -0,0 +1,20 @@ +#ifndef _ASM_ARM64_PARAVIRT_H +#define _ASM_ARM64_PARAVIRT_H + +#ifdef CONFIG_PARAVIRT +struct static_key ; +extern struct static_key paravirt_steal_enabled; +extern struct static_key paravirt_steal_rq_enabled; + +struct pv_time_ops { +unsigned long long (*steal_clock)(int cpu); +}; +extern struct pv_time_ops pv_time_ops; + +static inline u64 paravirt_steal_clock (int cpu) +{ +return pv_time_ops.steal_clock (cpu); +} +#endif + +#endif arch/arm64/kernel/paravirt.c new file +25
-0@@ -0,0 +1,25 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* Copyright (C) 2013 Citrix Systems +* +* Author: Stefano Stabellini <[email protected]> +*/ + +#include <linux/export.h> +#include <linux/jump_label.h> +#include <linux/types.h> +#include <asm/paravirt.h> + +struct static_key paravirt_steal_enabled; +struct static_key paravirt_steal_rq_enabled; + +struct pv_time_ops pv_time_ops; +EXPORT_SYMBOL_GPL (pv_time_ops);kernel/sched/cputime.c +0
-1@@ -7,7 +7,6 @@#include <linux/cpufreq_times.h> #include "sched.h" -#ifdef CONFIG_IRQ_TIME_ACCOUNTING /* kernel/sched/sched.h +4
-1@@ -10,6 +10,10 @@#include <linux/tick.h> #include <linux/slab.h> +#ifdef CONFIG_PARAVIRT +#include <asm/paravirt.h> +#endif +#include "cpupri.h" #include "cpudeadline.h" #include "cpuacct.h" --2.17.1