Re: [RFC PATCH v1 00/25] printk: new implementation

From: Eugeniu Rosca
Date: Fri Jan 24 2020 - 11:09:51 EST


Hi Geert,

On Wed, Jan 22, 2020 at 08:48:12PM +0100, Geert Uytterhoeven wrote:
> On Wed, Jan 22, 2020 at 5:59 PM Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> wrote:
> > On Wed, Jan 22, 2020 at 08:31:44AM +0100, Geert Uytterhoeven wrote:
> > > On Wed, Jan 22, 2020 at 3:34 AM Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> wrote:
> > > > So, what's specific to R-Car3, based on my testing, is that the issue
> > > > can only be reproduced if the printk storm originates on CPU0

Slight amendment the above statement. Below results are got on R-Car
H3ULCB running renesas-drivers-2020-01-14-v5.5-rc6 (cX stands for CPUx,
whitespace stands for clean audio, '!' stands for distorted audio):

printk @:
c0 c1 c2 c3 c4 c5 c6 c7
speaker-test @ c0 !
c1 ! !
c2 ! !
c3 ! !
c4 ! !
c5 ! !
c6 ! !
c7 ! !

One can see two patterns in the chart. The audio has glitches whenever:
- printk and the audio application run on the same CPU, or:
- printk runs on CPU0

> Yeah, cpu0 is always heavily loaded w.r.t. interrupts.
> Can you reproduce the problem after forcing all interrupts to e.g. cpu1?

With instrumentation shown in [1], the chart suffers below changes:

printk @:
c0 c1 c2 c3 c4 c5 c6 c7
speaker+test @ c0 ! !
c1 !
c2 ! !
c3 ! !
c4 ! !
c5 ! !
c6 ! !
c7 ! !

Any comments on the above empirical results?

[1] IRQ affinity set to CPU1

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index f06016d38a05..40003a3af4e0 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1786,6 +1786,12 @@ static int rcar_dmac_chan_probe(struct rcar_dmac *dmac,
return ret;
}

+ ret = irq_set_affinity(rchan->irq, cpumask_of(1));
+ if (ret) {
+ dev_err(dmac->dev, "failed to set IRQ affinity %u (%d)\n", rchan->irq, ret);
+ return ret;
+ }
+
return 0;
}

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 9b4ff872e297..c76b38626b6b 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1926,6 +1926,11 @@ static int sci_request_irq(struct sci_port *port)
dev_err(up->dev, "Can't allocate %s IRQ\n", desc->desc);
goto out_noirq;
}
+ ret = irq_set_affinity(irq, cpumask_of(1));
+ if (ret) {
+ dev_err(up->dev, "failed to set IRQ affinity %u (%d)\n", irq, ret);
+ return ret;
+ }
}

return 0;

--
Best Regards
Eugeniu Rosca