From patchwork Tue May 10 21:05:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9063351 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 06D1D9F1D3 for ; Tue, 10 May 2016 21:08:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB48E201C8 for ; Tue, 10 May 2016 21:08:18 +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 4E80620142 for ; Tue, 10 May 2016 21:08:17 +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 1b0Eqm-0006mo-2w; Tue, 10 May 2016 21:05:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0Eqk-0006mU-Pz for xen-devel@lists.xen.org; Tue, 10 May 2016 21:05:50 +0000 Received: from [85.158.137.68] by server-15.bemta-3.messagelabs.com id 6E/AB-03172-D2D42375; Tue, 10 May 2016 21:05:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMXThQV0dX6N wg1u91hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bh5lVMBbN9K173XGVrYPxq28XIxSEkMIFR 4vCui8wgDovAPGaJfb8OsoM4EgL9rBI3Tv8EcjiBnBiJrvnvmSHsaon2+5sYQWwhAQWJ3xMOM UGMmsQk0b9yM1iCTUBD4smvGWwgtoiAtMS1z5cZQYqYBZ4xSbw+3AU0iYNDWMBR4vVaJ5AaFg FVic9nusF6eQUcJOY/P8QKUiIhICex4L0PSJgTqHrxlFUsEHsdJM5/vsA4gVFgASPDKkaN4tS istQiXUNTvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKRiveT83E2MwNBiAIIdjGu2ex5ilORg UhLl7XEzChfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwRvkA5QTLEpNT61Iy8wBBjlMWoKDR0mEV wAkzVtckJhbnJkOkTrFaMmx5fe1tUwcnzbeAZLbpt5byyTEkpeflyolzssJ0iAA0pBRmgc3Dh aJlxhlpYR5GYEOFOIpSC3KzSxBlX/FKM7BqCTM6woyhSczrwRu6yugg5iADpJj0wc5qCQRISX VwMh6gDPFdXfoVqNvBy/1vz5cwpowb9OEuFuZu2zEJ/0uNZaqvqHV8uW12+wUgc/TlhzMjH73 LMC5JMbo3LcDLnbpC+WOtx3buzjwcPkC7v23TN/+n6KclqMwo1G+X8aZbfaWh8rr/RXdju/4e 6Xpalt/C2POusvv03h3Hm9RPbjBbdVG8+lZ2RuUWIozEg21mIuKEwGPzkFVvwIAAA== X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1462914347!22760419!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 63967 invoked from network); 10 May 2016 21:05:48 -0000 Received: from mail-yw0-f193.google.com (HELO mail-yw0-f193.google.com) (209.85.161.193) by server-12.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 May 2016 21:05:48 -0000 Received: by mail-yw0-f193.google.com with SMTP id y6so2214563ywe.0 for ; Tue, 10 May 2016 14:05:48 -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=8yuokJ9Y4LJdMAPpGRzD+oN/N8FmDX7oy7U7zfOxNAU=; b=L9LjKc60UFFtunl1I8V/V0966R2LFtqW7dVgqpRmAp1m1hE+3tU3JAMnTsYJxJIXMu VwnS5rYXng6soChAbf2oVZIbB45TQNoIHaaQKtbS9CfXUnUBN8yGDSmCdLDndGyXBp8t CeOzgbxGi1BFgQaQG+7tABPPIlmfglSIZ2PWo= 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=8yuokJ9Y4LJdMAPpGRzD+oN/N8FmDX7oy7U7zfOxNAU=; b=aO9O3kRYWDtoJHERo2ZCGRAiYy74mywxS7BZ8GjysPmEfxcVd1B8rZ/aqqW2V6Afqq xf4cpAnbCN4Rack3o5bn1Ka9A/G6cJyb4id6PutUBTnDH1mgrKPkLnpkE5FnHNCp+boC mR8+5HE+nzocn0Zgk7m23vVs/FyeU8NLUNHA8Qa3je3wG3fGQxHZVXlentN3PGle4DJg wwEOHHrnA5O6fHzEgSCyMKPAQCRmsxq1wrrz7T14rVFIGjrWdg1xFCp/alA+1bcFB92Z +S3wwVhTgNEbIUceEKnUJd+OHnH+2v2tqebzBjQSrpBYoBDa8sGwED3ODgGXDTXws/oB l2Eg== X-Gm-Message-State: AOPr4FXTqTVXFaTJ9fmHv6LG1IIu2UxVZKAE0TdvUCbJRqr0AZtBFGdq3jxQy3QUqxGoFQ== X-Received: by 10.129.158.87 with SMTP id v84mr25444162ywg.282.1462914347406; Tue, 10 May 2016 14:05:47 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 May 2016 14:05:46 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 10 May 2016 16:05:28 -0500 Message-Id: <1462914329-8797-6-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: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Doug Goldstein , Tim Deegan , Jan Beulich , Ian Jackson Subject: [Xen-devel] [PATCH v3 5/6] build: convert perfc{, _arrays} 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 'perfc' and 'perfc_arrays' options to Kconfig as CONFIG_PERF_COUNTERS and CONFIG_PERF_ARRAYS to minimize code changes. Signed-off-by: Doug Goldstein --- CC: Andrew Cooper CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu --- INSTALL | 2 -- xen/Kconfig.debug | 14 ++++++++++++++ xen/Rules.mk | 13 +++---------- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/time.c | 4 ++-- xen/arch/x86/x86_64/asm-offsets.c | 2 +- xen/common/Makefile | 2 +- xen/common/keyhandler.c | 2 +- xen/common/perfc.c | 2 +- xen/common/sysctl.c | 2 +- xen/include/asm-x86/asm_defns.h | 2 +- xen/include/asm-x86/domain.h | 2 +- xen/include/xen/perfc.h | 8 ++++---- xen/include/xen/sched.h | 2 +- 14 files changed, 32 insertions(+), 27 deletions(-) diff --git a/INSTALL b/INSTALL index f55d42c..623887d 100644 --- a/INSTALL +++ b/INSTALL @@ -227,8 +227,6 @@ VGABIOS_REL_DATE="dd Mon yyyy" The following variables can be used to tweak some aspects of the hypervisor build. -perfc=y -perfc_arrays=y lock_profile=y lto=y diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index 375c71d..d056748 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -23,6 +23,20 @@ config FRAME_POINTER maybe slower, but it gives very useful debugging information in case of any Xen bugs. +config PERF_COUNTERS + bool "Performance Counters" + ---help--- + Enables software performance counters that allows you to analyze + bottlenecks in the system. To access this data you must use the + 'xenperf' tool. + +config PERF_ARRAYS + bool "Performance Counter Array Histograms" + depends on PERF_COUNTERS + ---help--- + Enables software performance counter array histograms. + + config VERBOSE_DEBUG bool "Verbose debug messages" default DEBUG diff --git a/xen/Rules.mk b/xen/Rules.mk index 84b9d81..2d9265e 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -3,8 +3,6 @@ # If you change any of these configuration options then you must # 'make clean' before rebuilding. # -perfc ?= n -perfc_arrays ?= n lock_profile ?= n lto ?= n @@ -12,18 +10,15 @@ lto ?= n include $(XEN_ROOT)/Config.mk -# Hardcoded configuration implications and dependencies. -# Do this is a neater way if it becomes unwieldy. -ifeq ($(perfc_arrays),y) -perfc := y -endif - ifneq ($(origin kexec),undefined) $(error "You must use 'make menuconfig' to enable/disable kexec now.") endif ifneq ($(origin crash_debug),undefined) $(error "You must use 'make menuconfig' to enable/disable crash_debug now.") endif +ifneq ($(origin perfc),undefined) +$(error "You must use 'make menuconfig' to enable/disable perfc now.") +endif # Set ARCH/SUBARCH appropriately. override TARGET_SUBARCH := $(XEN_TARGET_ARCH) @@ -51,8 +46,6 @@ ifneq ($(clang),y) CFLAGS += -Wa,--strip-local-absolute endif -CFLAGS-$(perfc) += -DPERF_COUNTERS -CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS CFLAGS-$(lock_profile) += -DLOCK_PROFILE CFLAGS-$(CONFIG_FRAME_POINTER) += -fno-omit-frame-pointer diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 863d134..34bc7a8 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3535,7 +3535,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx, static uint64_t _hvm_rdtsc_intercept(void) { struct vcpu *curr = current; -#if !defined(NDEBUG) || defined(PERF_COUNTERS) +#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS) struct domain *currd = curr->domain; if ( currd->arch.vtsc ) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 6438b47..3928a5f 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1688,7 +1688,7 @@ void pv_soft_rdtsc(struct vcpu *v, struct cpu_user_regs *regs, int rdtscp) spin_lock(&d->arch.vtsc_lock); -#if !defined(NDEBUG) || defined(PERF_COUNTERS) +#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS) if ( guest_kernel_mode(v, regs) ) d->arch.vtsc_kerncount++; else @@ -1959,7 +1959,7 @@ static void dump_softtsc(unsigned char key) printk(",khz=%"PRIu32, d->arch.tsc_khz); if ( d->arch.incarnation ) printk(",inc=%"PRIu32, d->arch.incarnation); -#if !defined(NDEBUG) || defined(PERF_COUNTERS) +#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS) if ( !(d->arch.vtsc_kerncount | d->arch.vtsc_usercount) ) printk("\n"); else diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c index fa37ee0..891ddc8 100644 --- a/xen/arch/x86/x86_64/asm-offsets.c +++ b/xen/arch/x86/x86_64/asm-offsets.c @@ -151,7 +151,7 @@ void __dummy__(void) OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip); BLANK(); -#if PERF_COUNTERS +#if CONFIG_PERF_COUNTERS DEFINE(ASM_PERFC_hypercalls, PERFC_hypercalls); DEFINE(ASM_PERFC_exceptions, PERFC_exceptions); BLANK(); diff --git a/xen/common/Makefile b/xen/common/Makefile index a98bcc2..5891b1c 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -64,7 +64,7 @@ obj-$(CONFIG_XSPLICE) += xsplice_elf.o obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo unlz4 earlycpio,$(n).init.o) -obj-$(perfc) += perfc.o +obj-$(CONFIG_PERF_COUNTERS) += perfc.o obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o xlat.o) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 4ff90f6..65b70ce 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -59,7 +59,7 @@ static struct keyhandler { IRQ_KEYHANDLER('%', do_debug_key, "trap to xendbg", 0), IRQ_KEYHANDLER('*', run_all_keyhandlers, "print all diagnostics", 0), -#ifdef PERF_COUNTERS +#ifdef CONFIG_PERF_COUNTERS KEYHANDLER('p', perfc_printall, "print performance counters", 1), KEYHANDLER('P', perfc_reset, "reset performance counters", 0), #endif diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 9f078e1..3da4c96 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -78,7 +78,7 @@ void perfc_printall(unsigned char key) printk("TOTAL[%12Lu]", sum); if (sum) { -#ifdef PERF_ARRAYS +#ifdef CONFIG_PERF_ARRAYS for ( k = 0; k < perfc_info[i].nr_elements; k++ ) { sum = 0; diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 9a4cc1f..11bef0e 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -115,7 +115,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) } break; -#ifdef PERF_COUNTERS +#ifdef CONFIG_PERF_COUNTERS case XEN_SYSCTL_perfc_op: ret = perfc_control(&op->u.perfc_op); break; diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h index b5f79d8..24f5404 100644 --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -363,7 +363,7 @@ static always_inline void stac(void) #endif -#ifdef PERF_COUNTERS +#ifdef CONFIG_PERF_COUNTERS #define PERFC_INCR(_name,_idx,_cur) \ pushq _cur; \ movslq VCPU_processor(_cur),_cur; \ diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 165e533..783fa4f 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -377,7 +377,7 @@ struct arch_domain hardware TSC scaling cases */ uint32_t incarnation; /* incremented every restore or live migrate (possibly other cases in the future */ -#if !defined(NDEBUG) || defined(PERF_COUNTERS) +#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS) uint64_t vtsc_kerncount; uint64_t vtsc_usercount; #endif diff --git a/xen/include/xen/perfc.h b/xen/include/xen/perfc.h index 6cb0cd1..6846e71 100644 --- a/xen/include/xen/perfc.h +++ b/xen/include/xen/perfc.h @@ -1,7 +1,7 @@ #ifndef __XEN_PERFC_H__ #define __XEN_PERFC_H__ -#ifdef PERF_COUNTERS +#ifdef CONFIG_PERF_COUNTERS #include #include @@ -76,7 +76,7 @@ DECLARE_PER_CPU(perfc_t[NUM_PERFCOUNTERS], perfcounters); * Histogram: special treatment for 0 and 1 count. After that equally spaced * with last bucket taking the rest. */ -#ifdef PERF_ARRAYS +#ifdef CONFIG_PERF_ARRAYS #define perfc_incr_histo(x,v) \ do { \ if ( (v) == 0 ) \ @@ -100,7 +100,7 @@ extern void perfc_printall(unsigned char key); extern void perfc_reset(unsigned char key); -#else /* PERF_COUNTERS */ +#else /* CONFIG_PERF_COUNTERS */ #define perfc_value(x) (0) #define perfc_valuea(x,y) (0) @@ -114,6 +114,6 @@ extern void perfc_reset(unsigned char key); #define perfc_adda(x,y,z) ((void)0) #define perfc_incr_histo(x,y,z) ((void)0) -#endif /* PERF_COUNTERS */ +#endif /* CONFIG_PERF_COUNTERS */ #endif /* __XEN_PERFC_H__ */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index fe15e9c..46c82e7 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -39,7 +39,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_info_compat_t); * Enable and ease the use of scheduling related performance counters. * */ -#ifdef PERF_COUNTERS +#ifdef CONFIG_PERF_COUNTERS #define SCHED_STATS #endif