public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: kvm@vger.kernel.org, Alexander Graf <agraf@suse.de>,
	avi@redhat.com, Kevin Wolf <kwolf@suse.de>
Subject: Re: [PATCH] Fix almost infinite loop in APIC
Date: Tue, 20 Jan 2009 16:51:39 -0200	[thread overview]
Message-ID: <20090120185139.GA28746@amt.cnet> (raw)
In-Reply-To: <200901202143.16125.sheng@linux.intel.com>

Hi Sheng,

On Tue, Jan 20, 2009 at 09:43:15PM +0800, Sheng Yang wrote:
> Marcelo, I realize some interesting things.
> 
> In fact, on my machine, when I measured the delta of now() and last_update at 
> kvm_apic_timer_intr_post(), the delta was bigger and bigger...(and now() is 
> always bigger for me, so still no clue for why data can be like above, 
> last_update always ahead of when for about one period...).
> 
> Then I found something not good in original design - it ignored the interval 
> between time fire and injection, so we got:
> 
> last_update = now() + n * period;
> 
> And the time we update last_update:
> 
> time = now() + n * period + n * interval.
> 
> So last_update time is more and more inaccurate... Though it was revised by 
> tmcct function, it's still not a good way to go.
> 
> Then I understand your purpose more.
> 
> +       if (unlikely(atomic_read(&apic->timer.pending) > 0)) {
> +               remaining = apic->timer.injection_delay;
> +               if (ktime_to_ns(remaining) > apic->timer.period)
> +                       remaining = ns_to_ktime(apic->timer.period);
> +        } else
> +               remaining = hrtimer_expires_remaining(&apic->timer.dev);
> 
> And about your patch, how about take interval between intr_post() and read 
> tmcct in to account as well? 

You mean to sum up interval between intr_post() and read tmcct into
injection_delay? 

I don't get it. Can you be more descriptive please?

> That can keep the consistent with hrtimer_get_remaining() in the read 
> tmcct.

> And I think if remaining > period, 
> remaining = remain % period maybe more reasonable here.

Yes, thats better.

> How do you think?
> 
> -- 
> regards
> Yang, Sheng
> 
> 

  reply	other threads:[~2009-01-20 18:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-08 16:36 [PATCH] Fix almost infinite loop in APIC Alexander Graf
2009-01-09  6:34 ` Sheng Yang
2009-01-09 10:49   ` Alexander Graf
2009-01-09 12:57   ` Alexander Graf
2009-01-10 11:21     ` Sheng Yang
2009-01-11  4:55       ` Marcelo Tosatti
2009-01-13  7:47         ` Sheng Yang
2009-01-13 22:01           ` Marcelo Tosatti
2009-01-14  9:17             ` Sheng Yang
2009-01-14 17:03               ` Marcelo Tosatti
2009-01-15  7:20                 ` Sheng Yang
2009-01-16  5:01                   ` Marcelo Tosatti
2009-01-20 10:41                     ` Alexander Graf
2009-01-20 11:20                       ` Sheng Yang
2009-01-20 12:09                         ` Alexander Graf
2009-01-20 12:30                           ` Sheng Yang
2009-01-20 13:43                       ` Sheng Yang
2009-01-20 18:51                         ` Marcelo Tosatti [this message]
2009-01-21  2:40                           ` Sheng Yang
2009-01-21  4:23                             ` Marcelo Tosatti
2009-01-21  5:11                               ` Sheng Yang
2009-01-21 15:07                                 ` Marcelo Tosatti
2009-01-21 16:01                                   ` Alexander Graf
2009-01-21 16:03                                     ` Alexander Graf
2009-01-21 16:18                                   ` Alexander Graf
2009-01-21 16:55                                     ` Marcelo Tosatti
2009-01-22 13:08                                   ` Avi Kivity
2009-01-23 17:58                                     ` Alex Williamson
2009-01-10 11:25     ` Sheng Yang
2009-01-10 11:28     ` Sheng Yang

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=20090120185139.GA28746@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@suse.de \
    --cc=sheng@linux.intel.com \
    /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