linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Convert remaining platforms to common sched_clock()
@ 2012-01-18 16:14 Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation Marc Zyngier
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

Only two platforms are left with their own sched_clock() implementation.
This patch series converts them, leading in both cases to some cleanup.

The last patch makes the sched_clock framework mandatory, so people
don't try to add another implementation.

* From the initial revision
- Add a patch killing the HAVE_SCHED_CLOCK option.

Marc Zyngier (3):
  ARM: davinci: convert to common sched_clock() implementation
  ARM: prima2: convert to common sched_clock() implementation
  ARM: Make the sched_clock framework mandatory

 arch/arm/Kconfig                |   16 ----------------
 arch/arm/kernel/Makefile        |    3 +--
 arch/arm/kernel/time.c          |    2 --
 arch/arm/mach-davinci/time.c    |   24 +++++++-----------------
 arch/arm/mach-prima2/timer.c    |   21 +++++++--------------
 arch/arm/plat-nomadik/Kconfig   |    1 -
 arch/arm/plat-versatile/Kconfig |    1 -
 7 files changed, 15 insertions(+), 53 deletions(-)

-- 
1.7.7.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation
  2012-01-18 16:14 [PATCH v2 0/3] Convert remaining platforms to common sched_clock() Marc Zyngier
@ 2012-01-18 16:14 ` Marc Zyngier
  2012-01-18 18:36   ` Nori, Sekhar
  2012-01-18 16:14 ` [PATCH v2 2/3] ARM: prima2: " Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory Marc Zyngier
  2 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

Davinci has its own sched_clock() implementation, which gets in the
way of a single zImage. Moving to the common sched_clock framework
makes the code slightly cleaner.

Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/Kconfig             |    1 +
 arch/arm/mach-davinci/time.c |   24 +++++++-----------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 24626b0..cb75734 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -932,6 +932,7 @@ config ARCH_DAVINCI
 	select ARCH_REQUIRE_GPIOLIB
 	select ZONE_DMA
 	select HAVE_IDE
+	select HAVE_SCHED_CLOCK
 	select CLKDEV_LOOKUP
 	select GENERIC_ALLOCATOR
 	select GENERIC_IRQ_CHIP
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index e1969ce..187fcda 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -20,6 +20,7 @@
 #include <linux/platform_device.h>
 
 #include <mach/hardware.h>
+#include <asm/sched_clock.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <mach/cputype.h>
@@ -272,19 +273,9 @@ static cycle_t read_cycles(struct clocksource *cs)
 	return (cycles_t)timer32_read(t);
 }
 
-/*
- * Kernel assumes that sched_clock can be called early but may not have
- * things ready yet.
- */
-static cycle_t read_dummy(struct clocksource *cs)
-{
-	return 0;
-}
-
-
 static struct clocksource clocksource_davinci = {
 	.rating		= 300,
-	.read		= read_dummy,
+	.read		= read_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -292,12 +283,9 @@ static struct clocksource clocksource_davinci = {
 /*
  * Overwrite weak default sched_clock with something more precise
  */
-unsigned long long notrace sched_clock(void)
+static u32 notrace davinci_read_sched_clock(void)
 {
-	const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci);
-
-	return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
-				clocksource_davinci.shift);
+	return timer32_read(&timers[TID_CLOCKSOURCE]);
 }
 
 /*
@@ -397,12 +385,14 @@ static void __init davinci_timer_init(void)
 	davinci_clock_tick_rate = clk_get_rate(timer_clk);
 
 	/* setup clocksource */
-	clocksource_davinci.read = read_cycles;
 	clocksource_davinci.name = id_to_name[clocksource_id];
 	if (clocksource_register_hz(&clocksource_davinci,
 				    davinci_clock_tick_rate))
 		printk(err, clocksource_davinci.name);
 
+	setup_sched_clock(davinci_read_sched_clock, 32,
+			  davinci_clock_tick_rate);
+
 	/* setup clockevent */
 	clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id];
 	clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
-- 
1.7.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/3] ARM: prima2: convert to common sched_clock() implementation
  2012-01-18 16:14 [PATCH v2 0/3] Convert remaining platforms to common sched_clock() Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation Marc Zyngier
@ 2012-01-18 16:14 ` Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory Marc Zyngier
  2 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

Prima2 has its own sched_clock() implementation, which gets in the
way of a single zImage. Moving to the common sched_clock framework
makes the code slightly cleaner (the mapping hack in sched_clock()
goes away...).

Acked-by: Barry Song <baohua.song@csr.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/Kconfig             |    1 +
 arch/arm/mach-prima2/timer.c |   21 +++++++--------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cb75734..a18550e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -388,6 +388,7 @@ config ARCH_PRIMA2
 	select GENERIC_CLOCKEVENTS
 	select CLKDEV_LOOKUP
 	select GENERIC_IRQ_CHIP
+	select HAVE_SCHED_CLOCK
 	select MIGHT_HAVE_CACHE_L2X0
 	select USE_OF
 	select ZONE_DMA
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c
index b7a6091..0d024b1 100644
--- a/arch/arm/mach-prima2/timer.c
+++ b/arch/arm/mach-prima2/timer.c
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <mach/map.h>
+#include <asm/sched_clock.h>
 #include <asm/mach/time.h>
 
 #define SIRFSOC_TIMER_COUNTER_LO	0x0000
@@ -165,21 +166,9 @@ static struct irqaction sirfsoc_timer_irq = {
 };
 
 /* Overwrite weak default sched_clock with more precise one */
-unsigned long long notrace sched_clock(void)
+static u32 notrace sirfsoc_read_sched_clock(void)
 {
-	static int is_mapped;
-
-	/*
-	 * sched_clock is called earlier than .init of sys_timer
-	 * if we map timer memory in .init of sys_timer, system
-	 * will panic due to illegal memory access
-	 */
-	if (!is_mapped) {
-		sirfsoc_of_timer_map();
-		is_mapped = 1;
-	}
-
-	return sirfsoc_timer_read(NULL) * (NSEC_PER_SEC / CLOCK_TICK_RATE);
+	return (u32)(sirfsoc_timer_read(NULL) & 0xffffffff);
 }
 
 static void __init sirfsoc_clockevent_init(void)
@@ -210,6 +199,8 @@ static void __init sirfsoc_timer_init(void)
 	BUG_ON(rate < CLOCK_TICK_RATE);
 	BUG_ON(rate % CLOCK_TICK_RATE);
 
+	sirfsoc_of_timer_map();
+
 	writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
 	writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
 	writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
@@ -217,6 +208,8 @@ static void __init sirfsoc_timer_init(void)
 
 	BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
 
+	setup_sched_clock(sirfsoc_read_sched_clock, 32, CLOCK_TICK_RATE);
+
 	BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
 
 	sirfsoc_clockevent_init();
-- 
1.7.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory
  2012-01-18 16:14 [PATCH v2 0/3] Convert remaining platforms to common sched_clock() Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation Marc Zyngier
  2012-01-18 16:14 ` [PATCH v2 2/3] ARM: prima2: " Marc Zyngier
@ 2012-01-18 16:14 ` Marc Zyngier
  2012-01-18 16:26   ` Russell King - ARM Linux
  2012-01-18 20:14   ` Nicolas Pitre
  2 siblings, 2 replies; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

All sched_clock() providers have been converted to the sched_clock
framework, which also provides a jiffy based implementation for
the platforms that do not provide a counter.

It is now possible to make the sched_clock framework mandatory,
effectively preventing new platforms to add new sched_clock()
functions, which would be detrimental to the single zImage work.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/Kconfig                |   18 ------------------
 arch/arm/kernel/Makefile        |    3 +--
 arch/arm/kernel/time.c          |    2 --
 arch/arm/plat-nomadik/Kconfig   |    1 -
 arch/arm/plat-versatile/Kconfig |    1 -
 5 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a18550e..d1fcfe0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -52,9 +52,6 @@ config MIGHT_HAVE_PCI
 config SYS_SUPPORTS_APM_EMULATION
 	bool
 
-config HAVE_SCHED_CLOCK
-	bool
-
 config GENERIC_GPIO
 	bool
 
@@ -388,7 +385,6 @@ config ARCH_PRIMA2
 	select GENERIC_CLOCKEVENTS
 	select CLKDEV_LOOKUP
 	select GENERIC_IRQ_CHIP
-	select HAVE_SCHED_CLOCK
 	select MIGHT_HAVE_CACHE_L2X0
 	select USE_OF
 	select ZONE_DMA
@@ -439,7 +435,6 @@ config ARCH_MXC
 	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
 	select GENERIC_IRQ_CHIP
-	select HAVE_SCHED_CLOCK
 	select MULTI_IRQ_HANDLER
 	help
 	  Support for Freescale MXC/iMX-based family of processors
@@ -531,7 +526,6 @@ config ARCH_IXP4XX
 	select CPU_XSCALE
 	select GENERIC_GPIO
 	select GENERIC_CLOCKEVENTS
-	select HAVE_SCHED_CLOCK
 	select MIGHT_HAVE_PCI
 	select DMABOUNCE if PCI
 	help
@@ -602,7 +596,6 @@ config ARCH_MMP
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
 	select GPIO_PXA
-	select HAVE_SCHED_CLOCK
 	select TICK_ONESHOT
 	select PLAT_PXA
 	select SPARSE_IRQ
@@ -643,7 +636,6 @@ config ARCH_TEGRA
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_GPIO
 	select HAVE_CLK
-	select HAVE_SCHED_CLOCK
 	select HAVE_SMP
 	select MIGHT_HAVE_CACHE_L2X0
 	select ARCH_HAS_CPUFREQ
@@ -660,7 +652,6 @@ config ARCH_PICOXCELL
 	select DW_APB_TIMER
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_GPIO
-	select HAVE_SCHED_CLOCK
 	select HAVE_TCM
 	select NO_IOPORT
 	select SPARSE_IRQ
@@ -688,7 +679,6 @@ config ARCH_PXA
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_CLOCKEVENTS
 	select GPIO_PXA
-	select HAVE_SCHED_CLOCK
 	select TICK_ONESHOT
 	select PLAT_PXA
 	select SPARSE_IRQ
@@ -756,7 +746,6 @@ config ARCH_SA1100
 	select CPU_FREQ
 	select GENERIC_CLOCKEVENTS
 	select CLKDEV_LOOKUP
-	select HAVE_SCHED_CLOCK
 	select TICK_ONESHOT
 	select ARCH_REQUIRE_GPIOLIB
 	select HAVE_IDE
@@ -813,7 +802,6 @@ config ARCH_S5P64X0
 	select CLKSRC_MMIO
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select GENERIC_CLOCKEVENTS
-	select HAVE_SCHED_CLOCK
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C_RTC if RTC_CLASS
 	help
@@ -846,7 +834,6 @@ config ARCH_S5PV210
 	select ARM_L1_CACHE_SHIFT_6
 	select ARCH_HAS_CPUFREQ
 	select GENERIC_CLOCKEVENTS
-	select HAVE_SCHED_CLOCK
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C_RTC if RTC_CLASS
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -889,7 +876,6 @@ config ARCH_U300
 	depends on MMU
 	select CLKSRC_MMIO
 	select CPU_ARM926T
-	select HAVE_SCHED_CLOCK
 	select HAVE_TCM
 	select ARM_AMBA
 	select ARM_PATCH_PHYS_VIRT
@@ -933,7 +919,6 @@ config ARCH_DAVINCI
 	select ARCH_REQUIRE_GPIOLIB
 	select ZONE_DMA
 	select HAVE_IDE
-	select HAVE_SCHED_CLOCK
 	select CLKDEV_LOOKUP
 	select GENERIC_ALLOCATOR
 	select GENERIC_IRQ_CHIP
@@ -948,7 +933,6 @@ config ARCH_OMAP
 	select ARCH_HAS_CPUFREQ
 	select CLKSRC_MMIO
 	select GENERIC_CLOCKEVENTS
-	select HAVE_SCHED_CLOCK
 	select ARCH_HAS_HOLES_MEMORYMODEL
 	help
 	  Support for TI's OMAP platform (OMAP1/2/3/4).
@@ -1114,13 +1098,11 @@ config ARCH_ACORN
 config PLAT_IOP
 	bool
 	select GENERIC_CLOCKEVENTS
-	select HAVE_SCHED_CLOCK
 
 config PLAT_ORION
 	bool
 	select CLKSRC_MMIO
 	select GENERIC_IRQ_CHIP
-	select HAVE_SCHED_CLOCK
 
 config PLAT_PXA
 	bool
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 43b740d..92098e6 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg
 
 obj-y		:= elf.o entry-armv.o entry-common.o irq.o opcodes.o \
 		   process.o ptrace.o return_address.o setup.o signal.o \
-		   sys_arm.o stacktrace.o time.o traps.o
+		   sys_arm.o stacktrace.o time.o traps.o sched_clock.o
 
 obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
 
@@ -30,7 +30,6 @@ obj-$(CONFIG_ARTHUR)		+= arthur.o
 obj-$(CONFIG_ISA_DMA)		+= dma-isa.o
 obj-$(CONFIG_PCI)		+= bios32.o isa.o
 obj-$(CONFIG_ARM_CPU_SUSPEND)	+= sleep.o suspend.o
-obj-$(CONFIG_HAVE_SCHED_CLOCK)	+= sched_clock.o
 obj-$(CONFIG_SMP)		+= smp.o smp_tlb.o
 obj-$(CONFIG_HAVE_ARM_SCU)	+= smp_scu.o
 obj-$(CONFIG_HAVE_ARM_TWD)	+= smp_twd.o
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 8c57dd3..5bff288 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -149,8 +149,6 @@ void __init time_init(void)
 {
 	system_timer = machine_desc->timer;
 	system_timer->init();
-#ifdef CONFIG_HAVE_SCHED_CLOCK
 	sched_clock_postinit();
-#endif
 }
 
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
index bca4914..4c48c8b 100644
--- a/arch/arm/plat-nomadik/Kconfig
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -23,7 +23,6 @@ config HAS_MTU
 config NOMADIK_MTU_SCHED_CLOCK
 	bool
 	depends on HAS_MTU
-	select HAVE_SCHED_CLOCK
 	help
 	  Use the Multi Timer Unit as the sched_clock.
 
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 52353be..c6f4b96 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -12,6 +12,5 @@ config PLAT_VERSATILE_LEDS
 
 config PLAT_VERSATILE_SCHED_CLOCK
 	def_bool y if !ARCH_INTEGRATOR_AP
-	select HAVE_SCHED_CLOCK
 
 endif
-- 
1.7.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory
  2012-01-18 16:14 ` [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory Marc Zyngier
@ 2012-01-18 16:26   ` Russell King - ARM Linux
  2012-01-18 16:29     ` Marc Zyngier
  2012-01-18 20:14   ` Nicolas Pitre
  1 sibling, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2012-01-18 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 18, 2012 at 04:14:52PM +0000, Marc Zyngier wrote:
>  obj-y		:= elf.o entry-armv.o entry-common.o irq.o opcodes.o \
>  		   process.o ptrace.o return_address.o setup.o signal.o \
> -		   sys_arm.o stacktrace.o time.o traps.o
> +		   sys_arm.o stacktrace.o time.o traps.o sched_clock.o

This list is supposed to be sorted alphabetically, but it seems to have
been forgotten when folk have patched it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory
  2012-01-18 16:26   ` Russell King - ARM Linux
@ 2012-01-18 16:29     ` Marc Zyngier
  0 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/01/12 16:26, Russell King - ARM Linux wrote:
> On Wed, Jan 18, 2012 at 04:14:52PM +0000, Marc Zyngier wrote:
>>  obj-y		:= elf.o entry-armv.o entry-common.o irq.o opcodes.o \
>>  		   process.o ptrace.o return_address.o setup.o signal.o \
>> -		   sys_arm.o stacktrace.o time.o traps.o
>> +		   sys_arm.o stacktrace.o time.o traps.o sched_clock.o
> 
> This list is supposed to be sorted alphabetically, but it seems to have
> been forgotten when folk have patched it.

Good point. I'll fix that on my next rebase.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation
  2012-01-18 16:14 ` [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation Marc Zyngier
@ 2012-01-18 18:36   ` Nori, Sekhar
  2012-01-18 18:50     ` Marc Zyngier
  0 siblings, 1 reply; 10+ messages in thread
From: Nori, Sekhar @ 2012-01-18 18:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

On Wed, Jan 18, 2012 at 21:44:50, Marc Zyngier wrote:
> Davinci has its own sched_clock() implementation, which gets in the
> way of a single zImage. Moving to the common sched_clock framework
> makes the code slightly cleaner.
> 
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Tested this on DaVinci DM365 and works well.

> diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
> index e1969ce..187fcda 100644
> --- a/arch/arm/mach-davinci/time.c
> +++ b/arch/arm/mach-davinci/time.c
> @@ -20,6 +20,7 @@
>  #include <linux/platform_device.h>
>  
>  #include <mach/hardware.h>
> +#include <asm/sched_clock.h>
>  #include <asm/mach/irq.h>
>  #include <asm/mach/time.h>
>  #include <mach/cputype.h>

I did not like the fact that the asm/ and mach/ headers
are intermixed in this file so I created a patch to
fix that while I was doing the common sched_clock() conversion.

http://www.spinics.net/lists/arm-kernel/msg153506.html

Can you please rebase your patch on that?

If you are planning to take this from outside of DaVinci tree,
feel free to add my:

Acked-by: Sekhar Nori <nsekhar@ti.com>

Else, let me know and I will pick it.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation
  2012-01-18 18:36   ` Nori, Sekhar
@ 2012-01-18 18:50     ` Marc Zyngier
  2012-01-18 20:16       ` Nori, Sekhar
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2012-01-18 18:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sekhar,

On 18/01/12 18:36, Nori, Sekhar wrote:
> On Wed, Jan 18, 2012 at 21:44:50, Marc Zyngier wrote:
>> Davinci has its own sched_clock() implementation, which gets in the
>> way of a single zImage. Moving to the common sched_clock framework
>> makes the code slightly cleaner.
>>
>> Cc: Sekhar Nori <nsekhar@ti.com>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> Tested this on DaVinci DM365 and works well.

Thanks for giving it a go.

>> diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
>> index e1969ce..187fcda 100644
>> --- a/arch/arm/mach-davinci/time.c
>> +++ b/arch/arm/mach-davinci/time.c
>> @@ -20,6 +20,7 @@
>>  #include <linux/platform_device.h>
>>  
>>  #include <mach/hardware.h>
>> +#include <asm/sched_clock.h>
>>  #include <asm/mach/irq.h>
>>  #include <asm/mach/time.h>
>>  #include <mach/cputype.h>
> 
> I did not like the fact that the asm/ and mach/ headers
> are intermixed in this file so I created a patch to
> fix that while I was doing the common sched_clock() conversion.
> 
> http://www.spinics.net/lists/arm-kernel/msg153506.html
> 
> Can you please rebase your patch on that?

Sure. I can probably merge that patch altogether in mine if you want.

> If you are planning to take this from outside of DaVinci tree,
> feel free to add my:
> 
> Acked-by: Sekhar Nori <nsekhar@ti.com>

Thanks. Ideally, I'd like all 3 patches to be kept together, otherwise
we may end up with patch 3 being applied before patch 1, breaking your
platform.

Cheers,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory
  2012-01-18 16:14 ` [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory Marc Zyngier
  2012-01-18 16:26   ` Russell King - ARM Linux
@ 2012-01-18 20:14   ` Nicolas Pitre
  1 sibling, 0 replies; 10+ messages in thread
From: Nicolas Pitre @ 2012-01-18 20:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Jan 2012, Marc Zyngier wrote:

> All sched_clock() providers have been converted to the sched_clock
> framework, which also provides a jiffy based implementation for
> the platforms that do not provide a counter.
> 
> It is now possible to make the sched_clock framework mandatory,
> effectively preventing new platforms to add new sched_clock()
> functions, which would be detrimental to the single zImage work.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Acked-by: Nicolas Pitre <nico@linaro.org>

> ---
>  arch/arm/Kconfig                |   18 ------------------
>  arch/arm/kernel/Makefile        |    3 +--
>  arch/arm/kernel/time.c          |    2 --
>  arch/arm/plat-nomadik/Kconfig   |    1 -
>  arch/arm/plat-versatile/Kconfig |    1 -
>  5 files changed, 1 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index a18550e..d1fcfe0 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -52,9 +52,6 @@ config MIGHT_HAVE_PCI
>  config SYS_SUPPORTS_APM_EMULATION
>  	bool
>  
> -config HAVE_SCHED_CLOCK
> -	bool
> -
>  config GENERIC_GPIO
>  	bool
>  
> @@ -388,7 +385,6 @@ config ARCH_PRIMA2
>  	select GENERIC_CLOCKEVENTS
>  	select CLKDEV_LOOKUP
>  	select GENERIC_IRQ_CHIP
> -	select HAVE_SCHED_CLOCK
>  	select MIGHT_HAVE_CACHE_L2X0
>  	select USE_OF
>  	select ZONE_DMA
> @@ -439,7 +435,6 @@ config ARCH_MXC
>  	select CLKDEV_LOOKUP
>  	select CLKSRC_MMIO
>  	select GENERIC_IRQ_CHIP
> -	select HAVE_SCHED_CLOCK
>  	select MULTI_IRQ_HANDLER
>  	help
>  	  Support for Freescale MXC/iMX-based family of processors
> @@ -531,7 +526,6 @@ config ARCH_IXP4XX
>  	select CPU_XSCALE
>  	select GENERIC_GPIO
>  	select GENERIC_CLOCKEVENTS
> -	select HAVE_SCHED_CLOCK
>  	select MIGHT_HAVE_PCI
>  	select DMABOUNCE if PCI
>  	help
> @@ -602,7 +596,6 @@ config ARCH_MMP
>  	select CLKDEV_LOOKUP
>  	select GENERIC_CLOCKEVENTS
>  	select GPIO_PXA
> -	select HAVE_SCHED_CLOCK
>  	select TICK_ONESHOT
>  	select PLAT_PXA
>  	select SPARSE_IRQ
> @@ -643,7 +636,6 @@ config ARCH_TEGRA
>  	select GENERIC_CLOCKEVENTS
>  	select GENERIC_GPIO
>  	select HAVE_CLK
> -	select HAVE_SCHED_CLOCK
>  	select HAVE_SMP
>  	select MIGHT_HAVE_CACHE_L2X0
>  	select ARCH_HAS_CPUFREQ
> @@ -660,7 +652,6 @@ config ARCH_PICOXCELL
>  	select DW_APB_TIMER
>  	select GENERIC_CLOCKEVENTS
>  	select GENERIC_GPIO
> -	select HAVE_SCHED_CLOCK
>  	select HAVE_TCM
>  	select NO_IOPORT
>  	select SPARSE_IRQ
> @@ -688,7 +679,6 @@ config ARCH_PXA
>  	select ARCH_REQUIRE_GPIOLIB
>  	select GENERIC_CLOCKEVENTS
>  	select GPIO_PXA
> -	select HAVE_SCHED_CLOCK
>  	select TICK_ONESHOT
>  	select PLAT_PXA
>  	select SPARSE_IRQ
> @@ -756,7 +746,6 @@ config ARCH_SA1100
>  	select CPU_FREQ
>  	select GENERIC_CLOCKEVENTS
>  	select CLKDEV_LOOKUP
> -	select HAVE_SCHED_CLOCK
>  	select TICK_ONESHOT
>  	select ARCH_REQUIRE_GPIOLIB
>  	select HAVE_IDE
> @@ -813,7 +802,6 @@ config ARCH_S5P64X0
>  	select CLKSRC_MMIO
>  	select HAVE_S3C2410_WATCHDOG if WATCHDOG
>  	select GENERIC_CLOCKEVENTS
> -	select HAVE_SCHED_CLOCK
>  	select HAVE_S3C2410_I2C if I2C
>  	select HAVE_S3C_RTC if RTC_CLASS
>  	help
> @@ -846,7 +834,6 @@ config ARCH_S5PV210
>  	select ARM_L1_CACHE_SHIFT_6
>  	select ARCH_HAS_CPUFREQ
>  	select GENERIC_CLOCKEVENTS
> -	select HAVE_SCHED_CLOCK
>  	select HAVE_S3C2410_I2C if I2C
>  	select HAVE_S3C_RTC if RTC_CLASS
>  	select HAVE_S3C2410_WATCHDOG if WATCHDOG
> @@ -889,7 +876,6 @@ config ARCH_U300
>  	depends on MMU
>  	select CLKSRC_MMIO
>  	select CPU_ARM926T
> -	select HAVE_SCHED_CLOCK
>  	select HAVE_TCM
>  	select ARM_AMBA
>  	select ARM_PATCH_PHYS_VIRT
> @@ -933,7 +919,6 @@ config ARCH_DAVINCI
>  	select ARCH_REQUIRE_GPIOLIB
>  	select ZONE_DMA
>  	select HAVE_IDE
> -	select HAVE_SCHED_CLOCK
>  	select CLKDEV_LOOKUP
>  	select GENERIC_ALLOCATOR
>  	select GENERIC_IRQ_CHIP
> @@ -948,7 +933,6 @@ config ARCH_OMAP
>  	select ARCH_HAS_CPUFREQ
>  	select CLKSRC_MMIO
>  	select GENERIC_CLOCKEVENTS
> -	select HAVE_SCHED_CLOCK
>  	select ARCH_HAS_HOLES_MEMORYMODEL
>  	help
>  	  Support for TI's OMAP platform (OMAP1/2/3/4).
> @@ -1114,13 +1098,11 @@ config ARCH_ACORN
>  config PLAT_IOP
>  	bool
>  	select GENERIC_CLOCKEVENTS
> -	select HAVE_SCHED_CLOCK
>  
>  config PLAT_ORION
>  	bool
>  	select CLKSRC_MMIO
>  	select GENERIC_IRQ_CHIP
> -	select HAVE_SCHED_CLOCK
>  
>  config PLAT_PXA
>  	bool
> diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
> index 43b740d..92098e6 100644
> --- a/arch/arm/kernel/Makefile
> +++ b/arch/arm/kernel/Makefile
> @@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg
>  
>  obj-y		:= elf.o entry-armv.o entry-common.o irq.o opcodes.o \
>  		   process.o ptrace.o return_address.o setup.o signal.o \
> -		   sys_arm.o stacktrace.o time.o traps.o
> +		   sys_arm.o stacktrace.o time.o traps.o sched_clock.o
>  
>  obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
>  
> @@ -30,7 +30,6 @@ obj-$(CONFIG_ARTHUR)		+= arthur.o
>  obj-$(CONFIG_ISA_DMA)		+= dma-isa.o
>  obj-$(CONFIG_PCI)		+= bios32.o isa.o
>  obj-$(CONFIG_ARM_CPU_SUSPEND)	+= sleep.o suspend.o
> -obj-$(CONFIG_HAVE_SCHED_CLOCK)	+= sched_clock.o
>  obj-$(CONFIG_SMP)		+= smp.o smp_tlb.o
>  obj-$(CONFIG_HAVE_ARM_SCU)	+= smp_scu.o
>  obj-$(CONFIG_HAVE_ARM_TWD)	+= smp_twd.o
> diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
> index 8c57dd3..5bff288 100644
> --- a/arch/arm/kernel/time.c
> +++ b/arch/arm/kernel/time.c
> @@ -149,8 +149,6 @@ void __init time_init(void)
>  {
>  	system_timer = machine_desc->timer;
>  	system_timer->init();
> -#ifdef CONFIG_HAVE_SCHED_CLOCK
>  	sched_clock_postinit();
> -#endif
>  }
>  
> diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
> index bca4914..4c48c8b 100644
> --- a/arch/arm/plat-nomadik/Kconfig
> +++ b/arch/arm/plat-nomadik/Kconfig
> @@ -23,7 +23,6 @@ config HAS_MTU
>  config NOMADIK_MTU_SCHED_CLOCK
>  	bool
>  	depends on HAS_MTU
> -	select HAVE_SCHED_CLOCK
>  	help
>  	  Use the Multi Timer Unit as the sched_clock.
>  
> diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
> index 52353be..c6f4b96 100644
> --- a/arch/arm/plat-versatile/Kconfig
> +++ b/arch/arm/plat-versatile/Kconfig
> @@ -12,6 +12,5 @@ config PLAT_VERSATILE_LEDS
>  
>  config PLAT_VERSATILE_SCHED_CLOCK
>  	def_bool y if !ARCH_INTEGRATOR_AP
> -	select HAVE_SCHED_CLOCK
>  
>  endif
> -- 
> 1.7.7.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation
  2012-01-18 18:50     ` Marc Zyngier
@ 2012-01-18 20:16       ` Nori, Sekhar
  0 siblings, 0 replies; 10+ messages in thread
From: Nori, Sekhar @ 2012-01-18 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

On Thu, Jan 19, 2012 at 00:20:46, Marc Zyngier wrote:
> On 18/01/12 18:36, Nori, Sekhar wrote:

> > 
> > I did not like the fact that the asm/ and mach/ headers
> > are intermixed in this file so I created a patch to
> > fix that while I was doing the common sched_clock() conversion.
> > 
> > http://www.spinics.net/lists/arm-kernel/msg153506.html
> > 
> > Can you please rebase your patch on that?
> 
> Sure. I can probably merge that patch altogether in mine if you want.

No, please keep it separate since its not really related to
common sched_clock() conversion.

> 
> > If you are planning to take this from outside of DaVinci tree,
> > feel free to add my:
> > 
> > Acked-by: Sekhar Nori <nsekhar@ti.com>
> 
> Thanks. Ideally, I'd like all 3 patches to be kept together, otherwise
> we may end up with patch 3 being applied before patch 1, breaking your
> platform.

No problem, thanks!

Regards,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-01-18 20:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 16:14 [PATCH v2 0/3] Convert remaining platforms to common sched_clock() Marc Zyngier
2012-01-18 16:14 ` [PATCH v2 1/3] ARM: davinci: convert to common sched_clock() implementation Marc Zyngier
2012-01-18 18:36   ` Nori, Sekhar
2012-01-18 18:50     ` Marc Zyngier
2012-01-18 20:16       ` Nori, Sekhar
2012-01-18 16:14 ` [PATCH v2 2/3] ARM: prima2: " Marc Zyngier
2012-01-18 16:14 ` [PATCH v2 3/3] ARM: Make the sched_clock framework mandatory Marc Zyngier
2012-01-18 16:26   ` Russell King - ARM Linux
2012-01-18 16:29     ` Marc Zyngier
2012-01-18 20:14   ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).