All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kouya Shimura <kouya@jp.fujitsu.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] x86 hvm: freeze PIT/LAPIC timer emulation while its IRQ is masked
Date: Wed, 16 Sep 2009 15:46:38 +0900	[thread overview]
Message-ID: <7kocpbcrow.fsf@pingu.sky.yk.fujitsu.co.jp> (raw)
In-Reply-To: <C6CEB070.145C7%keir.fraser@eu.citrix.com>

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1194 bytes --]

I remade the patch and measured the performance win. Attached is
a benchmark program which I wrote. It is complied by cygwin's gcc
by -O2 and runs on Windows XP(32bit). And my cpu is 
Intel Core2 Quad Q9450@2.66GHz.

The result is that my patch saves 32 cycles(TSC) per one VM_EXIT(cpuid).
(2696 tsc => 2664 tsc)

The patch is split to two. I'll post them in another mail.

Thanks,
Kouya

Keir Fraser writes:
> On 10/09/2009 10:54, "Kouya Shimura" <kouya@jp.fujitsu.com> wrote:
> 
> >> Not using pt_irq_masked() seems odd. Is it to avoid 859 IRQ mask checks, and
> >> if so why are you doing that? Why do we care that rombios twiddles the 8259
> >> masks a bunch during boot?
> > 
> > I guessed that the cost of freezing/thawing a timer with the 8259 mask
> > is higher than timer emulation.  And the PIT timer is actually active
> > while rombios masks the 8259.
> > 
> > If using pt_irq_masked() is desirable, I'll remake it.
> 
> If your patch works without even any theoretical lost of correctness, then
> that makes it more attractive, obviously.
> 
> Some evidence that the cost saving is at all measurable would also be good.
> Premature optimisation being evil, etc. ;-)
> 
>  -- Keir


[-- Attachment #2: cpuidbench.c --]
[-- Type: text/plain, Size: 368 bytes --]

#include <stdio.h>
#include <stdint.h>

#define rdtsc(val) asm volatile("rdtsc" : "=a" (val))

static void cpuid(uint32_t idx)
{
    uint32_t a,b,c,d;
    asm volatile("cpuid": "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(idx) );
}

main()
{
    uint32_t tsc1, tsc2;
    while(1) {
	rdtsc(tsc1);
	cpuid(0x40000000);
	rdtsc(tsc2);
	printf("tsc=%d\n", tsc2 - tsc1);
    }
}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2009-09-16  6:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10  5:47 [PATCH] x86 hvm: freeze PIT/LAPIC timer emulation while its IRQ is masked Kouya Shimura
2009-09-10  6:49 ` Keir Fraser
2009-09-10  8:22   ` Kouya Shimura
2009-09-10  8:32     ` Keir Fraser
2009-09-10  9:54       ` Kouya Shimura
2009-09-10 12:32         ` Keir Fraser
2009-09-16  6:46           ` Kouya Shimura [this message]
2009-09-16  6:50             ` [PATCH 1/2] x86 hvm: don't set periodical timer again until its IRQ is delivered Kouya Shimura
2009-09-16  6:53               ` [PATCH 2/2] x86 hvm: suspend platform timer emulation while its IRQ is masked Kouya Shimura
2009-09-16  7:40             ` [PATCH] x86 hvm: freeze PIT/LAPIC " Keir Fraser
2009-09-16  8:00               ` Cui, Dexuan
2009-09-16  8:20                 ` Keir Fraser
2009-09-16  8:40                   ` Cui, Dexuan
2009-09-16  9:09                     ` Keir Fraser
2009-09-16  8:28                 ` Kouya Shimura
2009-09-16  8:36                   ` Keir Fraser
2009-09-11 12:07 ` Konrad Rzeszutek Wilk
2009-09-14  5:58   ` Kouya Shimura

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=7kocpbcrow.fsf@pingu.sky.yk.fujitsu.co.jp \
    --to=kouya@jp.fujitsu.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.