From patchwork Tue May 10 21:05:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9063321 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 87CBDBF440 for ; Tue, 10 May 2016 21:08:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA8FA201CD for ; Tue, 10 May 2016 21:08:13 +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 83F2D20142 for ; Tue, 10 May 2016 21:08:12 +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 1b0Eqn-0006n8-AI; Tue, 10 May 2016 21:05:53 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0Eql-0006mg-Mv for xen-devel@lists.xen.org; Tue, 10 May 2016 21:05:51 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 14/08-04060-F2D42375; Tue, 10 May 2016 21:05:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMXThQV09X6N wg87FwhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8as2TcYC14ZVHR03mRpYNyi3sXIxSEkMJFR ov/iPhYQh0VgHrPEhRudrCCOhEA/q8SfQ83sXYycQE6MxMazSxkh7FqJ+UvuMIHYQgIKEr8nH IKyJzFJ/FlgAWKzCWhIPPk1gw3EFhGQlrj2+TIjyFBmgROMEotetIINFRawk5jUuh3MZhFQlT j6/D8ziM0r4CBxfdkUoDgH0DI5iQXvfUDCnAKOEounrGKB2OUgcf7zBcYJjAILGBlWMWoUpxa VpRbpGproJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhhYDEOxgXLHd8xCjJAeT kihvj5tRuBBfUn5KZUZicUZ8UWlOavEhRhkODiUJXnEfoJxgUWp6akVaZg4wyGHSEhw8SiK8A iBp3uKCxNzizHSI1ClGS44tv6+tZeL4tPEOkNw29d5aJiGWvPy8VClxXk6QBgGQhozSPLhxsE i8xCgrJczLCHSgEE9BalFuZgmq/CtGcQ5GJWFeNpApPJl5JXBbXwEdxAR0kBybPshBJYkIKak GRldP0+b8WH32f37yf9Uy/r7Z9mBesPz+qaX99o0KItUKv84urS47P+9aeHvr9pl8yUvd7yc6 dj08fPH1MxPOT1qeb7SWK20KX8EXZbnF9fi/pL6nH1xVkzdwJZ86tLiLnfth7p/ycPb1IR/Lh SMVPx1ck8D64t6k7EK91ubg8BP1OkY9D3sfKrEUZyQaajEXFScCACTkF3q/AgAA X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1462914349!39443443!1 X-Originating-IP: [209.85.161.193] 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 18234 invoked from network); 10 May 2016 21:05:50 -0000 Received: from mail-yw0-f193.google.com (HELO mail-yw0-f193.google.com) (209.85.161.193) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 May 2016 21:05:50 -0000 Received: by mail-yw0-f193.google.com with SMTP id u62so2212367ywe.3 for ; Tue, 10 May 2016 14:05:50 -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=q60u1TvTsXD/KqDanHIpOT92hRB/XPDnWeU63layPL8=; b=F4d3CVFPAnKZiE5Thuf+60UGVTmG+tWIs5ukOBadJrF4oW5iRK5pCs3I2Nl0GYJk6Q Jpm+BOhRykjZZzzUyEBvJbGw3Tn/lHIA7420MiWTR35z+K6gGnRnaSl/sHJLxBVzTZ7q DDbXsJ+vVupgtyGmVECold1DPaFlRThMrGx3I= 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=q60u1TvTsXD/KqDanHIpOT92hRB/XPDnWeU63layPL8=; b=hjg/rQI4/2pxzlxwGPoGBr9of7a8pAVSDz6iMzvO3BaDdIcSBjfJt49x7Z2pQAeejl FrNCxmrJsQYUBaCU58SIEWiODaAk2lnZDcOvDIerehv1aZ/E9Jgw3r/FcmKtSqutYTMZ QY8P7510A2DVc29guNT72jBvAIOECFqAZxKleMyf4y2cJJ0jbe0OzJzFYjabR6aSAa7u WrtWf/isywma3lfvYlkQ+fhlqYDJeKf/KgmYhSs4GzKmybgK78Gcdl9VnYSYNG9KyThu hOBOdDYXqysYIvDZBor0a8rAQEbpCF8sKiF9ZQFKCO1MGSo+QslvItxgb+9ME4pBEs1f jmWA== X-Gm-Message-State: AOPr4FXUFysHU6+60gr8x0PF57uwL90tNj+PuRNWPMRkUYmGFxvhdMJAfXd80YQHw8pAdg== X-Received: by 10.129.161.199 with SMTP id y190mr24426451ywg.123.1462914348827; Tue, 10 May 2016 14:05:48 -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 e6sm2198740ywd.23.2016.05.10.14.05.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 May 2016 14:05:47 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 10 May 2016 16:05:29 -0500 Message-Id: <1462914329-8797-7-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1462914329-8797-1-git-send-email-cardoe@cardoe.com> References: <1462914329-8797-1-git-send-email-cardoe@cardoe.com> Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH v3 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-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 --- CC: Stefano Stabellini CC: Julien Grall CC: Jan Beulich CC: Andrew Cooper --- INSTALL | 1 - xen/Kconfig.debug | 7 +++++++ 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, 19 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 d056748..ca0913b 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -23,6 +23,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 2d9265e..f85b3b3 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 @@ -46,7 +45,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;