Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>

authored by

Stefano Stabellini and committed by
David Vrabel
dfd57bc3 02c2433b

+66
+20
arch/arm64/Kconfig
··· 556 556 and the task is only allowed to execute a few safe syscalls 557 557 defined by each seccomp mode. 558 558 559 + config PARAVIRT 560 + bool "Enable paravirtualization code" 561 + help 562 + This changes the kernel so it can modify itself when it is run 563 + under a hypervisor, potentially improving performance significantly 564 + over full virtualization. 565 + 566 + config PARAVIRT_TIME_ACCOUNTING 567 + bool "Paravirtual steal time accounting" 568 + select PARAVIRT 569 + default n 570 + help 571 + Select this option to enable fine granularity task steal time 572 + accounting. Time spent executing other tasks in parallel with 573 + the current vCPU is discounted from the vCPU power. To account for 574 + that, there can be a small performance impact. 575 + 576 + If in doubt, say N here. 577 + 559 578 config XEN_DOM0 560 579 def_bool y 561 580 depends on XEN ··· 583 564 bool "Xen guest support on ARM64" 584 565 depends on ARM64 && OF 585 566 select SWIOTLB_XEN 567 + select PARAVIRT 586 568 help 587 569 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64. 588 570
+20
arch/arm64/include/asm/paravirt.h
··· 1 + #ifndef _ASM_ARM64_PARAVIRT_H 2 + #define _ASM_ARM64_PARAVIRT_H 3 + 4 + #ifdef CONFIG_PARAVIRT 5 + struct static_key; 6 + extern struct static_key paravirt_steal_enabled; 7 + extern struct static_key paravirt_steal_rq_enabled; 8 + 9 + struct pv_time_ops { 10 + unsigned long long (*steal_clock)(int cpu); 11 + }; 12 + extern struct pv_time_ops pv_time_ops; 13 + 14 + static inline u64 paravirt_steal_clock(int cpu) 15 + { 16 + return pv_time_ops.steal_clock(cpu); 17 + } 18 + #endif 19 + 20 + #endif
+1
arch/arm64/kernel/Makefile
··· 41 41 arm64-obj-$(CONFIG_PCI) += pci.o 42 42 arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o 43 43 arm64-obj-$(CONFIG_ACPI) += acpi.o 44 + arm64-obj-$(CONFIG_PARAVIRT) += paravirt.o 44 45 45 46 obj-y += $(arm64-obj-y) vdso/ 46 47 obj-m += $(arm64-obj-m)
+25
arch/arm64/kernel/paravirt.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify 3 + * it under the terms of the GNU General Public License version 2 as 4 + * published by the Free Software Foundation. 5 + * 6 + * This program is distributed in the hope that it will be useful, 7 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 + * GNU General Public License for more details. 10 + * 11 + * Copyright (C) 2013 Citrix Systems 12 + * 13 + * Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com> 14 + */ 15 + 16 + #include <linux/export.h> 17 + #include <linux/jump_label.h> 18 + #include <linux/types.h> 19 + #include <asm/paravirt.h> 20 + 21 + struct static_key paravirt_steal_enabled; 22 + struct static_key paravirt_steal_rq_enabled; 23 + 24 + struct pv_time_ops pv_time_ops; 25 + EXPORT_SYMBOL_GPL(pv_time_ops);