Opened 14 years ago

Closed 10 years ago

#231 closed defect (deferred)

Two CPUs in critical section under Qemu/ia32/SMP

Reported by: Jakub Jermář Owned by: Jakub Jermář
Priority: major Milestone: 0.6.0
Component: helenos/kernel/ia32 Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description (last modified by Martin Decky)

After applying the attached changes on top of changeset:mainline,377, I am observing (under Qemu 0.11.?, 0.12.2+3) what appears to be more than one CPU in a spinlock-protected critical section.

In order to figure out more, I improved the spinlock code to be more sensitive to random lock corruption (which I can thus rule out) and also to be more observable by providing a global ring buffer for recording the locking history. See the attachement to see the diff. I am also going to attach screenshots which illustrate the panics.

Frankly speaking, my suspect number one is actually Qemu (since the HelenOS code looks good to me atm.), but I am logging this ticket anyway just for the case I am wrong. One more thing which makes me think that this is rather a Qemu issue is that with the given ring buffer and the spinlock_lock_debug() code, I would expect the panic to occur in spinlock_lock_debug() on either of the two checks for multiple CPUs in the CS, and not so late in spinlock_unlock(). With this behavior, the simulated CPUs appear to use some very strange memory model (i.e. we observe the effect of the lock_event_record() on both CPUs that manage to "lock" the spinlock, but in most of the cases do not hit the "not alone in critical section" panic).

Attachments (4)

diff (11.4 KB ) - added by Jakub Jermář 14 years ago.
Diff from changeset:head,377.
kernel.raw.bz2 (153.9 KB ) - added by Jakub Jermář 14 years ago.
kernel.raw for the sake of running a disassembler on it.
spinlock_unlock.png (35.6 KB ) - added by Jakub Jermář 14 years ago.
Screenshot with a ring buffer showing the lock-lock-unlock-unlock pattern
spinlock_lock_debug.png (35.3 KB ) - added by Jakub Jermář 14 years ago.
Screenshot which shows panic on one of the CS invariant checks in the modified spinlock_lock_debug()

Download all attachments as: .zip

Change History (10)

by Jakub Jermář, 14 years ago

Attachment: diff added

Diff from changeset:head,377.

by Jakub Jermář, 14 years ago

Attachment: kernel.raw.bz2 added

kernel.raw for the sake of running a disassembler on it.

by Jakub Jermář, 14 years ago

Attachment: spinlock_unlock.png added

Screenshot with a ring buffer showing the lock-lock-unlock-unlock pattern

by Jakub Jermář, 14 years ago

Attachment: spinlock_lock_debug.png added

Screenshot which shows panic on one of the CS invariant checks in the modified spinlock_lock_debug()

comment:1 by Jakub Jermář, 14 years ago

Description: modified (diff)

comment:2 by Martin Decky, 14 years ago

Description: modified (diff)

comment:3 by Jakub Jermář, 14 years ago

Owner: set to Jakub Jermář
Status: newassigned

comment:4 by Jakub Jermář, 14 years ago

Milestone: 0.4.30.5.0

comment:5 by Jakub Jermář, 12 years ago

Milestone: 0.5.00.5.1

comment:6 by Jakub Jermář, 10 years ago

Resolution: deferred
Status: assignedclosed

Too old branch of a too old version of HelenOS on a too old version of QEMU. Deferring indefinitely.

Note: See TracTickets for help on using tickets.