BACKPORT: n_tty: Fix unordered accesses to lockless read buffer
Add commit_head buffer index, which the producer-side publishes after input processing in non-canon mode. This ensures the consumer-side observes correctly-ordered writes in non-canonical mode (ie., the buffer data is written before the buffer index is advanced). Fix consumer-side uses of read_cnt() to use commit_head instead. Add required memory barriers to the tail index to guarantee the consumer-side has completed the loads before the producer-side begins writing new data. Open-code the producer-side receive_room() into the i/o loop. Remove no-longer-referenced receive_room(). Based on work by Christian Riesch <christian.riesch@omicron.at> Cc: Christian Riesch <christian.riesch@omicron.at> Signed-off-by:Peter Hurley <peter@hurleysoftware.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> [salidoa@google.com: Modied to keep receive_room() which is called in many places] BUG=b:29643166 TEST=smaug boots (cherry picked from commit 70aca71f92ca2c111978bf676287fab5580d2598) Signed-off-by:
Adrian Salido <salidoa@google.com> Reviewed-on: https://chromium-review.googlesource.com/356730 Commit-Ready: Adrian Salido <salidoa@chromium.org> Tested-by:
Adrian Salido <salidoa@chromium.org> Reviewed-by:
Stephen Barber <smbarber@chromium.org> CRs-Fixed: 1073011 Change-Id: I002f3eda7b1b1d06f38ee69c613ef4e90da51615 Git-repo: https://chromium.googlesource.com/chromiumos/third_party/kernel Git-commit: 86f682dca64c3144cfcd92dce2e4423457fbf878 (kimran@codeaurora.org: resolved minor cherry-pick conflicts) Signed-off-by:
Imran Khan <kimran@codeaurora.org>
Loading
Please register or sign in to comment