From: Blue Swirl <blauwirbel@gmail.com>
To: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sparc64: reimplement tick timers v3
Date: Fri, 22 Jan 2010 20:32:01 +0000 [thread overview]
Message-ID: <f43fc5581001221232h6cf2a6c1k60eb0ff5dc84406@mail.gmail.com> (raw)
In-Reply-To: <20100119222515.20170.38945.stgit@skyserv>
On Tue, Jan 19, 2010 at 10:25 PM, Igor V. Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>
> 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)
> {
> - ptimer_set_count(opaque, -count);
> + uint64_t real_count = count & ~timer->disabled_mask;
Formatting looks a bit odd. I'd prefer for such a short lists that '='
is close to the left hand value.
> + uint64_t disabled_bit = count & timer->disabled_mask;
> +
> + int64_t vm_clock_offset = qemu_get_clock(vm_clock) -
> + cpu_to_timer_ticks(real_count, timer->frequency);
> +
> + TIMER_DPRINTF("%s set_count count=0x%016lx (%s) p=%p\n",
> + timer->name, real_count,
> + timer->disabled?"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.
> +
> + timer->disabled = disabled_bit ? 1 : 0;
> + timer->clock_offset = vm_clock_offset;
Formatting.
> + TIMER_DPRINTF("%s get_count count=0x%016lx (%s) p=%p\n",
> + timer->name, real_count,
> + timer->disabled?"disabled":"enabled", opaque);
opaque
> + TIMER_DPRINTF("%s set_limit limit=0x%016lx (%s) p=%p "
> + "called with limit=0x%016lx at 0x%016lx (delta=0x%016lx)\n",
> + timer->name, real_limit,
> + timer->disabled?"disabled":"enabled",
> + opaque, limit,
> + timer_to_cpu_ticks(now - timer->clock_offset,
> + timer->frequency),
> + timer_to_cpu_ticks(expires - now, timer->frequency));
opaque
next prev parent reply other threads:[~2010-01-22 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 22:25 [Qemu-devel] [PATCH] sparc64: reimplement tick timers v3 Igor V. Kovalenko
2010-01-22 20:32 ` Blue Swirl [this message]
2010-01-26 23:09 ` Igor Kovalenko
2010-01-27 18:02 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f43fc5581001221232h6cf2a6c1k60eb0ff5dc84406@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=igor.v.kovalenko@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).