Jason Wessel wrote: > Jan Kiszka wrote: >> Hi Jason, >> >> so far I ignored this because it worked, but I know my customer will >> complain later anyway: What is the deeper meaning of this warning which >> shows up once per registered UART port on my (x86) boxes? >> >> void kgdb8250_add_port(int i, struct uart_port *serial_req) >> { >> #ifdef CONFIG_KGDB_SIMPLE_SERIAL >> if (should_copy_rs_table) >> printk(KERN_ERR "8250_kgdb: warning will over write serial" >> " port definitions at kgdb init time\n"); >> #endif >> ... >> >> When I look at kgdb8250_add_platform_port, it starts with a call to >> kgdb8250_copy_rs_table, and I'm wondering now if that wouldn't be more >> appropriate here. >> >> Jan >> > > > This was the result of a race condition between the init code of the > platform vs the init code in kgdb. The init code in the arch platform > could register serial ports prior to the kgdb module being configured > by the kernel while the kernel is processing all the __init functions. > It would have been easy to fix this with another call to > kgdb8250_copy_rs_table() but you cannot do that because a non-__init > function cannot call an __init function. > > > We might as well go ahead and fix the problem by adding in some checks > so as not to overwrite the dynamic registrations, because eventually > the SERIAL_PORT_DFNS will be gone. Below is the patch with the fix to > add some saftey checks as well as to remove the warning. > > --------Cut here----------- > > > Fix the initialization of the kgdb port structure such that > dynamically registered ports will not be later overwritten by the > SERIAL_PORT_DFNS table. With this problem fixed, the printk about the > overwriting of the kgdb serial definitions at init time can be > removed. > > Also add in additional runtime safety checks to make sure UART_NR was > statically allocated by the kernel at compile time to be large enough > for all the dynamic registered ports.
I'm currently preparing to post a larger patch series for KGDB which also addresses this problem - but quite differently. Therefore this question in advance: What use case could not be covered by polling the (8250) config via serial8250_get_port_def() when there were no kgdb8250_add_port()? That's in fact what I did in my patch because I found none and the result appears much more consistent to me. But I'm not claiming to be a UART expert across all those various embedded platforms. Jan
signature.asc
Description: OpenPGP digital signature