From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXfUD-00025w-6U for qemu-devel@nongnu.org; Wed, 20 Jan 2010 13:41:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXfU7-00020J-Vq for qemu-devel@nongnu.org; Wed, 20 Jan 2010 13:41:00 -0500 Received: from [199.232.76.173] (port=44233 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXfU7-000202-Rj for qemu-devel@nongnu.org; Wed, 20 Jan 2010 13:40:55 -0500 Received: from mail-pz0-f186.google.com ([209.85.222.186]:60111) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXfU7-0001HT-AU for qemu-devel@nongnu.org; Wed, 20 Jan 2010 13:40:55 -0500 Received: by pzk16 with SMTP id 16so3856051pzk.18 for ; Wed, 20 Jan 2010 10:40:54 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20100118222820.25394.64889.stgit@skyserv> From: Blue Swirl Date: Wed, 20 Jan 2010 18:40:34 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH] sparc64: reimplement tick timers v2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Kovalenko Cc: qemu-devel@nongnu.org On Tue, Jan 19, 2010 at 10:24 PM, Igor Kovalenko wrote: > On Tue, Jan 19, 2010 at 9:44 PM, Blue Swirl wrote: >> On Mon, Jan 18, 2010 at 10:28 PM, Igor V. Kovalenko >> wrote: >>> From: Igor V. Kovalenko >>> >>> sparc64 timer has tick counter which can be set and read, >>> and tick compare value used as deadline to fire timer interrupt. >>> The timer is not used as periodic timer, instead deadline >>> is set each time new timer interrupt is needed. >> >> Does not compile: >> >> =C2=A0CC =C2=A0 =C2=A0sparc64-softmmu/sun4u.o >> cc1: warnings being treated as errors >> /src/qemu/hw/sun4u.c: In function 'cpu_tick_set_count': >> /src/qemu/hw/sun4u.c:467: error: implicit declaration of function >> 'TIMER_DPRINTF' >> make[1]: *** [sun4u.o] Error 1 > > Sorry forgot the split out debugging piece. New v3 has all these > comments addressed. > >> If I add the missing TIMER_DPRINTF, Linux still crashes: >> >> Memory: 117376k available (2136k kernel code, 664k data, 184k init) >> [fffff80000000000,0000000007e80000] >> SLUB: Genslabs=3D14, HWalign=3D32, Order=3D0-3, MinObjects=3D0, CPUs=3D1= , Nodes=3D1 >> Hierarchical RCU implementation. >> NR_IRQS:255 >> clocksource: mult[a0000] shift[16] >> clockevent: mult[19999999] shift[32] >> Console: colour dummy device 80x25 >> Unable to handle kernel NULL pointer dereference >> tsk->{mm,active_mm}->context =3D 0000000000000000 >> tsk->{mm,active_mm}->pgd =3D fffff800006fdaa4 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\|/ ____ \|/ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"@'/ .. \`@" >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/_| \__/ |_\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \__U_/ >> swapper(0): Oops [#1] >> TSTATE: 0000004480001607 TPC: 00000000006e32f4 TNPC: 00000000006e32f8 >> Y: 00000000 =C2=A0 =C2=A0Not tainted >> TPC: > > Easy to reproduce here, and I still fail to find the reason for this cras= h. > It looks like linux kernel loads zero values from memory while returning > from timer softirq handler. Note this does not always happen at first tim= er > interrupt inside calibrate_delay loop. Maybe a bug with AG/MG/IG handling? > I really want to see debug trace of all processed instructions, but > qemu command line switch -singlestep does not really work for sparc64-sof= tmmu > and stepping through calibrate_delay does not seem to help at the moment. > Any ideas on how to force all instructions after approx. 5000000 cpu > cycles to be > single stepped, so I get the trace in qemu.log ? Fixing -singlestep should not be too difficult. :-) For a quick hack, you could add a call to tb_flush() near the end of cpu_exec() and hack gen_intermediate_code_internal() so that max_insns is 1 (or 2 for delay slots?).