Re: [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core



Greg KH wrote:

On Fri, Dec 16, 2005 at 01:23:32AM +0300, Vitaly Wool wrote:


Greg KH wrote:



On Thu, Dec 15, 2005 at 09:47:42AM +0300, Vitaly Wool wrote:




David Brownell wrote:





No, "stupid drivers will suffer"; nothing new.  Just observe
how the ads7846 touchscreen driver does small async transfers.






One cannot allocate memory in interrupt context, so the way to go is allocating it on stack, thus the buffer is not DMA-safe.
Making it DMA-safe in thread that does the very message processing is a good way of overcoming this.
Using preallocated buffer is not a good way, since it may well be
already used by another interrupt or not yet processed by the worker
thread (or tasklet, or whatever).




Yes it is a good way.  That's the way USB currently works in the kernel,
and it works just fine.  It keeps the rules simple and everyone knows
what needs to be done.




Looking at my usbnet stuff, I can't share that opinion :-/
Are you really ready to lower the performance and quality of service just for approach uniformity?



What performance issues? As an example, USB has this rule, and we can
saturate a 480Mbit line with a _userspace_ driver (loads of memcopy
calles involved there.)


What CPU is used there? I guess it's not 144 MHz ARM ;-)



And, can you please point me out the examples of devices behind USB bus that need to write registers from an interrupt context?



usb to serial drivers need to allocate buffers for their write functions
as they can be called in irq context from a tty line dicipline, which
causes a USB packet to be dynamically created and sent to the USB core.
I also think the USB network and ATM drivers have these requirements
too, just search for GFP_ATOMIC in the drivers/usb/ directory to find
these instances.


Oh BTW... I'm experiencing constant problems with root filesystem over NFS over usbnet on my target
I'm getting "server not responding, still trying" error whenever the system (208-MHz ARM926 board) is under heavy load.
I think it may well be related to the thing we discuss.


Vitaly
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Relevant Pages

  • Re: [spi-devel-general] Re: [PATCH/RFC] SPI: add DMAUNSAFE analog
    ... > One cannot allocate memory in interrupt context, so the way to go is ... is the way to allocate memory in irq context. ... but it's particularly relevant since both USB and SPI ... We would call those "driver bugs" and expect patches. ...
    (Linux-Kernel)
  • Re: [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownells core
    ... >>>One cannot allocate memory in interrupt context, so the way to go is ... >>>Using preallocated buffer is not a good way, ... That's the way USB currently works in the kernel, ...
    (Linux-Kernel)
  • Re: [RFC PATCH 0/3] sysfs: allow suicide
    ... The reference is dropped when the suiciding thread calls delete on the ... device has been removed or will be removed in interrupt context. ... Therefore every hotplug driver I have looked at has it's own workqueue ...
    (Linux-Kernel)
  • Re: [linux-pm] [patch update 2 fix] PM: Introduce core framework for run-time PM of I/O devi
    ... therefore want the runtime suspend and resume methods to be called as ... I'd like to call pm_request_suspendfrom interrupt context. ... callbacks do not need to be executed from interrupt context. ... Just marking the device as resumed and letting the driver access the ...
    (Linux-Kernel)
  • Re: RTC , ds1307 I2C driver and NTP does not work.
    ... from an interrupt context, which is what appears to be happening here. ... So the ds1307 driver would need to be changed not to directly call ... There is no way around the delay in the case of I2C RTC chips anyway ... bus driver may sleep as part of the bus transaction, ...
    (Linux-Kernel)