All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Nicholas Piggin <npiggin@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: Re: [RFC PATCH 2/3] powerpc: remove the last remnants of cputime_t
Date: Thu, 06 Oct 2022 21:06:20 +1100	[thread overview]
Message-ID: <871qrlp8pv.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20221004063306.511154-3-npiggin@gmail.com>

Nicholas Piggin <npiggin@gmail.com> writes:
> cputime_t is no longer, converted to u64.

Would be good to have some explanation of why we had it and why we don't
need it anymore.

cheers

> diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
> index 431ae2343022..4961fb38e438 100644
> --- a/arch/powerpc/include/asm/cputime.h
> +++ b/arch/powerpc/include/asm/cputime.h
> @@ -21,23 +21,8 @@
>  #include <asm/param.h>
>  #include <asm/firmware.h>
>  
> -typedef u64 __nocast cputime_t;
> -typedef u64 __nocast cputime64_t;
> -
> -#define cmpxchg_cputime(ptr, old, new) cmpxchg(ptr, old, new)
> -
>  #ifdef __KERNEL__
> -/*
> - * Convert cputime <-> microseconds
> - */
> -extern u64 __cputime_usec_factor;
> -
> -static inline unsigned long cputime_to_usecs(const cputime_t ct)
> -{
> -	return mulhdu((__force u64) ct, __cputime_usec_factor);
> -}
> -
> -#define cputime_to_nsecs(cputime) tb_to_ns((__force u64)cputime)
> +#define cputime_to_nsecs(cputime) tb_to_ns(cputime)
>  
>  /*
>   * PPC64 uses PACA which is task independent for storing accounting data while
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index a2ab397065c6..d68de3618741 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -130,7 +130,7 @@ unsigned long tb_ticks_per_jiffy;
>  unsigned long tb_ticks_per_usec = 100; /* sane default */
>  EXPORT_SYMBOL(tb_ticks_per_usec);
>  unsigned long tb_ticks_per_sec;
> -EXPORT_SYMBOL(tb_ticks_per_sec);	/* for cputime_t conversions */
> +EXPORT_SYMBOL(tb_ticks_per_sec);	/* for cputime conversions */
>  
>  DEFINE_SPINLOCK(rtc_lock);
>  EXPORT_SYMBOL_GPL(rtc_lock);
> @@ -150,21 +150,6 @@ EXPORT_SYMBOL_GPL(ppc_tb_freq);
>  bool tb_invalid;
>  
>  #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
> -/*
> - * Factor for converting from cputime_t (timebase ticks) to
> - * microseconds. This is stored as 0.64 fixed-point binary fraction.
> - */
> -u64 __cputime_usec_factor;
> -EXPORT_SYMBOL(__cputime_usec_factor);
> -
> -static void calc_cputime_factors(void)
> -{
> -	struct div_result res;
> -
> -	div128_by_32(1000000, 0, tb_ticks_per_sec, &res);
> -	__cputime_usec_factor = res.result_low;
> -}
> -
>  /*
>   * Read the SPURR on systems that have it, otherwise the PURR,
>   * or if that doesn't exist return the timebase value passed in.
> @@ -369,10 +354,7 @@ void vtime_flush(struct task_struct *tsk)
>  	acct->hardirq_time = 0;
>  	acct->softirq_time = 0;
>  }
> -
> -#else /* ! CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
> -#define calc_cputime_factors()
> -#endif
> +#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
>  
>  void __delay(unsigned long loops)
>  {
> @@ -914,7 +896,6 @@ void __init time_init(void)
>  	tb_ticks_per_jiffy = ppc_tb_freq / HZ;
>  	tb_ticks_per_sec = ppc_tb_freq;
>  	tb_ticks_per_usec = ppc_tb_freq / 1000000;
> -	calc_cputime_factors();
>  
>  	/*
>  	 * Compute scale factor for sched_clock.
> -- 
> 2.37.2

  reply	other threads:[~2022-10-06 10:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  6:33 [RFC PATCH 0/3] powerpc/32: nohz full support Nicholas Piggin
2022-10-04  6:33 ` [RFC PATCH 1/3] powerpc/32: Implement HAVE_CONTEXT_TRACKING_USER support Nicholas Piggin
2022-10-04 11:32   ` Christophe Leroy
2022-10-06  8:22     ` Nicholas Piggin
2022-10-04  6:33 ` [RFC PATCH 2/3] powerpc: remove the last remnants of cputime_t Nicholas Piggin
2022-10-06 10:06   ` Michael Ellerman [this message]
2022-10-04  6:33 ` [RFC PATCH 3/3] Remove HAVE_VIRT_CPU_ACCOUNTING_GEN option Nicholas Piggin
2022-10-04  6:33   ` Nicholas Piggin
2022-10-04 11:58 ` [RFC PATCH 0/3] powerpc/32: nohz full support Christophe Leroy
2022-10-06  8:18   ` Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qrlp8pv.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.