From: Xin Zhao <jackzxcui1989@163.com>
To: gregkh@linuxfoundation.org
Cc: hch@infradead.org, jackzxcui1989@163.com, jirislaby@kernel.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
tj@kernel.org
Subject: Re: [PATCH] serial: 8250_dma: add workqueue to flip tty buffer
Date: Fri, 24 Oct 2025 23:55:34 +0800 [thread overview]
Message-ID: <20251024155534.2302590-1-jackzxcui1989@163.com> (raw)
In-Reply-To: <2025102434-stoppage-stagnate-5f0e@gregkh>
On Fri, 24 Oct 2025 13:21:45 +0200 Greg KH <gregkh@linuxfoundation.org> wrote:
> > tty_flip_buffer_commit(buf->tail);
> > - queue_work(system_unbound_wq, &buf->work);
> > + queue_work(port->wq_tty_flip ?: system_unbound_wq, &buf->work);
>
> Why not just do this for all tty ports? What is the benifit of keeping
> this on the system_unbound_wq for all other tty devices?
Thank you for your reminder. I think we should create a workqueue for all
tty_ports to avoid similar issues that other tty_ports might encounter later.
Creating a workqueue for each tty_port only slightly increases memory usage,
but it allows users to configure it, which should result in benefits far
outweighing the drawbacks.
I plan to allocate the workqueue in tty_port_init and delete it in
tty_port_destroy. I briefly scanned the code and found that currently,
tty_port_init seems to match one-to-one with tty_port_destroy. I’m not sure
if I have checked everything, so I would appreciate your suggestions about
it.
Additionally, I will use the name in tty_struct to differentiate the names
of the nodes created due to WQ_SYSFS flag. If the WQ_SYSFS flag is set and
a duplicate name is detected, a warning will be printed in dmesg, and the
creation will fail. I plan to directly assign system_unbound_wq to the
variable for wq_tty_flip when creation fails. This way, during each flip,
we won’t have to perform '?:' operation; I will only need to check in
tty_port_destroy whether it is system_unbound_wq. If it’s not, I will
destroy the workqueue. I’m wondering if my approach is appropriate, as is
there any case tty_port_destory is called without calling tty_port_init
before?
> You forgot to document this new member, and so the documentation build
> will throw a warning.
I thought about it later, and since this workqueue is related to the logic
of tty_bufhead, which is also used for flipping, I plan to place the
wq_tty_flip workqueue inside tty_buffer. Since it will be placed together
with work in tty_buffer, it is self-explanatory. If I organize it this way,
there shouldn't be a need for additional comments. What do you think?
--
Xin Zhao
prev parent reply other threads:[~2025-10-24 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 6:51 Xin Zhao
2025-10-24 11:21 ` Greg KH
2025-10-24 15:55 ` Xin Zhao [this message]
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=20251024155534.2302590-1-jackzxcui1989@163.com \
--to=jackzxcui1989@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tj@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®