Bug 799391

Summary: Tasks waiting on a state change of another task may get wrong result
Product: Red Hat Enterprise MRG Reporter: Steven Rostedt <srostedt>
Component: realtime-kernelAssignee: John Kacur <jkacur>
Status: CLOSED ERRATA QA Contact: David Sommerseth <davids>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.2CC: bhu, jkacur, jkastner, lgoncalv, ovasik
Target Milestone: 2.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: wait_task_interactive() ignores the rt_spin_locks state Consequence: wait_task_interactive() can return with an incorrect result if the task it is waiting for is blocked on a rt_spin_lock() and is waking up. Fix: wait_task_interactive() must also test the saved_state field saved by rt_spin_locks Result: The correct result is returned from wait_task_interactive()
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-19 18:03:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Have wait_task_interactive() check saved state of task none

Description Steven Rostedt 2012-03-02 16:19:59 UTC
When a task calls the function wait_task_interactive(), it waits on the task to change its tasks state. But it does not take into account that spin_locks() in RT will change the real state of the task, but keep a mirror copy of the state, that it resets to when the task unlocks the spin lock.

The wait_task_interactive() may get the wrong result because it sees the temporary state caused by the RT spin lock and not the real state.

Comment 1 Steven Rostedt 2012-03-02 16:23:40 UTC
Created attachment 567100 [details]
Have wait_task_interactive() check saved state of task

In RT, spin locks store the task's state in a shadow copy because the wakeup of the spin lock will change it. On unlock the shadow copy is moved to the original tasks state. But this can confuse wait_task_interactive() because it doesn't see the copy of it. This patch makes wait_task_interactive() aware of the copy as well.

Comment 2 John Kacur 2012-05-23 13:00:43 UTC
The fix here is equivalent to c7004d0
git describe --contains c7004d0
v3.2.14-rt24~8

Documenting this in the changelog section of kernel-rt.spec

Comment 6 John Kacur 2012-06-20 22:08:16 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: wait_task_interactive() ignores the rt_spin_locks state
Consequence: wait_task_interactive() can return with an incorrect result if the task it is waiting for is blocked on a rt_spin_lock() and is waking up.
Fix: wait_task_interactive() must also test the saved_state field saved by rt_spin_locks
Result: The correct result is returned from wait_task_interactive()

Comment 10 errata-xmlrpc 2012-09-19 18:03:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-1282.html