Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: macppc: fix cpu idle percentage
To:
George Koehler <kernigh@gmail.com>
Cc:
tech@openbsd.org
Date:
Sat, 05 Apr 2025 11:26:15 +0200

Download raw body.

Thread
> Date: Fri, 4 Apr 2025 21:20:13 -0400
> From: George Koehler <kernigh@gmail.com>
> 
> If you wonder why top(1) on your macppc claims 99% intr and 0% idle,
> it's because I broke it in October 2024 (locore.S r1.66).  I changed
> ci_idepth from -1 to 0 when no interrupts, but I forgot to change
> CLKF_INTR to match.  The (frame)->depth in this macro is a copy of
> curcpu()->ci_idepth saved by "stw %r5,20(%r1)" in INTRENTER in
> locore.S.  This depth is now 1 if the clock interrupted an idle cpu,
> so CLKF_INTR should check > 1, as it does on most archs.
> 
> May I get an ok?

ok kettenis@

> Index: sys/arch/powerpc/include/cpu.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/powerpc/include/cpu.h,v
> diff -u -p -r1.79 cpu.h
> --- sys/arch/powerpc/include/cpu.h	22 Oct 2024 12:51:56 -0000	1.79
> +++ sys/arch/powerpc/include/cpu.h	5 Apr 2025 00:21:05 -0000
> @@ -155,7 +155,7 @@ extern struct cpu_info cpu_info[PPC_MAXP
>  
>  #define	CLKF_USERMODE(frame)	(((frame)->srr1 & PSL_PR) != 0)
>  #define	CLKF_PC(frame)		((frame)->srr0)
> -#define	CLKF_INTR(frame)	((frame)->depth != 0)
> +#define	CLKF_INTR(frame)	((frame)->depth > 1)
>  
>  extern int ppc_cpuidle;
>  extern int ppc_proc_is_64b;
> 
>