From: "Kohli, Gaurav" <gkohli@codeaurora.org>
To: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Cc: jslaby@suse.com, gregkh@linuxfoundation.org, mikey@neuling.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: fix data race in n_tty_receive_buf_common
Date: Thu, 4 Jan 2018 11:17:38 +0530 [thread overview]
Message-ID: <0a456419-c836-08cf-070b-a254fb702b75@codeaurora.org> (raw)
In-Reply-To: <20180103193807.465e054e@alans-desktop>
[-- Attachment #1: Type: text/plain, Size: 2683 bytes --]
Hi Alan ,
In our case we are seeing this, when tty_init_dev call is running on one
core and flush_to_ldisc is
running on other core:
So in below case tty_port is intact , only tty is reinitialized again.
kworker
-000|n_tty_receive_buf_common()
-001|n_tty_receive_buf2()
-002|tty_ldisc_receive_buf(inline)
-002|receive_buf(inline)
-002|flush_to_ldisc()
-003|__read_once_size(inline)
-003|static_key_count(inline)
-003|static_key_false(inline)
-003|trace_workqueue_execute_end(inline)
-003|process_one_work()
init
-005|tty_unthrottle()
-006|n_tty_open()
-007|tty_ldisc_open.isra.3()
-008|tty_ldisc_setup()
-009|tty_init_dev()
-010|tty_open_by_driver(inline)
-010|tty_open()
-011|chrdev_open()
-012|do_dentry_open()
-013|vfs_open()
-014|do_last()
>
>
> 2. tty_init_dev when we set up a new tty
>
> At that point the tty is not supposed to be receiving data and sure
> enough we don't call tty->ops->open until it has finished the ldisc set
> up, nor do we tty_init_dev a port that is already running.
>
> So given we don't activate the port until tty->ops->open() calls
> tty_port_open calls the port activation routine I don't see a bug.
So it seems this case only , open call has not completed but we have
request for receive .
>
> What does a full (all CPU) trace of the bug look like and what tty driver
> are you using when you capture the trace ?
We are using tty for console logging,
| tty = 0xFFFFFFFF477AC880 -> (
| magic = 21505,
| kref = (refcount = (counter = 2)),
| dev = 0xFFFFFFFFEDE3DA80,
| driver = 0xFFFFFFFFEDE2A480,
| ops = 0xFFFFFF9F26F7D0D0,
| index = 0,
| ldisc_sem = (count = 1, wait_lock = (raw_lock = (owner = 0,
next = 0), magic = 3735899821, own
| termiox = 0x0,
| name = "ttyMSM0",
| pgrp = 0x0,
We have seen this issue on 4.9 and also one thing i have observed,
before tty is getting reinit in tty_init_dev(),
there is console service exited before it in all the dumps.
35206.969644: <2> init: Service 'console' (pid 7440) exited with
status 130
35206.969690: <2> init: Sending signal 9 to service 'console' (pid
7440) process group...
35206.970857: <2> init: kill(7440, 9) failed: No such process.
So how can we stop request of receive buff, if we already have tty_port
and tty is getting reinitialized in midway like above
case?
Regards
Gaurav
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
[-- Attachment #2: Type: text/html, Size: 4083 bytes --]
next prev parent reply other threads:[~2018-01-04 5:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 13:48 [PATCH] tty: fix data race in n_tty_receive_buf_common Gaurav Kohli
2018-01-03 19:38 ` Alan Cox
2018-01-04 5:47 ` Kohli, Gaurav [this message]
2018-01-04 11:09 ` Alan Cox
2018-01-04 13:46 ` Kohli, Gaurav
2018-01-04 14:37 ` Alan Cox
2018-01-05 7:34 ` Kohli, Gaurav
2018-01-05 7:45 ` Kohli, Gaurav
2018-01-05 13:36 ` Alan Cox
2018-01-05 13:56 ` Kohli, Gaurav
2018-01-05 14:15 ` Alan Cox
2018-01-05 20:14 ` Kohli, Gaurav
2018-01-05 20:24 ` Kohli, Gaurav
2018-01-05 21:05 ` Alan Cox
2018-01-06 7:50 ` Kohli, Gaurav
2018-01-17 13:25 ` Kohli, Gaurav
2018-01-20 18:49 ` Alan Cox
2018-01-05 20:28 ` Kohli, Gaurav
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=0a456419-c836-08cf-070b-a254fb702b75@codeaurora.org \
--to=gkohli@codeaurora.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikey@neuling.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