From patchwork Tue May 24 13:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9133729 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 931C16075E for ; Tue, 24 May 2016 13:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8589628110 for ; Tue, 24 May 2016 13:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78C5528230; Tue, 24 May 2016 13:59:30 +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 3A3EC28110 for ; Tue, 24 May 2016 13:59:29 +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 1b5CpV-00068Z-H5; Tue, 24 May 2016 13:57:05 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5CpU-00067Z-Jj for xen-devel@lists.xen.org; Tue, 24 May 2016 13:57:04 +0000 Received: from [193.109.254.147] by server-15.bemta-14.messagelabs.com id FF/7B-25843-FAD54475; Tue, 24 May 2016 13:57:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRWlGSWpSXmKPExsVyMXThEd31sS7 hBrueM1ss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlX1n9mLugwreiccYO5gXGCdhcjJ4eQwCRG iXkLrLoYuThYBOYxS8w58pgdxJEQ6GeVuHn0OAtIlYRAjMT37q+sEHa1xJaTG1kguhUkfk84x ATSICQwhUli39SnYEVsAhoST37NYAOxRQSkJa59vswIUsQscIJRYtGLVnaQhLCAncSit+sYQW wWAVWJ2+1/mUFsXgFHiZ8/nwPFOYC2yUkseO8DYnIKOEls+yYPsddR4vH8I8wTGAUWMDKsYlQ vTi0qSy3SNdZLKspMzyjJTczM0TU0NNHLTS0uTkxPzUlMKtZLzs/dxAgMKwYg2MF4t8/5EKMk B5OSKK+Blku4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQlezhignGBRanpqRVpmDjDAYdISHDxKI rwxIGne4oLE3OLMdIjUKUZLji2/r61l4vi08Q6Q3Db13lomIZa8/LxUKXHeApAGAZCGjNI8uH GwKLzEKCslzMsIdKAQT0FqUW5mCar8K0ZxDkYlYd6/0UBTeDLzSuC2vgI6iAnoIP8vziAHlSQ ipKQaGG3LJ1ZVOYl+5WiRu1Q8QXS5zaa9p4/ET+5rfeAYumPT5bOmRyLyv+YfMtK/2fH5Vk39 lMkT1Hxm9Lc0r6pptlq0R8xl9mWWpNakXbsEUttSNFxqireJL4x5rPXOSfJ2TpFs6l1/xmoWo 4mXV6x+pnmvezNrzb5vrT5WLLtOlP2V2pJ3/w/zcSWW4oxEQy3mouJEAPTdQJ29AgAA X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1464098221!41589463!1 X-Originating-IP: [209.85.161.196] 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 45774 invoked from network); 24 May 2016 13:57:02 -0000 Received: from mail-yw0-f196.google.com (HELO mail-yw0-f196.google.com) (209.85.161.196) by server-2.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 May 2016 13:57:02 -0000 Received: by mail-yw0-f196.google.com with SMTP id l126so2322668ywe.3 for ; Tue, 24 May 2016 06:57:02 -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=WJhU7Head/gbtqzqKuVo+IwprjiO2Cx8i2o6i7MJXsY=; b=P6hn+HaoMR404qbw5EH2+e7CRJMoA2DwfpFymHGfGJpWJgoyG0pwp0o8osEPKyP2LJ gfEcFq4dPlXvqKmsABlNrQ99b4/j+tOcM2XRx2o/EwSi7oNFKavZv7LYTv5pRLOE+aZZ aMJsqj7GkPDpSxFAF/Wmr/4g2MtruUc+ZhdxE= 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=WJhU7Head/gbtqzqKuVo+IwprjiO2Cx8i2o6i7MJXsY=; b=QlKdr8sB1LUSsPaghL3aGX0+gsCKrQJUbQG4P5cl+PjLbTv8/xbbZVPMX9UOaFQzp2 jvj3hwQmuizeXqKjhtx3KpWrj5hphbFVBLGu8g3Sb0A3uDF7SwVtha45CLBCKM5rptGc vWeKgXFOa6FsAczqhljGMd6jpVdiG3vM6S2nQMM9hKoyctZ96EvItr5CFtOLqknPPhzu ss4bjdgYcnHU+GsmaYOlw0s4VKvwA2wFpgOcieLaEO+b4UOPxMVnfAuy7YdDgvPJonmy az50BuAzRiJ3h6qrg86r3+eglMlmmPAEqLgmVmZFvYidoVoGTlguRGVAZyfCvm/Z4ATI 6v8Q== X-Gm-Message-State: ALyK8tIANLsgJbc2GvU4W1ZPUecjKpsp0bD0Cg29yKoIRvKurf296l59suHojhyVMVGC4g== X-Received: by 10.13.211.131 with SMTP id v125mr2504057ywd.148.1464098221448; Tue, 24 May 2016 06:57:01 -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 i67sm22199641ywf.34.2016.05.24.06.56.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 May 2016 06:57:00 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 24 May 2016 08:56:39 -0500 Message-Id: <1464098199-19851-7-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1464098199-19851-1-git-send-email-cardoe@cardoe.com> References: <1464098199-19851-1-git-send-email-cardoe@cardoe.com> Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH v5 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 Reviewed-by: Andrew Cooper Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Jan Beulich Acked-by: Julien Grall --- 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 56d2c79..abef0ad 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -28,6 +28,13 @@ config FRAME_POINTER maybe slower, but it gives very useful debugging information in case of any Xen bugs. +config LOCK_PROFILE + bool "Lock Profiling" + ---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 209c91a..dded8b6 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;