From: Johan Hovold <johan@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org, stable@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v2 2/7] serial: qcom-geni: fix shutdown race
Date: Fri, 18 Oct 2024 11:21:40 +0200 [thread overview]
Message-ID: <ZxIopDwcqf8xqJK8@hovoldconsulting.com> (raw)
In-Reply-To: <CAD=FV=XuEPGtDCe4ssXPy2avigqviTBAycc0Q_U_Pwi9x6t23g@mail.gmail.com>
On Fri, Oct 11, 2024 at 07:30:30AM -0700, Doug Anderson wrote:
> On Thu, Oct 10, 2024 at 11:51 PM Johan Hovold <johan@kernel.org> wrote:
> >
> > > > Not sure how your "console process" works, but this should only happen
> > > > if you do not enable the serial console (console=ttyMSM0) and then try
> > > > to use a polled console (as enabling the console will prevent port
> > > > shutdown from being called).
> > And this is with a Chromium kernel, not mainline?
>
> Who do you take me for?!?! :-P :-P :-P Of course it's with mainline.
Heh. Just checking. I was sure about shutdown() not being called when
closing ports, but yeah, you can indeed hit this via hangup() as serial
core was only half-converted over to use the tty port implementation in
2016.
> > If you take a look at tty_port_shutdown() there's a hack in there for
> > consoles that was added back in 2010 and that prevents shutdown() from
> > called for console ports.
> >
> > Put perhaps you manage to hit shutdown() via some other path. Serial
> > core is not yet using tty_port_hangup() so a hangup might trigger
> > that...
> >
> > Could you check that with a dump_stack()?
> lazor-rev9 ~ # stop console-ttyMSM0
> [ 68.812702] qcom_geni_serial_shutdown+0x38/0x110
> [ 68.817578] uart_port_shutdown+0x48/0x68
> [ 68.821736] uart_shutdown+0xcc/0x170
> [ 68.825530] uart_hangup+0x54/0x158
> [ 68.829154] __tty_hangup+0x20c/0x318
> [ 68.832954] tty_vhangup_session+0x20/0x38
> [ 68.837195] disassociate_ctty+0xe8/0x1a8
> [ 68.841355] do_exit+0x10c/0x358
> [ 68.844716] do_group_exit+0x9c/0xa8
> [ 68.848441] get_signal+0x408/0x4d8
> [ 68.852071] do_signal+0xa8/0x770
Thanks for confirming. I see this too when stopping a getty.
> > > Now I (via ssh) drop into the debugger:
> > >
> > > echo g > /proc/sysrq-trigger
> > >
> > > I see the "kgdb" prompt but I can't interact with it because
> > > qcom_geni_serial_shutdown() stopped RX.
> >
> > How about simply amending poll_get_char() so that it enables the
> > receiver if it's not already enabled?
>
> Yeah, this would probably work.
Seems we should clean up serial core so that it at least behaves
consistently on hangup and close.
Having someone think trough and document how these polled consoles are
supposed to work would also be good and save people modifying these
drivers a lot of work.
If they are restricted to when the console is active, there would be no
need for most of poll_init(), and we already prevent the console from
being shut down on hangup() and close().
And then we now also have the detachable console mess to consider...
Johan
next prev parent reply other threads:[~2024-10-18 9:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 12:50 [PATCH v2 0/7] serial: qcom-geni: fix receiver enable Johan Hovold
2024-10-01 12:50 ` [PATCH v2 1/7] serial: qcom-geni: fix premature " Johan Hovold
2024-10-01 13:50 ` Mukesh Kumar Savaliya
2024-10-02 2:07 ` Bjorn Andersson
2024-10-09 13:43 ` Johan Hovold
2024-10-03 18:29 ` Doug Anderson
2024-10-09 13:55 ` Johan Hovold
2024-10-01 12:50 ` [PATCH v2 2/7] serial: qcom-geni: fix shutdown race Johan Hovold
2024-10-01 13:36 ` Bartosz Golaszewski
2024-10-01 13:39 ` Johan Hovold
2024-10-03 18:30 ` Doug Anderson
2024-10-09 14:10 ` Johan Hovold
2024-10-10 22:30 ` Doug Anderson
2024-10-11 6:51 ` Johan Hovold
2024-10-11 14:30 ` Doug Anderson
2024-10-18 9:21 ` Johan Hovold [this message]
2024-10-01 12:50 ` [PATCH v2 3/7] serial: qcom-geni: fix dma rx cancellation Johan Hovold
2024-10-01 12:50 ` [PATCH v2 4/7] serial: qcom-geni: fix receiver enable Johan Hovold
2024-10-03 20:10 ` Doug Anderson
2024-10-09 14:17 ` Johan Hovold
2024-10-01 12:50 ` [PATCH v2 5/7] serial: qcom-geni: fix rx cancel dma status bit Johan Hovold
2024-10-03 19:55 ` Doug Anderson
2024-10-09 14:20 ` Johan Hovold
2024-10-01 12:50 ` [PATCH v2 6/7] serial: qcom-geni: drop flip buffer WARN() Johan Hovold
2024-10-03 20:06 ` Doug Anderson
2024-10-09 14:23 ` Johan Hovold
2024-10-01 12:50 ` [PATCH v2 7/7] serial: qcom-geni: drop unused receive parameter Johan Hovold
2024-10-03 20:10 ` Doug Anderson
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=ZxIopDwcqf8xqJK8@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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®