Re: 答复: 答复: [PATCH] serial: 8250: add lock for dma rx

From: Greg KH
Date: Thu Dec 09 2021 - 05:07:38 EST


On Thu, Dec 09, 2021 at 09:08:51AM +0000, wigin zeng wrote:
> > What issue exactly?
> The interval of UART input packages is very small(1ms~ 10ms), and some package size larger than configured DMA transfer size.

What do you mean exactly by "package size"? Isn't it up to the DMA
transfer to do the whole copy?

> > But what data is being accessed at the same time to cause a crash?
> > How is data being added into the buffer at the same time in two different places into the same queue? What userspace programs are causing this?
> Both places will modify tty_port *port->buf.tail (kmalloc operation and write the data/flag into this address)

What is the "second" place here? Data should only be coming in from the
DMA transfer copy, right?

> >So all tty buffer accesses need to be protected by your new lock?
> New lock only protected the tty_buffer alloc and write operation in serial-tty case.

You need to document that really well as it does not seem that all
accesses are now protected by this lock. Only one odd access is, and I
still do not understand how this is happening at the same time now.

Again, what changed recently to cause this to start happening? Why is
this only showing up now? What is unique about your system that causes
this and prevents it from happening on any other system?

thanks,

greg k-h