From patchwork Thu Jan 9 18:32:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 23067 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 730C4216DD for ; Thu, 9 Jan 2014 18:34:17 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf5693082qae.7 for ; Thu, 09 Jan 2014 10:34:16 -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=YHWvHJc/W9sP+c4b+EJAjqS6wQL6vQKYHscWsoL5eu5IBqG4NNd8hpgLzg8MNs4yoO scINpa1zfBDhWUnSInZArqbVc3K2xfoGkUewdnQXgrx09aKC1Cyduj/JkiP72dRie1yg nyygliKU85ED2N2D525VbPlYD2ZYF9TmUaqbbjHraPjfs33wgCCLT8LJdcCRR8C/Cys4 RwZ9T8pNdy5uc7IEkHlKnhq9dEexK5UzO0Y9gkaAcsMtP9Na4MB4EuWSO+J884u4k9mL CGlC5X8zDi211KSSQnNb8MjwG/qrlrT1Oz3gZVvxfgYR37bIp+ZKpY2r94P4+bVKfsFh TnsA== X-Gm-Message-State: ALoCoQmvWuKzhGbETbqruu80mQhTih2kKOgWo5xp1JoJkt+af2wnpGoeprEHXdaOXKCN795cnBkh X-Received: by 10.236.93.230 with SMTP id l66mr1475507yhf.10.1389292456692; Thu, 09 Jan 2014 10:34:16 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.76 with SMTP id gc12ls1261733qeb.44.gmail; Thu, 09 Jan 2014 10:34:16 -0800 (PST) X-Received: by 10.52.245.9 with SMTP id xk9mr2588158vdc.68.1389292456610; Thu, 09 Jan 2014 10:34:16 -0800 (PST) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id gx6si3169643vdc.154.2014.01.09.10.34.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Jan 2014 10:34:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.52 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.52; Received: by mail-vb0-f52.google.com with SMTP id p5so2500421vbn.11 for ; Thu, 09 Jan 2014 10:34:16 -0800 (PST) X-Received: by 10.58.134.40 with SMTP id ph8mr3133420veb.61.1389292456483; Thu, 09 Jan 2014 10:34:16 -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 ey3csp31634ved; Thu, 9 Jan 2014 10:34:15 -0800 (PST) X-Received: by 10.66.197.164 with SMTP id iv4mr5552064pac.18.1389292455413; Thu, 09 Jan 2014 10:34:15 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rt6si4609996pbc.138.2014.01.09.10.34.14; Thu, 09 Jan 2014 10:34:14 -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 S1755040AbaAISeB (ORCPT + 26 others); Thu, 9 Jan 2014 13:34:01 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:34839 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756488AbaAISdX (ORCPT ); Thu, 9 Jan 2014 13:33:23 -0500 X-IronPort-AV: E=Sophos;i="4.95,632,1384300800"; d="scan'208";a="89253908" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.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 1W1KPn-0001LZ-1D; Thu, 09 Jan 2014 18:33:11 +0000 From: Stefano Stabellini To: CC: , , , , , , , , , , , Stefano Stabellini Subject: [PATCH v9 5/5] xen/arm: account for stolen ticks Date: Thu, 9 Jan 2014 18:32:16 +0000 Message-ID: <1389292336-9292-5-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.212.52 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);