From patchwork Sun May 22 05:01:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9130711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8BD02607D3 for ; Sun, 22 May 2016 05:04:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CB0728191 for ; Sun, 22 May 2016 05:04:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2034428195; Sun, 22 May 2016 05:04:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B215D281A2 for ; Sun, 22 May 2016 05:04:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4LWa-0005e1-Mi; Sun, 22 May 2016 05:02:00 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4LWZ-0005dW-Pz for xen-devel@lists.xen.org; Sun, 22 May 2016 05:01:59 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id F6/B6-18833-74D31475; Sun, 22 May 2016 05:01:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRWlGSWpSXmKPExsVyMXThYV03W8d wg/vvJSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozJs/4yFbw0rri75ThrA+M/zS5GLg4hgQmM ElOvn2fvYuTkYBGYxyzxZlY+SEJCoJ9V4ty11YwgCQmBGInPi1ewQ9jVEj+nXWADsYUEFCR+T zjEBDFpHpPEve0NYEVsAhoST37NACsSEZCWuPb5MiNIEbPACUaJRS9awYqEBewkbrxsYoVYrS ox8cYsFhCbV8BB4uqb68xdjBxA2+QkFrz3ATE5BRwlLnzXhtjrINGwbiHLBEaBBYwMqxjVi1O LylKLdI31kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECw4oBCHYwdvxzOsQoycGk JMqb2m0fLsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCd6+1Y7iQYFFqempFWmYOMMBh0hIcPEoiv KtA0rzFBYm5xZnpEKlTjJYcW35fW8vE8WnjHSC5beq9tUxCLHn5ealS4rzzQBoEQBoySvPgxs Gi8BKjrJQwLyPQgUI8BalFuZklqPKvGMU5GJWEeS+DTOHJzCuB2/oK6CAmoIMeSjuAHFSSiJC SamDsu/xxlqepuORtN285sVVH0oVYZrimVShdzFik5fbM/qiGeK9518zEEsZY9Z/7Aj1+XEqI uNCneePevm1hK2yynlgz3ql+EnxnYYOE/Fz/CVarlQ33HfUoebSWOXAZg/abEiHBwIvNf2pf5 j57+8R3cnivXvaSC4wTF/4Qf3PRo7dVZvZMdSclluKMREMt5qLiRAC1XqErvQIAAA== X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1463893317!14760137!1 X-Originating-IP: [209.85.161.195] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43860 invoked from network); 22 May 2016 05:01:58 -0000 Received: from mail-yw0-f195.google.com (HELO mail-yw0-f195.google.com) (209.85.161.195) by server-3.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 May 2016 05:01:58 -0000 Received: by mail-yw0-f195.google.com with SMTP id j74so887360ywg.1 for ; Sat, 21 May 2016 22:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cardoe.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jIRaHw1+HvpW8zIm24rndakcz7Lo7hI+dYq8Yj2gowo=; b=FFnunfvEfP+P943TfztKFvhB8sSlnCfWa7L7lhFjVPilyLps+VZD/9uNW4ejHEXbU7 GgmmmdlqvlPFFaWrRgz6kYAvzHyREMHjTolFrRjQEQfKbt8jBc20s+UG/2yedj6GLVur G6KIuPb9Z5DwfMZsH8NVtEqQ4IP3UWMjclWw0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jIRaHw1+HvpW8zIm24rndakcz7Lo7hI+dYq8Yj2gowo=; b=M6MpWevOmqsyPidufFneL3twqujFjZl5q6titELo5aslagJBjvBGjXOcjxxc7eMYKv 4od3KGBnynLBX2MAhl3r51Tyvx1JzI/DaX0AlUofGEHGSICs1Os7I9/8EO9BphZSNwRy 3NgAfnIVgGOAbS3y2c7NXsH1J0vCNHk5IdsISrchLV2gx3QKQNLKyCnERD9FSb1kl5p0 /gRwJqnSksAa8yVZXTTeuCWl+ZL2QpIvxiRF56lNYoULEVCT6nhlLX3BhUlHYNYK8SsI NhT8kH8eE28xyCL2GX4qtRuhY2u/8+a0TQZl/r5/dNcTYfTqQy9/lyQOb1TysnbBjRHJ hweA== X-Gm-Message-State: AOPr4FWFbgFk55y0zCQsdHSmqe3IpAtPndmnO30p/+Jng5dxvXX/4f//jltYbDOcf70DzQ== X-Received: by 10.129.122.207 with SMTP id v198mr6302525ywc.82.1463893317007; Sat, 21 May 2016 22:01:57 -0700 (PDT) Received: from localhost.localdomain (c-68-46-196-185.hsd1.al.comcast.net. [68.46.196.185]) by smtp.gmail.com with ESMTPSA id z20sm15961686ywd.44.2016.05.21.22.01.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 21 May 2016 22:01:56 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Sun, 22 May 2016 00:01:35 -0500 Message-Id: <1463893295-2610-7-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1463893295-2610-1-git-send-email-cardoe@cardoe.com> References: <1463893295-2610-1-git-send-email-cardoe@cardoe.com> Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH v4 6/6] build: convert lock_profile to Kconfig X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Convert the 'lock_profile' option to Kconfig as CONFIG_LOCK_PROFILE. Signed-off-by: Doug Goldstein --- CC: Stefano Stabellini CC: Julien Grall CC: Jan Beulich CC: Andrew Cooper --- INSTALL | 1 - xen/Kconfig.debug | 7 +++++++ xen/Rules.mk | 5 +++-- xen/arch/arm/xen.lds.S | 2 +- xen/arch/x86/domain.c | 2 +- xen/arch/x86/xen.lds.S | 2 +- xen/common/keyhandler.c | 2 +- xen/common/spinlock.c | 10 +++++----- xen/common/sysctl.c | 2 +- xen/include/xen/spinlock.h | 4 ++-- 10 files changed, 22 insertions(+), 15 deletions(-) diff --git a/INSTALL b/INSTALL index 623887d..616a67a 100644 --- a/INSTALL +++ b/INSTALL @@ -227,7 +227,6 @@ VGABIOS_REL_DATE="dd Mon yyyy" The following variables can be used to tweak some aspects of the hypervisor build. -lock_profile=y lto=y During tools build external repos will be cloned into the source tree. diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index 0678049..303bf36 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -27,6 +27,13 @@ config FRAME_POINTER maybe slower, but it gives very useful debugging information in case of any Xen bugs. +config LOCK_PROFILE + bool "Lock Profiiling" + ---help--- + Lock profiling allows you to see how often locks are taken and blocked. + You can use serial console to print (and reset) using 'l' and 'L' + respectively, or the 'xenlockprof' tool. + config PERF_COUNTERS bool "Performance Counters" ---help--- diff --git a/xen/Rules.mk b/xen/Rules.mk index 6a756f6..23c9181 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -3,7 +3,6 @@ # If you change any of these configuration options then you must # 'make clean' before rebuilding. # -lock_profile ?= n lto ?= n -include $(BASEDIR)/include/config/auto.conf @@ -23,6 +22,9 @@ endif ifneq ($(origin kexec),undefined) $(error "You must use 'make menuconfig' to enable/disable kexec now.") endif +ifneq ($(origin lock_profile),undefined) +$(error "You must use 'make menuconfig' to enable/disable lock_profile now.") +endif ifneq ($(origin perfc),undefined) $(error "You must use 'make menuconfig' to enable/disable perfc now.") endif @@ -56,7 +58,6 @@ ifneq ($(clang),y) CFLAGS += -Wa,--strip-local-absolute endif -CFLAGS-$(lock_profile) += -DLOCK_PROFILE CFLAGS-$(CONFIG_FRAME_POINTER) += -fno-omit-frame-pointer ifneq ($(max_phys_irqs),) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 1f010bd..76982b2 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -54,7 +54,7 @@ SECTIONS *(.rodata) *(.rodata.*) -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE . = ALIGN(POINTER_ALIGN); __lock_profile_start = .; *(.lockprofile.data) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 5af2cc5..978ec3a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -251,7 +251,7 @@ struct domain *alloc_domain_struct(void) #endif -#ifndef LOCK_PROFILE +#ifndef CONFIG_LOCK_PROFILE BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); #endif d = alloc_xenheap_pages(order, MEMF_bits(bits)); diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b14bcd2..a43b29d 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -103,7 +103,7 @@ SECTIONS *(.ex_table.pre) __stop___pre_ex_table = .; -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE . = ALIGN(POINTER_ALIGN); __lock_profile_start = .; *(.lockprofile.data) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 65b70ce..16de6e8 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -64,7 +64,7 @@ static struct keyhandler { KEYHANDLER('P', perfc_reset, "reset performance counters", 0), #endif -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE KEYHANDLER('l', spinlock_profile_printall, "print lock profile info", 1), KEYHANDLER('L', spinlock_profile_reset, "reset lock profile info", 0), #endif diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index b377bb9..017bdf3 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -85,7 +85,7 @@ void spin_debug_disable(void) #endif -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE #define LOCK_PROFILE_REL \ if (lock->profile) \ @@ -212,7 +212,7 @@ int _spin_trylock(spinlock_t *lock) if ( cmpxchg(&lock->tickets.head_tail, old.head_tail, new.head_tail) != old.head_tail ) return 0; -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE if (lock->profile) lock->profile->time_locked = NOW(); #endif @@ -227,7 +227,7 @@ int _spin_trylock(spinlock_t *lock) void _spin_barrier(spinlock_t *lock) { spinlock_tickets_t sample; -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE s_time_t block = NOW(); #endif @@ -238,7 +238,7 @@ void _spin_barrier(spinlock_t *lock) { while ( observe_head(&lock->tickets) == sample.head ) arch_lock_relax(); -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE if ( lock->profile ) { lock->profile->time_block += NOW() - block; @@ -296,7 +296,7 @@ void _spin_unlock_recursive(spinlock_t *lock) } } -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE struct lock_profile_anc { struct lock_profile_qhead *head_q; /* first head of this type */ diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 11bef0e..b4f235e 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -121,7 +121,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) break; #endif -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE case XEN_SYSCTL_lockprof_op: ret = spinlock_profile_control(&op->u.lockprof_op); break; diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 88b53f9..c1883bd 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -20,7 +20,7 @@ struct lock_debug { }; #define spin_debug_disable() ((void)0) #endif -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE #include @@ -144,7 +144,7 @@ typedef struct spinlock { u16 recurse_cnt:4; #define SPINLOCK_MAX_RECURSE 0xfu struct lock_debug debug; -#ifdef LOCK_PROFILE +#ifdef CONFIG_LOCK_PROFILE struct lock_profile *profile; #endif } spinlock_t;