From patchwork Thu Jan 9 18:32:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 23066 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D1DB5216DD for ; Thu, 9 Jan 2014 18:34:07 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf13594189iec.2 for ; Thu, 09 Jan 2014 10:34:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=laA53+fLGJ9bqygMZlBZISLi2xT5S/j1ymsM+yhvips=; b=cSYSPVCQciM88JEpnIAGW1ujYdzKOHCaah/1Gk6zlUHsdJBZi46e5HkRYLv7OwS2y8 xBgouNQTmT4HL8aavrjOTmio5VtSUH/4/JXySCPYEca9Dsb19B/1r4JQXTVINhwFEE9m 70LcP0sJwgDgPg+MEVpDr7JQ6zdI6YRQkaEETXFqJhWcfIH2EPMXzhdUq6jjlO58t91D rZA18SF2rlm9E3mGddNIJGxN72tAnYPMfYsAHsq9LMV5cTQocq0cS7Dgh4CduBh/5YHs EGUpB5lZzu637FTC2ew3uwYzh2eftkr+0xwCwHpLuNmSuLLrLtVGdCXuov5k5D1f39Bb WgFQ== X-Gm-Message-State: ALoCoQmLyhBvYdAgYr3G/z20X+TdUkfiRmXSlahUwq6jHuB3MNPGq/R+Hb0gYePyxmDWON5exGfD X-Received: by 10.182.126.137 with SMTP id my9mr1783401obb.13.1389292447160; Thu, 09 Jan 2014 10:34:07 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.75.129 with SMTP id c1ls206853qew.25.gmail; Thu, 09 Jan 2014 10:34:07 -0800 (PST) X-Received: by 10.52.69.231 with SMTP id h7mr2525728vdu.64.1389292447036; Thu, 09 Jan 2014 10:34:07 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id sp7si3189085vdc.86.2014.01.09.10.34.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Jan 2014 10:34:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so2680177veb.25 for ; Thu, 09 Jan 2014 10:34:06 -0800 (PST) X-Received: by 10.58.152.130 with SMTP id uy2mr2472278veb.71.1389292446906; Thu, 09 Jan 2014 10:34:06 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp31624ved; Thu, 9 Jan 2014 10:34:06 -0800 (PST) X-Received: by 10.66.155.7 with SMTP id vs7mr5483049pab.42.1389292427056; Thu, 09 Jan 2014 10:33:47 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si4611823pbg.125.2014.01.09.10.33.46; Thu, 09 Jan 2014 10:33:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756630AbaAISdh (ORCPT + 26 others); Thu, 9 Jan 2014 13:33:37 -0500 Received: from smtp.citrix.com ([66.165.176.89]:11020 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754709AbaAISdR (ORCPT ); Thu, 9 Jan 2014 13:33:17 -0500 X-IronPort-AV: E=Sophos;i="4.95,632,1384300800"; d="scan'208";a="91397937" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 09 Jan 2014 18:33:16 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Thu, 9 Jan 2014 13:33:15 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1W1KPm-0001LZ-VT; Thu, 09 Jan 2014 18:33:10 +0000 From: Stefano Stabellini To: CC: , , , , , , , , , , , Stefano Stabellini , , Subject: [PATCH v9 3/5] arm: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops Date: Thu, 9 Jan 2014 18:32:14 +0000 Message-ID: <1389292336-9292-3-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introduce CONFIG_PARAVIRT and PARAVIRT_TIME_ACCOUNTING on 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 Acked-by: Christopher Covington Acked-by: Ian Campbell CC: linux@arm.linux.org.uk CC: will.deacon@arm.com CC: nico@linaro.org CC: marc.zyngier@arm.com CC: cov@codeaurora.org CC: arnd@arndb.de CC: olof@lixom.net --- Changes in v7: - ifdef CONFIG_PARAVIRT the content of paravirt.h. Changes in v3: - improve commit description and Kconfig help text; - no need to initialize pv_time_ops; - add PARAVIRT_TIME_ACCOUNTING. --- arch/arm/Kconfig | 20 ++++++++++++++++++++ arch/arm/include/asm/paravirt.h | 20 ++++++++++++++++++++ arch/arm/kernel/Makefile | 2 ++ arch/arm/kernel/paravirt.c | 25 +++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 arch/arm/include/asm/paravirt.h create mode 100644 arch/arm/kernel/paravirt.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c1f1a7e..d6c3ba1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1874,6 +1874,25 @@ config SWIOTLB config IOMMU_HELPER def_bool SWIOTLB +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 @@ -1885,6 +1904,7 @@ config XEN depends on !GENERIC_ATOMIC64 select ARM_PSCI select SWIOTLB_XEN + select PARAVIRT help Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. diff --git a/arch/arm/include/asm/paravirt.h b/arch/arm/include/asm/paravirt.h new file mode 100644 index 0000000..8435ff59 --- /dev/null +++ b/arch/arm/include/asm/paravirt.h @@ -0,0 +1,20 @@ +#ifndef _ASM_ARM_PARAVIRT_H +#define _ASM_ARM_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 diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index a30fc9b..34cf9a6 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -87,6 +87,7 @@ obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o ifneq ($(CONFIG_ARCH_EBSA110),y) obj-y += io.o endif +obj-$(CONFIG_PARAVIRT) += paravirt.o head-y := head$(MMUEXT).o obj-$(CONFIG_DEBUG_LL) += debug.o @@ -97,5 +98,6 @@ ifeq ($(CONFIG_ARM_PSCI),y) obj-y += psci.o obj-$(CONFIG_SMP) += psci_smp.o endif +obj-$(CONFIG_PARAVIRT) += paravirt.o extra-y := $(head-y) vmlinux.lds diff --git a/arch/arm/kernel/paravirt.c b/arch/arm/kernel/paravirt.c new file mode 100644 index 0000000..53f371e --- /dev/null +++ b/arch/arm/kernel/paravirt.c @@ -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 + */ + +#include +#include +#include +#include + +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);