From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NYQBC-0004qT-MY for qemu-devel@nongnu.org; Fri, 22 Jan 2010 15:32:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NYQB7-0004q0-BY for qemu-devel@nongnu.org; Fri, 22 Jan 2010 15:32:29 -0500 Received: from [199.232.76.173] (port=59245 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NYQB7-0004pw-3f for qemu-devel@nongnu.org; Fri, 22 Jan 2010 15:32:25 -0500 Received: from mx20.gnu.org ([199.232.41.8]:29327) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NYQB6-00071d-Km for qemu-devel@nongnu.org; Fri, 22 Jan 2010 15:32:24 -0500 Received: from mail-pw0-f43.google.com ([209.85.160.43]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NYQB5-0004lM-VH for qemu-devel@nongnu.org; Fri, 22 Jan 2010 15:32:24 -0500 Received: by pwj11 with SMTP id 11so1125083pwj.2 for ; Fri, 22 Jan 2010 12:32:22 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20100119222515.20170.38945.stgit@skyserv> References: <20100119222515.20170.38945.stgit@skyserv> From: Blue Swirl Date: Fri, 22 Jan 2010 20:32:01 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH] sparc64: reimplement tick timers v3 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 V. Kovalenko" Cc: qemu-devel@nongnu.org On Tue, Jan 19, 2010 at 10:25 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. > > v2 -> v3: > - added missing timer debug output macro > - CPUTimer struct and typedef moved to cpu.h > - change CPU_SAVE_VERSION to 6, older save formats not supported > > v1 -> v2: > - new conversion helpers cpu_to_timer_ticks and timer_to_cpu_ticks > - save offset from clock source to implement cpu_tick_set_count > - renamed struct sun4u_timer to CPUTimer > - load and save cpu timers > > v0 -> v1: > - coding style My debugging of Linux panic has not been very fruitful. Once I got the panic triggered while single stepping calibrate_delay() with GDB and keeping enter key pressed. Then I missed the fault though. One possible problem is that 4dc28134f3d7db0033c6b3c5bc4be9a91adb3e2b added interrupt checks to the helpers which means that they can cause faults, but translation of the instructions was not changed to take this into account. But when I added calls to save_state() in translate.c, it didn't change anything. > -void cpu_tick_set_count(void *opaque, uint64_t count) > +void cpu_tick_set_count(CPUTimer *timer, uint64_t count) > =C2=A0{ > - =C2=A0 =C2=A0ptimer_set_count(opaque, -count); > + =C2=A0 =C2=A0uint64_t real_count =C2=A0 =3D count & ~timer->disabled_ma= sk; Formatting looks a bit odd. I'd prefer for such a short lists that '=3D' is close to the left hand value. > + =C2=A0 =C2=A0uint64_t disabled_bit =3D count & timer->disabled_mask; > + > + =C2=A0 =C2=A0int64_t vm_clock_offset =3D qemu_get_clock(vm_clock) - > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cp= u_to_timer_ticks(real_count, timer->frequency); > + > + =C2=A0 =C2=A0TIMER_DPRINTF("%s set_count count=3D0x%016lx (%s) p=3D%p\n= ", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer->na= me, real_count, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer->di= sabled?"disabled":"enabled", opaque); opaque is wrong, should be timer. Same problem is in some other debug messages. Timer name would be more helpful than pointer. > + > + =C2=A0 =C2=A0timer->disabled =C2=A0 =C2=A0 =3D disabled_bit ? 1 : 0; > + =C2=A0 =C2=A0timer->clock_offset =3D vm_clock_offset; Formatting. > + =C2=A0 =C2=A0TIMER_DPRINTF("%s get_count count=3D0x%016lx (%s) p=3D%p\n= ", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timer->name, real_count, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timer->disabled?"disabled":"enabled"= , opaque); opaque > + =C2=A0 =C2=A0TIMER_DPRINTF("%s set_limit limit=3D0x%016lx (%s) p=3D%p " > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"called w= ith limit=3D0x%016lx at 0x%016lx (delta=3D0x%016lx)\n", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer->na= me, real_limit, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer->di= sabled?"disabled":"enabled", > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opaque, l= imit, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer_to_= cpu_ticks(now - timer->clock_offset, > + =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 timer->frequency), > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timer_to_= cpu_ticks(expires - now, timer->frequency)); opaque