lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251024155534.2302590-1-jackzxcui1989@163.com>
Date: Fri, 24 Oct 2025 23:55:34 +0800
From: Xin Zhao <jackzxcui1989@....com>
To: gregkh@...uxfoundation.org
Cc: hch@...radead.org,
	jackzxcui1989@....com,
	jirislaby@...nel.org,
	linux-kernel@...r.kernel.org,
	linux-serial@...r.kernel.org,
	tj@...nel.org
Subject: Re: [PATCH] serial: 8250_dma: add workqueue to flip tty buffer

On Fri, 24 Oct 2025 13:21:45 +0200 Greg KH <gregkh@...uxfoundation.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ