linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"Shreyas B. Prabhu" <shreyasbp@gmail.com>,
	Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
	Anton Blanchard <anton@samba.org>,
	Balbir Singh <bsingharora@gmail.com>,
	Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] powernv:idle: Use correct IDLE_THREAD_BITS in POWER8/9
Date: Thu, 13 Apr 2017 16:36:20 +1000	[thread overview]
Message-ID: <1492065380.4624.50.camel@neuling.org> (raw)
In-Reply-To: <1b89d07b1a7ea140501a86b1ed246c5af1b0ce83.1491996797.git.ego@linux.vnet.ibm.com>

On Wed, 2017-04-12 at 17:16 +0530, Gautham R. Shenoy wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> This patch ensures that POWER8 and POWER9 processors use the correct
> value of IDLE_THREAD_BITS as POWER8 has 8 threads per core and hence
> the IDLE_THREAD_BITS should be 0xFF while POWER9 has only 4 threads
> per core and hence the IDLE_THREAD_BITS should be 0xF.

Why don't we derive this from the device tree rather than hard wiring it per cpu
type?

Mikey

> 
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/cpuidle.h    | 3 ++-
>  arch/powerpc/kernel/idle_book3s.S     | 9 ++++++---
>  arch/powerpc/platforms/powernv/idle.c | 5 ++++-
>  3 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/cpuidle.h
> b/arch/powerpc/include/asm/cpuidle.h
> index 52586f9..fece6ca 100644
> --- a/arch/powerpc/include/asm/cpuidle.h
> +++ b/arch/powerpc/include/asm/cpuidle.h
> @@ -34,7 +34,8 @@
>  #define PNV_CORE_IDLE_THREAD_WINKLE_BITS_SHIFT	8
>  #define PNV_CORE_IDLE_THREAD_WINKLE_BITS	0x0000FF00
>  
> -#define PNV_CORE_IDLE_THREAD_BITS       	0x000000FF
> +#define PNV_CORE_IDLE_4THREAD_BITS       	0x0000000F
> +#define PNV_CORE_IDLE_8THREAD_BITS       	0x000000FF
>  
>  /*
>   * ============================ NOTE =================================
> diff --git a/arch/powerpc/kernel/idle_book3s.S
> b/arch/powerpc/kernel/idle_book3s.S
> index 2b13fe2..9b747e9 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -223,7 +223,7 @@ lwarx_loop1:
>  	add	r15,r15,r5			/* Add if winkle */
>  	andc	r15,r15,r7			/* Clear thread bit */
>  
> -	andi.	r9,r15,PNV_CORE_IDLE_THREAD_BITS
> +	andi.	r9,r15,PNV_CORE_IDLE_8THREAD_BITS
>  
>  /*
>   * If cr0 = 0, then current thread is the last thread of the core entering
> @@ -582,8 +582,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
>  	stwcx.	r15,0,r14
>  	bne-	1b
>  	isync
> -
> -	andi.	r9,r15,PNV_CORE_IDLE_THREAD_BITS
> +BEGIN_FTR_SECTION
> +	andi.	r9,r15,PNV_CORE_IDLE_4THREAD_BITS
> +FTR_SECTION_ELSE
> +	andi.	r9,r15,PNV_CORE_IDLE_8THREAD_BITS
> +ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
>  	cmpwi	cr2,r9,0
>  
>  	/*
> diff --git a/arch/powerpc/platforms/powernv/idle.c
> b/arch/powerpc/platforms/powernv/idle.c
> index 445f30a..d46920b 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -112,7 +112,10 @@ static void pnv_alloc_idle_core_states(void)
>  		size_t paca_ptr_array_size;
>  
>  		core_idle_state = kmalloc_node(sizeof(u32), GFP_KERNEL,
> node);
> -		*core_idle_state = PNV_CORE_IDLE_THREAD_BITS;
> +		if (cpu_has_feature(CPU_FTR_ARCH_300))
> +			*core_idle_state = PNV_CORE_IDLE_4THREAD_BITS;
> +		else
> +			*core_idle_state = PNV_CORE_IDLE_8THREAD_BITS;
>  		paca_ptr_array_size = (threads_per_core *
>  				       sizeof(struct paca_struct *));
>  

  reply	other threads:[~2017-04-13  6:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 11:46 [PATCH 0/3] powernv:stop: Some fixes for handling deep stop Gautham R. Shenoy
2017-04-12 11:46 ` [PATCH 1/3] powernv:idle: Use correct IDLE_THREAD_BITS in POWER8/9 Gautham R. Shenoy
2017-04-13  6:36   ` Michael Neuling [this message]
2017-04-13 10:00     ` Michael Ellerman
2017-04-13 11:35       ` Gautham R Shenoy
2017-04-12 11:46 ` [PATCH 2/3] powernv:idle: Decouple TB restore & Per-core SPRs restore Gautham R. Shenoy
2017-04-13  6:55   ` Michael Neuling
2017-04-13 11:51     ` Gautham R Shenoy
2017-04-12 11:46 ` [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Gautham R. Shenoy
2017-04-13  3:58   ` Aneesh Kumar K.V
2017-04-13  4:12     ` Benjamin Herrenschmidt
2017-04-13  6:27       ` Michael Neuling
2017-04-13  7:18         ` Nicholas Piggin
2017-04-13 10:05           ` Michael Ellerman
2017-04-13 11:54           ` Gautham R Shenoy
2017-04-13 12:08             ` 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=1492065380.4624.50.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=akshay.adiga@linux.vnet.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=shilpa.bhat@linux.vnet.ibm.com \
    --cc=shreyasbp@gmail.com \
    --cc=svaidy@linux.vnet.ibm.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 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).