sched_clock: add data pointer argument to read callback
Subsystems (28)
PATCH 1/1 sched_clock: add data pointer argument to read callback
This passes a data pointer specified in the sched_clock_register() call to the read callback allowing simpler implementations thereof.
In this patch, existing uses of this interface are simply updated with a null pointer.
--- arch/arm/mach-davinci/time.c | 4 ++-- arch/arm/mach-ep93xx/timer-ep93xx.c | 4 ++-- arch/arm/mach-footbridge/dc21285-timer.c | 4 ++-- arch/arm/mach-gemini/time.c | 4 ++-- arch/arm/mach-integrator/integrator_cp.c | 4 ++-- arch/arm/mach-ixp4xx/common.c | 5 +++-- arch/arm/mach-mmp/time.c | 4 ++-- arch/arm/mach-omap1/time.c | 4 ++-- arch/arm/mach-omap2/timer.c | 4 ++-- arch/arm/plat-iop/time.c | 4 ++-- arch/arm/plat-omap/counter_32k.c | 4 ++-- arch/arm/plat-orion/time.c | 4 ++-- arch/arm/plat-versatile/sched-clock.c | 4 ++-- arch/cris/arch-v32/kernel/time.c | 4 ++-- arch/microblaze/kernel/timer.c | 4 ++-- arch/mips/jz4740/time.c | 4 ++-- arch/mips/kernel/cevt-txx9.c | 4 ++-- arch/mips/kernel/csrc-bcm1480.c | 4 ++-- arch/mips/kernel/csrc-ioasic.c | 4 ++-- arch/mips/kernel/csrc-r4k.c | 5 +++-- arch/mips/kernel/csrc-sb1250.c | 5 +++-- arch/mips/sgi-ip27/ip27-timer.c | 4 ++-- arch/xtensa/kernel/time.c | 4 ++-- drivers/clocksource/arm_arch_timer.c | 8 +++++++- drivers/clocksource/arm_global_timer.c | 4 ++-- drivers/clocksource/bcm2835_timer.c | 4 ++-- drivers/clocksource/cadence_ttc_timer.c | 4 ++-- drivers/clocksource/clksrc-dbx500-prcmu.c | 4 ++-- drivers/clocksource/clksrc_st_lpc.c | 4 ++-- drivers/clocksource/clps711x-timer.c | 4 ++-- drivers/clocksource/dw_apb_timer_of.c | 4 ++-- drivers/clocksource/exynos_mct.c | 4 ++-- drivers/clocksource/fsl_ftm_timer.c | 5 +++-- drivers/clocksource/meson6_timer.c | 4 ++-- drivers/clocksource/mxs_timer.c | 4 ++-- drivers/clocksource/nomadik-mtu.c | 4 ++-- drivers/clocksource/pxa_timer.c | 4 ++-- drivers/clocksource/qcom-timer.c | 4 ++-- drivers/clocksource/samsung_pwm_timer.c | 4 ++-- drivers/clocksource/sun4i_timer.c | 4 ++-- drivers/clocksource/tegra20_timer.c | 4 ++-- drivers/clocksource/time-armada-370-xp.c | 5 +++-- drivers/clocksource/time-lpc32xx.c | 4 ++-- drivers/clocksource/time-orion.c | 5 +++-- drivers/clocksource/time-pistachio.c | 4 ++-- drivers/clocksource/timer-digicolor.c | 4 ++-- drivers/clocksource/timer-imx-gpt.c | 4 ++-- drivers/clocksource/timer-integrator-ap.c | 4 ++-- drivers/clocksource/timer-prima2.c | 5 +++-- drivers/clocksource/timer-sp804.c | 4 ++-- drivers/clocksource/timer-u300.c | 4 ++-- drivers/clocksource/versatile.c | 4 ++-- drivers/clocksource/vf_pit_timer.c | 4 ++-- include/linux/sched_clock.h | 4 ++-- kernel/time/sched_clock.c | 32 +++++++++++++++++++------------ 55 files changed, 140 insertions(+), 119 deletions(-)
arch/arm/mach-davinci/time.c +2 -2
@@ -285,7 +285,7 @@ static struct clocksource clocksource_davinci = {/* * Overwrite weak default sched_clock with something more precise */ -static u64 notrace davinci_read_sched_clock(void) +static u64 notrace davinci_read_sched_clock(void *data) {return timer32_read (&timers[TID_CLOCKSOURCE ]); }
@@ -397,7 +397,7 @@ void __init davinci_timer_init(void) clocksource_davinci.name);sched_clock_register (davinci_read_sched_clock,32 , - davinci_clock_tick_rate); + davinci_clock_tick_rate,NULL );/* setup clockevent */ clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT ].id];
arch/arm/mach-ep93xx/timer-ep93xx.c +2 -2
@@ -50,7 +50,7 @@#define EP93XX_TIMER123_RATE 508469#define EP93XX_TIMER4_RATE 983040 -static u64 notrace ep93xx_read_sched_clock(void) +static u64 notrace ep93xx_read_sched_clock(void *data) {u64 ret;
@@ -132,7 +132,7 @@ void __init ep93xx_timer_init(void)EP93XX_TIMER4_RATE ,200 ,40 , ep93xx_clocksource_read);sched_clock_register (ep93xx_read_sched_clock,40 , -EP93XX_TIMER4_RATE ); +EP93XX_TIMER4_RATE ,NULL );/* Set up clockevent on timer 3 */ setup_irq (IRQ_EP93XX_TIMER3 , &ep93xx_timer_irq);
arch/arm/mach-footbridge/dc21285-timer.c +2 -2
@@ -123,7 +123,7 @@ void __init footbridge_timer_init(void)clockevents_config_and_register (ce, rate,0x4 ,0xffffff ); } -static u64 notrace footbridge_read_sched_clock(void) +static u64 notrace footbridge_read_sched_clock(void *data) {return ~*CSR_TIMER3_VALUE ; }
@@ -136,5 +136,5 @@ void __init footbridge_sched_clock(void) *CSR_TIMER3_CLR =0 ; *CSR_TIMER3_CNTL =TIMER_CNTL_ENABLE |TIMER_CNTL_DIV16 ; -sched_clock_register (footbridge_read_sched_clock,24 , rate); +sched_clock_register (footbridge_read_sched_clock,24 , rate,NULL ); }
arch/arm/mach-gemini/time.c +2 -2
@@ -63,7 +63,7 @@static unsigned int tick_rate; -static u64 notrace gemini_read_sched_clock(void) +static u64 notrace gemini_read_sched_clock(void *data) {return readl (TIMER_COUNT (TIMER3_BASE )); }
@@ -222,7 +222,7 @@ void __init gemini_timer_init(void)clocksource_mmio_init (TIMER_COUNT (TIMER3_BASE ),"gemini_clocksource" , tick_rate,300 ,32 , clocksource_mmio_readl_up); -sched_clock_register (gemini_read_sched_clock,32 , tick_rate); +sched_clock_register (gemini_read_sched_clock,32 , tick_rate,NULL );/* * Setup clockevent timer (interrupt-driven.)
arch/arm/mach-integrator/integrator_cp.c +2 -2
@@ -223,14 +223,14 @@ static struct clcd_board clcd_data = {#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28) -static u64 notrace intcp_read_sched_clock(void) +static u64 notrace intcp_read_sched_clock(void *data) {return readl (REFCOUNTER ); }static void __init intcp_init_early (void ) { -sched_clock_register (intcp_read_sched_clock,32 ,24000000 ); +sched_clock_register (intcp_read_sched_clock,32 ,24000000 ,NULL ); }static void __init intcp_init_irq_of (void )
arch/arm/mach-ixp4xx/common.c +3 -2
@@ -484,7 +484,7 @@ void __init ixp4xx_sys_init(void)/* * sched_clock() */ -static u64 notrace ixp4xx_read_sched_clock(void) +static u64 notrace ixp4xx_read_sched_clock(void *data) {return *IXP4XX_OSTS ; }
@@ -502,7 +502,8 @@ unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;EXPORT_SYMBOL (ixp4xx_timer_freq);static void __init ixp4xx_clocksource_init (void ) { -sched_clock_register (ixp4xx_read_sched_clock,32 , ixp4xx_timer_freq); +sched_clock_register (ixp4xx_read_sched_clock,32 , ixp4xx_timer_freq, +NULL );clocksource_mmio_init (NULL ,"OSTS" , ixp4xx_timer_freq,200 ,32 , ixp4xx_clocksource_read);
arch/arm/mach-mmp/time.c +2 -2
@@ -67,7 +67,7 @@ static inline uint32_t timer_read(void)return __raw_readl (mmp_timer_base +TMR_CVWR (1 )); } -static u64 notrace mmp_read_sched_clock(void) +static u64 notrace mmp_read_sched_clock(void *data) {return timer_read (); }
@@ -194,7 +194,7 @@ void __init timer_init(int irq) {timer_config (); -sched_clock_register (mmp_read_sched_clock,32 ,MMP_CLOCK_FREQ ); +sched_clock_register (mmp_read_sched_clock,32 ,MMP_CLOCK_FREQ ,NULL ); ckevt.cpumask =cpumask_of (0 );
arch/arm/mach-omap1/time.c +2 -2
@@ -178,7 +178,7 @@ static __init void omap_init_mpu_timer(unsigned long rate)* --------------------------------------------------------------------------- */ -static u64 notrace omap_mpu_read_sched_clock(void) +static u64 notrace omap_mpu_read_sched_clock(void *data) {return ~omap_mpu_timer_read (1 ); }
@@ -190,7 +190,7 @@ static void __init omap_init_clocksource(unsigned long rate)"%s: can't register clocksource!\n" ;omap_mpu_timer_start (1 , ~0 ,1 ); -sched_clock_register (omap_mpu_read_sched_clock,32 , rate); +sched_clock_register (omap_mpu_read_sched_clock,32 , rate,NULL );if (clocksource_mmio_init (&timer->read_tim,"mpu_timer2" , rate,300 ,32 , clocksource_mmio_readl_down))
arch/arm/mach-omap2/timer.c +2 -2
@@ -374,7 +374,7 @@ static struct clocksource clocksource_gpt = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace dmtimer_read_sched_clock(void) +static u64 notrace dmtimer_read_sched_clock(void *data) {if (clksrc.reserved) return __omap_dm_timer_read_counter(&clksrc,
@@ -466,7 +466,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,__omap_dm_timer_load_start (&clksrc,OMAP_TIMER_CTRL_ST |OMAP_TIMER_CTRL_AR ,0 ,OMAP_TIMER_NONPOSTED ); -sched_clock_register (dmtimer_read_sched_clock,32 , clksrc.rate); +sched_clock_register (dmtimer_read_sched_clock,32 , clksrc.rate,NULL );if (clocksource_register_hz (&clocksource_gpt, clksrc.rate)) pr_err("Could not register clocksource %s\n",
arch/arm/plat-iop/time.c +2 -2
@@ -54,7 +54,7 @@ static struct clocksource iop_clocksource = {/* * IOP sched_clock() implementation via its clocksource. */ -static u64 notrace iop_read_sched_clock(void) +static u64 notrace iop_read_sched_clock(void *data) {return 0xffffffffu -read_tcr1 (); }
@@ -158,7 +158,7 @@ void __init iop_init_time(unsigned long tick_rate) {u32 timer_ctl; -sched_clock_register (iop_read_sched_clock,32 , tick_rate); +sched_clock_register (iop_read_sched_clock,32 , tick_rate,NULL ); ticks_per_jiffy =DIV_ROUND_CLOSEST (tick_rate,HZ ); iop_tick_rate = tick_rate;
arch/arm/plat-omap/counter_32k.c +2 -2
@@ -38,7 +38,7 @@*/ static void __iomem *sync32k_cnt_reg; -static u64 notrace omap_32k_read_sched_clock(void) +static u64 notrace omap_32k_read_sched_clock(void *data) {return sync32k_cnt_reg ?readl_relaxed (sync32k_cnt_reg) :0 ; }
@@ -109,7 +109,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)return ret; } -sched_clock_register (omap_32k_read_sched_clock,32 ,32768 ); +sched_clock_register (omap_32k_read_sched_clock,32 ,32768 ,NULL );register_persistent_clock (NULL , omap_read_persistent_clock64);pr_info ("OMAP clocksource: 32k_counter at 32768 Hz\n" );
arch/arm/plat-orion/time.c +2 -2
@@ -61,7 +61,7 @@ static u32 ticks_per_jiffy;* at least 7.5ns (133MHz TCLK). */ -static u64 notrace orion_read_sched_clock(void) +static u64 notrace orion_read_sched_clock(void *data) {return ~readl (timer_base +TIMER0_VAL_OFF ); }
@@ -205,7 +205,7 @@ orion_time_init(void __iomem *_bridge_base, u32 _bridge_timer1_clr_mask,/* * Set scale and timer for sched_clock. */ -sched_clock_register (orion_read_sched_clock,32 , tclk); +sched_clock_register (orion_read_sched_clock,32 , tclk,NULL );/* * Setup free-running clocksource timer (interrupts
arch/arm/plat-versatile/sched-clock.c +2 -2
@@ -26,7 +26,7 @@static void __iomem *ctr; -static u64 notrace versatile_read_sched_clock(void) +static u64 notrace versatile_read_sched_clock(void *data) {if (ctr)return readl (ctr);
@@ -37,5 +37,5 @@ static u64 notrace versatile_read_sched_clock(void)void __init versatile_sched_clock_init (void __iomem *reg,unsigned long rate) { ctr = reg; -sched_clock_register (versatile_read_sched_clock,32 , rate); +sched_clock_register (versatile_read_sched_clock,32 , rate,NULL ); }
arch/cris/arch-v32/kernel/time.c +2 -2
@@ -245,7 +245,7 @@ static struct irqaction irq_timer = { .dev_id = &crisv32_clockevent, }; -static u64 notrace crisv32_timer_sched_clock(void) +static u64 notrace crisv32_timer_sched_clock(void *data) {return REG_RD (timer, timer_base, r_time); }
@@ -284,7 +284,7 @@ void __init time_init(void)crisv32_timer_init ();sched_clock_register (crisv32_timer_sched_clock,32 , -CRISV32_TIMER_FREQ ); +CRISV32_TIMER_FREQ ,NULL ); clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time, "crisv32-timer", CRISV32_TIMER_FREQ,
arch/microblaze/kernel/timer.c +2 -2
@@ -183,7 +183,7 @@ static __init void xilinx_clockevent_init(void)clockevents_register_device (&clockevent_xilinx_timer); } -static u64 xilinx_clock_read (void ) +static u64 xilinx_clock_read (void *data) {return read_fn (timer_baseaddr +TCR1 ); }
@@ -304,7 +304,7 @@ static void __init xilinx_timer_init(struct device_node *timer)xilinx_clocksource_init ();xilinx_clockevent_init (); -sched_clock_register (xilinx_clock_read,32 , timer_clock_freq); +sched_clock_register (xilinx_clock_read,32 , timer_clock_freq,NULL ); } CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a",
arch/mips/jz4740/time.c +2 -2
@@ -47,7 +47,7 @@ static struct clocksource jz4740_clocksource = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace jz4740_read_sched_clock(void) +static u64 notrace jz4740_read_sched_clock(void *data) {return jz4740_timer_get_count (TIMER_CLOCKSOURCE ); }
@@ -155,7 +155,7 @@ void __init plat_time_init(void)if (ret)printk (KERN_ERR "Failed to register clocksource: %d\n" , ret); -sched_clock_register (jz4740_read_sched_clock,16 , clk_rate); +sched_clock_register (jz4740_read_sched_clock,16 , clk_rate,NULL );setup_irq (jz4740_clockevent.irq, &timer_irqaction);
arch/mips/kernel/cevt-txx9.c +2 -2
@@ -47,7 +47,7 @@ static struct txx9_clocksource txx9_clocksource = { }, }; -static u64 notrace txx9_read_sched_clock(void) +static u64 notrace txx9_read_sched_clock(void *data) {return __raw_readl (&txx9_clocksource.tmrptr->trr); }
@@ -69,7 +69,7 @@ void __init txx9_clocksource_init(unsigned long baseaddr, txx9_clocksource.tmrptr = tmrptr;sched_clock_register (txx9_read_sched_clock,TXX9_CLOCKSOURCE_BITS , -TIMER_CLK (imbusclk)); +TIMER_CLK (imbusclk),NULL ); }struct txx9_clock_event_device {
arch/mips/kernel/csrc-bcm1480.c +2 -2
@@ -38,7 +38,7 @@ struct clocksource bcm1480_clocksource = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace sb1480_read_sched_clock(void) +static u64 notrace sb1480_read_sched_clock(void *data) {return __raw_readq (IOADDR (A_SCD_ZBBUS_CYCLE_COUNT )); }
@@ -53,5 +53,5 @@ void __init sb1480_clocksource_init(void) zbbus = ((plldiv >>1 ) *50000000 ) + ((plldiv &1 ) *25000000 );clocksource_register_hz (cs, zbbus); -sched_clock_register (sb1480_read_sched_clock,64 , zbbus); +sched_clock_register (sb1480_read_sched_clock,64 , zbbus,NULL ); }
arch/mips/kernel/csrc-ioasic.c +2 -2
@@ -34,7 +34,7 @@ static struct clocksource clocksource_dec = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace dec_ioasic_read_sched_clock(void) +static u64 notrace dec_ioasic_read_sched_clock(void *data) {return ioasic_read (IO_REG_FCTR ); }
@@ -68,7 +68,7 @@ int __init dec_ioasic_clocksource_init(void) clocksource_dec.rating =200 + freq /10000000 ;clocksource_register_hz (&clocksource_dec, freq); -sched_clock_register (dec_ioasic_read_sched_clock,32 , freq); +sched_clock_register (dec_ioasic_read_sched_clock,32 , freq,NULL );return 0 ; }
arch/mips/kernel/csrc-r4k.c +3 -2
@@ -23,7 +23,7 @@ static struct clocksource clocksource_mips = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace r4k_read_sched_clock(void) +static u64 notrace r4k_read_sched_clock(void *data) {return read_c0_count (); }
@@ -38,7 +38,8 @@ int __init init_r4k_clocksource(void)clocksource_register_hz (&clocksource_mips, mips_hpt_frequency); -sched_clock_register (r4k_read_sched_clock,32 , mips_hpt_frequency); +sched_clock_register (r4k_read_sched_clock,32 , mips_hpt_frequency, +NULL );return 0 ; }
arch/mips/kernel/csrc-sb1250.c +3 -2
@@ -54,7 +54,7 @@ struct clocksource bcm1250_clocksource = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace sb1250_read_sched_clock(void) +static u64 notrace sb1250_read_sched_clock(void *data) {return sb1250_hpt_get_cycles (); }
@@ -76,5 +76,6 @@ void __init sb1250_clocksource_init(void)clocksource_register_hz (cs,V_SCD_TIMER_FREQ ); -sched_clock_register (sb1250_read_sched_clock,23 ,V_SCD_TIMER_FREQ ); +sched_clock_register (sb1250_read_sched_clock,23 ,V_SCD_TIMER_FREQ , +NULL ); }
arch/mips/sgi-ip27/ip27-timer.c +2 -2
@@ -153,7 +153,7 @@ struct clocksource hub_rt_clocksource = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace hub_rt_read_sched_clock(void) +static u64 notrace hub_rt_read_sched_clock(void *data) {return REMOTE_HUB_L (cputonasid (0 ),PI_RT_COUNT ); }
@@ -164,7 +164,7 @@ static void __init hub_rt_clocksource_init(void)clocksource_register_hz (cs,CYCLES_PER_SEC ); -sched_clock_register (hub_rt_read_sched_clock,52 ,CYCLES_PER_SEC ); +sched_clock_register (hub_rt_read_sched_clock,52 ,CYCLES_PER_SEC ,NULL ); }void __init plat_time_init (void )
arch/xtensa/kernel/time.c +2 -2
@@ -37,7 +37,7 @@ static cycle_t ccount_read(struct clocksource *cs)return (cycle_t )get_ccount (); } -static u64 notrace ccount_sched_clock_read(void) +static u64 notrace ccount_sched_clock_read(void *data) {return get_ccount (); }
@@ -147,7 +147,7 @@ void __init time_init(void)clocksource_register_hz (&ccount_clocksource, ccount_freq);local_timer_setup (0 );setup_irq (this_cpu_ptr (&ccount_timer)->evt.irq, &timer_irqaction); -sched_clock_register (ccount_sched_clock_read,32 , ccount_freq); +sched_clock_register (ccount_sched_clock_read,32 , ccount_freq,NULL );clocksource_of_init (); }
drivers/clocksource/arm_arch_timer.c +7 -1
@@ -434,6 +434,11 @@ static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)return arch_timer_read_counter (); } +static u64 notrace arch_counter_sched_read(void *data) +{ +return arch_timer_read_counter (); +} +static struct clocksource clocksource_counter = { .name ="arch_sys_counter" , .rating =400 ,
@@ -482,7 +487,8 @@ static void __init arch_counter_register(unsigned type)timecounter_init (&timecounter, &cyclecounter, start_count);/* 56 bits minimum, so we assume worst case rollover */ -sched_clock_register (arch_timer_read_counter,56 , arch_timer_rate); +sched_clock_register (arch_counter_sched_read,56 , arch_timer_rate, +NULL ); }static void arch_timer_stop (struct clock_event_device *clk)
drivers/clocksource/arm_global_timer.c +2 -2
@@ -199,7 +199,7 @@ static struct clocksource gt_clocksource = { };#ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK -static u64 notrace gt_sched_clock_read(void) +static u64 notrace gt_sched_clock_read(void *data) {return gt_counter_read (); }
@@ -214,7 +214,7 @@ static void __init gt_clocksource_init(void)writel (GT_CONTROL_TIMER_ENABLE , gt_base +GT_CONTROL );#ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK -sched_clock_register (gt_sched_clock_read,64 , gt_clk_rate); +sched_clock_register (gt_sched_clock_read,64 , gt_clk_rate,NULL );#endif clocksource_register_hz (>_clocksource, gt_clk_rate); }
drivers/clocksource/bcm2835_timer.c +2 -2
@@ -49,7 +49,7 @@ struct bcm2835_timer {static void __iomem *system_clock__read_mostly ; -static u64 notrace bcm2835_sched_read(void) +static u64 notrace bcm2835_sched_read(void *data) {return readl_relaxed (system_clock); }
@@ -95,7 +95,7 @@ static void __init bcm2835_timer_init(struct device_node *node)panic ("Can't read clock-frequency" ); system_clock = base +REG_COUNTER_LO ; -sched_clock_register (bcm2835_sched_read,32 , freq); +sched_clock_register (bcm2835_sched_read,32 , freq,NULL );clocksource_mmio_init (base +REG_COUNTER_LO , node->name, freq,300 ,32 , clocksource_mmio_readl_up);
drivers/clocksource/cadence_ttc_timer.c +2 -2
@@ -166,7 +166,7 @@ static cycle_t __ttc_clocksource_read(struct clocksource *cs) TTC_COUNT_VAL_OFFSET); } -static u64 notrace ttc_sched_clock_read(void) +static u64 notrace ttc_sched_clock_read(void *data) {return readl_relaxed (ttc_sched_clock_val_reg); }
@@ -375,7 +375,7 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base, ttc_sched_clock_val_reg = base +TTC_COUNT_VAL_OFFSET ;sched_clock_register (ttc_sched_clock_read, timer_width, - ttccs->ttc.freq /PRESCALE ); + ttccs->ttc.freq /PRESCALE ,NULL ); } static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
drivers/clocksource/clksrc-dbx500-prcmu.c +2 -2
@@ -53,7 +53,7 @@ static struct clocksource clocksource_dbx500_prcmu = {#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK -static u64 notrace dbx500_prcmu_sched_clock_read(void) +static u64 notrace dbx500_prcmu_sched_clock_read(void *data) {if (unlikely (!clksrc_dbx500_timer_base))return 0 ;
@@ -81,7 +81,7 @@ void __init clksrc_dbx500_prcmu_init(void __iomem *base) clksrc_dbx500_timer_base + PRCMU_TIMER_REF); }#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK -sched_clock_register (dbx500_prcmu_sched_clock_read,32 ,RATE_32K ); +sched_clock_register (dbx500_prcmu_sched_clock_read,32 ,RATE_32K ,NULL );#endif clocksource_register_hz (&clocksource_dbx500_prcmu,RATE_32K ); }
drivers/clocksource/clksrc_st_lpc.c +2 -2
@@ -39,7 +39,7 @@ static void __init st_clksrc_reset(void)writel_relaxed (1 , ddata.base +LPC_LPT_START_OFF ); } -static u64 notrace st_clksrc_sched_clock_read(void) +static u64 notrace st_clksrc_sched_clock_read(void *data) {return (u64 )readl_relaxed (ddata.base +LPC_LPT_LSB_OFF ); }
@@ -53,7 +53,7 @@ static int __init st_clksrc_init(void) rate =clk_get_rate (ddata.clk); -sched_clock_register (st_clksrc_sched_clock_read,32 , rate); +sched_clock_register (st_clksrc_sched_clock_read,32 , rate,NULL ); ret = clocksource_mmio_init(ddata.base + LPC_LPT_LSB_OFF, "clksrc-st-lpc", rate, 300, 32,
drivers/clocksource/clps711x-timer.c +2 -2
@@ -26,7 +26,7 @@ enum {static void __iomem *tcd; -static u64 notrace clps711x_sched_clock_read(void) +static u64 notrace clps711x_sched_clock_read(void *data) {return ~readw (tcd); }
@@ -47,7 +47,7 @@ static int __init _clps711x_clksrc_init(struct clk *clock, void __iomem *base)clocksource_mmio_init (tcd,"clps711x-clocksource" , rate,300 ,16 , clocksource_mmio_readw_down); -sched_clock_register (clps711x_sched_clock_read,16 , rate); +sched_clock_register (clps711x_sched_clock_read,16 , rate,NULL );return 0 ; }
drivers/clocksource/dw_apb_timer_of.c +2 -2
@@ -106,7 +106,7 @@ static void __init add_clocksource(struct device_node *source_timer) sched_rate = rate; } -static u64 notrace read_sched_clock(void) +static u64 notrace read_sched_clock(void *data) {return ~readl_relaxed (sched_io_base); }
@@ -127,7 +127,7 @@ static void __init init_sched_clock(void)of_node_put (sched_timer); } -sched_clock_register (read_sched_clock,32 , sched_rate); +sched_clock_register (read_sched_clock,32 , sched_rate,NULL ); }static int num_called;
drivers/clocksource/exynos_mct.c +2 -2
@@ -218,7 +218,7 @@ static struct clocksource mct_frc = { .resume = exynos4_frc_resume, }; -static u64 notrace exynos4_read_sched_clock(void) +static u64 notrace exynos4_read_sched_clock(void *data) {return exynos4_read_count_32 (); }
@@ -243,7 +243,7 @@ static void __init exynos4_clocksource_init(void)if (clocksource_register_hz (&mct_frc, clk_rate))panic ("%s: can't register clocksource\n" , mct_frc.name); -sched_clock_register (exynos4_read_sched_clock,32 , clk_rate); +sched_clock_register (exynos4_read_sched_clock,32 , clk_rate,NULL ); }static void exynos4_mct_comp0_stop (void )
drivers/clocksource/fsl_ftm_timer.c +3 -2
@@ -118,7 +118,7 @@ static inline void ftm_reset_counter(void __iomem *base)ftm_writel (0x00 , base +FTM_CNT ); } -static u64 ftm_read_sched_clock (void ) +static u64 ftm_read_sched_clock (void *data) {return ftm_readl (priv->clksrc_base +FTM_CNT ); }
@@ -234,7 +234,8 @@ static int __init ftm_clocksource_init(unsigned long freq)ftm_reset_counter (priv->clksrc_base); -sched_clock_register (ftm_read_sched_clock,16 , freq / (1 << priv->ps)); +sched_clock_register (ftm_read_sched_clock,16 , freq / (1 << priv->ps), +NULL ); err =clocksource_mmio_init (priv->clksrc_base +FTM_CNT ,"fsl-ftm" , freq / (1 << priv->ps),300 ,16 , clocksource_mmio_readl_up);
drivers/clocksource/meson6_timer.c +2 -2
@@ -38,7 +38,7 @@static void __iomem *timer_base; -static u64 notrace meson6_timer_sched_read(void) +static u64 notrace meson6_timer_sched_read(void *data) {return (u64 )readl (timer_base +TIMER_ISA_VAL (CSD_ID )); }
@@ -145,7 +145,7 @@ static void __init meson6_timer_init(struct device_node *node) val |=TIMER_CSD_UNIT_1US <<TIMER_INPUT_BIT (CSD_ID );writel (val, timer_base +TIMER_ISA_MUX ); -sched_clock_register (meson6_timer_sched_read,32 ,USEC_PER_SEC ); +sched_clock_register (meson6_timer_sched_read,32 ,USEC_PER_SEC ,NULL );clocksource_mmio_init (timer_base +TIMER_ISA_VAL (CSD_ID ), node->name,1000 *1000 ,300 ,32 , clocksource_mmio_readl_up);
drivers/clocksource/mxs_timer.c +2 -2
@@ -206,7 +206,7 @@ static struct clocksource clocksource_mxs = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -static u64 notrace mxs_read_sched_clock_v2(void) +static u64 notrace mxs_read_sched_clock_v2(void *data) {return ~readl_relaxed (mxs_timrot_base +HW_TIMROT_RUNNING_COUNTn (1 )); }
@@ -220,7 +220,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)else {clocksource_mmio_init (mxs_timrot_base +HW_TIMROT_RUNNING_COUNTn (1 ),"mxs_timer" , c,200 ,32 , clocksource_mmio_readl_down); -sched_clock_register (mxs_read_sched_clock_v2,32 , c); +sched_clock_register (mxs_read_sched_clock_v2,32 , c,NULL ); }return 0 ;
drivers/clocksource/nomadik-mtu.c +2 -2
@@ -75,7 +75,7 @@ static struct delay_timer mtu_delay_timer;* local implementation which uses the clocksource to get some * better resolution when scheduling the kernel. */ -static u64 notrace nomadik_read_sched_clock(void) +static u64 notrace nomadik_read_sched_clock(void *data) {if (unlikely (!mtu_base))return 0 ;
@@ -232,7 +232,7 @@ static void __init nmdk_timer_init(void __iomem *base, int irq, "mtu_0");#ifdef CONFIG_CLKSRC_NOMADIK_MTU_SCHED_CLOCK -sched_clock_register (nomadik_read_sched_clock,32 , rate); +sched_clock_register (nomadik_read_sched_clock,32 , rate,NULL );#endif /* Timer 1 is used for events, register irq and clockevents */
drivers/clocksource/pxa_timer.c +2 -2
@@ -54,7 +54,7 @@static void __iomem *timer_base; -static u64 notrace pxa_read_sched_clock(void) +static u64 notrace pxa_read_sched_clock(void *data) {return timer_readl (OSCR ); }
@@ -155,7 +155,7 @@ static void __init pxa_timer_common_init(int irq, unsigned long clock_tick_rate)timer_writel (0 ,OIER );timer_writel (OSSR_M0 |OSSR_M1 |OSSR_M2 |OSSR_M3 ,OSSR ); -sched_clock_register (pxa_read_sched_clock,32 , clock_tick_rate); +sched_clock_register (pxa_read_sched_clock,32 , clock_tick_rate,NULL ); ckevt_pxa_osmr0.cpumask =cpumask_of (0 );
drivers/clocksource/qcom-timer.c +2 -2
@@ -164,7 +164,7 @@ static struct notifier_block msm_timer_cpu_nb = { .notifier_call = msm_timer_cpu_notify, }; -static u64 notrace msm_sched_clock_read(void) +static u64 notrace msm_sched_clock_read(void *data) {return msm_clocksource.read (&msm_clocksource); }
@@ -215,7 +215,7 @@ err: res =clocksource_register_hz (cs, dgt_hz);if (res)pr_err ("clocksource_register failed\n" ); -sched_clock_register (msm_sched_clock_read, sched_bits, dgt_hz); +sched_clock_register (msm_sched_clock_read, sched_bits, dgt_hz,NULL ); msm_delay_timer.freq = dgt_hz;register_current_timer_delay (&msm_delay_timer); }
drivers/clocksource/samsung_pwm_timer.c +2 -2
@@ -328,7 +328,7 @@ static struct clocksource samsung_clocksource = {* this wraps around for now, since it is just a relative time * stamp. (Inspired by U300 implementation.) */ -static u64 notrace samsung_read_sched_clock(void) +static u64 notrace samsung_read_sched_clock(void *data) {return samsung_clocksource_read (NULL ); }
@@ -355,7 +355,7 @@ static void __init samsung_clocksource_init(void) pwm.source_reg = pwm.base + pwm.source_id *0x0c +0x14 ;sched_clock_register (samsung_read_sched_clock, - pwm.variant.bits, clock_rate); + pwm.variant.bits, clock_rate,NULL ); samsung_clocksource.mask =CLOCKSOURCE_MASK (pwm.variant.bits); ret =clocksource_register_hz (&samsung_clocksource, clock_rate);
drivers/clocksource/sun4i_timer.c +2 -2
@@ -141,7 +141,7 @@ static struct irqaction sun4i_timer_irq = { .dev_id = &sun4i_clockevent, }; -static u64 notrace sun4i_timer_sched_read(void) +static u64 notrace sun4i_timer_sched_read(void *data) {return ~readl (timer_base +TIMER_CNTVAL_REG (1 )); }
@@ -180,7 +180,7 @@ static void __init sun4i_timer_init(struct device_node *node)if (of_machine_is_compatible ("allwinner,sun4i-a10" ) ||of_machine_is_compatible ("allwinner,sun5i-a13" ) ||of_machine_is_compatible ("allwinner,sun5i-a10s" )) -sched_clock_register (sun4i_timer_sched_read,32 , rate); +sched_clock_register (sun4i_timer_sched_read,32 , rate,NULL );clocksource_mmio_init (timer_base +TIMER_CNTVAL_REG (1 ), node->name, rate,350 ,32 , clocksource_mmio_readl_down);
drivers/clocksource/tegra20_timer.c +2 -2
@@ -104,7 +104,7 @@ static struct clock_event_device tegra_clockevent = { .tick_resume = tegra_timer_shutdown, }; -static u64 notrace tegra_read_sched_clock(void) +static u64 notrace tegra_read_sched_clock(void *data) {return timer_readl (TIMERUS_CNTR_1US ); }
@@ -208,7 +208,7 @@ static void __init tegra20_init_timer(struct device_node *np)WARN (1 ,"Unknown clock rate" ); } -sched_clock_register (tegra_read_sched_clock,32 ,1000000 ); +sched_clock_register (tegra_read_sched_clock,32 ,1000000 ,NULL );if (clocksource_mmio_init (timer_reg_base +TIMERUS_CNTR_1US ,"timer_us" ,1000000 ,300 ,32 , clocksource_mmio_readl_up)) {
drivers/clocksource/time-armada-370-xp.c +3 -2
@@ -92,7 +92,7 @@ static void local_timer_ctrl_clrset(u32 clr, u32 set) local_base + TIMER_CTRL_OFF); } -static u64 notrace armada_370_xp_read_sched_clock(void) +static u64 notrace armada_370_xp_read_sched_clock(void *data) {return ~readl (timer_base +TIMER0_VAL_OFF ); }
@@ -290,7 +290,8 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)/* * Set scale and timer for sched_clock. */ -sched_clock_register (armada_370_xp_read_sched_clock,32 , timer_clk); +sched_clock_register (armada_370_xp_read_sched_clock,32 , timer_clk, +NULL ); clocksource_mmio_init(timer_base + TIMER0_VAL_OFF, "armada_370_xp_clocksource",
drivers/clocksource/time-lpc32xx.c +2 -2
@@ -48,7 +48,7 @@ struct lpc32xx_clock_event_ddata {/* Needed for the sched clock */ static void __iomem *clocksource_timer_counter; -static u64 notrace lpc32xx_read_sched_clock(void) +static u64 notrace lpc32xx_read_sched_clock(void *data) {return readl (clocksource_timer_counter); }
@@ -162,7 +162,7 @@ static int __init lpc32xx_clocksource_init(struct device_node *np) } clocksource_timer_counter = base +LPC32XX_TIMER_TC ; -sched_clock_register (lpc32xx_read_sched_clock,32 , rate); +sched_clock_register (lpc32xx_read_sched_clock,32 , rate,NULL );return 0 ;
drivers/clocksource/time-orion.c +3 -2
@@ -39,7 +39,7 @@ static void __iomem *timer_base;/* * Free-running clocksource handling. */ -static u64 notrace orion_read_sched_clock(void) +static u64 notrace orion_read_sched_clock(void *data) {return ~readl (timer_base +TIMER0_VAL ); }
@@ -133,7 +133,8 @@ static void __init orion_timer_init(struct device_node *np)clocksource_mmio_init (timer_base +TIMER0_VAL ,"orion_clocksource" ,clk_get_rate (clk),300 ,32 , clocksource_mmio_readl_down); -sched_clock_register (orion_read_sched_clock,32 ,clk_get_rate (clk)); +sched_clock_register (orion_read_sched_clock,32 ,clk_get_rate (clk), +NULL );/* setup timer1 as clockevent timer */ if (setup_irq (irq, &orion_clkevt_irq))
drivers/clocksource/time-pistachio.c +2 -2
@@ -86,7 +86,7 @@ static cycle_t pistachio_clocksource_read_cycles(struct clocksource *cs)return ~(cycle_t )counter; } -static u64 notrace pistachio_read_sched_clock(void) +static u64 notrace pistachio_read_sched_clock(void *data) {return pistachio_clocksource_read_cycles (&pcs_gpt.cs); }
@@ -210,7 +210,7 @@ static void __init pistachio_clksrc_of_init(struct device_node *node)writel (TIMER_ME_GLOBAL , pcs_gpt.base);raw_spin_lock_init (&pcs_gpt.lock); -sched_clock_register (pistachio_read_sched_clock,32 , rate); +sched_clock_register (pistachio_read_sched_clock,32 , rate,NULL );clocksource_register_hz (&pcs_gpt.cs, rate); } CLOCKSOURCE_OF_DECLARE(pistachio_gptimer, "img,pistachio-gptimer",
drivers/clocksource/timer-digicolor.c +2 -2
@@ -143,7 +143,7 @@ static irqreturn_t digicolor_timer_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -static u64 digicolor_timer_sched_read (void ) +static u64 digicolor_timer_sched_read (void *data) {return ~readl (dc_timer_dev.base +COUNT (TIMER_B )); }
@@ -183,7 +183,7 @@ static void __init digicolor_timer_init(struct device_node *node)writel (UINT_MAX , dc_timer_dev.base +COUNT (TIMER_B ));writeb (CONTROL_ENABLE , dc_timer_dev.base +CONTROL (TIMER_B )); -sched_clock_register (digicolor_timer_sched_read,32 , rate); +sched_clock_register (digicolor_timer_sched_read,32 , rate,NULL );clocksource_mmio_init (dc_timer_dev.base +COUNT (TIMER_B ), node->name, rate,340 ,32 , clocksource_mmio_readl_down);
drivers/clocksource/timer-imx-gpt.c +2 -2
@@ -152,7 +152,7 @@ static void imx31_gpt_irq_acknowledge(struct imx_timer *imxtm)static void __iomem *sched_clock_reg; -static u64 notrace mxc_read_sched_clock(void) +static u64 notrace mxc_read_sched_clock(void *data) {return sched_clock_reg ?readl_relaxed (sched_clock_reg) :0 ; }
@@ -175,7 +175,7 @@ static int __init mxc_clocksource_init(struct imx_timer *imxtm) sched_clock_reg = reg; -sched_clock_register (mxc_read_sched_clock,32 , c); +sched_clock_register (mxc_read_sched_clock,32 , c,NULL );return clocksource_mmio_init (reg,"mxc_timer1" , c,200 ,32 , clocksource_mmio_readl_up); }
drivers/clocksource/timer-integrator-ap.c +2 -2
@@ -31,7 +31,7 @@static void __iomem * sched_clk_base; -static u64 notrace integrator_read_sched_clock(void) +static u64 notrace integrator_read_sched_clock(void *data) {return -readl (sched_clk_base +TIMER_VALUE ); }
@@ -54,7 +54,7 @@ static void integrator_clocksource_init(unsigned long inrate, rate, 200, 16, clocksource_mmio_readl_down); sched_clk_base = base; -sched_clock_register (integrator_read_sched_clock,16 , rate); +sched_clock_register (integrator_read_sched_clock,16 , rate,NULL ); }static unsigned long timer_reload;
drivers/clocksource/timer-prima2.c +3 -2
@@ -176,7 +176,7 @@ static struct irqaction sirfsoc_timer_irq = { };/* Overwrite weak default sched_clock with more precise one */ -static u64 notrace sirfsoc_read_sched_clock(void) +static u64 notrace sirfsoc_read_sched_clock(void *data) {return sirfsoc_timer_read (NULL ); }
@@ -219,7 +219,8 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np)BUG_ON (clocksource_register_hz (&sirfsoc_clocksource,PRIMA2_CLOCK_FREQ )); -sched_clock_register (sirfsoc_read_sched_clock,64 ,PRIMA2_CLOCK_FREQ ); +sched_clock_register (sirfsoc_read_sched_clock,64 ,PRIMA2_CLOCK_FREQ , +NULL );BUG_ON (setup_irq (sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
drivers/clocksource/timer-sp804.c +2 -2
@@ -67,7 +67,7 @@ static long __init sp804_get_clock_rate(struct clk *clk)static void __iomem *sched_clock_base; -static u64 notrace sp804_read(void) +static u64 notrace sp804_read(void *data) {return ~readl_relaxed (sched_clock_base +TIMER_VALUE ); }
@@ -110,7 +110,7 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,if (use_sched_clock) { sched_clock_base = base; -sched_clock_register (sp804_read,32 , rate); +sched_clock_register (sp804_read,32 , rate,NULL ); } }
drivers/clocksource/timer-u300.c +2 -2
@@ -344,7 +344,7 @@ static struct irqaction u300_timer_irq = {* stamp. (Inspired by OMAP implementation.) */ -static u64 notrace u300_read_sched_clock(void) +static u64 notrace u300_read_sched_clock(void *data) {return readl (u300_timer_base +U300_TIMER_APP_GPT2CC ); }
@@ -384,7 +384,7 @@ static void __init u300_timer_init_of(struct device_node *np) u300_clockevent_data.ticks_per_jiffy =DIV_ROUND_CLOSEST (rate,HZ ); -sched_clock_register (u300_read_sched_clock,32 , rate); +sched_clock_register (u300_read_sched_clock,32 , rate,NULL ); u300_delay_timer.read_current_timer = &u300_read_current_timer; u300_delay_timer.freq = rate;
drivers/clocksource/versatile.c +2 -2
@@ -20,7 +20,7 @@static void __iomem *versatile_sys_24mhz; -static u64 notrace versatile_sys_24mhz_read(void) +static u64 notrace versatile_sys_24mhz_read(void *data) {return readl (versatile_sys_24mhz); }
@@ -34,7 +34,7 @@ static void __init versatile_sched_clock_init(struct device_node *node) versatile_sys_24mhz = base +SYS_24MHZ ; -sched_clock_register (versatile_sys_24mhz_read,32 ,24000000 ); +sched_clock_register (versatile_sys_24mhz_read,32 ,24000000 ,NULL ); }CLOCKSOURCE_OF_DECLARE (vexpress,"arm,vexpress-sysreg" , versatile_sched_clock_init);
drivers/clocksource/vf_pit_timer.c +2 -2
@@ -52,7 +52,7 @@ static inline void pit_irq_acknowledge(void)__raw_writel (PITTFLG_TIF , clkevt_base +PITTFLG ); } -static u64 pit_read_sched_clock (void ) +static u64 pit_read_sched_clock (void *data) {return ~__raw_readl (clksrc_base +PITCVAL ); }
@@ -64,7 +64,7 @@ static int __init pit_clocksource_init(unsigned long rate)__raw_writel (~0UL , clksrc_base +PITLDVAL );__raw_writel (PITTCTRL_TEN , clksrc_base +PITTCTRL ); -sched_clock_register (pit_read_sched_clock,32 , rate); +sched_clock_register (pit_read_sched_clock,32 , rate,NULL );return clocksource_mmio_init (clksrc_base +PITCVAL ,"vf-pit" , rate,300 ,32 , clocksource_mmio_readl_down); }
include/linux/sched_clock.h +2 -2
@@ -14,7 +14,7 @@ extern void sched_clock_postinit(void);static inline void sched_clock_postinit (void ) { }#endif -extern void sched_clock_register (u64 (*read)(void ),int bits, -unsigned long rate); +extern void sched_clock_register (u64 (*read)(void *),int bits, +unsigned long rate,void *data);#endif
kernel/time/sched_clock.c +20 -12
@@ -27,6 +27,7 @@* @sched_clock_mask: Bitmask for two's complement subtraction of non 64bit * clocks. * @read_sched_clock: Current clock source (or dummy source when suspended). +* @sched_clock_data: Pointer passed to read_sched_clock() * @mult: Multipler for scaled math conversion. * @shift: Shift value for scaled math conversion. *
@@ -39,7 +40,8 @@ struct clock_read_data {u64 epoch_ns;u64 epoch_cyc;u64 sched_clock_mask; -u64 (*read_sched_clock)(void); +u64 (*read_sched_clock)(void *); +void *sched_clock_data;u32 mult;u32 shift; };
@@ -54,6 +56,7 @@ struct clock_read_data {* @wrap_kt: Duration for which clock can run before wrapping. * @rate: Tick rate of the registered clock. * @actual_read_sched_clock: Registered hardware level clock read function. +* @sched_clock_data: Pointer passed to actual_read_sched_clock() * * The ordering of this structure has been chosen to optimize cache * performance. In particular 'seq' and 'read_data[0]' (combined) should fit
@@ -65,7 +68,8 @@ struct clock_data {ktime_t wrap_kt;unsigned long rate; -u64 (*actual_read_sched_clock)(void); +u64 (*actual_read_sched_clock)(void *data); +void *sched_clock_data; };static struct hrtimer sched_clock_timer;
@@ -73,7 +77,7 @@ static int irqtime = -1;core_param (irqtime, irqtime, int,0400 ); -static u64 notrace jiffy_sched_clock_read(void) +static u64 notrace jiffy_sched_clock_read(void *data) {/* * We don't need to use get_jiffies_64 on 32-bit arches here
@@ -103,8 +107,8 @@ unsigned long long notrace sched_clock(void) seq =raw_read_seqcount (&cd.seq); rd = cd.read_data + (seq &1 ); - cyc = (rd->read_sched_clock () - rd->epoch_cyc) & - rd->sched_clock_mask; + cyc = (rd->read_sched_clock (rd->sched_clock_data) - + rd->epoch_cyc) & rd->sched_clock_mask; res = rd->epoch_ns +cyc_to_ns (cyc, rd->mult, rd->shift); }while (read_seqcount_retry (&cd.seq, seq));
@@ -147,7 +151,7 @@ static void update_sched_clock(void) rd = cd.read_data[0 ]; - cyc = cd.actual_read_sched_clock (); + cyc = cd.actual_read_sched_clock (cd.sched_clock_data); ns = rd.epoch_ns +cyc_to_ns ((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); rd.epoch_ns = ns;
@@ -165,7 +169,8 @@ static enum hrtimer_restart sched_clock_poll(struct hrtimer *hrt) }void __init -sched_clock_register (u64 (*read)(void ),int bits,unsigned long rate) +sched_clock_register (u64 (*read)(void *),int bits,unsigned long rate, +void *data) {u64 res, wrap, new_mask, new_epoch, cyc, ns;u32 new_mult, new_shift;
@@ -191,12 +196,14 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) rd = cd.read_data[0 ];/* Update epoch for new counter and update 'epoch_ns' from old counter*/ - new_epoch =read (); - cyc = cd.actual_read_sched_clock (); + new_epoch =read (data); + cyc = cd.actual_read_sched_clock (cd.sched_clock_data); ns = rd.epoch_ns +cyc_to_ns ((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); cd.actual_read_sched_clock = read; + cd.sched_clock_data = data; rd.read_sched_clock = read; + rd.sched_clock_data = data; rd.sched_clock_mask = new_mask; rd.mult = new_mult; rd.shift = new_shift;
@@ -238,7 +245,8 @@ void __init sched_clock_postinit(void)* make it the final one one. */ if (cd.actual_read_sched_clock == jiffy_sched_clock_read) -sched_clock_register (jiffy_sched_clock_read,BITS_PER_LONG ,HZ ); +sched_clock_register (jiffy_sched_clock_read,BITS_PER_LONG ,HZ , +NULL );update_sched_clock ();
@@ -262,7 +270,7 @@ void __init sched_clock_postinit(void)* at the end of the critical section to be sure we observe the * correct copy of 'epoch_cyc'. */ -static u64 notrace suspended_sched_clock_read(void) +static u64 notrace suspended_sched_clock_read(void *data) {unsigned long seq =raw_read_seqcount (&cd.seq);
@@ -284,7 +292,7 @@ static void sched_clock_resume(void) {struct clock_read_data *rd = &cd.read_data[0 ]; - rd->epoch_cyc = cd.actual_read_sched_clock (); + rd->epoch_cyc = cd.actual_read_sched_clock (cd.sched_clock_data);hrtimer_start (&sched_clock_timer, cd.wrap_kt,HRTIMER_MODE_REL ); rd->read_sched_clock = cd.actual_read_sched_clock; }
Signature · 1 line
2.5.3
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
This is a bad description. It tells us what the patch is doing, (which we can see by reading the patch) but not _why_. Please include information on why the change is necessary - describe what you are trying to achieve.
I generally don't accept patches what add new stuff to the kernel with no users of that new stuff - that's called experience, experience of people who submit stuff like that, and then vanish leaving their junk in the kernel without any users. Please ensure that this gets a user very quickly, or better still, submit this patch as part of a series which makes use of it.
Also, copying soo many people is guaranteed to be silently dropped by mailing lists.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
This is a bad description. It tells us what the patch is doing, (which we can see by reading the patch) but not _why_. Please include information on why the change is necessary - describe what you are trying to achieve.
Currently most of the callbacks use a global variable to store the address of a counter register. This has several downsides:
- Loading the address of a global variable can be more expensive than keeping a pointer next to the function pointer.
- It makes it impossible to have multiple instances of a driver call sched_clock_register() since the caller can't know which clock will win in the end.
- Many of the existing callbacks are practically identical and could be replaced with a common generic function if it had a pointer argument.
If I've missed something that makes this a stupid idea, please tell.
Signature · 2 lines
M?ns Rullg?rd mans at mansr.com
Quoted 20 lines · M?ns Rullg?rd
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
This is a bad description. It tells us what the patch is doing, (which we can see by reading the patch) but not _why_. Please include information on why the change is necessary - describe what you are trying to achieve.
Currently most of the callbacks use a global variable to store the address of a counter register. This has several downsides:
- Loading the address of a global variable can be more expensive than keeping a pointer next to the function pointer.
Quoted 8 lines
- It makes it impossible to have multiple instances of a driver call
sched_clock_register()since the caller can't know which clock will win in the end.- Many of the existing callbacks are practically identical and could be replaced with a common generic function if it had a pointer argument.
If I've missed something that makes this a stupid idea, please tell.
So my next question is whether you intend to pass an iomem pointer through this, or a some kind of structure, or both. It matters, because iomem pointers have a __iomem attribute to keep sparse happy. Having to force that attribute on and off pointers is frowned upon, as it defeats the purpose of the sparse static checker.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Quoted 28 lines · Russell King - ARM Linux
Quoted 27 lines · M?ns Rullg?rd
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
This is a bad description. It tells us what the patch is doing, (which we can see by reading the patch) but not _why_. Please include information on why the change is necessary - describe what you are trying to achieve.
Currently most of the callbacks use a global variable to store the address of a counter register. This has several downsides:
- Loading the address of a global variable can be more expensive than keeping a pointer next to the function pointer.
- It makes it impossible to have multiple instances of a driver call
sched_clock_register()since the caller can't know which clock will win in the end.- Many of the existing callbacks are practically identical and could be replaced with a common generic function if it had a pointer argument.
Quoted 7 lines
Quoted 1 line
If I've missed something that makes this a stupid idea, please tell.
So my next question is whether you intend to pass an iomem pointer through this, or a some kind of structure, or both. It matters, because iomem pointers have a
__iomemattribute to keep sparse happy. Having to force that attribute on and off pointers is frowned upon, as it defeats the purpose of the sparse static checker.
So this is an instance where tools like sparse get in the way of doing the simplest, most efficient, and obviously correct thing. Who wins in such cases?
Signature · 2 lines
M?ns Rullg?rd mans at mansr.com
Quoted 38 lines · M?ns Rullg?rd
Quoted 28 lines · Russell King - ARM Linux
Quoted 27 lines · M?ns Rullg?rd
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
This is a bad description. It tells us what the patch is doing, (which we can see by reading the patch) but not _why_. Please include information on why the change is necessary - describe what you are trying to achieve.
Currently most of the callbacks use a global variable to store the address of a counter register. This has several downsides:
- Loading the address of a global variable can be more expensive than keeping a pointer next to the function pointer.
- It makes it impossible to have multiple instances of a driver call
sched_clock_register()since the caller can't know which clock will win in the end.- Many of the existing callbacks are practically identical and could be replaced with a common generic function if it had a pointer argument.
Quoted 7 lines
Quoted 1 line
If I've missed something that makes this a stupid idea, please tell.
So my next question is whether you intend to pass an iomem pointer through this, or a some kind of structure, or both. It matters, because iomem pointers have a
__iomemattribute to keep sparse happy. Having to force that attribute on and off pointers is frowned upon, as it defeats the purpose of the sparse static checker.
Quoted 3 lines
So this is an instance where tools like sparse get in the way of doing the simplest, most efficient, and obviously correct thing. Who wins in such cases?
In that case, NAK on the patch. I don't have time for your stupid games.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Mans,
Quoted 5 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
I can't see any simplifaction of any driver. This is called in hot pathes and that extra unused argument just adds register pressure for no value.
What are you actually trying to solve?
Thanks,
tglx
Hi Mans,
Quoted 8 lines · Mans Rullgard
This passes a data pointer specified in the
sched_clock_register()call to the read callback allowing simpler implementations thereof.In this patch, existing uses of this interface are simply updated with a null pointer.
Signed-off-by Mans Rullgard <[email protected]>---
[...]
Quoted 14 lines
drivers/clocksource/time-armada-370-xp.c +1
-1@@ -92,7 +92,7 @@ static void local_timer_ctrl_clrset(u32 clr, u32 set) local_base + TIMER_CTRL_OFF); } -static u64 notrace armada_370_xp_read_sched_clock(void) +static u64 notrace armada_370_xp_read_sched_clock(void *data) {return ~readl (timer_base +TIMER0_VAL_OFF ); }
drivers/clocksource/time-armada-370-xp.c static void __init armada_370_xp_timer_common_init(struct device_node *np) · line 297
Quoted 9 lines
drivers/clocksource/time-armada-370-xp.c +2
-1@@ -290,7 +290,8 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)/* * Set scale and timer for sched_clock. */ -sched_clock_register (armada_370_xp_read_sched_clock,32 , timer_clk); +sched_clock_register (armada_370_xp_read_sched_clock,32 , timer_clk, +NULL ); clocksource_mmio_init(timer_base + TIMER0_VAL_OFF, "armada_370_xp_clocksource",
For the time-armada-370-xp.c file:
Thanks,
Gregory
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com