John Ogness <john.ogness@xxxxxxxxxxxxx> writes: > On 2024-04-02, Esben Haabendal <esben@xxxxxxxxxx> wrote: >> Are there any other examples other than 8250 for how to port a driver to >> nbcon? > > No. 8250 is the first example. And even this example is changing a bit > with each new RT version as the underlying APIs and semantics have been > changing. > >> What is the plans for porting all of this to mainline? Should all >> drivers be ported first, or will a solution to prevent this type of >> regression be implemented at some later time? > > First off, I want to mention that this behavior is only with the > PREEMPT_RT preemption model. And it has been this way for a long > time. The behavior of legacy consoles for other preemption models is the > same as mainline now. So from a mainline perspective, I would not > consider it a regression. Got it. I think the last version where I know that this problem was not seen with PREEMPT_RT was 4.19. And yes, that is a long time ago :) > It is hard to say how this will actually play out though. We are > bringing the printk/console rework to mainline piece by piece. Until now > every piece has needed significant modifications in order to be accepted > mainline. (This is the main reason the 8250 driver keeps needing > changes.) > > The updated 8250 driver will be the last piece to go mainline. Only then > would all the APIs, semantics, and documentation be official. Hopefully > it is quite similar to what we have in the PREEMPT_RT tree now. > > I hope that once the printk/console rework is complete, there will be a > big push to port over the other serial drivers. Most of them are just > copy/paste of each other, which should simplify the porting. And since > the new nbcon consoles provide real advantages, there will also be > incentive to take on the porting effort. > > Finally, if someone wanted to try porting another driver for PREEMPT_RT > (for example, the imx serial console), I would certainly be interested > in reviewing and integrating the patches for the PREEMPT_RT tree. Sounds good. I have looked at porting imx uart driver to nbcon, and have something working now. It does smell quite a lot of copy-paste behaviour, but I will send it as an RFC for you to see when I have tested it a bit more. The write_thread and write_atomic functions share quite a lot of code, carrying half of the copy-paste smell. The other half is the inner loop of the write_thread function, which is almost identical in 8250 and imx drivers. I guess there is room to refactor this to avoid this amount of copy-paste before starting mass-porting. /Esben