From patchwork Tue Feb 7 18:06:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 6678 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 75D3723ECA for ; Tue, 7 Feb 2012 18:06:19 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 27871A18031 for ; Tue, 7 Feb 2012 18:06:19 +0000 (UTC) Received: by ghbz22 with SMTP id z22so4002733ghb.11 for ; Tue, 07 Feb 2012 10:06:18 -0800 (PST) Received: by 10.50.15.231 with SMTP id a7mr27933278igd.8.1328637978538; Tue, 07 Feb 2012 10:06:18 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.169.210 with SMTP id a18cs131718ibz; Tue, 7 Feb 2012 10:06:18 -0800 (PST) Received: by 10.50.178.73 with SMTP id cw9mr20121695igc.23.1328637978026; Tue, 07 Feb 2012 10:06:18 -0800 (PST) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id d3si10277612icb.9.2012.02.07.10.06.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Feb 2012 10:06:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) smtp.mail=dmitry.antipov@linaro.org Received: by iage36 with SMTP id e36so8520170iag.37 for ; Tue, 07 Feb 2012 10:06:17 -0800 (PST) Received: by 10.50.202.97 with SMTP id kh1mr28483768igc.19.1328637977450; Tue, 07 Feb 2012 10:06:17 -0800 (PST) Received: from localhost.localdomain.com ([108.60.121.129]) by mx.google.com with ESMTPS id or2sm22118395igc.5.2012.02.07.10.06.14 (version=SSLv3 cipher=OTHER); Tue, 07 Feb 2012 10:06:16 -0800 (PST) From: Dmitry Antipov To: Rusty Russell , Ingo Molnar Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linaro-dev@lists.linaro.org, patches@linaro.org, Dmitry Antipov Subject: [PATCH] sched: generalize CONFIG_IRQ_TIME_ACCOUNTING for X86 and ARM Date: Tue, 7 Feb 2012 10:06:22 -0800 Message-Id: <1328637982-26681-1-git-send-email-dmitry.antipov@linaro.org> X-Mailer: git-send-email 1.7.7.6 Generalize CONFIG_IRQ_TIME_ACCOUNTING between X86 and ARM, move "noirqtime=" option to common debugging code. Signed-off-by: Dmitry Antipov --- arch/arm/kernel/sched_clock.c | 3 +++ arch/x86/Kconfig | 11 ----------- arch/x86/kernel/tsc.c | 4 ---- include/linux/sched.h | 2 ++ lib/Kconfig.debug | 12 ++++++++++++ lib/Makefile | 2 ++ lib/irqtime.c | 12 ++++++++++++ 7 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 lib/irqtime.c diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 5416c7c..56d2a9d 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c @@ -162,5 +162,8 @@ void __init sched_clock_postinit(void) if (read_sched_clock == jiffy_sched_clock_read) setup_sched_clock(jiffy_sched_clock_read, 32, HZ); + if (!no_sched_irq_time) + enable_sched_clock_irqtime(); + sched_clock_poll(sched_clock_timer.data); } diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5bed94e..4759676 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -805,17 +805,6 @@ config SCHED_MC making when dealing with multi-core CPU chips at a cost of slightly increased overhead in some places. If unsure say N here. -config IRQ_TIME_ACCOUNTING - bool "Fine granularity task level IRQ time accounting" - default n - ---help--- - Select this option to enable fine granularity task irq time - accounting. This is done by reading a timestamp on each - transitions between softirq and hardirq state, so there can be a - small performance impact. - - If in doubt, say N here. - source "kernel/Kconfig.preempt" config X86_UP_APIC diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index a62c201..a3a5465 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -103,14 +103,10 @@ int __init notsc_setup(char *str) __setup("notsc", notsc_setup); -static int no_sched_irq_time; - static int __init tsc_setup(char *str) { if (!strcmp(str, "reliable")) tsc_clocksource_reliable = 1; - if (!strncmp(str, "noirqtime", 9)) - no_sched_irq_time = 1; return 1; } diff --git a/include/linux/sched.h b/include/linux/sched.h index 7d379a6..b3575b5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1966,9 +1966,11 @@ extern void sched_clock_idle_wakeup_event(u64 delta_ns); * The reason for this explicit opt-in is not to have perf penalty with * slow sched_clocks. */ +extern int no_sched_irq_time; extern void enable_sched_clock_irqtime(void); extern void disable_sched_clock_irqtime(void); #else +#define no_sched_irq_time 1 static inline void enable_sched_clock_irqtime(void) {} static inline void disable_sched_clock_irqtime(void) {} #endif diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 8745ac7..a55287e 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -299,6 +299,18 @@ config SCHEDSTATS application, you can say N to avoid the very slight overhead this adds. +config IRQ_TIME_ACCOUNTING + bool "Fine granularity task level IRQ time accounting" + depends on DEBUG_KERNEL && (X86 || (ARM && HAVE_SCHED_CLOCK)) + default n + ---help--- + Select this option to enable fine granularity task irq time + accounting. This is done by reading a timestamp on each + transitions between softirq and hardirq state, so there can be a + small performance impact. + + If in doubt, say N here. + config TIMER_STATS bool "Collect kernel timers statistics" depends on DEBUG_KERNEL && PROC_FS diff --git a/lib/Makefile b/lib/Makefile index 18515f0..44d67d4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -49,6 +49,8 @@ obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o obj-$(CONFIG_DEBUG_LIST) += list_debug.o obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o +obj-$(CONFIG_IRQ_TIME_ACCOUNTING) += irqtime.o + ifneq ($(CONFIG_HAVE_DEC_LOCK),y) lib-y += dec_and_lock.o endif diff --git a/lib/irqtime.c b/lib/irqtime.c new file mode 100644 index 0000000..10d440d --- /dev/null +++ b/lib/irqtime.c @@ -0,0 +1,12 @@ +#include +#include + +int no_sched_irq_time; + +static int __init irqtime_setup(char *str) +{ + no_sched_irq_time = 1; + return 1; +} + +__setup("noirqtime", irqtime_setup);