Patchwork sparc32 do not clear interrupts when masking

login
register
mail settings
Submitter Artyom Tarasenko
Date Jan. 15, 2010, 10:37 p.m.
Message ID <1263595050-17791-1-git-send-email-atar4qemu@google.com>
Download mbox | patch
Permalink /patch/42999/
State New
Headers show

Comments

Artyom Tarasenko - Jan. 15, 2010, 10:37 p.m.
Don't clear interrupts on disabling, because
* Sun4M_SystemArchitecture_edited2.pdf doesn't describe
  that masking or un-masking IRQ shall clear pending ones.

* Field tests also show that SPARCstation-20 doesn't 
  clear them.

* The patch makes Solaris 2.5.1/2.6 boot ~1500 times
  faster (~20 seconds instead of ~8 hours)

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
Blue Swirl - Jan. 16, 2010, 8:16 a.m.
On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
<atar4qemu@googlemail.com> wrote:
> Don't clear interrupts on disabling, because
> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>  that masking or un-masking IRQ shall clear pending ones.
>
> * Field tests also show that SPARCstation-20 doesn't
>  clear them.

Awesome work!

> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>  faster (~20 seconds instead of ~8 hours)

Unfortunately there is some problem with the patch (or more likely
there is some other bug that this uncovers), because all my Linux test
now panic. NetBSD and OpenBSD are unaffected.

For example, sparc-test:
eth0: LANCE 52:54:00:12:34:56
esp0: no command in esp_handle()
Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
 <0>Press L1-A to return to the boot prom

The bug may be in ESP interrupt handling (or in the interrupt chain
between ESP, DMA controller and interrupt controller) as the panic
always happens in ESP probe.
Blue Swirl - Jan. 16, 2010, 8:47 a.m.
On Sat, Jan 16, 2010 at 8:16 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
> <atar4qemu@googlemail.com> wrote:
>> Don't clear interrupts on disabling, because
>> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>>  that masking or un-masking IRQ shall clear pending ones.
>>
>> * Field tests also show that SPARCstation-20 doesn't
>>  clear them.
>
> Awesome work!
>
>> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>>  faster (~20 seconds instead of ~8 hours)
>
> Unfortunately there is some problem with the patch (or more likely
> there is some other bug that this uncovers), because all my Linux test
> now panic. NetBSD and OpenBSD are unaffected.
>
> For example, sparc-test:
> eth0: LANCE 52:54:00:12:34:56
> esp0: no command in esp_handle()
> Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
>  <0>Press L1-A to return to the boot prom
>
> The bug may be in ESP interrupt handling (or in the interrupt chain
> between ESP, DMA controller and interrupt controller) as the panic
> always happens in ESP probe.

In fact the bug was that OpenBIOS didn't clear ESP interrupts after
issuing commands, so the IRQ line was left raised which confused
Linux.
Blue Swirl - Jan. 16, 2010, 9:10 a.m.
On Sat, Jan 16, 2010 at 8:47 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sat, Jan 16, 2010 at 8:16 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
>> <atar4qemu@googlemail.com> wrote:
>>> Don't clear interrupts on disabling, because
>>> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>>>  that masking or un-masking IRQ shall clear pending ones.
>>>
>>> * Field tests also show that SPARCstation-20 doesn't
>>>  clear them.
>>
>> Awesome work!
>>
>>> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>>>  faster (~20 seconds instead of ~8 hours)
>>
>> Unfortunately there is some problem with the patch (or more likely
>> there is some other bug that this uncovers), because all my Linux test
>> now panic. NetBSD and OpenBSD are unaffected.
>>
>> For example, sparc-test:
>> eth0: LANCE 52:54:00:12:34:56
>> esp0: no command in esp_handle()
>> Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
>>  <0>Press L1-A to return to the boot prom
>>
>> The bug may be in ESP interrupt handling (or in the interrupt chain
>> between ESP, DMA controller and interrupt controller) as the panic
>> always happens in ESP probe.
>
> In fact the bug was that OpenBIOS didn't clear ESP interrupts after
> issuing commands, so the IRQ line was left raised which confused
> Linux.
>

Thanks, applied. I fixed the OpenBIOS bug and updated images in pc-bios.
Blue Swirl - Jan. 16, 2010, 9:31 a.m.
On Sat, Jan 16, 2010 at 9:10 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sat, Jan 16, 2010 at 8:47 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Sat, Jan 16, 2010 at 8:16 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
>>> <atar4qemu@googlemail.com> wrote:
>>>> Don't clear interrupts on disabling, because
>>>> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>>>>  that masking or un-masking IRQ shall clear pending ones.
>>>>
>>>> * Field tests also show that SPARCstation-20 doesn't
>>>>  clear them.
>>>
>>> Awesome work!
>>>
>>>> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>>>>  faster (~20 seconds instead of ~8 hours)
>>>
>>> Unfortunately there is some problem with the patch (or more likely
>>> there is some other bug that this uncovers), because all my Linux test
>>> now panic. NetBSD and OpenBSD are unaffected.
>>>
>>> For example, sparc-test:
>>> eth0: LANCE 52:54:00:12:34:56
>>> esp0: no command in esp_handle()
>>> Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
>>>  <0>Press L1-A to return to the boot prom
>>>
>>> The bug may be in ESP interrupt handling (or in the interrupt chain
>>> between ESP, DMA controller and interrupt controller) as the panic
>>> always happens in ESP probe.
>>
>> In fact the bug was that OpenBIOS didn't clear ESP interrupts after
>> issuing commands, so the IRQ line was left raised which confused
>> Linux.
>>
>
> Thanks, applied. I fixed the OpenBIOS bug and updated images in pc-bios.
>

Except that I'm idiot and commit the wrong fix.
Artyom Tarasenko - Jan. 17, 2010, 6:42 p.m.
2010/1/16 Blue Swirl <blauwirbel@gmail.com>:
> On Sat, Jan 16, 2010 at 8:47 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Sat, Jan 16, 2010 at 8:16 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
>>> <atar4qemu@googlemail.com> wrote:
>>>> Don't clear interrupts on disabling, because
>>>> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>>>>  that masking or un-masking IRQ shall clear pending ones.
>>>>
>>>> * Field tests also show that SPARCstation-20 doesn't
>>>>  clear them.
>>>
>>> Awesome work!
>>>
>>>> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>>>>  faster (~20 seconds instead of ~8 hours)
>>>
>>> Unfortunately there is some problem with the patch (or more likely
>>> there is some other bug that this uncovers), because all my Linux test
>>> now panic. NetBSD and OpenBSD are unaffected.
>>>
>>> For example, sparc-test:
>>> eth0: LANCE 52:54:00:12:34:56
>>> esp0: no command in esp_handle()
>>> Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
>>>  <0>Press L1-A to return to the boot prom
>>>
>>> The bug may be in ESP interrupt handling (or in the interrupt chain
>>> between ESP, DMA controller and interrupt controller) as the panic
>>> always happens in ESP probe.
>>
>> In fact the bug was that OpenBIOS didn't clear ESP interrupts after
>> issuing commands, so the IRQ line was left raised which confused
>> Linux.
>>
>
> Thanks, applied. I fixed the OpenBIOS bug and updated images in pc-bios.

Looks like this version of the OpenBIOS has a sort of a regression: it
doesn't recognize
NetBSD 1.3.3 miniroot anymore:

qemu-system-sparc -nographic  -hda ../images/miniroot-133.fs -m 64 -M SS-20

Welcome to OpenBIOS v1.0 built on Jan 16 2010 08:54
  Type 'help' for detailed information

[sparc] Booting file 'disk' with parameters ''
Trying disk (disk)
Trying disk:d (disk:d)
Unsupported image format

I say "sort of" because it may be the correct behavior: due to the bad
disk labels OBP doesn't boot miniroots either.

On the other hand it doesn't recognize Solaris cdroms too:

0 > boot cdrom
[sparc] Booting file 'cdrom' with parameters ''
Trying cdrom (cdrom)
Trying cdrom:d (cdrom:d)
Unsupported image format
 ok
Blue Swirl - Jan. 17, 2010, 7:51 p.m.
On Sun, Jan 17, 2010 at 6:42 PM, Artyom Tarasenko
<atar4qemu@googlemail.com> wrote:
> 2010/1/16 Blue Swirl <blauwirbel@gmail.com>:
>> On Sat, Jan 16, 2010 at 8:47 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> On Sat, Jan 16, 2010 at 8:16 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>>> On Fri, Jan 15, 2010 at 10:37 PM, Artyom Tarasenko
>>>> <atar4qemu@googlemail.com> wrote:
>>>>> Don't clear interrupts on disabling, because
>>>>> * Sun4M_SystemArchitecture_edited2.pdf doesn't describe
>>>>>  that masking or un-masking IRQ shall clear pending ones.
>>>>>
>>>>> * Field tests also show that SPARCstation-20 doesn't
>>>>>  clear them.
>>>>
>>>> Awesome work!
>>>>
>>>>> * The patch makes Solaris 2.5.1/2.6 boot ~1500 times
>>>>>  faster (~20 seconds instead of ~8 hours)
>>>>
>>>> Unfortunately there is some problem with the patch (or more likely
>>>> there is some other bug that this uncovers), because all my Linux test
>>>> now panic. NetBSD and OpenBSD are unaffected.
>>>>
>>>> For example, sparc-test:
>>>> eth0: LANCE 52:54:00:12:34:56
>>>> esp0: no command in esp_handle()
>>>> Kernel panic - not syncing: esp_handle: current_SC == penguin within interrupt!
>>>>  <0>Press L1-A to return to the boot prom
>>>>
>>>> The bug may be in ESP interrupt handling (or in the interrupt chain
>>>> between ESP, DMA controller and interrupt controller) as the panic
>>>> always happens in ESP probe.
>>>
>>> In fact the bug was that OpenBIOS didn't clear ESP interrupts after
>>> issuing commands, so the IRQ line was left raised which confused
>>> Linux.
>>>
>>
>> Thanks, applied. I fixed the OpenBIOS bug and updated images in pc-bios.
>
> Looks like this version of the OpenBIOS has a sort of a regression: it
> doesn't recognize
> NetBSD 1.3.3 miniroot anymore:
>
> qemu-system-sparc -nographic  -hda ../images/miniroot-133.fs -m 64 -M SS-20
>
> Welcome to OpenBIOS v1.0 built on Jan 16 2010 08:54
>  Type 'help' for detailed information
>
> [sparc] Booting file 'disk' with parameters ''
> Trying disk (disk)
> Trying disk:d (disk:d)
> Unsupported image format
>
> I say "sort of" because it may be the correct behavior: due to the bad
> disk labels OBP doesn't boot miniroots either.
>
> On the other hand it doesn't recognize Solaris cdroms too:
>
> 0 > boot cdrom
> [sparc] Booting file 'cdrom' with parameters ''
> Trying cdrom (cdrom)
> Trying cdrom:d (cdrom:d)
> Unsupported image format
>  ok

Yes, that's what I meant with committing the wrong fix,
694b9309462f07307d16f492961f01271f10c245 doesn't boot anything. That
will cause bisection problems, sorry.

OpenBIOS r666 should work as before. I'm considering whether to update
the ROMs, but it seems lame to update them so soon.

Patch

diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c
index 9aff892..b76d3ac 100644
--- a/hw/slavio_intctl.c
+++ b/hw/slavio_intctl.c
@@ -185,11 +185,10 @@  static void slavio_intctlm_mem_writel(void *opaque, target_phys_addr_t addr,
                 s->intregm_disabled);
         slavio_check_interrupts(s, 1);
         break;
-    case 3: // set (disable, clear pending)
+    case 3: // set (disable; doesn't affect pending)
         // Force clear unused bits
         val &= MASTER_IRQ_MASK;
         s->intregm_disabled |= val;
-        s->intregm_pending &= ~val;
         slavio_check_interrupts(s, 1);
         DPRINTF("Disabled master irq mask %x, curmask %x\n", val,
                 s->intregm_disabled);