From patchwork Wed Jan 8 18:49:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 22981 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 B7036202E2 for ; Wed, 8 Jan 2014 18:51:08 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf8527913iec.2 for ; Wed, 08 Jan 2014 10:51:08 -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=YvI87gQ4dBAbkwS2f+KlUAPrbp6tEMlm/QO8SNI6UEI=; b=EZHIYy1JPIPH5J9Wg6tgl90kHeLAtinO2TP1gCOGj3hfMYPaBfhldpQJ5pRywvc5Yk 8PJrtUfupzLHRULE5c1LmdOLNzTvy48gpQPvj1WpmnC6WRYoyP5DBLdrLhlsrXyCmw2+ 7tixBadEKugmdwyN7T/N5kAdZpLlmUmD9WZDPr8XeKmwMaFPFANYXsM4yURUfRejFkrD byU3qfIHAQhsHBfWwptEImsp4HuveUSrRNnxYb9/vdDm9z0FT7vadMT/Z/ksWhpPjuEf qP2qK5ZUgEYN+y7eFAfmdWbvd7FZ368ngjvlydRSN25Tqi1gn9iSZ3ZBlOsa2yvLVOvs ng2Q== X-Gm-Message-State: ALoCoQmmIhCmYK5pXlGn5sYL/MyyWBWKgf1ltqADitI9nIV8Wqyf0/nt4o7Dv0AfR9uNtywewlcs X-Received: by 10.50.32.103 with SMTP id h7mr16272451igi.6.1389207068005; Wed, 08 Jan 2014 10:51:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.70 with SMTP id ok6ls730169qeb.86.gmail; Wed, 08 Jan 2014 10:51:07 -0800 (PST) X-Received: by 10.52.163.65 with SMTP id yg1mr68841977vdb.14.1389207067873; Wed, 08 Jan 2014 10:51:07 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id xw5si1114278vec.8.2014.01.08.10.51.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 10:51:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x11so1417325vbb.8 for ; Wed, 08 Jan 2014 10:51:07 -0800 (PST) X-Received: by 10.58.181.71 with SMTP id du7mr11386573vec.25.1389207067757; Wed, 08 Jan 2014 10:51:07 -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 ey3csp245607ved; Wed, 8 Jan 2014 10:51:07 -0800 (PST) X-Received: by 10.68.232.132 with SMTP id to4mr24946158pbc.141.1389207066627; Wed, 08 Jan 2014 10:51:06 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eb3si1332141pbc.176.2014.01.08.10.51.05; Wed, 08 Jan 2014 10:51:06 -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 S1751537AbaAHSvD (ORCPT + 26 others); Wed, 8 Jan 2014 13:51:03 -0500 Received: from smtp.citrix.com ([66.165.176.89]:9052 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756880AbaAHSu5 (ORCPT ); Wed, 8 Jan 2014 13:50:57 -0500 X-IronPort-AV: E=Sophos;i="4.95,625,1384300800"; d="scan'208";a="90999329" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 08 Jan 2014 18:50:57 +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; Wed, 8 Jan 2014 13:50:56 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1W0yDL-0005sr-9b; Wed, 08 Jan 2014 18:50:51 +0000 From: Stefano Stabellini To: CC: , , , , , , , , , , , Stefano Stabellini Subject: [PATCH v8 6/6] xen/arm: account for stolen ticks Date: Wed, 8 Jan 2014 18:49:58 +0000 Message-ID: <1389206998-27875-6-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: MIA2 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.212.49 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: , Register the runstate_memory_area with the hypervisor. Use pv_time_ops.steal_clock to account for stolen ticks. Signed-off-by: Stefano Stabellini --- Changes in v4: - don't use paravirt_steal_rq_enabled: we do not support retrieving stolen ticks for vcpus other than one we are running on. Changes in v3: - use BUG_ON and smp_processor_id. --- arch/arm/xen/enlighten.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 8550123..fa8bdc0 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -14,7 +14,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -154,6 +157,19 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma, } EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range); +unsigned long long xen_stolen_accounting(int cpu) +{ + struct vcpu_runstate_info state; + + BUG_ON(cpu != smp_processor_id()); + + xen_get_runstate_snapshot(&state); + + WARN_ON(state.state != RUNSTATE_running); + + return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline]; +} + static void __init xen_percpu_init(void *unused) { struct vcpu_register_vcpu_info info; @@ -171,6 +187,8 @@ static void __init xen_percpu_init(void *unused) BUG_ON(err); per_cpu(xen_vcpu, cpu) = vcpup; + xen_setup_runstate_info(cpu); + enable_percpu_irq(xen_events_irq, 0); put_cpu(); } @@ -313,6 +331,9 @@ static int __init xen_init_events(void) on_each_cpu(xen_percpu_init, NULL, 0); + pv_time_ops.steal_clock = xen_stolen_accounting; + static_key_slow_inc(¶virt_steal_enabled); + return 0; } postcore_initcall(xen_init_events);