From patchwork Tue Feb 16 18:11:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8330491 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA1B6C02AA for ; Tue, 16 Feb 2016 18:14:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACE5320268 for ; Tue, 16 Feb 2016 18:14:07 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF4ED202A1 for ; Tue, 16 Feb 2016 18:14:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aVk63-0003KV-2E; Tue, 16 Feb 2016 18:11:35 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aVk61-0003Jp-GU for xen-devel@lists.xenproject.org; Tue, 16 Feb 2016 18:11:33 +0000 Received: from [193.109.254.147] by server-6.bemta-14.messagelabs.com id B6/D2-16618-45663C65; Tue, 16 Feb 2016 18:11:32 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1455646291!24344008!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52826 invoked from network); 16 Feb 2016 18:11:32 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-10.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Feb 2016 18:11:32 -0000 Received: by mail-wm0-f66.google.com with SMTP id b205so14508354wmb.1 for ; Tue, 16 Feb 2016 10:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=dlxdcXbUW2hXRmQi9KI9BKGsWu7Sk/XOqnTKh/uVWq0=; b=ITT/L8vclf2oSgqMqw1EYyKlbpi8CvFwNx4aENZ/H41tzBgcWQuaMM+775DJnmHcEk 5a/qJQ5RtFxprzeLC+BTgYnM+57SSYihO8lXXj4fWkfkxxdf3YNRFogPiir9Aq2zel5m FouZChP1Yc0znLMr1rLUE14ZHa8x+P52lj7WuIDMaDMdCGlFUZuLAAqesdMNl7JTuUR0 0w7n3/jA/uo7sOGcqP4eJbAaAK2MbnV50oxfEbNHd7fQmdZpE0zWPFX6c/Y3GiwJhYwP ZblnHJUn9LoVX0ol4nqUFQqZsx9r45RwT/aGhdD5yAL1IK3XpeCfejK+cLO/PF5W9lSe rUkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=dlxdcXbUW2hXRmQi9KI9BKGsWu7Sk/XOqnTKh/uVWq0=; b=TrGwixgywevJksScnRP8vwnNdmT0VrQJmsV227jOdhGNpylnaEJBa8wtUUoJBJrjPI BqEtkB6IUaTysyRGWBIbvOpBdBDIWQo1ERq+adUlh/2Bjj8RCvB4bllDx09PpfKkh4sp Y0gODfJAvFQNpANpN91XuU6157Zr2iWPHQ5BkTZa/JD0I880PTJKJcRBKTCn5u8Mo0CP tmxd78nMjyGOlqsuBnYWycT8GV9ITsTZbAIvLNz5lhuQz8d7reTLMUNZnbifnV98l2Zd DCrUNZS0yVq2sM4tH0KV6Ln8z8lxRSUQV2LroqiAuLBE8N0MI5gUZE2SyZ5cEWxpL/kX e3aQ== X-Gm-Message-State: AG10YOS51eJ4kKXsb2ZSpJ0HlLMhzX9R9qRl2Ub9v7H1/iBgkRpJoMoGI4WSxd6/3w8WAg== X-Received: by 10.194.21.135 with SMTP id v7mr23693904wje.131.1455646291742; Tue, 16 Feb 2016 10:11:31 -0800 (PST) Received: from Solace.station (net-2-35-170-8.cust.vodafonedsl.it. [2.35.170.8]) by smtp.gmail.com with ESMTPSA id r10sm31255677wjz.24.2016.02.16.10.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Feb 2016 10:11:31 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 16 Feb 2016 19:11:29 +0100 Message-ID: <20160216181129.27876.21579.stgit@Solace.station> In-Reply-To: <20160216180550.27876.22680.stgit@Solace.station> References: <20160216180550.27876.22680.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH v2 03/16] xen: sched: improve domain creation tracing X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP by doing the following two things: - move TRC_SCHED_DOM_{ADD,REM}, into the functions that do the actual scheduling-related domain initialization; - add two 'generic' DOM_{ADD,REM} events. They're made part of the TRC_DOM0 tracing class, as Dom0 is, usually, from where domains are created and destroyed. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap Acked-by: Jan Beulich --- Cc: George Dunlap Cc: Konrad Rzeszutek Wilk --- Changes from v1: * added generic domain creation and destruction events, as suggested during review. --- xen/common/domain.c | 5 ++++- xen/common/schedule.c | 4 ++-- xen/include/public/trace.h | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 425767c..45273d4 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -270,6 +270,8 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags, d->domain_id = domid; + TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); + lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain"); if ( (err = xsm_alloc_security_domain(d)) != 0 ) @@ -864,10 +866,11 @@ void domain_destroy(struct domain *d) if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 ) return; + TRACE_1D(TRC_DOM0_DOM_REM, d->domain_id); + cpupool_rm_domain(d); /* Delete from task list and task hashtable. */ - TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id); spin_lock(&domlist_update_lock); pd = &domain_list; while ( *pd != d ) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c87922f..27695e3 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -241,8 +241,6 @@ int sched_init_vcpu(struct vcpu *v, unsigned int processor) if ( v->sched_priv == NULL ) return 1; - TRACE_2D(TRC_SCHED_DOM_ADD, v->domain->domain_id, v->vcpu_id); - /* Idle VCPUs are scheduled immediately, so don't put them in runqueue. */ if ( is_idle_domain(d) ) { @@ -369,12 +367,14 @@ void sched_destroy_vcpu(struct vcpu *v) int sched_init_domain(struct domain *d) { SCHED_STAT_CRANK(dom_init); + TRACE_1D(TRC_SCHED_DOM_ADD, d->domain_id); return SCHED_OP(DOM2OP(d), init_domain, d); } void sched_destroy_domain(struct domain *d) { SCHED_STAT_CRANK(dom_destroy); + TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id); SCHED_OP(DOM2OP(d), destroy_domain, d); } diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index 274f8f6..5ef9c37 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -85,6 +85,9 @@ ((TRC_SCHED_##_c << TRC_SCHED_ID_SHIFT) & TRC_SCHED_ID_MASK) ) + \ (_e & TRC_SCHED_EVT_MASK) ) +/* Trace classes for DOM0 operations */ +#define TRC_DOM0_DOMOPS 0x00041000 /* Domains manipulations */ + /* Trace classes for Hardware */ #define TRC_HW_PM 0x00801000 /* Power management traces */ #define TRC_HW_IRQ 0x00802000 /* Traces relating to the handling of IRQs */ @@ -113,6 +116,9 @@ #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15) #define TRC_SCHED_SHUTDOWN_CODE (TRC_SCHED_VERBOSE + 16) +#define TRC_DOM0_DOM_ADD (TRC_DOM0_DOMOPS + 1) +#define TRC_DOM0_DOM_REM (TRC_DOM0_DOMOPS + 2) + #define TRC_MEM_PAGE_GRANT_MAP (TRC_MEM + 1) #define TRC_MEM_PAGE_GRANT_UNMAP (TRC_MEM + 2) #define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3)