diff options
author | Federico Vaga <federico.vaga@cern.ch> | 2019-02-14 09:51:30 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2019-02-14 17:55:20 +0100 |
commit | e7663ef5ae0f02e3b902eb0305dec981333eb3e1 (patch) | |
tree | c2186d1e3285863a6e136daa472b4e58ce7b81c6 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 0940d24912e9256fdf172f84c54ffd91680f05d0 (diff) |
i2c: ocores: stop transfer on timeout
Detecting a timeout is ok, but we also need to assert a STOP command on
the bus in order to prevent it from generating interrupts when there are
no on going transfers.
Example: very long transmission.
1. ocores_xfer: START a transfer
2. ocores_isr : handle byte by byte the transfer
3. ocores_xfer: goes in timeout [[bugfix here]]
4. ocores_xfer: return to I2C subsystem and to the I2C driver
5. I2C driver : it may clean up the i2c_msg memory
6. ocores_isr : receives another interrupt (pending bytes to be
transferred) but the i2c_msg memory is invalid now
So, since the transfer was too long, we have to detect the timeout and
STOP the transfer.
Another point is that we have a critical region here. When handling the
timeout condition we may have a running IRQ handler. For this reason I
introduce a spinlock.
In order to make easier to understan locking I have:
- added a new function to handle timeout
- modified the current ocores_process() function in order to be protected
by the new spinlock
Like this it is obvious at first sight that this locking serializes
the execution of ocores_process() and ocores_process_timeout()
Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions