Re: [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name

From: Tony Lindgren
Date: Sat Aug 05 2023 - 07:48:55 EST


* Guenter Roeck <linux@xxxxxxxxxxxx> [230805 10:50]:
> On 8/4/23 21:49, Tony Lindgren wrote:
> > * Guenter Roeck <linux@xxxxxxxxxxxx> [230804 21:42]:
> > > kobject: kobject_add_internal failed for serial8250.0:0.0 with -EEXIST, don't try to register things with the same name in the same directory.
> > > serial8250 serial8250.0: unable to register port at index 1 (IO2f8 MEM0 IRQ3): -17
> > > sysfs: cannot create duplicate filename '/devices/platform/serial8250.0/serial8250.0:0/serial8250.0:0.0'
> >
> > The issue above should be fixed with commit:
> >
> > bbb4abb1bcfb ("serial: 8250: Reinit port_id when adding back serial8250_isa_devs")
> >
>
> No. I tested the tip of tty-linus (v6.5-rc4-9-gdfe2aeb226fd) which includes
> above commit, but still see the problem. sparc images also still stall after
> the "cannot create duplicate filename" message.
> I bisected the sparc problem - it also bisects to commit d962de6ae51f.
>
> The problem affects all mips boot tests, all sparc boot tests, as well as
> arm sx1, ppc bamboo and sam460ex emulations. As far as I can see, those
> call serial8250_register_8250_port() without calling serial8250_setup_port()
> and thus don't set port_id. I am only testing a few of those, so I strongly
> suspect that all similar callers of serial8250_register_8250_port() are
> affected (i.e., almost all of them) if they register more than one serial port.

OK thanks for explaining. So we need to initialize port->port_id for the
multi-port instances to avoid being stuck with the port->line index. I'll
take a look.

I wonder if we should just revert d962de6ae51f for now. It needs to be
tested to see if something else also needs reverting though.

Regards,

Tony