xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Jan Beulich <JBeulich@suse.com>, Don Slutz <dslutz@verizon.com>
Cc: Keir Fraser <keir@xen.org>, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 10/10] hvm/hpet: handle 1st period special
Date: Mon, 14 Apr 2014 20:21:01 -0400	[thread overview]
Message-ID: <534C7B6D.8020000@terremark.com> (raw)
In-Reply-To: <534C1A7D0200007800008912@nat28.tlf.novell.com>

On 04/14/14 11:27, Jan Beulich wrote:
>>>> On 08.04.14 at 16:24, <dslutz@verizon.com> wrote:
>> The software-developers-hpet-spec-1-0a.pdf says that the 1st
>> interrupt is based on the setting of comparator.  After that it will
>> be on each period.  Add code that checks for this special case.
> The way hpet_set_timer() call create_periodic_time() to me seems to
> do exactly that. What am I missing?

Since hpet_get_comparator() will always adjust
the current value of comparator  to the current value
of the master clock, the call to create_periodic_time()
which uses diff which is:


     tn_cmp   = hpet_get_comparator(h, tn);
     cur_tick = hpet_read_maincounter(h);
     ...
     diff = tn_cmp - cur_tick;



So using the manual test code and asking for 1 and 3 starting
periods:

dcs-xen-54:~/xen/tools/tests/vhpet>./test_vhpet 0 1 0 3 3 >foo
hpet: T0 Error: Set 0x1fcbd(130,237) != 0x1e848(125,000)
...

Which is not the default mode, and the important arguments are:

hvm_clock_cost=0 hpet_mult=1 hpet_add=0

(I.E. the 1st 3)

create_periodic_time: pt=0 delta=916,208 period=1,000,000 - 1,000.00 Hz irq=0


and

dcs-xen-54:~/xen/tools/tests/vhpet>./test_vhpet 0 3 0 3 3 >foo
hpet: T0 Error: Set 0x3e505(255,237) != 0x1e848(125,000)
...
(hvm_clock_cost=0 hpet_mult=3 hpet_add=0)


create_periodic_time: pt=0 delta=916,208 period=1,000,000 - 1,000.00 Hz irq=0


Notice that the cmp jumps back to the same value.  The master clock is not at
the period (it is 0x10899(67,737)) and so cmp is adjusted "backwards" in this case.

This output is with no changes.  It is not until patch #6:
hvm/hpet: comparator can only change when master clock is enabled.

That the unit test stops printing the error.   However the hpet_save output still
shows the changed value.

It is not till after this patch that:

dcs-xen-54:~/xen/tools/tests/vhpet>./test_vhpet 0 1 0 3 0x13 >foo1
dcs-xen-54:~/xen/tools/tests/vhpet>./test_vhpet 0 3 0 3 0x13 >foo3
dcs-xen-54:~/xen>diff -suwp tools/tests/vhpet/foo1 tools/tests/vhpet/foo3 | head -30
--- tools/tests/vhpet/foo1      2014-04-14 20:17:51.923684610 -0400
+++ tools/tests/vhpet/foo3      2014-04-14 20:19:02.148251889 -0400
@@ -1,5 +1,5 @@
  test_vhpet 1.0
-hvm_clock_cost=0 hpet_mult=1 hpet_add=0 tick_count=3 debug=0x13
+hvm_clock_cost=0 hpet_mult=3 hpet_add=0 tick_count=3 debug=0x13

  skip_load=1
      HPET: capability 0xf424008086a201 config 0()
@@ -56,19 +56,19 @@ skip_load
            timer1 period 0(0) fsb 0
            timer2 config 0xf0000000000030() cmp 0xffffffffffffffff(-1)
            timer2 period 0(0) fsb 0
-hpet_writel: HPET_TN_SETVAL cmp=0x1fccc(130,252) timer=0
+hpet_writel: HPET_TN_SETVAL cmp=0x3e514(255,252) timer=0
  hpet_writel: period=0xf424(62,500) timer=0
  create_periodic_time: mc64=0x108a8(67,752) mc_offset=0x108a7(67,751)
-                 [0] cmp64=0x1fccc(130,252) cmp=0x1fccc(130,252)
+                 [0] cmp64=0x3e514(255,252) cmp=0x3e514(255,252)
                   [1] cmp64=0xffffffffffffffff(-1) cmp=0xffffffffffffffff(-1)
                   [2] cmp64=0xffffffffffffffff(-1) cmp=0xffffffffffffffff(-1)
-create_periodic_time: pt=0 delta=1,000,000 period=1,000,000 - 1,000.00 Hz irq=0
+create_periodic_time: pt=0 delta=3,000,000 period=1,000,000 - 1,000.00 Hz irq=0
  hpet: hpet_set_mode(402):
  hpet: ID: 0x8086a201, PERIOD: 0xf42400
  hpet: CFG: 0x1, STATUS: 0x0
  hpet: COUNTER_l: 0x108a8, COUNTER_h: 0x0
  hpet: T0: CFG_l: 0x13c, CFG_h: 0xf00000
-hpet: T0: CMP_l: 0x1fccc, CMP_h: 0x0
+hpet: T0: CMP_l: 0x3e514, CMP_h: 0x0


that the 1st delta is actually the request one in both cases.


    -Don Slutz


> Jan
>

      reply	other threads:[~2014-04-15  0:21 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 14:24 [PATCH v2 00/10] Prevent one cause of "MP-BIOS bug: 8254 timer"... message from linux Don Slutz
2014-04-08 14:24 ` [PATCH v2 01/10] hvm/hpet: Add manual unit test code Don Slutz
2014-04-09 16:08   ` Jan Beulich
2014-04-09 18:35     ` Don Slutz
2014-04-10  6:11       ` Jan Beulich
2014-04-11  2:53         ` Don Slutz
2014-04-11  7:45           ` Jan Beulich
2014-04-11 11:57             ` [PATCH optional " Don Slutz
2014-04-11 12:09               ` Jan Beulich
2014-04-11 12:48                 ` Don Slutz
2014-04-11 15:14                   ` Jan Beulich
2014-04-11 17:40                     ` Don Slutz
2014-04-14  7:40                       ` Jan Beulich
2014-04-14 17:29                         ` test_x86_emulator (was Re: [PATCH optional v2 01/10] hvm/hpet: Add manual unit test code.) Don Slutz
2014-04-15  6:49                           ` test_x86_emulator Jan Beulich
2014-04-15 14:24                             ` test_x86_emulator Don Slutz
2014-04-16  8:26                               ` test_x86_emulator Jan Beulich
2014-04-16  9:32                                 ` test_x86_emulator Keir Fraser
2014-04-16 15:21                                   ` test_x86_emulator Don Slutz
2014-04-08 14:24 ` [PATCH v2 02/10] hvm/hpet: Only call guest_time_hpet(h) one time per action Don Slutz
2014-04-14 14:31   ` Jan Beulich
2014-04-14 17:38     ` Don Slutz
2014-04-08 14:24 ` [PATCH v2 03/10] hvm/hpet: Only set comparator or period not both Don Slutz
2014-04-14 14:58   ` Jan Beulich
2014-04-14 22:53     ` Don Slutz
2014-04-15  6:59       ` Jan Beulich
2014-04-16  4:06         ` Don Slutz
2014-04-08 14:24 ` [PATCH v2 04/10] hvm/hpet: In hpet_save, correctly compute mc64 Don Slutz
2014-04-08 14:24 ` [PATCH v2 05/10] hvm/hpet: Init comparator64 like comparator Don Slutz
2014-04-08 14:24 ` [PATCH v2 06/10] hvm/hpet: comparator can only change when master clock is enabled Don Slutz
2014-04-14 15:07   ` Jan Beulich
2014-04-14 19:50     ` Don Slutz
2014-04-15  7:05       ` Jan Beulich
2014-04-15 15:53         ` Don Slutz
2014-04-15 16:14           ` Jan Beulich
2014-04-15 18:11             ` Don Slutz
2014-04-16  8:42               ` Jan Beulich
2014-04-08 14:24 ` [PATCH v2 07/10] hvm/hpet: Call hpet_get_comparator during hpet_save Don Slutz
2014-04-14 15:13   ` Jan Beulich
2014-04-15  0:21     ` Don Slutz
2014-04-15  7:06       ` Jan Beulich
2014-04-15 14:18         ` Don Slutz
2014-04-08 14:24 ` [PATCH v2 08/10] hvm/hpet: Prevent master clock equal to comparator while enabled Don Slutz
2014-04-08 14:24 ` [PATCH v2 09/10] hvm/hpet: Correctly limit period to a maximum Don Slutz
2014-04-08 14:24 ` [PATCH v2 10/10] hvm/hpet: handle 1st period special Don Slutz
2014-04-14 15:27   ` Jan Beulich
2014-04-15  0:21     ` Don Slutz [this message]

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=534C7B6D.8020000@terremark.com \
    --to=dslutz@verizon.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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).