From: Tejun Heo <tj@kernel.org>
To: Xin Zhao <jackzxcui1989@163.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
hch@infradead.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH v3] tty: tty_port: add workqueue to flip tty buffer
Date: Mon, 24 Nov 2025 06:02:33 -1000 [thread overview]
Message-ID: <aSSBmStZfV9XL7IL@slm.duckdns.org> (raw)
In-Reply-To: <aSSBfwm6L4jXqYor@slm.duckdns.org>
On Mon, Nov 24, 2025 at 06:02:07AM -1000, Tejun Heo wrote:
> On Mon, Nov 24, 2025 at 01:17:51PM +0800, Xin Zhao wrote:
> > > +/**
> > > + * tty_flip_wq_init -- prepare workqueue for tty/pty flip buffer work
> > > + * @port: tty_port of the device
> > > + * @driver: tty_driver for this device
> > > + * @index: index of the tty
> > > + *
> > > + * Not all tty_port will be initialized by tty_port_init where tty_flip_wq will
> > > + * be set to system_unbound_wq as default. Allocate workqueue with WQ_SYSFS for
> > > + * flip buffer, so that cpumask and nice can be changed dynamically.
> > > + */
> > > +void tty_flip_wq_init(struct tty_port *port, struct tty_driver *driver,
> > > + unsigned int index)
> > > +{
> > > + char name[64];
> > > +
> > > + if (driver->type == TTY_DRIVER_TYPE_PTY) {
> > > + port->buf.tty_flip_wq = pty_flip_wq;
> > > + return;
> > > + }
> > > + tty_line_name(driver, index, name);
> > > + if (!port->buf.tty_flip_wq
> > > + || port->buf.tty_flip_wq == system_unbound_wq) {
> > > + port->buf.tty_flip_wq = alloc_workqueue("%s-flip-wq",
> > > + WQ_UNBOUND | WQ_SYSFS,
> > > + 0, name);
> > > + if (unlikely(!port->buf.tty_flip_wq))
> > > + port->buf.tty_flip_wq = system_unbound_wq;
> > > + }
> > > +}
>
> These look overly elaborate to me. Just fail init if workqueue allocation
> fails? Also, is it necessary for each port to have separate port?
Sorry, I meant a separate workqueue.
--
tejun
next prev parent reply other threads:[~2025-11-24 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 6:09 [PATCH v3] tty: tty_port: add workqueue to flip tty buffer Xin Zhao
2025-11-24 5:17 ` Xin Zhao
2025-11-24 16:02 ` Tejun Heo
2025-11-24 16:02 ` Tejun Heo [this message]
2025-11-25 2:19 ` Xin Zhao
2025-11-26 12:10 ` Greg KH
2025-11-26 14:46 ` Xin Zhao
2025-11-26 16:37 ` Tejun Heo
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=aSSBmStZfV9XL7IL@slm.duckdns.org \
--to=tj@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jackzxcui1989@163.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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