qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
@ 2008-08-23 16:40 Hervé Poussineau
  0 siblings, 0 replies; 9+ messages in thread
From: Hervé Poussineau @ 2008-08-23 16:40 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

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.

Hervé

[-- Attachment #2: dmtc0_fix.diff --]
[-- Type: text/plain, Size: 402 bytes --]

Index: target-mips/translate.c
===================================================================
--- target-mips/translate.c	(revision 5074)
+++ target-mips/translate.c	(working copy)
@@ -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();

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
@ 2008-08-23 16:42 Hervé Poussineau
  2008-08-23 17:24 ` Aurelien Jarno
  0 siblings, 1 reply; 9+ messages in thread
From: Hervé Poussineau @ 2008-08-23 16:42 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

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é

[-- Attachment #2: dmtc0_fix.diff --]
[-- Type: text/plain, Size: 402 bytes --]

Index: target-mips/translate.c
===================================================================
--- target-mips/translate.c	(revision 5074)
+++ target-mips/translate.c	(working copy)
@@ -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();

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-23 16:42 [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction Hervé Poussineau
@ 2008-08-23 17:24 ` Aurelien Jarno
  2008-08-25 11:28   ` Thiemo Seufer
  0 siblings, 1 reply; 9+ messages in thread
From: Aurelien Jarno @ 2008-08-23 17:24 UTC (permalink / raw)
  To: qemu-devel

On Sat, Aug 23, 2008 at 06:42:34PM +0200, Hervé Poussineau wrote:
> 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!

> Hervé

> Index: target-mips/translate.c
> ===================================================================
> --- target-mips/translate.c	(revision 5074)
> +++ target-mips/translate.c	(working copy)
> @@ -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();


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-23 17:24 ` Aurelien Jarno
@ 2008-08-25 11:28   ` Thiemo Seufer
  2008-08-25 12:55     ` Aurelien Jarno
  2008-08-25 18:51     ` Stefan Weil
  0 siblings, 2 replies; 9+ messages in thread
From: Thiemo Seufer @ 2008-08-25 11:28 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel

Aurelien Jarno wrote:
> On Sat, Aug 23, 2008 at 06:42:34PM +0200, Hervé Poussineau wrote:
> > 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).

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

> 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 tsbogend@alpha.franken.de
[    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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-25 11:28   ` Thiemo Seufer
@ 2008-08-25 12:55     ` Aurelien Jarno
  2008-08-25 14:12       ` Thiemo Seufer
  2008-08-25 18:51     ` Stefan Weil
  1 sibling, 1 reply; 9+ messages in thread
From: Aurelien Jarno @ 2008-08-25 12:55 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: qemu-devel

Thiemo Seufer a écrit :
> Aurelien Jarno wrote:
>> On Sat, Aug 23, 2008 at 06:42:34PM +0200, Hervé Poussineau wrote:
>>> 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).
> 
> My old 64-bit testcase worked for some reason despite that bug. The current
> debian/testing kernel image for malta/5kc failed, though.
> 
>> 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 tsbogend@alpha.franken.de
> [    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.
> 

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).

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-25 12:55     ` Aurelien Jarno
@ 2008-08-25 14:12       ` Thiemo Seufer
  0 siblings, 0 replies; 9+ messages in thread
From: Thiemo Seufer @ 2008-08-25 14:12 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel

Aurelien Jarno wrote:
> Thiemo Seufer a écrit :
> > Aurelien Jarno wrote:
> >> On Sat, Aug 23, 2008 at 06:42:34PM +0200, Hervé Poussineau wrote:
> >>> 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).
> > 
> > My old 64-bit testcase worked for some reason despite that bug. The current
> > debian/testing kernel image for malta/5kc failed, though.
> > 
> >> 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 tsbogend@alpha.franken.de
> > [    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.
> > 
> 
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-25 11:28   ` Thiemo Seufer
  2008-08-25 12:55     ` Aurelien Jarno
@ 2008-08-25 18:51     ` Stefan Weil
  2008-08-25 21:10       ` Thiemo Seufer
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Weil @ 2008-08-25 18:51 UTC (permalink / raw)
  To: qemu-devel, Thiemo Seufer

Thiemo Seufer schrieb:
> 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 tsbogend@alpha.franken.de
> [ 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
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-25 18:51     ` Stefan Weil
@ 2008-08-25 21:10       ` Thiemo Seufer
  2008-08-25 22:26         ` Aurelien Jarno
  0 siblings, 1 reply; 9+ messages in thread
From: Thiemo Seufer @ 2008-08-25 21:10 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Stefan Weil wrote:
> Thiemo Seufer schrieb:
> > 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 tsbogend@alpha.franken.de
> > [ 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
> 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.

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


Thiemo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction
  2008-08-25 21:10       ` Thiemo Seufer
@ 2008-08-25 22:26         ` Aurelien Jarno
  0 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2008-08-25 22:26 UTC (permalink / raw)
  To: qemu-devel

On Mon, Aug 25, 2008 at 11:10:32PM +0200, Thiemo Seufer wrote:
> Stefan Weil wrote:
> > Thiemo Seufer schrieb:
> > > 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 tsbogend@alpha.franken.de
> > > [ 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
> > 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.
> 
> 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

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-08-25 22:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-23 16:42 [Qemu-devel] [PATCH] MIPS: Fix dmtc0 instruction Hervé Poussineau
2008-08-23 17:24 ` Aurelien Jarno
2008-08-25 11:28   ` Thiemo Seufer
2008-08-25 12:55     ` Aurelien Jarno
2008-08-25 14:12       ` Thiemo Seufer
2008-08-25 18:51     ` Stefan Weil
2008-08-25 21:10       ` Thiemo Seufer
2008-08-25 22:26         ` Aurelien Jarno
  -- strict thread matches above, loose matches on Subject: below --
2008-08-23 16:40 Hervé Poussineau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).