From: Guenter Roeck <linux@roeck-us.net>
To: Tony Lindgren <tony@atomide.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Dhruva Gole" <d-gole@ti.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"John Ogness" <john.ogness@linutronix.de>,
"Johan Hovold" <johan@kernel.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
"kernel test robot" <oliver.sang@intel.com>
Subject: Re: [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name
Date: Sat, 5 Aug 2023 09:12:37 -0700 [thread overview]
Message-ID: <095e0120-ba81-64e7-e5d0-c042fb64978f@roeck-us.net> (raw)
In-Reply-To: <aeca6f69-49df-898c-e70b-afcc5427a29b@roeck-us.net>
On 8/5/23 08:50, Guenter Roeck wrote:
> On 8/5/23 04:48, Tony Lindgren wrote:
>> * Guenter Roeck <linux@roeck-us.net> [230805 10:50]:
>>> On 8/4/23 21:49, Tony Lindgren wrote:
>>>> * Guenter Roeck <linux@roeck-us.net> [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.
>>
>
> It is actually more complicated like that. Adding some debug into, I get the following
> from a mips boot. Turns out that serial8250_setup_port() is actually called.
>
> ...
> ####### serial8250_setup_port: index 0
> ####### serial8250_setup_port: index 0 returning 819a5ab8
> ####### serial8250_setup_port: index 1
> ####### serial8250_setup_port: index 1 returning 819a5d20
> ####### serial8250_setup_port: index 2
> ####### serial8250_setup_port: index 2 returning 819a5f88
> ####### serial8250_setup_port: index 3
> ####### serial8250_setup_port: index 3 returning 819a61f0
> ...
> #### serial8250_register_8250_port: uart=819a5ab8
> #### serial8250_register_8250_port: uart=819a5ab8 port_id=0 line=0
> ...
> #### serial8250_register_8250_port: uart=819a5d20
> #### serial8250_register_8250_port: uart=819a5d20 port_id=1 line=1
> sysfs: cannot create duplicate filename '/devices/platform/serial8250.0/serial8250.0:0/serial8250.0:0.0'
>
> So line and port_id are both set, but the created sysfs attribute
> is still duplicate. I'll do some more debugging.
>
Ok, it is actually quite simple. In serial8250_register_8250_port(),
uart->port.port_id has the correct and expected value. However, that is
overwritten with
uart->port.port_id = up->port.port_id;
where 'up' is the port pointer passed by the caller of serial8250_register_8250_port().
And 'port_id' is always 0 in _that_ port pointer (while 'line' is set correctly).
Guenter
next prev parent reply other threads:[~2023-08-05 16:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 7:10 Tony Lindgren
2023-08-03 7:26 ` Jiri Slaby
2023-08-03 7:50 ` Greg Kroah-Hartman
2023-08-03 8:52 ` Conor Dooley
2023-08-03 15:34 ` Biju Das
2023-08-04 21:42 ` Guenter Roeck
2023-08-05 4:49 ` Tony Lindgren
2023-08-05 10:50 ` Guenter Roeck
2023-08-05 11:48 ` Tony Lindgren
2023-08-05 15:50 ` Guenter Roeck
2023-08-05 16:12 ` Guenter Roeck [this message]
2023-08-06 4:33 ` Tony Lindgren
2023-08-06 6:23 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=095e0120-ba81-64e7-e5d0-c042fb64978f@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andriy.shevchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=d-gole@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=tony@atomide.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®