[squeak-dev] Re: [Vm-dev] re: "callback failed to own the VM"

Eliot Miranda eliot.miranda at gmail.com
Thu Oct 8 22:20:27 UTC 2015

Hi Craig,

    so the code in tryLockVMOwner is
        mov $1, %eax
        xchg %eax, vmOwnerLock
        sub $1, %eax    "Since we only ever set the lock to 1 or 0,
subtracting 1 sets EAX to 0 if the lock was already locked and non-zero if
it wasn't."

i.e. it attempts to set vmOwnerLock and answers if the attempt succeeded,
where it will only succeed if vmOwnerLock was zero.  So I guess the system
is never arranging to unlock the Vm so there is never any opportunity for
the foreign callback to get entry.  Try adding an occasional
"Processor relinquishProcessorForMicroseconds: 100" and see if that gives
your call-back a window.  Ideally you'd only do such a thing when the
system is  ready to accept callbacks.  I expect the foreign callback logic
is wrong in only allowing callbacks when the VM is unlocked.  Instead, the
system should probably see if the foreign callback priority is greater than
the current process's priority, and then somehow preempt the current
process (e.g. by setting stackLimit appropriately).  But I have no cycles
to think about this right now.

On Thu, Oct 8, 2015 at 6:10 AM, Craig Latta <craig at netjam.org> wrote:

> Hi Eliot--
>      Well, I have a callback that gets as far as
> ownVMFromUnidentifiedThread() now, but I just keep spinning on
> tryLockVMOwner(). Help?
>      thanks again,
> -C
> --
> Craig Latta
> netjam.org
> +31 6 2757 7177 (SMS ok)
> + 1 415 287 3547 (no SMS)

best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151008/64ddd020/attachment-0001.htm

More information about the Squeak-dev mailing list