On 2019/4/27 5:05, Leon Romanovsky wrote: > On Fri, Apr 26, 2019 at 11:36:56AM -0300, Jason Gunthorpe wrote: >> On Fri, Apr 26, 2019 at 06:12:11PM +0800, Liuyixian (Eason) wrote: >> >>> However, I have talked with our chip team about function clear >>> functionality. We think it is necessary to inform the chip to >>> perform the outstanding task and some cleanup work and restore >>> hardware resources in time when rmmod ko. Otherwise, it is >>> dangerous to reuse the hardware as it can not guarantee those >>> work can be done well without the notification from our driver. >> >> If it is dangerous to reuse the hardware then you have to do this >> cleanup on device startup, not on device removal. > > Right, I can think about gazillion ways to brick such HW. > The simplest way will be to call SysRq during RDMA traffic > and no cleanup function will be called in such case. > > Thanks Hi Jason and Leon, As hip08 is a fake pcie device, we could not disassociate and stop the hardware access through the chain break mechanism as a real pcie device. Alternatively, function clear is used as a notification to the hardware to stop accessing and ensure to not read or write DDR later. That is, the role of function clear to hip08 is similar as the chain break to pcie device. Without function clear, following problems would be happened: 1) With current hardware design, the hardware request to the bus may not be able to wait for respone, as the rquest (read or write) may arrive to processor after the hardware has already returned to the destroy verbs from application, in this case, the access error may happen. 2) The traffic buffer applied from schedule module could not return back, it will affect the traffic of other functions. Thus, we think it is more reasonable to do function clear on device removal. Thanks.