Re: [EXTERNAL] Re: [PATCH v1] ASoC: tas2781: fixed compiling issue in m68k

From: Geert Uytterhoeven
Date: Tue Oct 03 2023 - 08:16:02 EST


Hi Shenghao,

On Tue, Oct 3, 2023 at 12:47 PM Ding, Shenghao <shenghao-ding@xxxxxx> wrote:
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> > Sent: Tuesday, October 3, 2023 3:24 AM
> > To: Ding, Shenghao <shenghao-ding@xxxxxx>
> > Cc: broonie@xxxxxxxxxx; robh+dt@xxxxxxxxxx;
> > andriy.shevchenko@xxxxxxxxxxxxxxx; lgirdwood@xxxxxxxxx; perex@xxxxxxxx;
> > pierre-louis.bossart@xxxxxxxxxxxxxxx; Lu, Kevin <kevin-lu@xxxxxx>;
> > 13916275206@xxxxxxx; alsa-devel@xxxxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; liam.r.girdwood@xxxxxxxxx; mengdong.lin@xxxxxxxxx;
> > Xu, Baojun <baojun.xu@xxxxxx>; thomas.gfeller@xxxxxxxxxx; Gupta, Peeyush
> > <peeyush@xxxxxx>; Navada Kanyana, Mukund <navada@xxxxxx>;
> > tiwai@xxxxxxx
> > Subject: [EXTERNAL] Re: [PATCH v1] ASoC: tas2781: fixed compiling issue in
> > m68k
> >
> > Hi Shenghao,
> >
> > Thanks for your patch!
> >
> > On Mon, Oct 2, 2023 at 4:38 PM Shenghao Ding <shenghao-ding@xxxxxx>
> > wrote:
> > > fixed m68k compiling issue: mapping table can save code field; storing
> > > the
> >
> > Please replicate the actual error message from the compiler, so it is recorded in
> > the commit description, and easy to find when someone searches for the actual
> > error message
> >
> > From the Reported-by (which is not included in the actual description, as it is
> > below the "---"):
> >
> > {standard input}: Assembler messages:
> > >> {standard input}:992: Error: value -148 out of range
> > {standard input}:992: Error: value of ffffff6c too large for field of 1 byte at
> > 0000045f
> >
> > > dev_idx as a member of block can reduce unnecessary time and system
> > > resource comsumption of dev_idx mapping every time the block data
> > > writing to the dsp.
> >
> > I am sorry, but I don't understand what this means.
> > Can you please elaborate?
> >
> > Also, can you please explain what the real issue is?
> > (My first guess when seeing the error message before was that a signed
> > integer is truncated to an unsigned char or so, but I couldn't see immediately
> > where that is happening)
> Sorry to late feedback. I had been troubled by this issue for several weeks. At first, I also think it would one of variables overflow, according to the compiling error message. However, after investigation, no result came out. In fact, compiler will report the line number where the variable overflow is, if there was risk on the variable overflow. Yet, this compiling error did not report any line number. Finally, I didn’t realize that it would be the code section overflow until that compiling error message magically disappeared, one day I removed some functions in the tas2781-fwlib.c. So, I began to simplify some functions in the code.

I managed to reproduce the issue with the m68k cross-compiler from
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/

| sound/soc/codecs/tas2781-fmwlib.c:779: switch (block->type) {
subq.l #1,%a0 |, tmp56
moveq #36,%d0 |,
cmp.l %a0,%d0 | tmp56,
jcs .L122 |
move.l %a0,%d0 | tmp56, tmp59
add.l %d0,%d0 | tmp59
move.w .L95(%pc,%d0.l),%d0 |, tmp60
.L125:
| sound/soc/codecs/tas2781-fmwlib.c:827: switch (block->type) {
jmp %pc@(2,%d0:w) | tmp66
.balignw 2,0x284c
.L95:
.word .L109-.L95
.word .L113-.L95

[...]

| sound/soc/codecs/tas2781-fmwlib.c:827: switch (block->type) {
moveq #36,%d0 |,
cmp.l %a0,%d0 | tmp77,
jcs .L122 |
move.l %a0,%d0 | tmp77,
add.l %d0,%d0 |
move.l %d0,%a0 |, tmp65
---> move.w .L95(%pc,%a0.l),%d0 |, tmp66
jra .L125 |

Looks like the compiler is sharing the jump table at L95 for two
different switch() statements, but the PC-relative offset to refer to
the table is too large when using -m68000. It works fine with -m68020.

Probably a compiler bug?

> > > Signed-off-by: Shenghao Ding <shenghao-ding@xxxxxx>
> > >
> > > ---
> > > Changes in v1:
> > > - | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > > | Closes:
> > > | https://lore.kernel.org/oe-kbuild-all/202309222048.RnSqEIK5-lkp@xxxxxxxxx/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds