Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "tty: tty_port: add workqueue to flip TTY buffer"

This reverts commit d000422a46aad32217cf1be747eb61d641baae2f.

It is reported by many to cause boot failures, so must be reverted.

Cc: Xin Zhao <jackzxcui1989@163.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/d1942304-ee30-478d-90fb-279519f3ae81@samsung.com
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reported-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+9 -78
+4 -10
drivers/tty/pty.c
··· 403 403 o_tty->link = tty; 404 404 tty_port_init(ports[0]); 405 405 tty_port_init(ports[1]); 406 - tty_port_link_wq(ports[0], system_dfl_wq); 407 - tty_port_link_wq(ports[1], system_dfl_wq); 408 406 tty_buffer_set_limit(ports[0], 8192); 409 407 tty_buffer_set_limit(ports[1], 8192); 410 408 o_tty->port = ports[0]; ··· 532 534 pty_driver = tty_alloc_driver(legacy_count, 533 535 TTY_DRIVER_RESET_TERMIOS | 534 536 TTY_DRIVER_REAL_RAW | 535 - TTY_DRIVER_DYNAMIC_ALLOC | 536 - TTY_DRIVER_CUSTOM_WORKQUEUE); 537 + TTY_DRIVER_DYNAMIC_ALLOC); 537 538 if (IS_ERR(pty_driver)) 538 539 panic("Couldn't allocate pty driver"); 539 540 540 541 pty_slave_driver = tty_alloc_driver(legacy_count, 541 542 TTY_DRIVER_RESET_TERMIOS | 542 543 TTY_DRIVER_REAL_RAW | 543 - TTY_DRIVER_DYNAMIC_ALLOC | 544 - TTY_DRIVER_CUSTOM_WORKQUEUE); 544 + TTY_DRIVER_DYNAMIC_ALLOC); 545 545 if (IS_ERR(pty_slave_driver)) 546 546 panic("Couldn't allocate pty slave driver"); 547 547 ··· 849 853 TTY_DRIVER_REAL_RAW | 850 854 TTY_DRIVER_DYNAMIC_DEV | 851 855 TTY_DRIVER_DEVPTS_MEM | 852 - TTY_DRIVER_DYNAMIC_ALLOC | 853 - TTY_DRIVER_CUSTOM_WORKQUEUE); 856 + TTY_DRIVER_DYNAMIC_ALLOC); 854 857 if (IS_ERR(ptm_driver)) 855 858 panic("Couldn't allocate Unix98 ptm driver"); 856 859 pts_driver = tty_alloc_driver(NR_UNIX98_PTY_MAX, ··· 857 862 TTY_DRIVER_REAL_RAW | 858 863 TTY_DRIVER_DYNAMIC_DEV | 859 864 TTY_DRIVER_DEVPTS_MEM | 860 - TTY_DRIVER_DYNAMIC_ALLOC | 861 - TTY_DRIVER_CUSTOM_WORKQUEUE); 865 + TTY_DRIVER_DYNAMIC_ALLOC); 862 866 if (IS_ERR(pts_driver)) 863 867 panic("Couldn't allocate Unix98 pts driver"); 864 868
+4 -4
drivers/tty/tty_buffer.c
··· 76 76 mutex_unlock(&buf->lock); 77 77 78 78 if (restart) 79 - queue_work(buf->flip_wq, &buf->work); 79 + queue_work(system_dfl_wq, &buf->work); 80 80 } 81 81 EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive); 82 82 ··· 530 530 struct tty_bufhead *buf = &port->buf; 531 531 532 532 tty_flip_buffer_commit(buf->tail); 533 - queue_work(buf->flip_wq, &buf->work); 533 + queue_work(system_dfl_wq, &buf->work); 534 534 } 535 535 EXPORT_SYMBOL(tty_flip_buffer_push); 536 536 ··· 560 560 tty_flip_buffer_commit(buf->tail); 561 561 spin_unlock_irqrestore(&port->lock, flags); 562 562 563 - queue_work(buf->flip_wq, &buf->work); 563 + queue_work(system_dfl_wq, &buf->work); 564 564 565 565 return size; 566 566 } ··· 613 613 614 614 bool tty_buffer_restart_work(struct tty_port *port) 615 615 { 616 - return queue_work(port->buf.flip_wq, &port->buf.work); 616 + return queue_work(system_dfl_wq, &port->buf.work); 617 617 } 618 618 619 619 bool tty_buffer_cancel_work(struct tty_port *port)
+1 -20
drivers/tty/tty_io.c
··· 3446 3446 if (error < 0) 3447 3447 goto err; 3448 3448 3449 - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) { 3450 - driver->flip_wq = alloc_workqueue("%s-flip-wq", WQ_UNBOUND | WQ_SYSFS, 3451 - 0, driver->name); 3452 - if (!driver->flip_wq) { 3453 - error = -ENOMEM; 3454 - goto err_unreg_char; 3455 - } 3456 - for (i = 0; i < driver->num; i++) { 3457 - if (driver->ports[i]) 3458 - tty_port_link_driver_wq(driver->ports[i], driver); 3459 - } 3460 - } 3461 - 3462 3449 if (driver->flags & TTY_DRIVER_DYNAMIC_ALLOC) { 3463 3450 error = tty_cdev_add(driver, dev, 0, driver->num); 3464 3451 if (error) 3465 - goto err_destroy_wq; 3452 + goto err_unreg_char; 3466 3453 } 3467 3454 3468 3455 scoped_guard(mutex, &tty_mutex) ··· 3475 3488 scoped_guard(mutex, &tty_mutex) 3476 3489 list_del(&driver->tty_drivers); 3477 3490 3478 - err_destroy_wq: 3479 - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) 3480 - destroy_workqueue(driver->flip_wq); 3481 - 3482 3491 err_unreg_char: 3483 3492 unregister_chrdev_region(dev, driver->num); 3484 3493 err: ··· 3494 3511 driver->num); 3495 3512 scoped_guard(mutex, &tty_mutex) 3496 3513 list_del(&driver->tty_drivers); 3497 - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) 3498 - destroy_workqueue(driver->flip_wq); 3499 3514 } 3500 3515 EXPORT_SYMBOL(tty_unregister_driver); 3501 3516
-23
drivers/tty/tty_port.c
··· 100 100 EXPORT_SYMBOL(tty_port_init); 101 101 102 102 /** 103 - * tty_port_link_wq - link tty_port and flip workqueue 104 - * @port: tty_port of the device 105 - * @flip_wq: workqueue to queue flip buffer work on 106 - * 107 - * When %TTY_DRIVER_CUSTOM_WORKQUEUE is used, every tty_port shall be linked to 108 - * a workqueue manually by this function, otherwise tty_flip_buffer_push() will 109 - * see %NULL flip_wq pointer on queue_work. 110 - * When %TTY_DRIVER_CUSTOM_WORKQUEUE is NOT used, the function can be used to 111 - * link a certain port to a specific workqueue, instead of using the workqueue 112 - * allocated in tty_register_driver(). 113 - * 114 - * Note that TTY port API will NOT destroy the workqueue. 115 - */ 116 - void tty_port_link_wq(struct tty_port *port, struct workqueue_struct *flip_wq) 117 - { 118 - port->buf.flip_wq = flip_wq; 119 - } 120 - EXPORT_SYMBOL_GPL(tty_port_link_wq); 121 - 122 - /** 123 103 * tty_port_link_device - link tty and tty_port 124 104 * @port: tty_port of the device 125 105 * @driver: tty_driver for this device ··· 157 177 const struct attribute_group **attr_grp) 158 178 { 159 179 tty_port_link_device(port, driver, index); 160 - tty_port_link_driver_wq(port, driver); 161 180 return tty_register_device_attr(driver, index, device, drvdata, 162 181 attr_grp); 163 182 } ··· 183 204 struct device *dev; 184 205 185 206 tty_port_link_device(port, driver, index); 186 - tty_port_link_driver_wq(port, driver); 187 207 188 208 dev = serdev_tty_port_register(port, host, parent, driver, index); 189 209 if (PTR_ERR(dev) != -ENODEV) { ··· 703 725 struct tty_struct *tty) 704 726 { 705 727 tty->port = port; 706 - tty_port_link_driver_wq(port, driver); 707 728 return tty_standard_install(driver, tty); 708 729 } 709 730 EXPORT_SYMBOL_GPL(tty_port_install);
-1
include/linux/tty_buffer.h
··· 34 34 35 35 struct tty_bufhead { 36 36 struct tty_buffer *head; /* Queue head */ 37 - struct workqueue_struct *flip_wq; 38 37 struct work_struct work; 39 38 struct mutex lock; 40 39 atomic_t priority;
-7
include/linux/tty_driver.h
··· 69 69 * Do not create numbered ``/dev`` nodes. For example, create 70 70 * ``/dev/ttyprintk`` and not ``/dev/ttyprintk0``. Applicable only when a 71 71 * driver for a single tty device is being allocated. 72 - * 73 - * @TTY_DRIVER_CUSTOM_WORKQUEUE: 74 - * Do not create workqueue when tty_register_driver(). When set, flip 75 - * buffer workqueue shall be set by tty_port_link_wq() for every port. 76 72 */ 77 73 enum tty_driver_flag { 78 74 TTY_DRIVER_INSTALLED = BIT(0), ··· 79 83 TTY_DRIVER_HARDWARE_BREAK = BIT(5), 80 84 TTY_DRIVER_DYNAMIC_ALLOC = BIT(6), 81 85 TTY_DRIVER_UNNUMBERED_NODE = BIT(7), 82 - TTY_DRIVER_CUSTOM_WORKQUEUE = BIT(8), 83 86 }; 84 87 85 88 enum tty_driver_type { ··· 506 511 * @flags: tty driver flags (%TTY_DRIVER_) 507 512 * @proc_entry: proc fs entry, used internally 508 513 * @other: driver of the linked tty; only used for the PTY driver 509 - * @flip_wq: workqueue to queue flip buffer work on 510 514 * @ttys: array of active &struct tty_struct, set by tty_standard_install() 511 515 * @ports: array of &struct tty_port; can be set during initialization by 512 516 * tty_port_link_device() and similar ··· 539 545 unsigned long flags; 540 546 struct proc_dir_entry *proc_entry; 541 547 struct tty_driver *other; 542 - struct workqueue_struct *flip_wq; 543 548 544 549 /* 545 550 * Pointer to the tty data structures
-13
include/linux/tty_port.h
··· 138 138 kernel */ 139 139 140 140 void tty_port_init(struct tty_port *port); 141 - void tty_port_link_wq(struct tty_port *port, struct workqueue_struct *flip_wq); 142 141 void tty_port_link_device(struct tty_port *port, struct tty_driver *driver, 143 142 unsigned index); 144 143 struct device *tty_port_register_device(struct tty_port *port, ··· 163 164 if (port && kref_get_unless_zero(&port->kref)) 164 165 return port; 165 166 return NULL; 166 - } 167 - 168 - /* 169 - * Never overwrite the workqueue set by tty_port_link_wq(). 170 - * No effect when %TTY_DRIVER_CUSTOM_WORKQUEUE is set, as driver->flip_wq is 171 - * %NULL. 172 - */ 173 - static inline void tty_port_link_driver_wq(struct tty_port *port, 174 - struct tty_driver *driver) 175 - { 176 - if (!port->buf.flip_wq) 177 - port->buf.flip_wq = driver->flip_wq; 178 167 } 179 168 180 169 /* If the cts flow control is enabled, return true. */