Skip to contentSkip to conversation

MIPS: Fix dmtc0 instruction

PATCH In review Hervé Poussineau 4 participants 8 messages Aug 23, 2008 – Aug 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Fix dmtc0 instruction

Hi,

In gen_dmtc0 function, TCG temporary variable t0 is freed at the end of the function. Variable is freed again in the gen_dmtc0 caller. I removed the free in gen_dmtc0, to do like in gen_dmfc0, gen_mfc0, gen_mtc0.

Incidentally, this unregresses NetBSD on Pica 61.

Hervé

translate.c +0 -1
Index: target-mips/translate.c
===================================================================
@@ -5188,7 +5188,6 @@
                 rn, reg, sel);
     }
 #endif
-    tcg_temp_free(t0);
     /* For simplicity assume that all writes can cause interrupts.  */
     if (use_icount) {
         gen_io_end();
#1 lore raw
Quoted 8 lines · Hervé Poussineau

Hi,

In gen_dmtc0 function, TCG temporary variable t0 is freed at the end of the function. Variable is freed again in the gen_dmtc0 caller. I removed the free in gen_dmtc0, to do like in gen_dmfc0, gen_mfc0, gen_mtc0.

Incidentally, this unregresses NetBSD on Pica 61.

This was also affecting Linux MIPS64 and I have noticed the problem this morning (though it seems to be a few weeks old).

I have applied the patch, and also removed another tcg_temp_free(t0) which has been left. Thanks!

Quoted 14 lines

Hervé

Index: target-mips/translate.c
===================================================================

translate.c +0 -1
@@ -5188,7 +5188,6 @@
                 rn, reg, sel);
     }
 #endif
-    tcg_temp_free(t0);
     /* For simplicity assume that all writes can cause interrupts.  */
     if (use_icount) {
         gen_io_end();
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
Quoted 8 lines · Aurelien Jarno
Quoted 7 lines · Hervé Poussineau

Hi,

In gen_dmtc0 function, TCG temporary variable t0 is freed at the end of the function. Variable is freed again in the gen_dmtc0 caller. I removed the free in gen_dmtc0, to do like in gen_dmfc0, gen_mfc0, gen_mtc0.

Quoted 4 lines
Quoted 1 line

Incidentally, this unregresses NetBSD on Pica 61.

This was also affecting Linux MIPS64 and I have noticed the problem this morning (though it seems to be a few weeks old).

My old 64-bit testcase worked for some reason despite that bug. The current debian/testing kernel image for malta/5kc failed, though.

Quoted 2 lines

I have applied the patch, and also removed another tcg_temp_free(t0) which has been left. Thanks!

I can confirm it works here as well, thank you. However, I still see QEMU hang with the debian kernel at IDE detection:

[...]

[    2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[    2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56 assigned IRQ 10.
[    2.040127] eth0: registered as PCnet/PCI II 79C970A
[    2.040127] pcnet32: 1 cards_found.
[    2.040127] Uniform Multi-Platform E-IDE driver
[    2.040127] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[    2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at  PCI slot 0000:00:0a.1
[    2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[    2.040127] PIIX4: not 100% native mode: will probe irqs later
[    2.040127]     ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[    2.040127]     ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

Thiemo

#3 lore raw
Quoted 36 lines · Thiemo Seufer
Quoted 8 lines · Aurelien Jarno
Quoted 7 lines · Hervé Poussineau

Hi,

In gen_dmtc0 function, TCG temporary variable t0 is freed at the end of the function. Variable is freed again in the gen_dmtc0 caller. I removed the free in gen_dmtc0, to do like in gen_dmfc0, gen_mfc0, gen_mtc0.

Quoted 4 lines
Quoted 1 line

Incidentally, this unregresses NetBSD on Pica 61.

This was also affecting Linux MIPS64 and I have noticed the problem this morning (though it seems to be a few weeks old).

My old 64-bit testcase worked for some reason despite that bug. The current debian/testing kernel image for malta/5kc failed, though.

Quoted 2 lines

I have applied the patch, and also removed another tcg_temp_free(t0) which has been left. Thanks!

I can confirm it works here as well, thank you. However, I still see QEMU hang with the debian kernel at IDE detection:

[...]

[    2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[    2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56 assigned IRQ 10.
[    2.040127] eth0: registered as PCnet/PCI II 79C970A
[    2.040127] pcnet32: 1 cards_found.
[    2.040127] Uniform Multi-Platform E-IDE driver
[    2.040127] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[    2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at  PCI slot 0000:00:0a.1
[    2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[    2.040127] PIIX4: not 100% native mode: will probe irqs later
[    2.040127]     ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[    2.040127]     ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO
Quoted 2 lines

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

I don't have this problem. Are you sure it is related to CONFIG_NO_HZ? AFAIK the problems with CONFIG_NO_HZ appear earlier, when computing the CPU speed.

OTOH, my machine may be faster than yours (Intel Core 2 >= 2.0 Ghz).

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#4 lore raw
Quoted 37 lines · Aurelien Jarno
Quoted 36 lines · Thiemo Seufer
Quoted 8 lines · Aurelien Jarno
Quoted 7 lines · Hervé Poussineau

Hi,

In gen_dmtc0 function, TCG temporary variable t0 is freed at the end of the function. Variable is freed again in the gen_dmtc0 caller. I removed the free in gen_dmtc0, to do like in gen_dmfc0, gen_mfc0, gen_mtc0.

Quoted 4 lines
Quoted 1 line

Incidentally, this unregresses NetBSD on Pica 61.

This was also affecting Linux MIPS64 and I have noticed the problem this morning (though it seems to be a few weeks old).

My old 64-bit testcase worked for some reason despite that bug. The current debian/testing kernel image for malta/5kc failed, though.

Quoted 2 lines

I have applied the patch, and also removed another tcg_temp_free(t0) which has been left. Thanks!

I can confirm it works here as well, thank you. However, I still see QEMU hang with the debian kernel at IDE detection:

[...]

[    2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[    2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56 assigned IRQ 10.
[    2.040127] eth0: registered as PCnet/PCI II 79C970A
[    2.040127] pcnet32: 1 cards_found.
[    2.040127] Uniform Multi-Platform E-IDE driver
[    2.040127] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[    2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at  PCI slot 0000:00:0a.1
[    2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[    2.040127] PIIX4: not 100% native mode: will probe irqs later
[    2.040127]     ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[    2.040127]     ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO
Quoted 6 lines
Quoted 2 lines

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

I don't have this problem. Are you sure it is related to CONFIG_NO_HZ? AFAIK the problems with CONFIG_NO_HZ appear earlier, when computing the CPU speed.

I'M not sure, I only inferred it is a timing problem from the printk timing output.

Thiemo

#5 lore raw
In reply to Thiemo Seufer
Quoted 20 lines · Thiemo Seufer

I can confirm it works here as well, thank you. However, I still see

QEMU hang with the debian kernel at IDE detection:

[...]

[ 2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[ 2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56
assigned IRQ 10.
[ 2.040127] eth0: registered as PCnet/PCI II 79C970A
[ 2.040127] pcnet32: 1 cards_found.
[ 2.040127] Uniform Multi-Platform E-IDE driver
[ 2.040127] ide: Assuming 33MHz system bus speed for PIO modes;
override with idebus=xx
[ 2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at PCI slot
0000:00:0a.1
[ 2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[ 2.040127] PIIX4: not 100% native mode: will probe irqs later
[ 2.040127] ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[ 2.040127] ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO
Quoted 4 lines

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

Thiemo

There is a problem with the current count/compare emulation:
c0_compare_int_usable in newer Linux kernels fails to detect that it is usable.

I had a Mips Linux kernel hanging while calibrating bogo mips caused by this.
A workaround was running Qemu with all debug output enabled (-d ...), so a slower running Qemu was better.

A crude workaround is here:
http://svn.berlios.de/svnroot/repos/ar7-firmware/qemu/trunk/hw/mips_timer.c

I don't really like my patch, but it improves count/compare emulation, and my kernel no longer hangs when running in Qemu. Maybe you can try it with your kernel.

Stefan

#6 lore raw
Quoted 34 lines · Stefan Weil
Quoted 20 lines · Thiemo Seufer

I can confirm it works here as well, thank you. However, I still see

QEMU hang with the debian kernel at IDE detection:

[...]

[ 2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[ 2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56
assigned IRQ 10.
[ 2.040127] eth0: registered as PCnet/PCI II 79C970A
[ 2.040127] pcnet32: 1 cards_found.
[ 2.040127] Uniform Multi-Platform E-IDE driver
[ 2.040127] ide: Assuming 33MHz system bus speed for PIO modes;
override with idebus=xx
[ 2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at PCI slot
0000:00:0a.1
[ 2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[ 2.040127] PIIX4: not 100% native mode: will probe irqs later
[ 2.040127] ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[ 2.040127] ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO
Quoted 4 lines

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

Thiemo

There is a problem with the current count/compare emulation:
c0_compare_int_usable in newer Linux kernels fails to detect that it is usable.

I had a Mips Linux kernel hanging while calibrating bogo mips caused by this.
A workaround was running Qemu with all debug output enabled (-d ...), so a slower running Qemu was better.

Quoted 6 lines

A crude workaround is here:
http://svn.berlios.de/svnroot/repos/ar7-firmware/qemu/trunk/hw/mips_timer.c

I don't really like my patch, but it improves count/compare emulation, and my kernel no longer hangs when running in Qemu. Maybe you can try it with your kernel.

No change with my testcase (which is available from
http://people.debian.org/~ths/qemu/lenny64/).

Thiemo

#7 lore raw
Quoted 38 lines · Thiemo Seufer
Quoted 37 lines · Stefan Weil
Quoted 20 lines · Thiemo Seufer

I can confirm it works here as well, thank you. However, I still see

QEMU hang with the debian kernel at IDE detection:

[...]

[ 2.040127] pcnet32.c:v1.34-NAPI 14.Aug.2007 [email protected]
[ 2.040127] pcnet32: PCnet/PCI II 79C970A at 0x1020, 52:54:00:12:34:56
assigned IRQ 10.
[ 2.040127] eth0: registered as PCnet/PCI II 79C970A
[ 2.040127] pcnet32: 1 cards_found.
[ 2.040127] Uniform Multi-Platform E-IDE driver
[ 2.040127] ide: Assuming 33MHz system bus speed for PIO modes;
override with idebus=xx
[ 2.040127] PIIX4: IDE controller (0x8086:0x7111 rev 0x00) at PCI slot
0000:00:0a.1
[ 2.040127] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001)
[ 2.040127] PIIX4: not 100% native mode: will probe irqs later
[ 2.040127] ide0: BM-DMA at 0x1040-0x1047, BIOS settings: hda:PIO, hdb:PIO
[ 2.040127] ide1: BM-DMA at 0x1048-0x104f, BIOS settings: hdc:PIO, hdd:PIO
Quoted 4 lines

I figure CONFIG_NO_HZ has too high demands on the count/compare emulation.

Thiemo

There is a problem with the current count/compare emulation:
c0_compare_int_usable in newer Linux kernels fails to detect that it is usable.

I had a Mips Linux kernel hanging while calibrating bogo mips caused by this.
A workaround was running Qemu with all debug output enabled (-d ...), so a slower running Qemu was better.

A crude workaround is here:
http://svn.berlios.de/svnroot/repos/ar7-firmware/qemu/trunk/hw/mips_timer.c

Quoted 7 lines
Quoted 3 lines

I don't really like my patch, but it improves count/compare emulation, and my kernel no longer hangs when running in Qemu. Maybe you can try it with your kernel.

No change with my testcase (which is available from
http://people.debian.org/~ths/qemu/lenny64/).

I have just tried on my computer. I confirm it work fine without any specific patches.

Aurelien

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net