diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-03-06 13:20:52 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 23:11:59 (GMT) |
commit | 70bc126471af30bb115e635512dcf6d86fe6e29a (patch) | |
tree | e6fc82736558f3a1b1f1601e237bc395b78a9dcd /drivers/tty/rocket.h | |
parent | c828f679eed393d6925a2b44a4c3fb80a8d657cb (diff) | |
download | linux-fsl-qoriq-70bc126471af30bb115e635512dcf6d86fe6e29a.tar.xz |
tty: Add safe tty throttle/unthrottle functions
The tty driver can become stuck throttled due to race conditions
between throttle and unthrottle, when the decision to throttle
or unthrottle is conditional. The following example helps to
illustrate the race:
CPU 0 | CPU 1
|
if (condition A) |
| <processing such that A not true>
| if (!condition A)
| unthrottle()
throttle() |
|
Note the converse is also possible; ie.,
CPU 0 | CPU 1
|
| if (!condition A)
<processing such that A true> |
if (condition A) |
throttle() |
| unthrottle()
|
Add new throttle/unthrottle functions based on the familiar model
of task state and schedule/wake. For example,
while (1) {
tty_set_flow_change(tty, TTY_THROTTLE_SAFE);
if (!condition)
break;
if (!tty_throttle_safe(tty))
break;
}
__tty_set_flow_change(tty, 0);
In this example, if an unthrottle occurs after the condition is
evaluated but before tty_throttle_safe(), then tty_throttle_safe()
will return non-zero, looping and forcing the re-evaluation of
condition.
Reported-by: Vincent Pillet <vincentx.pillet@intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/rocket.h')
0 files changed, 0 insertions, 0 deletions