Re: spinlock recursion when running q800 emulation in qemu

Michael Schmitz
2024-03-06T23:42:07Z

Thanks Brad,

On 6/03/24 21:30, Brad Boyer wrote:
> On Wed, Mar 06, 2024 at 08:14:31PM +1300, Michael Schmitz wrote:
>> Looking at the backtraces some more, I think what happens here is that the
>> swapper kernel task is stalled for long enough here that on the next
>> scheduler tick, it is still running. With no other tasks scheduled to run in
>> the meantime, it may still be the current task.
>>
>> The stalled swapper task still holds the run queue lock, hence the recursion
>> message.
>>
>> I do not think this is a bug, just a reflection of a slow system with
>> nothing much to do.
>>
>> There does not appear to be any interrupt nesting here. I cannot recall the
>> interrupt level assignment on the Q800, in particular as regards disk
>> interrupts and whether both VIAs are using the same interrupt level. I'd
>> suppose they would, as these chips date back a long time and probably cannot
... that should have been 'would not', of course. Autovectoring can't
work otherwise.
>> place a vector number on the bus as part of the interrupt stack frame?
> No, a Mac with 2 VIA chips should always have them on separate interrupt
> levels. The exact mapping varies by model, but every model supported
> by Linux uses at least three different hardware IRQ levels.
>
> On most Mac models, VIA1 is IRQ1, VIA2 is IRQ2, and the SCC is IRQ4.
> VIA1 would handle the timer and ADB while VIA2 handles NuBus and SCSI.
> It looks like the Q800 supports switching VIA1 to IRQ6 through the
> alternate IRQ mapping. Most models also are using various other chips
> emulating a real VIA for VIA2 with varying levels of compatibility.
>
> Apple always used autovectoring and the three IPL pins to determine
> the interrupt vector. Older models just have three external IRQ
> sources, one matching each pin (thus the 1, 2, 4 pattern). I presume
> they had some external circuit to make sure only one line is being
> pulled low at a time since we never get other IRQ levels by accident.

Makes sense - thanks for refreshing my memory!

Cheers,

Michael

>
> The AV macs and the IIfx are the only models with more complex
> interrupt controllers as separate chips (PSC or OSS).
>
> Brad Boyer
> flar@allandria.com
>
>