Re: [PATCH 04/15] powerpc/time: Prepare to stop elapsing in dynticks-idle

Shrikanth Hegde
2026-02-26T04:07:43Z

On 2/25/26 11:29 PM, Christophe Leroy (CS GROUP) wrote:
>
>
> Le 25/02/2026 à 18:47, Shrikanth Hegde a écrit :
>> Hi Christophe.
>>
>>> I think I'm starting to understand now.
>>>
>>> I think the problem is that acct->starttime has an invalid value the
>>> very first time it is used.
>>>
>>> We are probably lacking an initial value in paca->accounting.starttime.
>>> This should likely be initialised from mftb in head_64.S in
>>> start_here_common for main CPU and __secondary_start for other CPUs
>>> or maybe at higher level in C in setup_arch() and start_secondary()
>>>
>>> Christophe
>>
>> How about below? this works too.
>
> Fine it is works, it means we found the real problem.
>
> What about using the newly added vtime_reset() ? See below (untested)
>

Thanks Christophe for helping.

This works too. vtime_reset does the exact same thing.
Let me write a changelog and a comment on vtime_reset and send it.

> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index 9b3167274653..f4aef85106ac 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -377,7 +377,6 @@ void vtime_task_switch(struct task_struct *prev)
>      }
>  }
>
> -#ifdef CONFIG_NO_HZ_COMMON
>  /**
>   * vtime_reset - Fast forward vtime entry clocks
>   *
> @@ -394,6 +393,7 @@ void vtime_reset(void)
>  #endif
>  }
>
> +#ifdef CONFIG_NO_HZ_COMMON
>  /**
>   * vtime_dyntick_start - Inform vtime about entry to idle-dynticks
>   *
> @@ -931,6 +931,7 @@ static void __init set_decrementer_max(void)
>  static void __init init_decrementer_clockevent(void)
>  {
>      register_decrementer_clockevent(smp_processor_id());
> +    vtime_reset();
>  }
>
>  void secondary_cpu_time_init(void)
> @@ -946,6 +947,7 @@ void secondary_cpu_time_init(void)
>      /* FIME: Should make unrelated change to move snapshot_timebase
>       * call here ! */
>      register_decrementer_clockevent(smp_processor_id());
> +    vtime_reset();
>  }
>
>  /*
>
>