[bionic] powerpc/xive: Fix trying to "push" an already active pool VP

Message ID 1523546237-10429-1-git-send-email-breno.leitao@gmail.com
State New
Headers show
Series
  • [bionic] powerpc/xive: Fix trying to "push" an already active pool VP
Related show

Commit Message

Breno Leitao April 12, 2018, 3:17 p.m.
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1763386

When setting up a CPU, we "push" (activate) a pool VP for it.

However it's an error to do so if it already has an active
pool VP.

This happens when doing soft CPU hotplug on powernv since we
don't tear down the CPU on unplug. The HW flags the error which
gets captured by the diagnostics.

Fix this by making sure to "pull" out any already active pool
first.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Link: https://patchwork.ozlabs.org/patch/897035/
Signed-off-by: Breno Leitao <breno.leitao@gmail.com>

Comments

Kleber Souza April 18, 2018, 8:04 a.m. | #1
On 04/12/18 17:17, Breno Leitao wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1763386
> 
> When setting up a CPU, we "push" (activate) a pool VP for it.
> 
> However it's an error to do so if it already has an active
> pool VP.
> 
> This happens when doing soft CPU hotplug on powernv since we
> don't tear down the CPU on unplug. The HW flags the error which
> gets captured by the diagnostics.
> 
> Fix this by making sure to "pull" out any already active pool
> first.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Link: https://patchwork.ozlabs.org/patch/897035/
> Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
> 
> diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
> index ebc244b08d67..0f89ee557b04 100644
> --- a/arch/powerpc/sysdev/xive/native.c
> +++ b/arch/powerpc/sysdev/xive/native.c
> @@ -388,6 +388,10 @@ static void xive_native_setup_cpu(unsigned int cpu, struct xive_cpu *xc)
>  	if (xive_pool_vps == XIVE_INVALID_VP)
>  		return;
>  
> +	/* Check if pool VP already active, if it is, pull it */
> +	if (in_be32(xive_tima + TM_QW2_HV_POOL + TM_WORD2) & TM_QW2W2_VP)
> +		in_be64(xive_tima + TM_SPC_PULL_POOL_CTX);
> +
>  	/* Enable the pool VP */
>  	vp = xive_pool_vps + cpu;
>  	pr_debug("CPU %d setting up pool VP 0x%x\n", cpu, vp);
> 

This patch has already been applied to bionic/master-next branch:
https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic/commit/?h=master-next&id=78618bd6ea5c687560a4c7315762020bc6d7c7ce


Thanks,
Kleber

Patch

diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index ebc244b08d67..0f89ee557b04 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -388,6 +388,10 @@  static void xive_native_setup_cpu(unsigned int cpu, struct xive_cpu *xc)
 	if (xive_pool_vps == XIVE_INVALID_VP)
 		return;
 
+	/* Check if pool VP already active, if it is, pull it */
+	if (in_be32(xive_tima + TM_QW2_HV_POOL + TM_WORD2) & TM_QW2W2_VP)
+		in_be64(xive_tima + TM_SPC_PULL_POOL_CTX);
+
 	/* Enable the pool VP */
 	vp = xive_pool_vps + cpu;
 	pr_debug("CPU %d setting up pool VP 0x%x\n", cpu, vp);