* [patch 0/4] Please pull merge branch of cell-2.6.git
@ 2008-11-28 19:51 Arnd Bergmann
2008-11-28 19:51 ` [patch 2/4] powerpc/cell/axon-msi: retry on missing interrupt Arnd Bergmann
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Arnd Bergmann @ 2008-11-28 19:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, cbe-oss-dev
Hi Paul,
These are four bug fixes for the cell platform that I would
still like to see merged in 2.6.28. None of them are regressions,
but they are all nasty bugs that can easily be trigged by users.
If you agree that these are 2.6.28 material, please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/cell-2.6.git merge
Thanks,
Arnd <><
arch/powerpc/kernel/entry_64.S | 2 -
arch/powerpc/platforms/cell/axon_msi.c | 36 ++++++++++++++++++++++++++++-----
arch/powerpc/platforms/cell/smp.c | 9 ++++++--
arch/powerpc/sysdev/mpic.c | 9 ++++++--
4 files changed, 46 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/4] powerpc/cell/axon-msi: retry on missing interrupt
2008-11-28 19:51 [patch 0/4] Please pull merge branch of cell-2.6.git Arnd Bergmann
@ 2008-11-28 19:51 ` Arnd Bergmann
2008-11-28 19:51 ` [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot Arnd Bergmann
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2008-11-28 19:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, cbe-oss-dev
The MSI capture logic for the axon bridge can sometimes
lose interrupts in case of high DMA and interrupt load,
when it signals an MSI interrupt to the MPIC interrupt
controller while we are already handling another MSI.
Each MSI vector gets written into a FIFO buffer in main
memory using DMA, and that DMA access is normally flushed
by the actual interrupt packet on the IOIF. An MMIO
register in the MSIC holds the position of the last
entry in the FIFO buffer that was written. However,
reading that position does not flush the DMA, so that
we can observe stale data in the buffer.
In a stress test, we have observed the DMA to arrive
up to 14 microseconds after reading the register.
This patch works around this problem by retrying the
access to the FIFO buffer.
We can reliably detect the conditioning by writing
an invalid MSI vector into the FIFO buffer after
reading from it, assuming that all MSIs we get
are valid. After detecting an invalid MSI vector,
we udelay(1) in the interrupt cascade for up to
100 times before giving up.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/platforms/cell/axon_msi.c | 36 +++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 896548b..442cf36 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -95,6 +95,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
struct axon_msic *msic = get_irq_data(irq);
u32 write_offset, msi;
int idx;
+ int retry = 0;
write_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG);
pr_debug("axon_msi: original write_offset 0x%x\n", write_offset);
@@ -102,7 +103,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
/* write_offset doesn't wrap properly, so we have to mask it */
write_offset &= MSIC_FIFO_SIZE_MASK;
- while (msic->read_offset != write_offset) {
+ while (msic->read_offset != write_offset && retry < 100) {
idx = msic->read_offset / sizeof(__le32);
msi = le32_to_cpu(msic->fifo_virt[idx]);
msi &= 0xFFFF;
@@ -110,13 +111,37 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
pr_debug("axon_msi: woff %x roff %x msi %x\n",
write_offset, msic->read_offset, msi);
+ if (msi < NR_IRQS && irq_map[msi].host == msic->irq_host) {
+ generic_handle_irq(msi);
+ msic->fifo_virt[idx] = cpu_to_le32(0xffffffff);
+ } else {
+ /*
+ * Reading the MSIC_WRITE_OFFSET_REG does not
+ * reliably flush the outstanding DMA to the
+ * FIFO buffer. Here we were reading stale
+ * data, so we need to retry.
+ */
+ udelay(1);
+ retry++;
+ pr_debug("axon_msi: invalid irq 0x%x!\n", msi);
+ continue;
+ }
+
+ if (retry) {
+ pr_debug("axon_msi: late irq 0x%x, retry %d\n",
+ msi, retry);
+ retry = 0;
+ }
+
msic->read_offset += MSIC_FIFO_ENTRY_SIZE;
msic->read_offset &= MSIC_FIFO_SIZE_MASK;
+ }
- if (msi < NR_IRQS && irq_map[msi].host == msic->irq_host)
- generic_handle_irq(msi);
- else
- pr_debug("axon_msi: invalid irq 0x%x!\n", msi);
+ if (retry) {
+ printk(KERN_WARNING "axon_msi: irq timed out\n");
+
+ msic->read_offset += MSIC_FIFO_ENTRY_SIZE;
+ msic->read_offset &= MSIC_FIFO_SIZE_MASK;
}
desc->chip->eoi(irq);
@@ -364,6 +389,7 @@ static int axon_msi_probe(struct of_device *device,
dn->full_name);
goto out_free_fifo;
}
+ memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES);
msic->irq_host = irq_alloc_host(dn, IRQ_HOST_MAP_NOMAP,
NR_IRQS, &msic_host_ops, 0);
--
1.5.6.3
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot
2008-11-28 19:51 [patch 0/4] Please pull merge branch of cell-2.6.git Arnd Bergmann
2008-11-28 19:51 ` [patch 2/4] powerpc/cell/axon-msi: retry on missing interrupt Arnd Bergmann
@ 2008-11-28 19:51 ` Arnd Bergmann
2008-11-29 2:22 ` Benjamin Herrenschmidt
2008-11-28 19:51 ` [patch 4/4] powerpc/cell: fix GDB watchpoints, again Arnd Bergmann
2008-11-28 20:12 ` [patch 1/4] powerpc: Fix system calls on Cell entered with XER.SO=1 Arnd Bergmann
3 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2008-11-28 19:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, cbe-oss-dev
Kexec/kdump currently fails on the IBM QS2x blades when the kexec happens
on a CPU other than the initial boot CPU. It turns out that this is the
result of mpic_init trying to set affinity of each interrupt vector to the
current boot CPU.
As far as I can tell, the same problem is likely to exist on any
secondary MPIC, because they have to deliver interrupts to the first
output all the time. There are two potential solutions for this: either
not set up affinity at all for secondary MPICs, or assume that a single
CPU output is connected to the upstream interrupt controller and hardcode
affinity to that per architecture.
This patch implements the second approach, defaulting to the first output.
Currently, all known secondary MPICs are routed to their upstream port
using the first destination, so we hardcode that.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/sysdev/mpic.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index f6299cc..b24e1d0 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1271,6 +1271,7 @@ void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count)
void __init mpic_init(struct mpic *mpic)
{
int i;
+ int cpu;
BUG_ON(mpic->num_sources == 0);
@@ -1313,6 +1314,11 @@ void __init mpic_init(struct mpic *mpic)
mpic_pasemi_msi_init(mpic);
+ if (mpic->flags & MPIC_PRIMARY)
+ cpu = hard_smp_processor_id();
+ else
+ cpu = 0;
+
for (i = 0; i < mpic->num_sources; i++) {
/* start with vector = source number, and masked */
u32 vecpri = MPIC_VECPRI_MASK | i |
@@ -1323,8 +1329,7 @@ void __init mpic_init(struct mpic *mpic)
continue;
/* init hw */
mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
- mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION),
- 1 << hard_smp_processor_id());
+ mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
}
/* Init spurious vector */
--
1.5.6.3
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 4/4] powerpc/cell: fix GDB watchpoints, again
2008-11-28 19:51 [patch 0/4] Please pull merge branch of cell-2.6.git Arnd Bergmann
2008-11-28 19:51 ` [patch 2/4] powerpc/cell/axon-msi: retry on missing interrupt Arnd Bergmann
2008-11-28 19:51 ` [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot Arnd Bergmann
@ 2008-11-28 19:51 ` Arnd Bergmann
2008-11-28 20:12 ` [patch 1/4] powerpc: Fix system calls on Cell entered with XER.SO=1 Arnd Bergmann
3 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2008-11-28 19:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, cbe-oss-dev
An earlier patch from Jens Osterkamp attempted to fix GDB
watchpoints by enabling the DABRX register at boot time.
Unfortunately, this did not work on SMP setups, where
secondary CPUs were still using the power-on DABRX value.
This introduces the same change for secondary CPUs on cell
as well.
Reported-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Tested-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/platforms/cell/smp.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index c0d86e1..9046803 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -129,10 +129,15 @@ static int __init smp_iic_probe(void)
return cpus_weight(cpu_possible_map);
}
-static void __devinit smp_iic_setup_cpu(int cpu)
+static void __devinit smp_cell_setup_cpu(int cpu)
{
if (cpu != boot_cpuid)
iic_setup_cpu();
+
+ /*
+ * change default DABRX to allow user watchpoints
+ */
+ mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER);
}
static DEFINE_SPINLOCK(timebase_lock);
@@ -192,7 +197,7 @@ static struct smp_ops_t bpa_iic_smp_ops = {
.message_pass = smp_iic_message_pass,
.probe = smp_iic_probe,
.kick_cpu = smp_cell_kick_cpu,
- .setup_cpu = smp_iic_setup_cpu,
+ .setup_cpu = smp_cell_setup_cpu,
.cpu_bootable = smp_cell_cpu_bootable,
};
--
1.5.6.3
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 1/4] powerpc: Fix system calls on Cell entered with XER.SO=1
2008-11-28 19:51 [patch 0/4] Please pull merge branch of cell-2.6.git Arnd Bergmann
` (2 preceding siblings ...)
2008-11-28 19:51 ` [patch 4/4] powerpc/cell: fix GDB watchpoints, again Arnd Bergmann
@ 2008-11-28 20:12 ` Arnd Bergmann
3 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2008-11-28 20:12 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, cbe-oss-dev
It turns out that on Cell, on a kernel with CONFIG_VIRT_CPU_ACCOUNTING
= y, if a program sets the SO (summary overflow) bit in the XER and
then does a system call, the SO bit in CR0 will be set on return
regardless of whether the system call detected an error. Since CR0.SO
is used as the error indication from the system call, this means that
all system calls appear to fail.
The reason is that the workaround for the timebase bug on Cell uses a
compare instruction. With CONFIG_VIRT_CPU_ACCOUNTING = y, the
ACCOUNT_CPU_USER_ENTRY macro reads the timebase, so we end up doing a
compare instruction, which copies XER.SO to CR0.SO. Since we were
doing this in the system call entry patch after clearing CR0.SO but
before saving the CR, this meant that the saved CR image had CR0.SO
set if XER.SO was set on entry.
This fixes it by moving the clearing of CR0.SO to after the
ACCOUNT_CPU_USER_ENTRY call in the system call entry path.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/kernel/entry_64.S | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index e6d5284..9d80f55 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -57,12 +57,12 @@ system_call_common:
beq- 1f
ld r1,PACAKSAVE(r13)
1: std r10,0(r1)
- crclr so
std r11,_NIP(r1)
std r12,_MSR(r1)
std r0,GPR0(r1)
std r10,GPR1(r1)
ACCOUNT_CPU_USER_ENTRY(r10, r11)
+ crclr so
std r2,GPR2(r1)
std r3,GPR3(r1)
std r4,GPR4(r1)
--
1.5.6.3
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot
2008-11-28 19:51 ` [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot Arnd Bergmann
@ 2008-11-29 2:22 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2008-11-29 2:22 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, paulus, cbe-oss-dev
On Fri, 2008-11-28 at 20:51 +0100, Arnd Bergmann wrote:
> plain text document attachment
> (0003-powerpc-mpic-don-t-reset-affinity-for-secondary-MPI.patch)
> Kexec/kdump currently fails on the IBM QS2x blades when the kexec happens
> on a CPU other than the initial boot CPU. It turns out that this is the
> result of mpic_init trying to set affinity of each interrupt vector to the
> current boot CPU.
>
> As far as I can tell, the same problem is likely to exist on any
> secondary MPIC, because they have to deliver interrupts to the first
> output all the time. There are two potential solutions for this: either
> not set up affinity at all for secondary MPICs, or assume that a single
> CPU output is connected to the upstream interrupt controller and hardcode
> affinity to that per architecture.
>
> This patch implements the second approach, defaulting to the first output.
> Currently, all known secondary MPICs are routed to their upstream port
> using the first destination, so we hardcode that.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-11-29 2:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-28 19:51 [patch 0/4] Please pull merge branch of cell-2.6.git Arnd Bergmann
2008-11-28 19:51 ` [patch 2/4] powerpc/cell/axon-msi: retry on missing interrupt Arnd Bergmann
2008-11-28 19:51 ` [patch 3/4] powerpc/mpic: dont reset affinity for secondary MPIC on boot Arnd Bergmann
2008-11-29 2:22 ` Benjamin Herrenschmidt
2008-11-28 19:51 ` [patch 4/4] powerpc/cell: fix GDB watchpoints, again Arnd Bergmann
2008-11-28 20:12 ` [patch 1/4] powerpc: Fix system calls on Cell entered with XER.SO=1 Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).