Monday, February 1, 2010

Spurious interrupts

Previously qemu dropped interrupts on disabling them. The real hardware doesn't do it. Which means, that lots of interrupts were dropped, including the spurious ones. But the real ones were dropped too, that's why the system timer was ticking so slow.

The question is where the spurious  IRQs are coming from: it's not only the ESP which produces them, under Solaris 8 & 9 there are lots of complains about spurious timer interrupts, and they both seem to crash due to a buffer overflow during processing of a (possibly spurious) LE interrupt.

NetBSD 1.3.3 boot doesn't crash with my wrong irq patch. The patch makes qemu drop interrupts, including the spurious ones.

All in all it looked like there is one global problem with interrupts processing. Until now. But now it looks like there is not one source of spurious interrupts, but many.
  • esp doesn't seem to produce spurious interrupts under Solaris while reading.
  • I've found a bug in the slavio timer which produces spurious interrupts.
  • NetBSD may be crashing due to another issue: I don't have a disk which I could boot under OBP. It is possible that OpenBIOS is not compatible with the older NetBSD versions. Update: This is the reason for NetBSD crashing, Michael Kostylev confirmed it.

16 comments:

  1. А NetBSD-1.6.2 уже считается работающей системой, или там совершенно другая проблема? Взял sparccd.iso поиграться, а qemu-git хрусть и пополам.
    qemu: fatal: Trap 0x29 while interrupts disabled, Error state

    ReplyDelete
  2. Другая. Возможно, что её корни лежат там же, но Trap 0x29 while interrupts disabled скорее всего означает, что нас уже выкинуло с дороги, и мы немного проехав, впечатались в дерево. 1.3.3 падает на
    power-management at sbus0 slot 15 offset 0xa000000 not configured
    data fault: pc=0xf0029518 addr=0xb8 sfsr=126

    Что наводит на мысль, что может быть, power-management, просто криво сконфигурирован в OpenBIOS.

    Кстати, Trap 0x29 было с OpenBIOS или c OBP?

    ReplyDelete
  3. С OpenBIOS.
    Можно прояснить ситуацию с 1.3.3, раз оно уже успешно падает, то чем поможет образ?

    ReplyDelete
  4. Образ поможет тем, что можно будет отделить мух (баги OpenBIOS) от котлет (баги qemu).

    ReplyDelete
  5. Hm. The interrupts look really spurious in both lucag's listings. When ESP raises an irq it does the following:

    s->rregs[ESP_RSTAT] |= STAT_INT;
    qemu_irq_raise(s->irq);

    RSTAT is the status register, reg[4]. So, once esp raises an irq, at least one bit of reg[4] has to be set.

    Solaris tires hard to clear the irq by reading reg[5] (22 times), but the poor esp can not clear it, it didn't raise it...

    Looks like the same latency problem due to which POST test fail: qemu notices irq too late, in this case the irq is even got cleared meanwhile.

    ReplyDelete
  6. Какие машины вообще можно запустить с OBP? Пробовал SS-2,10,20 - ни одна не поднялась, прошивки взял с locomotion.tw/sparc/prom.
    Хотелось посмотреть, есть ли толк от
    setenv sunmon-compat? false (кстати, а на SS-5 как?).

    ReplyDelete
  7. Только SS-5. Для 10/20 нужено сэмулировать ещё одно устройство, ПЗУ для видеосиммов. Я уже писал об этом (и обсуждать фичи, которых не хватает в qemu, лучше в комментах там). К тому же есть сильное подозрение, что процы SuperSparc эмулируются хуже. Как минимум Viking точно не эмулирует баг с NMI присутствующий в настоящем викинге.

    Поэтому, я забил на 10/20, хотя начинал именно с них и вернулся к SS-5.

    Можно попробовать спуститься ещё ниже: classic/X/LX почти работают. qemu вываливается из-за ошибки в том как FPU реагирует на ошибку. :). Если хотите - можете попробовать (или мы на ты? Я уже забыл). Простейший хак был бы выключить герерацию 29го трапа при ошибках FPU.

    sunmon-compat,по-моему, только меняет тип приглашения (ok или >). Разве он должен влиять на что-то ещё?

    ReplyDelete
  8. В NetBSD-1.3.3/sparc/INSTALL пишут, что таки да:

    Your OpenBOOT ROM may need some setup. make sure you boot from `new
    command mode'. If your machine comes up and gives you a `>' prompt
    instead of `ok', type:

    >n
    ok setenv sunmon-compat? false
    ok

    This is needed because the NetBSD kernel relies on functionality provided
    by OpenBOOT ROMs -- the ability to pass down Forth commands and have them
    executed in the ROM -- that appears to go away when the OpenBOOT ROM
    operates in `old monitor compatibility' mode.

    Also, you cannot use the security modes of the sparc OpenBOOT ROM.

    ok setenv security-mode none

    PS на "ты" проще

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Что касается хаков на тему classic/X/LX, я бы и не против, но прошивок у меня все равно нет.

    ReplyDelete
  11. так http://tyom.blogspot.com/2009/08/open-boot-prom-images.html

    ReplyDelete
  12. Согласен, классиков нужно перечитывать.

    Если кратко, то
    NetBSD-1.3.3:
    cannot mount root, error = 79

    NetBSD-5.0.1:
    panic: kernel fault

    Причем пятерка с OpenBIOS как-то работает.

    ReplyDelete
  13. Упс, корень же на :a. Так что miniroot-1.3.3 успешно грузится.

    ReplyDelete
  14. ### 1.3.3

    OBP: OK

    OpenBIOS:
    power-management at sbus0 slot 4 offset 0xa000000 not configured
    data fault: pc=0xf0029518 addr=0xb8 sfsr=126
    panic: kernel fault
    halted

    ### 1.5

    OBP:
    bpp0 at sbus0 slot 5 offset 0xc800000 level 2 (ipl 3): rev trap type 0x29: pc=0xf002b9e4 npc=0xf002b9e8 psr=4401fc6
    panic: trap
    halted

    OpenBIOS: OK

    ### 1.6.2

    OBP, OpenBIOS:
    qemu: fatal: Trap 0x29 while interrupts disabled

    ### 5.0.1

    OBP:
    bpp0 at sbus0 slot 5 offset 0xc800000 level 2 (ipl 3)system[0]: trap 0x29: pc=0xf02cf730 sfsr=0x36 sfva=0x7c800000
    data fault: pc=0xf02cf730 addr=0x7c800000 sfsr=36
    panic: kernel fault

    OpenBIOS: OK

    ReplyDelete
  15. Блин! С OBP SS-5 я-то и не пробовал. OBP от SS-20 не грузил этот минирут, ругался на отсутствие disklabel. Ну, значит, проблема с 1.3.3 решилась. А жаль - там она красивее всего падала. Зато - идеальный тест для команды OpenBIOS.

    1.5 и 5.0 падают из-за отсутствия параллельного порта. Надо попробовать выключить.

    1.6.2 надо будет повнимательнее посмотреть. Ещё интересна 3.0: она падает на определении жесткого диска.

    Спасибо за проделанную работу!

    У тебя уведомления об ответах стоят? Хочу коменты почистить.

    ReplyDelete
  16. 1.6.2 грузил с cd, ибо с минирута никак - bad magic number in disk label.

    PS Уведомлениями не пользуюсь.

    ReplyDelete