From patchwork Tue May 3 14:29:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9004351 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3826B9F65D for ; Tue, 3 May 2016 14:31:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 71C032028D for ; Tue, 3 May 2016 14:31:48 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 4FE5A2022A for ; Tue, 3 May 2016 14:31:47 +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 1axbKV-0004IY-7w; Tue, 03 May 2016 14:29:39 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axbKT-0004HX-U8 for xen-devel@lists.xen.org; Tue, 03 May 2016 14:29:38 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id F9/C3-25799-1D5B8275; Tue, 03 May 2016 14:29:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRWlGSWpSXmKPExsVyMXThId0LWzX CDf5dFLJY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDOO7tnNXtBiWPH6yRHWBsYT6l2MXBxCAhMY JX59380E4rAIzGOWePTuHzuIIyHQzyox5fRvoAwnkBMj8frvPxYIu0pi7bKDjCC2kICCxO8Jh 5ggRk1hklj+fCYbSIJNQEPiya8ZYLaIgLTEtc+XGUGKmAVOMEosetHKDpIQFrCTWD3nAlgRi4 CqxJPj74E2cHDwCjhIrN6SDGJKCMhJLHjvA2JyCjhKvN6RDrHWQeJ+032mCYwCCxgZVjGqF6c WlaUW6ZrrJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhhUDEOxgPDbZ+RCjJAeT kijvjyUa4UJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeH9uAcoJFqWmp1akZeYAAxwmLcHBoyTCe w0kzVtckJhbnJkOkTrFaMmx5fe1tUwcnzbeAZLbpt5byyTEkpeflyolznsLpEEApCGjNA9uHC wKLzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmY9xfIFJ7MvBK4ra+ADmICOih7vSrIQSWJCCm pBkY/r2Me/xiDWYIcOfdMeWr4ed3JHVkuKpI11ZkpOm4Om1Yl/BBOV78d0PugJFqCx63B+kxX lI6XStA+tbZzU/JmBFqzMQpOkFWwmGG/SODraz7mxw/Pi5kahgS/ef2wMc3k0Ef75p/6S6tT7 ooGG//69/Zc7bWHKy0UmM0eiFVzLzv3aslxCyWW4oxEQy3mouJEAA6GAFi9AgAA X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1462285774!34052009!1 X-Originating-IP: [209.85.161.194] 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 17160 invoked from network); 3 May 2016 14:29:36 -0000 Received: from mail-yw0-f194.google.com (HELO mail-yw0-f194.google.com) (209.85.161.194) by server-3.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 3 May 2016 14:29:36 -0000 Received: by mail-yw0-f194.google.com with SMTP id y6so1770589ywe.0 for ; Tue, 03 May 2016 07:29:36 -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=Q0HDSNO986Q9IeQbrkwEjAOCh4jVicDWnWFYbH1QEOA=; b=E9JxLeRtt8DdissPAvFA8zQ3IlB2uocoP2PPHXv1+DK6RvXJpaXJHUvWNjzpue7yUB TBfDUDuSVHWXEHNVt7hKtMT6w+pI8+3E0dHqm5iGJZKBqevmWPBxdx6/vBWooQct370c m7ZgUS10TVcNwNok/9S0YD8BQE64yFoai70yY= 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=Q0HDSNO986Q9IeQbrkwEjAOCh4jVicDWnWFYbH1QEOA=; b=TNPFEGY/ZwprULwhnDCPDoOtyVuv0i40epC3ye3k36+E9eaMVi9CFi+giKxI3C+rIx 4QOaI35vR99jH12u2a5gAyfb+rxHm0JLZDvnh5+O+5SwMUCn0Ret1/LvaKJW2ighwIzc ylCxeAwMkWL1izuuRA/vs0lYYRYl+JcPT+L3ZUTDAPzcqqtC+Z/u/pjhUUebUAt1ezoH FGHC6v8gBKqmKGrMsmsMnznjLrMR7UtTlAwIUVr417pHMKP/5hB/Bdj57k1JfHPkHyhq kjlTJvIlFqPBgsPUE3n7acrMFPn7NSkNFxn7TPY4SDJUWyvRSMB5X0mMBAaMB6D2QF/x HnjQ== X-Gm-Message-State: AOPr4FV65OkO9p89G8D/Gpb+VCRLyWV3BM2BjWGOtkUdMlgyps+3Hck+FSaZqBv9xsBZdw== X-Received: by 10.37.204.142 with SMTP id l136mr1289909ybf.13.1462285774601; Tue, 03 May 2016 07:29:34 -0700 (PDT) Received: from swanson.lan (c-68-46-196-185.hsd1.al.comcast.net. [68.46.196.185]) by smtp.gmail.com with ESMTPSA id l132sm1879409ywb.26.2016.05.03.07.29.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 May 2016 07:29:33 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 3 May 2016 09:29:13 -0500 Message-Id: <1462285753-5588-8-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1462285753-5588-1-git-send-email-cardoe@cardoe.com> References: <1462285753-5588-1-git-send-email-cardoe@cardoe.com> Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH v2 7/7] 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-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 Convert the 'lock_profile' option to Kconfig as CONFIG_LOCK_PROFILE. Signed-off-by: Doug Goldstein Reviewed-by: Jan Beulich --- CC: Stefano Stabellini CC: Julien Grall CC: Jan Beulich CC: Andrew Cooper --- INSTALL | 1 - xen/Kconfig.debug | 8 ++++++++ xen/Rules.mk | 2 -- 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, 20 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 3ea717e..a03aca9 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -28,6 +28,14 @@ config FRAME_POINTER maybe slower, but it gives very useful debugging information in case of any Xen bugs. +config LOCK_PROFILE + bool "Lock Profiiling" + default n + ---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_ARRAYS bool "Performance Counter Array Histograms" default n diff --git a/xen/Rules.mk b/xen/Rules.mk index 7e2cb5f..3015c5b 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 @@ -43,7 +42,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;