* Re: [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h>
From: Paul Gortmaker @ 2014-01-28 16:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linux-arch, Stephen Rothwell, linux-m68k, x86, linux-ia64, kvm,
linux-mips, linux-s390, rusty, linux-kernel, linuxppc-dev,
linux-alpha, gregkh, netdev, sparclinux, akpm, torvalds,
linux-arm-kernel
In-Reply-To: <1390878783.3872.63.camel@pasglop>
On 14-01-27 10:13 PM, Benjamin Herrenschmidt wrote:
> On Wed, 2014-01-22 at 19:38 -0500, Paul Gortmaker wrote:
>
>> Thanks, it was a great help as it uncovered a few issues in fringe arch
>> that I didn't have toolchains for, and I've fixed all of those up.
>>
>> I've noticed that powerpc has been un-buildable for a while now; I have
>> used this hack patch locally so I could run the ppc defconfigs to check
>> that I didn't break anything. Maybe useful for linux-next in the
>> interim? It is a hack patch -- Not-Signed-off-by: Paul Gortmaker. :)
>
> Can you and/or Aneesh submit that as a proper patch (with S-O-B
> etc...) ?
I'd updated toolchains and didn't realize it was still broken. Patch sent.
http://patchwork.ozlabs.org/patch/314749/
Paul.
--
>
> Thanks !
>
> Cheers,
> Ben.
>
>> Paul.
>> --
>>
>> diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
>> index d27960c89a71..d0f070a2b395 100644
>> --- a/arch/powerpc/include/asm/pgtable-ppc64.h
>> +++ b/arch/powerpc/include/asm/pgtable-ppc64.h
>> @@ -560,9 +560,9 @@ 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)
>> +struct spinlock;
>> +static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
>> + struct spinlock *old_pmd_ptl)
>> {
>> /*
>> * Archs like ppc64 use pgtable to store per pmd
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>
^ permalink raw reply
* [RFC PATCH 01/10] KVM: PPC: BOOK3S: PR: Add POWER8 support
From: Aneesh Kumar K.V @ 2014-01-28 16:44 UTC (permalink / raw)
To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc
Hello,
This patch series implements PR KVM support for POWER8 platform
-aneesh
^ permalink raw reply
* [RFC PATCH 01/10] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation
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 definitely don't need to emulate mtspr, because both the registers
are hypervisor resource.
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)
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 02/10] KVM: PPC: BOOK3S: PR: Emulate virtual timebase 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>
virtual time base register is a per vm register and need to saved
and restored on vm exit and entry. Writing to VTB is not allowed
in the privileged mode.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 1 +
arch/powerpc/include/asm/reg.h | 7 +++++++
arch/powerpc/include/asm/time.h | 12 ++++++++++++
arch/powerpc/kvm/book3s_emulate.c | 3 +++
arch/powerpc/kvm/book3s_pr.c | 3 +++
5 files changed, 26 insertions(+)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 0a3785271f34..9ebdd12e50a9 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -508,6 +508,7 @@ struct kvm_vcpu_arch {
#endif
/* Time base value when we entered the guest */
u64 entry_tb;
+ u64 entry_vtb;
u32 tcr;
ulong tsr; /* we need to perform set/clr_bits() which requires ulong */
u32 ivor[64];
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index e789f76c9bc2..6c649355b1e9 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1161,6 +1161,13 @@
#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : \
: "r" ((unsigned long)(v)) \
: "memory")
+#ifdef CONFIG_PPC_BOOK3S_64
+#define mfvtb() ({unsigned long rval; \
+ asm volatile("mfspr %0, %1" : \
+ "=r" (rval) : "i" (SPRN_VTB)); rval;})
+#else
+#define mfvtb() BUG()
+#endif
#ifdef __powerpc64__
#if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E)
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index c1f267694acb..1e89dbc665d9 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -101,6 +101,18 @@ static inline u64 get_rtc(void)
return (u64)hi * 1000000000 + lo;
}
+#ifdef CONFIG_PPC_BOOK3S_64
+static inline u64 get_vtb(void)
+{
+ return mfvtb();
+}
+#else
+static inline u64 get_vtb(void)
+{
+ return 0;
+}
+#endif
+
#ifdef CONFIG_PPC64
static inline u64 get_tb(void)
{
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index e1f1e5e16449..4b58d8a90cb5 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -528,6 +528,9 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
*/
*spr_val = vcpu->arch.spurr;
break;
+ case SPRN_VTB:
+ *spr_val = vcpu->arch.vtb;
+ break;
case SPRN_GQR0:
case SPRN_GQR1:
case SPRN_GQR2:
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 02231f5193c2..b5598e9cdd09 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -120,6 +120,8 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
* to find the guest purr and spurr value.
*/
vcpu->arch.entry_tb = get_tb();
+ vcpu->arch.entry_vtb = get_vtb();
+
}
/* Copy data touched by real-mode code from shadow vcpu back to vcpu */
@@ -171,6 +173,7 @@ out:
*/
vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb;
vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb;
+ vcpu->arch.vtb += get_vtb() - vcpu->arch.entry_vtb;
}
static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 03/10] KVM: PPC: BOOK3S: PR: Emulate instruction counter
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>
Writing to IC is not allowed in the privileged mode.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 1 +
arch/powerpc/kvm/book3s_emulate.c | 3 +++
arch/powerpc/kvm/book3s_pr.c | 2 ++
3 files changed, 6 insertions(+)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 9ebdd12e50a9..e0b13aca98e6 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -509,6 +509,7 @@ struct kvm_vcpu_arch {
/* Time base value when we entered the guest */
u64 entry_tb;
u64 entry_vtb;
+ u64 entry_ic;
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 4b58d8a90cb5..abe6f3057e5b 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -531,6 +531,9 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
case SPRN_VTB:
*spr_val = vcpu->arch.vtb;
break;
+ case SPRN_IC:
+ *spr_val = vcpu->arch.ic;
+ break;
case SPRN_GQR0:
case SPRN_GQR1:
case SPRN_GQR2:
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index b5598e9cdd09..51d469f8c9fd 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -121,6 +121,7 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
*/
vcpu->arch.entry_tb = get_tb();
vcpu->arch.entry_vtb = get_vtb();
+ vcpu->arch.entry_ic = mfspr(SPRN_IC);
}
@@ -174,6 +175,7 @@ out:
vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb;
vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb;
vcpu->arch.vtb += get_vtb() - vcpu->arch.entry_vtb;
+ vcpu->arch.ic += mfspr(SPRN_IC) - vcpu->arch.entry_ic;
}
static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 06/10] KVM: PPC: BOOK3S: PR: Emulate DPDES 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>
Since we don't support SMT yet, we should always find zero in
Directed privileged doorbell exception state register.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_emulate.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 9cf0392e3dcf..7f25adbd2590 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -585,6 +585,12 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
*/
*spr_val = 0;
break;
+ case SPRN_DPDES:
+ /*
+ * We don't have SMT support for PR yet, hence always return 0
+ */
+ *spr_val = 0;
+ break;
default:
unprivileged:
printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 05/10] KVM: PPC: BOOK3S: PR: Doorbell support
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 don't have SMT support yet, hence we should not find a doorbell
message generated
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_emulate.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index e74dda36ebea..9cf0392e3dcf 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -28,7 +28,9 @@
#define OP_19_XOP_RFI 50
#define OP_31_XOP_MFMSR 83
+#define OP_31_XOP_MSGSNDP 142
#define OP_31_XOP_MTMSR 146
+#define OP_31_XOP_MSGCLRP 174
#define OP_31_XOP_MTMSRD 178
#define OP_31_XOP_MTSR 210
#define OP_31_XOP_MTSRIN 242
@@ -286,6 +288,22 @@ int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
break;
}
+ case OP_31_XOP_MSGSNDP:
+ {
+ /*
+ * PR KVM still don't support SMT mode. So we should
+ * not see a MSGSNDP/MSGCLRP used with PR KVM
+ */
+ pr_info("KVM: MSGSNDP used in non SMT case\n");
+ emulated = EMULATE_FAIL;
+ break;
+ }
+ case OP_31_XOP_MSGCLRP:
+ {
+ pr_info"KVM: MSGCLRP used in non SMT case\n");
+ emulated = EMULATE_FAIL;
+ break;
+ }
default:
emulated = EMULATE_FAIL;
}
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 04/10] KVM: PPC: BOOK3S: PR: Emulate Thread identification 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>
Since PR KVM doesn't support SMT yet, we always return 0.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_emulate.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index abe6f3057e5b..e74dda36ebea 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -561,6 +561,12 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
case SPRN_DABR:
*spr_val = 0;
break;
+ case SPRN_TIR:
+ /*
+ * We don't have SMT support for PR yet, hence always return 0
+ */
+ *spr_val = 0;
+ break;
default:
unprivileged:
printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
--
1.8.5.3
^ permalink raw reply related
* [RFC PATCH 08/10] KVM: PPC: BOOK3S: PR: Add support for facility unavailable interrupt
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>
At this point we allow all the supported facilities except EBB. So
forward the interrupt to guest as illegal instruction.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_asm.h | 4 +++-
arch/powerpc/kvm/book3s.c | 4 ++++
arch/powerpc/kvm/book3s_emulate.c | 18 ++++++++++++++++++
arch/powerpc/kvm/book3s_pr.c | 17 +++++++++++++++++
4 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 1bd92fd43cfb..799244face51 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -99,6 +99,7 @@
#define BOOK3S_INTERRUPT_PERFMON 0xf00
#define BOOK3S_INTERRUPT_ALTIVEC 0xf20
#define BOOK3S_INTERRUPT_VSX 0xf40
+#define BOOK3S_INTERRUPT_FAC_UNAVAIL 0xf60
#define BOOK3S_IRQPRIO_SYSTEM_RESET 0
#define BOOK3S_IRQPRIO_DATA_SEGMENT 1
@@ -117,7 +118,8 @@
#define BOOK3S_IRQPRIO_DECREMENTER 14
#define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15
#define BOOK3S_IRQPRIO_EXTERNAL_LEVEL 16
-#define BOOK3S_IRQPRIO_MAX 17
+#define BOOK3S_IRQPRIO_FAC_UNAVAIL 17
+#define BOOK3S_IRQPRIO_MAX 18
#define BOOK3S_HFLAG_DCBZ32 0x1
#define BOOK3S_HFLAG_SLB 0x2
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 8912608b7e1b..a9aea28c2677 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -143,6 +143,7 @@ static int kvmppc_book3s_vec2irqprio(unsigned int vec)
case 0xd00: prio = BOOK3S_IRQPRIO_DEBUG; break;
case 0xf20: prio = BOOK3S_IRQPRIO_ALTIVEC; break;
case 0xf40: prio = BOOK3S_IRQPRIO_VSX; break;
+ case 0xf60: prio = BOOK3S_IRQPRIO_FAC_UNAVAIL; break;
default: prio = BOOK3S_IRQPRIO_MAX; break;
}
@@ -273,6 +274,9 @@ int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
case BOOK3S_IRQPRIO_PERFORMANCE_MONITOR:
vec = BOOK3S_INTERRUPT_PERFMON;
break;
+ case BOOK3S_IRQPRIO_FAC_UNAVAIL:
+ vec = BOOK3S_INTERRUPT_FAC_UNAVAIL;
+ break;
default:
deliver = 0;
printk(KERN_ERR "KVM: Unknown interrupt: 0x%x\n", priority);
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 60d0b6b745e7..bf6b11021250 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -481,6 +481,15 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
vcpu->arch.shadow_fscr = vcpu->arch.fscr & host_fscr;
break;
}
+ case SPRN_EBBHR:
+ vcpu->arch.ebbhr = spr_val;
+ break;
+ case SPRN_EBBRR:
+ vcpu->arch.ebbrr = spr_val;
+ break;
+ case SPRN_BESCR:
+ vcpu->arch.bescr = spr_val;
+ break;
unprivileged:
default:
printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
@@ -607,6 +616,15 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
case SPRN_FSCR:
*spr_val = vcpu->arch.fscr;
break;
+ case SPRN_EBBHR:
+ *spr_val = vcpu->arch.ebbhr;
+ break;
+ case SPRN_EBBRR:
+ *spr_val = vcpu->arch.ebbrr;
+ break;
+ case SPRN_BESCR:
+ *spr_val = vcpu->arch.bescr;
+ break;
default:
unprivileged:
printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 51d469f8c9fd..828056ec208f 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -900,6 +900,23 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
case BOOK3S_INTERRUPT_PERFMON:
r = RESUME_GUEST;
break;
+ case BOOK3S_INTERRUPT_FAC_UNAVAIL:
+ {
+ /*
+ * Check for the facility that need to be emulated
+ */
+ ulong fscr_ic = vcpu->arch.shadow_fscr >> 56;
+ if (fscr_ic != FSCR_EBB_LG) {
+ /*
+ * We only disable EBB facility.
+ * So only emulate that.
+ */
+ kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
+ r = RESUME_GUEST;
+ break;
+ }
+ /* Fall through */
+ }
case BOOK3S_INTERRUPT_PROGRAM:
case BOOK3S_INTERRUPT_H_EMUL_ASSIST:
{
--
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
* [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 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
* 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
* 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
* [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] 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: 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] 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
* 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 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 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 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: [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] 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: 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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox