Message ID | 20190713210853.GA25753@lenoch (mailing list archive) |
---|---|
Headers | show |
Series | usb: gadget: u_serial: Fix and cleanup | expand |
On Sat, Jul 13, 2019 at 11:08:53PM +0200, Ladislav Michl wrote: > Following patchset makes console work (patch 1 and 4) for an AT91SAM9G20 > board connected to xhci_hcd and does some cleanup. > Tested with "console=ttyS0,115200n8 console=ttyGS0" on kernel command line > and following inittab: > console::respawn:/sbin/getty -L 115200 ttyS0 vt100 > console::respawn:/sbin/getty -L 115200 ttyGS0 vt100 > > However there is an issue remaining: > Disconnect triggers WARN_ON in gs_close: [...] Hi, Can you try a patchset I sent some time ago [1] if it fixes your case? Best Regards, Michał Mirosław [1] https://www.spinics.net/lists/linux-usb/msg177537.html
On Sun, Jul 14, 2019 at 12:04:26PM +0200, Michał Mirosław wrote: > On Sat, Jul 13, 2019 at 11:08:53PM +0200, Ladislav Michl wrote: > > Following patchset makes console work (patch 1 and 4) for an AT91SAM9G20 > > board connected to xhci_hcd and does some cleanup. > > Tested with "console=ttyS0,115200n8 console=ttyGS0" on kernel command line > > and following inittab: > > console::respawn:/sbin/getty -L 115200 ttyS0 vt100 > > console::respawn:/sbin/getty -L 115200 ttyGS0 vt100 > > > > However there is an issue remaining: > > Disconnect triggers WARN_ON in gs_close: > [...] > > Hi, > > Can you try a patchset I sent some time ago [1] if it fixes your case? You can pull it from branch usb-console on https://rere.qmqm.pl/git/linux (rebased on current usb-next tree). Best Regards, Michał Mirosław
On Sun, Jul 14, 2019 at 01:37:17PM +0200, Michał Mirosław wrote: > On Sun, Jul 14, 2019 at 12:04:26PM +0200, Michał Mirosław wrote: > > On Sat, Jul 13, 2019 at 11:08:53PM +0200, Ladislav Michl wrote: > > > Following patchset makes console work (patch 1 and 4) for an AT91SAM9G20 > > > board connected to xhci_hcd and does some cleanup. > > > Tested with "console=ttyS0,115200n8 console=ttyGS0" on kernel command line > > > and following inittab: > > > console::respawn:/sbin/getty -L 115200 ttyS0 vt100 > > > console::respawn:/sbin/getty -L 115200 ttyGS0 vt100 > > > > > > However there is an issue remaining: > > > Disconnect triggers WARN_ON in gs_close: > > [...] > > > > Hi, > > > > Can you try a patchset I sent some time ago [1] if it fixes your case? > > You can pull it from branch usb-console on https://rere.qmqm.pl/git/linux > (rebased on current usb-next tree). Thank you! I has just in the middle of pulling patches from mail archive. Your first two patches are definitely worth applying and I'll add my Tested-by after more testing. 3/5 is unfortunately "I do not care" as not having use case, 4/5 is something I do not see use case either, but I'm fine with that, except for #ifdefs, but 5/5 should be solved the other way around - just wait until everything is written out, of course only if USB is connected. That's what serial consoles does and that's what I expect from kernel console. Your patch set does not attempt to solve tty write to unconnected USB and WARN_ON on gs_close, so I'll wait for comments to those two issues and redo fix on top of "reimplement console support" as getting rid of the kthread is definitely superior to fixing it :) Best regards, ladis
Hi Michał, On Sun, Jul 14, 2019 at 12:04:26PM +0200, Michał Mirosław wrote: > On Sat, Jul 13, 2019 at 11:08:53PM +0200, Ladislav Michl wrote: > > Following patchset makes console work (patch 1 and 4) for an AT91SAM9G20 > > board connected to xhci_hcd and does some cleanup. > > Tested with "console=ttyS0,115200n8 console=ttyGS0" on kernel command line > > and following inittab: > > console::respawn:/sbin/getty -L 115200 ttyS0 vt100 > > console::respawn:/sbin/getty -L 115200 ttyGS0 vt100 > > > > However there is an issue remaining: > > Disconnect triggers WARN_ON in gs_close: > [...] > > Hi, > > Can you try a patchset I sent some time ago [1] if it fixes your case? your "usb: gadget: u_serial: add missing port entry locking" and "usb: gadget: u_serial: reimplement console support" fixes every single problem I had with the driver (including that WARN_ON on gs_close), except starving console write. Fortunately my patch "usb: gadget: u_serial: Fix starving write" applies on top of your first two patches. So here's my Tested-by: Ladislav Michl <ladis@linux-mips.org> and also one nit for your second patch (there are people running cocci scripts, so save them some time ;-)): --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -931,8 +931,8 @@ static void gs_console_complete_out(struct usb_ep *ep, struct usb_request *req) static void __gs_console_push(struct gs_console *cons) { struct usb_request *req = cons->req; - struct usb_ep *ep = cons->console.data; - size_t size = 0; + struct usb_ep *ep; + size_t size; if (!req) return; /* disconnected */ @@ -940,6 +940,7 @@ static void __gs_console_push(struct gs_console *cons) if (req->length) return; /* busy */ + ep = cons->console.data; size = kfifo_out(&cons->buf, req->buf, ep->maxpacket); if (!size) return; I'm dropping all my patches except the fourth one in favour of your solution as it is clearly superior. Care to resend it possibly with above fix and said fourth patch as a single serie? Thank you, ladis