LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC PATCH 01/10] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation
From: Alexander Graf @ 2014-01-29 16:32 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: paulus, linuxppc-dev, kvm-ppc, kvm
In-Reply-To: <1390927455-3312-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On 01/28/2014 05:44 PM, Aneesh Kumar K.V wrote:
> We definitely don't need to emulate mtspr, because both the registers
> are hypervisor resource.

This patch description doesn't cover what the patch actually does. It 
changes the implementation from "always tell the guest it uses 100%" to 
"give the guest an accurate amount of cpu time spent inside guest context".

Also, I think we either go with full hyp semantics which means we also 
emulate the offset or we go with no hyp awareness in the guest at all 
which means we also don't emulate SPURR which is a hyp privileged register.

Otherwise I like the patch :).


Alex

>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>   arch/powerpc/include/asm/kvm_book3s.h |  2 --
>   arch/powerpc/include/asm/kvm_host.h   |  4 ++--
>   arch/powerpc/kvm/book3s_emulate.c     | 16 ++++++++--------
>   arch/powerpc/kvm/book3s_pr.c          | 10 ++++++++++
>   4 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index bc23b1ba7980..396448afa38b 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -83,8 +83,6 @@ struct kvmppc_vcpu_book3s {
>   	u64 sdr1;
>   	u64 hior;
>   	u64 msr_mask;
> -	u64 purr_offset;
> -	u64 spurr_offset;
>   #ifdef CONFIG_PPC_BOOK3S_32
>   	u32 vsid_pool[VSID_POOL_SIZE];
>   	u32 vsid_next;
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index 9a0cdb2c9d58..0a3785271f34 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -506,8 +506,8 @@ struct kvm_vcpu_arch {
>   #ifdef CONFIG_BOOKE
>   	u32 decar;
>   #endif
> -	u32 tbl;
> -	u32 tbu;
> +	/* Time base value when we entered the guest */
> +	u64 entry_tb;
>   	u32 tcr;
>   	ulong tsr; /* we need to perform set/clr_bits() which requires ulong */
>   	u32 ivor[64];
> diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
> index a7d54aa203d0..e1f1e5e16449 100644
> --- a/arch/powerpc/kvm/book3s_emulate.c
> +++ b/arch/powerpc/kvm/book3s_emulate.c
> @@ -422,12 +422,6 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
>   		    (mfmsr() & MSR_HV))
>   			vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
>   		break;
> -	case SPRN_PURR:
> -		to_book3s(vcpu)->purr_offset = spr_val - get_tb();
> -		break;
> -	case SPRN_SPURR:
> -		to_book3s(vcpu)->spurr_offset = spr_val - get_tb();
> -		break;
>   	case SPRN_GQR0:
>   	case SPRN_GQR1:
>   	case SPRN_GQR2:
> @@ -523,10 +517,16 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
>   		*spr_val = 0;
>   		break;
>   	case SPRN_PURR:
> -		*spr_val = get_tb() + to_book3s(vcpu)->purr_offset;
> +		/*
> +		 * On exit we would have updated purr
> +		 */
> +		*spr_val = vcpu->arch.purr;
>   		break;
>   	case SPRN_SPURR:
> -		*spr_val = get_tb() + to_book3s(vcpu)->purr_offset;
> +		/*
> +		 * On exit we would have updated spurr
> +		 */
> +		*spr_val = vcpu->arch.spurr;
>   		break;
>   	case SPRN_GQR0:
>   	case SPRN_GQR1:
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index fdcbabdfb709..02231f5193c2 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -115,6 +115,11 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
>   	svcpu->lr  = vcpu->arch.lr;
>   	svcpu->pc  = vcpu->arch.pc;
>   	svcpu->in_use = true;
> +	/*
> +	 * Now also save the current time base value. We use this
> +	 * to find the guest purr and spurr value.
> +	 */
> +	vcpu->arch.entry_tb = get_tb();
>   }
>   
>   /* Copy data touched by real-mode code from shadow vcpu back to vcpu */
> @@ -161,6 +166,11 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
>   
>   out:
>   	preempt_enable();
> +	/*
> +	 * Update purr and spurr using time base
> +	 */
> +	vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb;
> +	vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb;
>   }
>   
>   static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)

^ permalink raw reply

* Re: [PATCH] powerpc: enable CONFIG_HAVE_MEMORYLESS_NODES
From: Christoph Lameter @ 2014-01-29 15:55 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: David Rientjes, Pekka Enberg, linux-mm, Paul Mackerras,
	Anton Blanchard, Matt Mackall, Joonsoo Kim, linuxppc-dev,
	Wanpeng Li
In-Reply-To: <20140128183457.GA9315@linux.vnet.ibm.com>

On Tue, 28 Jan 2014, Nishanth Aravamudan wrote:

> Anton Blanchard found an issue with an LPAR that had no memory in Node
> 0. Christoph Lameter recommended, as one possible solution, to use
> numa_mem_id() for locality of the nearest memory node-wise. However,
> numa_mem_id() [and the other related APIs] are only useful if
> CONFIG_HAVE_MEMORYLESS_NODES is set. This is only the case for ia64
> currently, but clearly we can have memoryless nodes on ppc64. Add the
> Kconfig option and define it to be the same value as CONFIG_NUMA.

Well this is trivial but if you need encouragement:

Reviewed-by: Christoph Lameter <cl@linux.com>

^ permalink raw reply

* Re: [PATCH] slub: Don't throw away partial remote slabs if there is no local memory
From: Christoph Lameter @ 2014-01-29 15:54 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Han Pingtian, mpm, penberg, linux-mm, paulus, Anton Blanchard,
	David Rientjes, Joonsoo Kim, linuxppc-dev, Wanpeng Li
In-Reply-To: <20140128182947.GA1591@linux.vnet.ibm.com>

On Tue, 28 Jan 2014, Nishanth Aravamudan wrote:

> This helps about the same as David's patch -- but I found the reason
> why! ppc64 doesn't set CONFIG_HAVE_MEMORYLESS_NODES :) Expect a patch
> shortly for that and one other case I found.

Oww...

^ permalink raw reply

* [PATCH] powerpc/ppc32: fix the bug in the init of non-base exception stack for UP
From: Kevin Hao @ 2014-01-29 10:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc

We would allocate one specific exception stack for each kind of
non-base exceptions for every CPU. For ppc32 the CPU hard ID is
used as the subscript to get the specific exception stack for
one CPU. But for an UP kernel, there is only one element in the
each kind of exception stack array. We would get stuck if the
CPU hard ID is not equal to '0'. So in this case we should use the
subscript '0' no matter what the CPU hard ID is.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/kernel/irq.c      | 5 +++++
 arch/powerpc/kernel/setup_32.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 9729b23bfb0a..1d0848bba049 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -559,8 +559,13 @@ void exc_lvl_ctx_init(void)
 #ifdef CONFIG_PPC64
 		cpu_nr = i;
 #else
+#ifdef CONFIG_SMP
 		cpu_nr = get_hard_smp_processor_id(i);
+#else
+		cpu_nr = 0;
 #endif
+#endif
+
 		memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE);
 		tp = critirq_ctx[cpu_nr];
 		tp->cpu = cpu_nr;
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 2b0da27eaee4..04cc4fcca78b 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -247,7 +247,12 @@ static void __init exc_lvl_early_init(void)
 	/* interrupt stacks must be in lowmem, we get that for free on ppc32
 	 * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
 	for_each_possible_cpu(i) {
+#ifdef CONFIG_SMP
 		hw_cpu = get_hard_smp_processor_id(i);
+#else
+		hw_cpu = 0;
+#endif
+
 		critirq_ctx[hw_cpu] = (struct thread_info *)
 			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
 #ifdef CONFIG_BOOKE
-- 
1.8.5.3

^ permalink raw reply related

* Re: Please pull 'next' branch of 5xxx tree
From: Gerhard Sittig @ 2014-01-29 10:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Anatolij Gustschin, linuxppc-dev
In-Reply-To: <1390981569.8524.53.camel@pasglop>

On Wed, Jan 29, 2014 at 18:46 +1100, Benjamin Herrenschmidt wrote:
> 
> On Tue, 2014-01-28 at 17:00 +1100, Benjamin Herrenschmidt wrote:
> > On Tue, 2014-01-28 at 06:46 +0100, Anatolij Gustschin wrote:
> > > Hi Ben !
> > > 
> > > On Wed, 15 Jan 2014 22:18:59 +0100
> > > Anatolij Gustschin <agust@denx.de> wrote:
> > > 
> > > > Hi Ben !
> > > > 
> > > > please pull mpc5xxx patches for v3.14:
> > > 
> > > Ping.
> > 
> > Oops, you sent that while I was on vacation and I missed it.
> > 
> > Next time, try to send your pull request earlier if possible, I'd like
> > to have most stuff together before -rc5. I'll try to send this one to
> > Linus after he has pulled my current one.
> 
> Hrm, I get a merge conflicts with spi-mpc512x-psc.c, please check that I
> fixed it up properly in powerpc-next and let me know.

Did read the merge commit (git show e9a371100dfd), did a build
and run test of

  f878f84373ae powerpc: Wire up sched_setattr and sched_getattr syscalls

and everything looks good.  Thank you!


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply

* Re: [git pull] Please pull powerpc.git next branch
From: Olaf Hering @ 2014-01-29  8:41 UTC (permalink / raw)
  To: Alistair Popple; +Cc: Linus Torvalds, linuxppc-dev, Linux Kernel list
In-Reply-To: <4555187.D5eRSF5r8x@mexican>

On Wed, Jan 29, Alistair Popple wrote:

> Looks like I missed the dart iommu code when changing the iommu table
> initialisation. The patch below should fix it, would you mind testing it Ben?

> +++ b/arch/powerpc/sysdev/dart_iommu.c

> + iommu_table_dart.it_page_shift = IOMMU_PAGE_SHIFT_4K;


Yes, that fixes it for me. Thanks!

Olaf

^ permalink raw reply

* Re: Please pull 'next' branch of 5xxx tree
From: Benjamin Herrenschmidt @ 2014-01-29  7:46 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: linuxppc-dev
In-Reply-To: <1390888814.8524.13.camel@pasglop>

On Tue, 2014-01-28 at 17:00 +1100, Benjamin Herrenschmidt wrote:
> On Tue, 2014-01-28 at 06:46 +0100, Anatolij Gustschin wrote:
> > Hi Ben !
> > 
> > On Wed, 15 Jan 2014 22:18:59 +0100
> > Anatolij Gustschin <agust@denx.de> wrote:
> > 
> > > Hi Ben !
> > > 
> > > please pull mpc5xxx patches for v3.14:
> > 
> > Ping.
> 
> Oops, you sent that while I was on vacation and I missed it.
> 
> Next time, try to send your pull request earlier if possible, I'd like
> to have most stuff together before -rc5. I'll try to send this one to
> Linus after he has pulled my current one.

Hrm, I get a merge conflicts with spi-mpc512x-psc.c, please check that I
fixed it up properly in powerpc-next and let me know.

If it's good I'll send to Linus tomorrow.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc: Fix 32-bit frames for signals delivered when transactional
From: Paul Mackerras @ 2014-01-29  5:33 UTC (permalink / raw)
  To: linuxppc-dev

Commit d31626f70b61 ("powerpc: Don't corrupt transactional state when
using FP/VMX in kernel") introduced a bug where the uc_link and uc_regs
fields of the ucontext_t that is created to hold the transactional
values of the registers in a 32-bit signal frame didn't get set
correctly.  The reason is that we now clear the MSR_TS bits in the MSR
in save_tm_user_regs(), before the code that sets uc_link and uc_regs.
To fix this, we move the setting of uc_link and uc_regs into the same
if statement that selects whether to call save_tm_user_regs() or
save_user_regs().

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/kernel/signal_32.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 6ce69e6..a67e00a 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1022,29 +1022,24 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	tm_frame = &rt_sf->uc_transact.uc_mcontext;
 	if (MSR_TM_ACTIVE(regs->msr)) {
+		if (__put_user((unsigned long)&rt_sf->uc_transact,
+			       &rt_sf->uc.uc_link) ||
+		    __put_user((unsigned long)tm_frame,
+			       &rt_sf->uc_transact.uc_regs))
+			goto badframe;
 		if (save_tm_user_regs(regs, frame, tm_frame, sigret))
 			goto badframe;
 	}
 	else
 #endif
 	{
+		if (__put_user(0, &rt_sf->uc.uc_link))
+			goto badframe;
 		if (save_user_regs(regs, frame, tm_frame, sigret, 1))
 			goto badframe;
 	}
 	regs->link = tramp;
 
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-	if (MSR_TM_ACTIVE(regs->msr)) {
-		if (__put_user((unsigned long)&rt_sf->uc_transact,
-			       &rt_sf->uc.uc_link)
-		    || __put_user((unsigned long)tm_frame, &rt_sf->uc_transact.uc_regs))
-			goto badframe;
-	}
-	else
-#endif
-		if (__put_user(0, &rt_sf->uc.uc_link))
-			goto badframe;
-
 	current->thread.fp_state.fpscr = 0;	/* turn off all fp exceptions */
 
 	/* create a stack frame for the caller of the handler */
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH] powerpc/iommu: Fix initialisation of DART iommu table
From: Alistair Popple @ 2014-01-29  4:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: olaf, linux-kernel, Alistair Popple

Commit d084775738b746648d4102337163a04534a02982 switched the generic
powerpc iommu backend code to use the it_page_shift field to determine
page size. Commit 3a553170d35d69bea3877bffa508489dfa6f133d should have
initiliased this field for all platforms, however the DART iommu table
code was not updated.

This commit initialises the it_page_shift field to 4K for the DART
iommu.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/sysdev/dart_iommu.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index bd968a4..62c47bb 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -292,6 +292,7 @@ static void iommu_table_dart_setup(void)
 	iommu_table_dart.it_offset = 0;
 	/* it_size is in number of entries */
 	iommu_table_dart.it_size = dart_tablesize / sizeof(u32);
+	iommu_table_dart.it_page_shift = IOMMU_PAGE_SHIFT_4K;
 
 	/* Initialize the common IOMMU code */
 	iommu_table_dart.it_base = (unsigned long)dart_vbase;
-- 
1.7.10.4

^ permalink raw reply related

* Re: [git pull] Please pull powerpc.git next branch
From: Alistair Popple @ 2014-01-29  2:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Olaf Hering, Linus Torvalds, Linux Kernel list
In-Reply-To: <1390940395.8524.25.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

On Wed, 29 Jan 2014 07:19:55 Benjamin Herrenschmidt wrote:
> On Tue, 2014-01-28 at 16:03 +0100, Olaf Hering wrote:
> > d084775738b746648d4102337163a04534a02982 is the first bad commit
> > commit d084775738b746648d4102337163a04534a02982
> > Author: Alistair Popple <alistair@popple.id.au>
> > Date:   Mon Dec 9 18:17:03 2013 +1100
> > 
> >     powerpc/iommu: Update the generic code to use dynamic iommu page sizes
> >     
> >     This patch updates the generic iommu backend code to use the
> >     it_page_shift field to determine the iommu page size instead of
> >     using hardcoded values.
> 
> Interesting. This is new infrastructure but a nop in functionality, ie,
> we support different page sizes for DMA but we still set it to 4k,
> unless we somewhat failed to initialize something...

Looks like I missed the dart iommu code when changing the iommu table 
initialisation. The patch below should fix it, would you mind testing it Ben? 
Thanks.

> I'll have a look, I actually have one of those G5s here still. Thanks !
> 
> Cheers,
> Ben.
> 

---

diff --git a/arch/powerpc/sysdev/dart_iommu.c 
b/arch/powerpc/sysdev/dart_iommu.c
index bd968a4..62c47bb 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -292,6 +292,7 @@ static void iommu_table_dart_setup(void)
 	iommu_table_dart.it_offset = 0;
 	/* it_size is in number of entries */
 	iommu_table_dart.it_size = dart_tablesize / sizeof(u32);
+	iommu_table_dart.it_page_shift = IOMMU_PAGE_SHIFT_4K;
 
 	/* Initialize the common IOMMU code */
 	iommu_table_dart.it_base = (unsigned long)dart_vbase;

[-- Attachment #2: Type: text/html, Size: 7724 bytes --]

^ permalink raw reply related

* Re: [PATCH] powerpc/sysdev: Fix a mpic section mismatch for MPC85xx
From: Christian Engelmayer @ 2014-01-28 21:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev, Kevin Hao
In-Reply-To: <20131220000041.05da4209@spike>

On Fri, 20 Dec 2013 00:00:41 +0100, Christian Engelmayer <cengelma@gmx.at> wrote:
> On Mon, 16 Dec 2013 11:10:53 +1100 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > On Sun, 2013-12-15 at 19:38 +0100, Christian Engelmayer wrote:
> > > Moved arch/powerpc/sysdev/mpic.c : smp_mpic_probe() out of the __init section.
> > > It is referenced by arch/powerpc/platforms/85xx/smp.c : smp_85xx_setup_cpu().
> > 
> > I don't like this. The reference is not actually going to call into the
> > code at all and as such is not an error, it's just a pointer comparison.
> 
> That's correct. I proposed it that way because on first sight I was concerned
> that there is an address of an __init function assigned to a function pointer
> within a non __initdata struct at all that can be compared against. However,
> further usage of smp_ops->probe is currently safe of course and *_ops symbols
> within .data are whitelisted to refer to init sections.
> 
> > If there is no way to silence the warning, then I'd suggest to use a
> > global flag, something like mpc85xx_pic_type and test that instead
> > of comparing the pointers.
> 
> I've seen that there is currently a patch proposed against
> 
>    commit dc2c9c52b604f51b1416ed87ff54a1c77a1a8b5b
>    powerpc/85xx: Set up doorbells even with no mpic
> 
> that introduced the section causing the warning:
> 
>    http://patchwork.ozlabs.org/patch/289214/
>    powerpc/85xx: don't init the mpic ipi for the SoC which has doorbell support
> 
> This patch also removes the affected pointer comparison and if accepted would
> thus also silence this warning.

Kevin's change (powerpc/85xx: don't init the mpic ipi for the SoC which has
doorbell support) entered mainline by merge 1b17366d. I verified that the
issue is thereby solved and my patch obsolete.

   http://patchwork.ozlabs.org/patch/301402/

Regards,
Christian

^ permalink raw reply

* Re: [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2014-01-28 20:19 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Alistair Popple, Linus Torvalds, linuxppc-dev, Linux Kernel list
In-Reply-To: <20140128150309.GA7428@aepfle.de>

On Tue, 2014-01-28 at 16:03 +0100, Olaf Hering wrote:
> 
> d084775738b746648d4102337163a04534a02982 is the first bad commit
> commit d084775738b746648d4102337163a04534a02982
> Author: Alistair Popple <alistair@popple.id.au>
> Date:   Mon Dec 9 18:17:03 2013 +1100
> 
>     powerpc/iommu: Update the generic code to use dynamic iommu page sizes
> 
>     This patch updates the generic iommu backend code to use the
>     it_page_shift field to determine the iommu page size instead of
>     using hardcoded values.

Interesting. This is new infrastructure but a nop in functionality, ie,
we support different page sizes for DMA but we still set it to 4k,
unless we somewhat failed to initialize something...

I'll have a look, I actually have one of those G5s here still. Thanks !

Cheers,
Ben.

>     Signed-off-by: Alistair Popple <alistair@popple.id.au>
>     Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> :040000 040000 52a8e1ca3166e3c916f8cdc1df5c1f42c76b2359 3d4915e416b28501ff502305bd4f76d64153dbc4 M      arch
> :040000 040000 e9a9020abbef5622ffa1be381e0ff845e3741fa9 d6fc206dd372c1a8deded826cc5de8b05f71c614 M      drivers
> 
> # git bisect log
> git bisect start
> # good: [b2e448eca1a52fea181905845728ae00a138d84e] Merge branch 'ipmi' (ipmi patches from Corey Minyard)
> git bisect good b2e448eca1a52fea181905845728ae00a138d84e
> # bad: [54c0a4b46150db1571d955d598cd342c9f1d9657] Merge branch 'akpm' (incoming from Andrew)
> git bisect bad 54c0a4b46150db1571d955d598cd342c9f1d9657
> # good: [403227641533c4227d44d14f25c8f3676f6e7436] softirq: convert printks to pr_<level>
> git bisect good 403227641533c4227d44d14f25c8f3676f6e7436
> # bad: [8b52312880ecbc5beb40b313600f2903c16a59ed] powerpc/p1010rdb-pa: modify phy interrupt.
> git bisect bad 8b52312880ecbc5beb40b313600f2903c16a59ed
> # good: [2c49195b6aedd21ff1cd1e095fab9866fba3411b] powernv: Remove get/set_rtc_time when they are not present
> git bisect good 2c49195b6aedd21ff1cd1e095fab9866fba3411b
> # bad: [a68c33f3592eef63304a5f5ab68466539ccac56c] powerpc: Fix endian issues in power7/8 machine check handler
> git bisect bad a68c33f3592eef63304a5f5ab68466539ccac56c
> # good: [c34a51ce49b40b9667cd7f5cc2e40475af8b4c3d] powerpc/mm: Enable _PAGE_NUMA for book3s
> git bisect good c34a51ce49b40b9667cd7f5cc2e40475af8b4c3d
> # good: [fee26f6d5d68a8815b20c32d15dd70d5384eb937] powerpc: Remove unused REDBOOT Kconfig parameter
> git bisect good fee26f6d5d68a8815b20c32d15dd70d5384eb937
> # good: [3a553170d35d69bea3877bffa508489dfa6f133d] powerpc/iommu: Add it_page_shift field to determine iommu page size
> git bisect good 3a553170d35d69bea3877bffa508489dfa6f133d
> # bad: [d084775738b746648d4102337163a04534a02982] powerpc/iommu: Update the generic code to use dynamic iommu page sizes
> git bisect bad d084775738b746648d4102337163a04534a02982
> # first bad commit: [d084775738b746648d4102337163a04534a02982] powerpc/iommu: Update the generic code to use dynamic iommu page sizes
> 

^ permalink raw reply

* Re: [PATCH v2 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
From: Nathan Fontenot @ 2014-01-28 19:45 UTC (permalink / raw)
  To: Tyrel Datwyler, linuxppc-dev
In-Reply-To: <1390420717-23907-4-git-send-email-tyreld@linux.vnet.ibm.com>

On 01/22/2014 01:58 PM, Tyrel Datwyler wrote:
> Traditionally it has been drmgr's responsibilty to update the device tree
> through the /proc/ppc64/ofdt interface after a suspend/resume operation.
> This patchset however has modified suspend/resume ops to preform that update
> entirely in the kernel during the resume. Therefore, a mechanism is required
> for drmgr to determine who is responsible for the update. This patch adds a
> show function to the "hibernate" attribute that returns 1 if the kernel
> updates the device tree after the resume and 0 if drmgr is responsible.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
> index 16a2552..723115d 100644
> --- a/arch/powerpc/platforms/pseries/suspend.c
> +++ b/arch/powerpc/platforms/pseries/suspend.c
> @@ -174,7 +174,30 @@ out:
>  	return rc;
>  }
> 
> -static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
> +#define USER_DT_UPDATE	0
> +#define KERN_DT_UPDATE	1
> +
> +/**
> + * show_hibernate - Report device tree update responsibilty
> + * @dev:		subsys root device
> + * @attr:		device attribute struct
> + * @buf:		buffer
> + *
> + * Report whether a device tree update is performed by the kernel after a
> + * resume, or if drmgr must coordinate the update from user space.
> + *
> + * Return value:
> + *	0 if drmgr is to initiate update, and 1 otherwise
> + **/
> +static ssize_t show_hibernate(struct device *dev,
> +			      struct device_attribute *attr,
> +			      char *buf)
> +{
> +	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
> +}
> +
> +static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
> +		   show_hibernate, store_hibernate);
> 
>  static struct bus_type suspend_subsys = {
>  	.name = "power",
> 

^ permalink raw reply

* Re: [PATCH v2 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate
From: Nathan Fontenot @ 2014-01-28 19:44 UTC (permalink / raw)
  To: Tyrel Datwyler, linuxppc-dev
In-Reply-To: <1390420717-23907-2-git-send-email-tyreld@linux.vnet.ibm.com>

On 01/22/2014 01:58 PM, Tyrel Datwyler wrote:
> From: Haren Myneni <hbabu@us.ibm.com>
> 
> From: Haren Myneni <hbabu@us.ibm.com>
> 
> The current code makes rtas calls for update-nodes, activate-firmware and then
> update-nodes again. The FW provides the same data for both update-nodes calls.
> As a result a proc entry exists error is reported for the second update while
> adding device nodes.
> 
> This patch makes a single rtas call for update-nodes after activating the FW.
> It also add rtas_busy delay for the activate-firmware rtas call.
> 
> Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Acked-by: Nathan fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/mobility.c | 26 ++++++++++----------------
>  1 file changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
> index cde4e0a..bde7eba 100644
> --- a/arch/powerpc/platforms/pseries/mobility.c
> +++ b/arch/powerpc/platforms/pseries/mobility.c
> @@ -290,13 +290,6 @@ void post_mobility_fixup(void)
>  	int rc;
>  	int activate_fw_token;
> 
> -	rc = pseries_devicetree_update(MIGRATION_SCOPE);
> -	if (rc) {
> -		printk(KERN_ERR "Initial post-mobility device tree update "
> -		       "failed: %d\n", rc);
> -		return;
> -	}
> -
>  	activate_fw_token = rtas_token("ibm,activate-firmware");
>  	if (activate_fw_token == RTAS_UNKNOWN_SERVICE) {
>  		printk(KERN_ERR "Could not make post-mobility "
> @@ -304,16 +297,17 @@ void post_mobility_fixup(void)
>  		return;
>  	}
> 
> -	rc = rtas_call(activate_fw_token, 0, 1, NULL);
> -	if (!rc) {
> -		rc = pseries_devicetree_update(MIGRATION_SCOPE);
> -		if (rc)
> -			printk(KERN_ERR "Secondary post-mobility device tree "
> -			       "update failed: %d\n", rc);
> -	} else {
> +	do {
> +		rc = rtas_call(activate_fw_token, 0, 1, NULL);
> +	} while (rtas_busy_delay(rc));
> +
> +	if (rc)
>  		printk(KERN_ERR "Post-mobility activate-fw failed: %d\n", rc);
> -		return;
> -	}
> +
> +	rc = pseries_devicetree_update(MIGRATION_SCOPE);
> +	if (rc)
> +		printk(KERN_ERR "Post-mobility device tree update "
> +			"failed: %d\n", rc);
> 
>  	return;
>  }
> 

^ permalink raw reply

* Re: [PATCH v2 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation
From: Nathan Fontenot @ 2014-01-28 19:41 UTC (permalink / raw)
  To: Tyrel Datwyler, linuxppc-dev
In-Reply-To: <1390420717-23907-3-git-send-email-tyreld@linux.vnet.ibm.com>

On 01/22/2014 01:58 PM, Tyrel Datwyler wrote:
> From: Haren Myneni <hbabu@us.ibm.com>
> 
> From: Haren Myneni <hbabu@us.ibm.com>
> 
> pHyp can change cache nodes for suspend/resume operation. The current code
> updates the device tree after all non boot CPUs are enabled. Hence, we do not
> modify the cache list based on the latest cache nodes. Also we do not remove
> cache entries for the primary CPU.
> 
> This patch removes the cache list for the boot CPU, updates the device tree
> before enabling nonboot CPUs and adds cache list for the boot cpu.
> 
> Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/rtas.h |  4 ++++
>  arch/powerpc/kernel/rtas.c      | 17 +++++++++++++++++
>  arch/powerpc/kernel/time.c      |  6 ++++++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
> index 9bd52c6..da9d733 100644
> --- a/arch/powerpc/include/asm/rtas.h
> +++ b/arch/powerpc/include/asm/rtas.h
> @@ -283,6 +283,10 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
> 
>  #ifdef CONFIG_PPC_PSERIES
>  extern int pseries_devicetree_update(s32 scope);
> +extern void post_mobility_fixup(void);
> +extern void update_dynamic_configuration(void);
> +#else /* !CONFIG_PPC_PSERIES */
> +void update_dynamic_configuration(void) { }
>  #endif
> 
>  #ifdef CONFIG_PPC_RTAS_DAEMON
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 4cf674d..8249eb2 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -43,6 +43,7 @@
>  #include <asm/time.h>
>  #include <asm/mmu.h>
>  #include <asm/topology.h>
> +#include "cacheinfo.h"
> 
>  struct rtas_t rtas = {
>  	.lock = __ARCH_SPIN_LOCK_UNLOCKED
> @@ -972,6 +973,22 @@ out:
>  	free_cpumask_var(offline_mask);
>  	return atomic_read(&data.error);
>  }
> +
> +/*
> + * The device tree cache nodes can be modified during suspend/ resume.
> + * So delete all cache entries and recreate them again after the device tree
> + * update.
> + * We already deleted cache entries for notboot CPUs before suspend. So delete
> + * entries for the primary CPU, recreate entries after the device tree update.
> + * We can create entries for nonboot CPU when enable them later.
> + */
> +
> +void update_dynamic_configuration(void)
> +{
> +	cacheinfo_cpu_offline(smp_processor_id());
> +	post_mobility_fixup();
> +	cacheinfo_cpu_online(smp_processor_id());
> +}
>  #else /* CONFIG_PPC_PSERIES */
>  int rtas_ibm_suspend_me(struct rtas_args *args)
>  {
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index b3b1441..5f1ca28 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -69,6 +69,7 @@
>  #include <asm/vdso_datapage.h>
>  #include <asm/firmware.h>
>  #include <asm/cputime.h>
> +#include <asm/rtas.h>
> 
>  /* powerpc clocksource/clockevent code */
> 
> @@ -592,6 +593,11 @@ void arch_suspend_enable_irqs(void)
>  	generic_suspend_enable_irqs();
>  	if (ppc_md.suspend_enable_irqs)
>  		ppc_md.suspend_enable_irqs();
> +	/*
> +	 * Update configuration which can be modified based on devicetree
> +	 * changes during resume.
> +	 */
> +	update_dynamic_configuration();

Instead of creating this new routine update_dynamic_reconfiguration() for
pseries systems only, shouldn't we be defining ppc_md.suspend_enable_irqs
for pseries. I think this could be done in platforms/pseries/suspend.c

-Nathan

>  }
>  #endif
> 

^ permalink raw reply

* Re: [PATCH] powerpc: don't re-issue spinlock typedef that breaks older gcc
From: Paul Gortmaker @ 2014-01-28 19:07 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linuxppc-dev; +Cc: Kirill A. Shutemov
In-Reply-To: <87ppnc0wn1.fsf@linux.vnet.ibm.com>

On 14-01-28 01:49 PM, Aneesh Kumar K.V wrote:
> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
> 
>> On 14-01-28 12:28 PM, Aneesh Kumar K.V wrote:
>>> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
>>>
>>>> Commit b3084f4db3aeb991c507ca774337c7e7893ed04f ("powerpc/thp: Fix
>>>> crash on mremap") added a "typedef struct spinlock spinlock_t;"
>>>> which on gcc 4.5.2 (and possibly other versions) causes many of:
>>>>
>>>> include/linux/spinlock_types.h:76:3: error: redefinition of typedef 'spinlock_t'
>>>> arch/powerpc/include/asm/pgtable-ppc64.h:563:25: note: previous declaration of 'spinlock_t' was here
>>>> In file included from include/linux/mutex.h:15:0,
>>>>                  from include/linux/notifier.h:13,
>>>>                  from include/linux/pm_qos.h:8,
>>>>                  from include/linux/netdevice.h:28,
>>>>                  from drivers/net/wireless/ath/wil6210/wil6210.h:20,
>>>>                  from drivers/net/wireless/ath/wil6210/debug.c:17:
>>>>
>>>> It appears that somewhere between gcc 4.5.2 and 4.6.3 this
>>>> redefinition restriction was lifted.  Using the proper header
>>>> from within !ASSEMBLY seems to fix it up in an acceptable way.
>>>>
>>>> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>>>> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>>>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>>>> ---
>>>>
>>>
>>>
>>> http://mid.gmane.org/1389939036.3000.7.camel@ThinkPad-T5421.cn.ibm.com
>>>
>>> This was posted earlier.
>>
>> I see.  Well I guess Ben didn't use it since it is the same as the
>> temporary not-signed-off-by hack patch I posted earlier as well.
>>
>> https://lkml.org/lkml/2014/1/27/584
>>
>> I believe what I've posted here below to be the proper fix.
> 
> I had another variant which needed this
> 
> http://mid.gmane.org/1388999012-14424-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com

What config did you use to trigger that?  I've not seen it in
allyes/allmodconfig.  I'd like us to try and fix it an alternate
way, vs. fragmenting the header into smaller and smaller
specialized chunks, if possible.

> 
> BTW I had added the above struct spinlock; patch as the backport to
> stable 3.13 series. So if we are picking another one, we may need to
> update stable also

The stable tree is self-correcting ; it won't take any patches that
don't have the same commit present in mainline.  But yes, someone
will still have to _nominate_ one for stable tree consideration.

Paul.
--

> 
> -aneesh
> 

^ permalink raw reply

* Re: [PATCH] powerpc: don't re-issue spinlock typedef that breaks older gcc
From: Aneesh Kumar K.V @ 2014-01-28 18:49 UTC (permalink / raw)
  To: Paul Gortmaker, linuxppc-dev; +Cc: Kirill A. Shutemov
In-Reply-To: <52E7EDC4.3000102@windriver.com>

Paul Gortmaker <paul.gortmaker@windriver.com> writes:

> On 14-01-28 12:28 PM, Aneesh Kumar K.V wrote:
>> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
>> 
>>> Commit b3084f4db3aeb991c507ca774337c7e7893ed04f ("powerpc/thp: Fix
>>> crash on mremap") added a "typedef struct spinlock spinlock_t;"
>>> which on gcc 4.5.2 (and possibly other versions) causes many of:
>>>
>>> include/linux/spinlock_types.h:76:3: error: redefinition of typedef 'spinlock_t'
>>> arch/powerpc/include/asm/pgtable-ppc64.h:563:25: note: previous declaration of 'spinlock_t' was here
>>> In file included from include/linux/mutex.h:15:0,
>>>                  from include/linux/notifier.h:13,
>>>                  from include/linux/pm_qos.h:8,
>>>                  from include/linux/netdevice.h:28,
>>>                  from drivers/net/wireless/ath/wil6210/wil6210.h:20,
>>>                  from drivers/net/wireless/ath/wil6210/debug.c:17:
>>>
>>> It appears that somewhere between gcc 4.5.2 and 4.6.3 this
>>> redefinition restriction was lifted.  Using the proper header
>>> from within !ASSEMBLY seems to fix it up in an acceptable way.
>>>
>>> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>>> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>>> ---
>>>
>> 
>> 
>> http://mid.gmane.org/1389939036.3000.7.camel@ThinkPad-T5421.cn.ibm.com
>> 
>> This was posted earlier.
>
> I see.  Well I guess Ben didn't use it since it is the same as the
> temporary not-signed-off-by hack patch I posted earlier as well.
>
> https://lkml.org/lkml/2014/1/27/584
>
> I believe what I've posted here below to be the proper fix.

I had another variant which needed this

http://mid.gmane.org/1388999012-14424-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com

BTW I had added the above struct spinlock; patch as the backport to
stable 3.13 series. So if we are picking another one, we may need to
update stable also

-aneesh

^ permalink raw reply

* [PATCH] powerpc: enable CONFIG_HAVE_MEMORYLESS_NODES
From: Nishanth Aravamudan @ 2014-01-28 18:34 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: David Rientjes, Pekka Enberg, linux-mm, Paul Mackerras,
	Anton Blanchard, Matt Mackall, Joonsoo Kim, linuxppc-dev,
	Wanpeng Li

Anton Blanchard found an issue with an LPAR that had no memory in Node
0. Christoph Lameter recommended, as one possible solution, to use
numa_mem_id() for locality of the nearest memory node-wise. However,
numa_mem_id() [and the other related APIs] are only useful if
CONFIG_HAVE_MEMORYLESS_NODES is set. This is only the case for ia64
currently, but clearly we can have memoryless nodes on ppc64. Add the
Kconfig option and define it to be the same value as CONFIG_NUMA.

On the LPAR in question, which was very inefficiently using slabs, this
took the slab consumption at boot from roughly 7GB to roughly 4GB.
    
---
Ben, the only question I have wrt this change is if it's appropriate to
change it for all powerpc configs (that have NUMA on)?

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 25493a0..bb2d5fe 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -447,6 +447,9 @@ config NODES_SHIFT
 	default "4"
 	depends on NEED_MULTIPLE_NODES
 
+config HAVE_MEMORYLESS_NODES
+	def_bool NUMA
+
 config ARCH_SELECT_MEMORY_MODEL
 	def_bool y
 	depends on PPC64

^ permalink raw reply related

* Re: [PATCH] slub: Don't throw away partial remote slabs if there is no local memory
From: Nishanth Aravamudan @ 2014-01-28 18:29 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Han Pingtian, mpm, penberg, linux-mm, paulus, Anton Blanchard,
	David Rientjes, Christoph Lameter, linuxppc-dev, Wanpeng Li
In-Reply-To: <20140127055805.GA2471@lge.com>

On 27.01.2014 [14:58:05 +0900], Joonsoo Kim wrote:
> On Fri, Jan 24, 2014 at 05:10:42PM -0800, Nishanth Aravamudan wrote:
> > On 24.01.2014 [16:25:58 -0800], David Rientjes wrote:
> > > On Fri, 24 Jan 2014, Nishanth Aravamudan wrote:
> > > 
> > > > Thank you for clarifying and providing  a test patch. I ran with this on
> > > > the system showing the original problem, configured to have 15GB of
> > > > memory.
> > > > 
> > > > With your patch after boot:
> > > > 
> > > > MemTotal:       15604736 kB
> > > > MemFree:         8768192 kB
> > > > Slab:            3882560 kB
> > > > SReclaimable:     105408 kB
> > > > SUnreclaim:      3777152 kB
> > > > 
> > > > With Anton's patch after boot:
> > > > 
> > > > MemTotal:       15604736 kB
> > > > MemFree:        11195008 kB
> > > > Slab:            1427968 kB
> > > > SReclaimable:     109184 kB
> > > > SUnreclaim:      1318784 kB
> > > > 
> > > > 
> > > > I know that's fairly unscientific, but the numbers are reproducible. 
> > > > 
> 
> Hello,
> 
> I think that there is one mistake on David's patch although I'm not sure
> that it is the reason for this result.
> 
> With David's patch, get_partial() in new_slab_objects() doesn't work
> properly, because we only change node id in !node_match() case. If we
> meet just !freelist case, we pass node id directly to
> new_slab_objects(), so we always try to allocate new slab page
> regardless existence of partial pages. We should solve it.
> 
> Could you try this one?

This helps about the same as David's patch -- but I found the reason
why! ppc64 doesn't set CONFIG_HAVE_MEMORYLESS_NODES :) Expect a patch
shortly for that and one other case I found.

This patch on its own seems to help on our test system by saving around
1.5GB of slab.

Tested-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Acked-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

with the caveat below.

Thanks,
Nish

> 
> Thanks.
> 
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1698,8 +1698,10 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node,
>                 struct kmem_cache_cpu *c)
>  {
>         void *object;
> -       int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node;
> +       int searchnode = (node == NUMA_NO_NODE) ? numa_mem_id() : node;
> 
> +       if (node != NUMA_NO_NODE && !node_present_pages(node))
> +               searchnode = numa_mem_id();

This might be clearer as:

int searchnode = node;
if (node == NUMA_NO_NODE || !node_present_pages(node))
	searchnode = numa_mem_id();

>         object = get_partial_node(s, get_node(s, searchnode), c, flags);
>         if (object || node != NUMA_NO_NODE)
>                 return object;
> @@ -2278,10 +2280,14 @@ redo:
> 
>         if (unlikely(!node_match(page, node))) {
>                 stat(s, ALLOC_NODE_MISMATCH);
> -               deactivate_slab(s, page, c->freelist);
> -               c->page = NULL;
> -               c->freelist = NULL;
> -               goto new_slab;
> +               if (unlikely(!node_present_pages(node)))
> +                       node = numa_mem_id();
> +               if (!node_match(page, node)) {
> +                       deactivate_slab(s, page, c->freelist);
> +                       c->page = NULL;
> +                       c->freelist = NULL;
> +                       goto new_slab;
> +               }
>         }
> 
>         /*
> 

^ permalink raw reply

* [PATCH] powerpc: numa: Fix decimal permissions
From: Joe Perches @ 2014-01-28 18:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Nathan Fontenot; +Cc: linuxppc-dev, LKML

This should have been octal.

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/powerpc/mm/numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 86a63de..30a42e2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1785,7 +1785,7 @@ static const struct file_operations topology_ops = {
 static int topology_update_init(void)
 {
 	start_topology_update();
-	proc_create("powerpc/topology_updates", 644, NULL, &topology_ops);
+	proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
 
 	return 0;
 }

^ permalink raw reply related

* Re: [PATCH] powerpc: don't re-issue spinlock typedef that breaks older gcc
From: Paul Gortmaker @ 2014-01-28 17:49 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linuxppc-dev; +Cc: Kirill A. Shutemov
In-Reply-To: <87sis810dl.fsf@linux.vnet.ibm.com>

On 14-01-28 12:28 PM, Aneesh Kumar K.V wrote:
> Paul Gortmaker <paul.gortmaker@windriver.com> writes:
> 
>> Commit b3084f4db3aeb991c507ca774337c7e7893ed04f ("powerpc/thp: Fix
>> crash on mremap") added a "typedef struct spinlock spinlock_t;"
>> which on gcc 4.5.2 (and possibly other versions) causes many of:
>>
>> include/linux/spinlock_types.h:76:3: error: redefinition of typedef 'spinlock_t'
>> arch/powerpc/include/asm/pgtable-ppc64.h:563:25: note: previous declaration of 'spinlock_t' was here
>> In file included from include/linux/mutex.h:15:0,
>>                  from include/linux/notifier.h:13,
>>                  from include/linux/pm_qos.h:8,
>>                  from include/linux/netdevice.h:28,
>>                  from drivers/net/wireless/ath/wil6210/wil6210.h:20,
>>                  from drivers/net/wireless/ath/wil6210/debug.c:17:
>>
>> It appears that somewhere between gcc 4.5.2 and 4.6.3 this
>> redefinition restriction was lifted.  Using the proper header
>> from within !ASSEMBLY seems to fix it up in an acceptable way.
>>
>> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>> ---
>>
> 
> 
> http://mid.gmane.org/1389939036.3000.7.camel@ThinkPad-T5421.cn.ibm.com
> 
> This was posted earlier.

I see.  Well I guess Ben didn't use it since it is the same as the
temporary not-signed-off-by hack patch I posted earlier as well.

https://lkml.org/lkml/2014/1/27/584

I believe what I've posted here below to be the proper fix.

Paul.
--


> 
> 
> 
>> [ Note that b3084f4db3 isn't mainline yet, it is currently in
>>   benh/powerpc.git #merge -- but is headed there soon via:
>>              https://lkml.org/lkml/2014/1/27/599           ]
>>
>>  arch/powerpc/include/asm/pgtable-ppc64.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
>> index d27960c89a71..3b638411646a 100644
>> --- a/arch/powerpc/include/asm/pgtable-ppc64.h
>> +++ b/arch/powerpc/include/asm/pgtable-ppc64.h
>> @@ -111,6 +111,8 @@
>>
>>  #ifndef __ASSEMBLY__
>>
>> +#include <linux/spinlock_types.h>
>> +
>>  /*
>>   * This is the default implementation of various PTE accessors, it's
>>   * used in all cases except Book3S with 64K pages where we have a
>> @@ -560,7 +562,6 @@ extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
>>  			    pmd_t *pmdp);
>>
>>  #define pmd_move_must_withdraw pmd_move_must_withdraw
>> -typedef struct spinlock spinlock_t;
>>  static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
>>  					 spinlock_t *old_pmd_ptl)
>>  {
>> -- 
>> 1.8.5.2
> 

^ permalink raw reply

* Re: [PATCH] powerpc: don't re-issue spinlock typedef that breaks older gcc
From: Aneesh Kumar K.V @ 2014-01-28 17:28 UTC (permalink / raw)
  To: Paul Gortmaker, linuxppc-dev; +Cc: Paul Gortmaker, Kirill A. Shutemov
In-Reply-To: <1390925817-27374-1-git-send-email-paul.gortmaker@windriver.com>

Paul Gortmaker <paul.gortmaker@windriver.com> writes:

> Commit b3084f4db3aeb991c507ca774337c7e7893ed04f ("powerpc/thp: Fix
> crash on mremap") added a "typedef struct spinlock spinlock_t;"
> which on gcc 4.5.2 (and possibly other versions) causes many of:
>
> include/linux/spinlock_types.h:76:3: error: redefinition of typedef 'spinlock_t'
> arch/powerpc/include/asm/pgtable-ppc64.h:563:25: note: previous declaration of 'spinlock_t' was here
> In file included from include/linux/mutex.h:15:0,
>                  from include/linux/notifier.h:13,
>                  from include/linux/pm_qos.h:8,
>                  from include/linux/netdevice.h:28,
>                  from drivers/net/wireless/ath/wil6210/wil6210.h:20,
>                  from drivers/net/wireless/ath/wil6210/debug.c:17:
>
> It appears that somewhere between gcc 4.5.2 and 4.6.3 this
> redefinition restriction was lifted.  Using the proper header
> from within !ASSEMBLY seems to fix it up in an acceptable way.
>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>


http://mid.gmane.org/1389939036.3000.7.camel@ThinkPad-T5421.cn.ibm.com

This was posted earlier.



> [ Note that b3084f4db3 isn't mainline yet, it is currently in
>   benh/powerpc.git #merge -- but is headed there soon via:
>              https://lkml.org/lkml/2014/1/27/599           ]
>
>  arch/powerpc/include/asm/pgtable-ppc64.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
> index d27960c89a71..3b638411646a 100644
> --- a/arch/powerpc/include/asm/pgtable-ppc64.h
> +++ b/arch/powerpc/include/asm/pgtable-ppc64.h
> @@ -111,6 +111,8 @@
>
>  #ifndef __ASSEMBLY__
>
> +#include <linux/spinlock_types.h>
> +
>  /*
>   * This is the default implementation of various PTE accessors, it's
>   * used in all cases except Book3S with 64K pages where we have a
> @@ -560,7 +562,6 @@ extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
>  			    pmd_t *pmdp);
>
>  #define pmd_move_must_withdraw pmd_move_must_withdraw
> -typedef struct spinlock spinlock_t;
>  static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
>  					 spinlock_t *old_pmd_ptl)
>  {
> -- 
> 1.8.5.2

^ permalink raw reply

* [RFC PATCH 10/10] PPC: BOOK3S: Disable/Enable TM looking at the ibm, pa-features device tree entry
From: Aneesh Kumar K.V @ 2014-01-28 16:44 UTC (permalink / raw)
  To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc, Aneesh Kumar K.V
In-Reply-To: <1390927455-3312-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

Runtime disable transactional memory feature looking at pa-features
device tree entry. We need to do this so that we can run a kernel
built with TM config in PR mode. For PR guest we provide a device
tree entry with TM feature disabled in pa-features

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/prom.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fa0ad8aafbcc..de8c2caf1024 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -160,6 +160,11 @@ static struct ibm_pa_feature {
 	{CPU_FTR_NODSISRALIGN, 0, 0,	1, 1, 1},
 	{0, MMU_FTR_CI_LARGE_PAGE, 0,	1, 2, 0},
 	{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
+	/*
+	 * We should use CPU_FTR_TM_COMP so that if we disable TM, it won't get
+	 * enabled via device tree
+	 */
+	{CPU_FTR_TM_COMP, 0, 0,		22, 0, 0},
 };
 
 static void __init scan_features(unsigned long node, unsigned char *ftrs,
-- 
1.8.5.3

^ permalink raw reply related

* [RFC PATCH 09/10] KVM: PPC: BOOK3S: PR: Ignore write to monitor mode control register
From: Aneesh Kumar K.V @ 2014-01-28 16:44 UTC (permalink / raw)
  To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc, Aneesh Kumar K.V
In-Reply-To: <1390927455-3312-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

We ignore write to these registers now

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_emulate.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index bf6b11021250..c0aee34ef04f 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -490,6 +490,16 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
 	case SPRN_BESCR:
 		vcpu->arch.bescr = spr_val;
 		break;
+	case SPRN_MMCRS:
+		break;
+	case SPRN_MMCRA:
+		break;
+	case SPRN_MMCR0:
+		break;
+	case SPRN_MMCR1:
+		break;
+	case SPRN_MMCR2:
+		break;
 unprivileged:
 	default:
 		printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
-- 
1.8.5.3

^ permalink raw reply related

* [RFC PATCH 07/10] KVM: PPC: BOOK3S: PR: Emulate facility status and control register
From: Aneesh Kumar K.V @ 2014-01-28 16:44 UTC (permalink / raw)
  To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc, Aneesh Kumar K.V
In-Reply-To: <1390927455-3312-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

We allow priv-mode update of this. The guest value is saved in fscr,
and the value actually used is saved in shadow_fscr. shadow_fscr
only contains values that are allowed by the host. On
facility unavailable interrupt, if the facility is allowed by fscr
but disabled in shadow_fscr we need to emulate the support. Currently
all but EBB is disabled. We still don't support performance monitoring
in PR guest.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/kvm_book3s_asm.h |  1 +
 arch/powerpc/include/asm/kvm_host.h       |  1 +
 arch/powerpc/kernel/asm-offsets.c         |  2 ++
 arch/powerpc/kvm/book3s_emulate.c         | 16 ++++++++++++++++
 arch/powerpc/kvm/book3s_interrupts.S      | 25 ++++++++++++++++++++++---
 5 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 192917d2239c..abd42523ad93 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -103,6 +103,7 @@ struct kvmppc_host_state {
 #ifdef CONFIG_PPC_BOOK3S_64
 	u64 cfar;
 	u64 ppr;
+	u64 host_fscr;
 #endif
 };
 
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index e0b13aca98e6..f4be7be14330 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -478,6 +478,7 @@ struct kvm_vcpu_arch {
 	ulong ppr;
 	ulong pspb;
 	ulong fscr;
+	ulong shadow_fscr;
 	ulong tfhar;
 	ulong tfiar;
 	ulong texasr;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 2c2227da6917..7484676b8f25 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -525,6 +525,7 @@ int main(void)
 	DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar));
 	DEFINE(VCPU_PPR, offsetof(struct kvm_vcpu, arch.ppr));
 	DEFINE(VCPU_FSCR, offsetof(struct kvm_vcpu, arch.fscr));
+	DEFINE(VCPU_SHADOW_FSCR, offsetof(struct kvm_vcpu, arch.shadow_fscr));
 	DEFINE(VCPU_PSPB, offsetof(struct kvm_vcpu, arch.pspb));
 	DEFINE(VCPU_TFHAR, offsetof(struct kvm_vcpu, arch.tfhar));
 	DEFINE(VCPU_TFIAR, offsetof(struct kvm_vcpu, arch.tfiar));
@@ -626,6 +627,7 @@ int main(void)
 #ifdef CONFIG_PPC_BOOK3S_64
 	HSTATE_FIELD(HSTATE_CFAR, cfar);
 	HSTATE_FIELD(HSTATE_PPR, ppr);
+	HSTATE_FIELD(HSTATE_FSCR, host_fscr);
 #endif /* CONFIG_PPC_BOOK3S_64 */
 
 #else /* CONFIG_PPC_BOOK3S */
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 7f25adbd2590..60d0b6b745e7 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -468,6 +468,19 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
 	case SPRN_MSSSR0:
 	case SPRN_DABR:
 		break;
+	case SPRN_FSCR:
+	{
+		ulong host_fscr = mfspr(SPRN_FSCR);
+		/*
+		 * We disable FSCR_EBB for pr guest. TAR and DSCR are always
+		 * enabled.
+		 */
+		if (spr_val & ~(FSCR_TAR|FSCR_DSCR|FSCR_EBB))
+			pr_info("KVM: invalud FSCR value 0x%lx", spr_val);
+		vcpu->arch.fscr = spr_val & (FSCR_TAR|FSCR_DSCR);
+		vcpu->arch.shadow_fscr = vcpu->arch.fscr & host_fscr;
+		break;
+	}
 unprivileged:
 	default:
 		printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
@@ -591,6 +604,9 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
 		 */
 		*spr_val = 0;
 		break;
+	case SPRN_FSCR:
+		*spr_val = vcpu->arch.fscr;
+		break;
 	default:
 unprivileged:
 		printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S
index f779450cb07c..fcbdf4817301 100644
--- a/arch/powerpc/kvm/book3s_interrupts.S
+++ b/arch/powerpc/kvm/book3s_interrupts.S
@@ -107,6 +107,14 @@ kvm_start_lightweight:
 	ld	r3, VCPU_SHARED(r4)
 	ld	r3, VCPU_SHARED_SPRG3(r3)
 	mtspr	SPRN_SPRG3, r3
+
+BEGIN_FTR_SECTION
+	mfspr r3,SPRN_FSCR
+	PPC_STL	r3, HSTATE_FSCR(r13)
+
+	PPC_LL r3, VCPU_SHADOW_FSCR(r4)
+	mtspr SPRN_FSCR, r3
+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
 #endif /* CONFIG_PPC_BOOK3S_64 */
 
 	PPC_LL	r4, VCPU_SHADOW_MSR(r4)	/* get shadow_msr */
@@ -148,6 +156,9 @@ kvm_start_lightweight:
 	bl	FUNC(kvmppc_copy_from_svcpu)
 	nop
 
+	/* R7 = vcpu */
+	PPC_LL	r7, GPR4(r1)
+
 #ifdef CONFIG_PPC_BOOK3S_64
 	/*
 	 * Reload kernel SPRG3 value.
@@ -155,10 +166,18 @@ kvm_start_lightweight:
 	 */
 	ld	r3, PACA_SPRG3(r13)
 	mtspr	SPRN_SPRG3, r3
-#endif /* CONFIG_PPC_BOOK3S_64 */
+BEGIN_FTR_SECTION
+	/*
+	 * Save the current fscr in shadow fscr
+	 */
+	mfspr r3,SPRN_FSCR
+	PPC_STL r3, VCPU_SHADOW_FSCR(r7)
 
-	/* R7 = vcpu */
-	PPC_LL	r7, GPR4(r1)
+	PPC_LL	r3, HSTATE_FSCR(r13)
+	mtspr	SPRN_FSCR, r3
+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
+
+#endif /* CONFIG_PPC_BOOK3S_64 */
 
 	PPC_STL	r14, VCPU_GPR(R14)(r7)
 	PPC_STL	r15, VCPU_GPR(R15)(r7)
-- 
1.8.5.3

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox