From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.osdl.org, kvm-owner@vger.kernel.org
Subject: Re: [PATCH 1/5] Add structs and functions for paravirt clocksource.
Date: Tue, 03 Jun 2008 14:34:05 +0100 [thread overview]
Message-ID: <4845484D.7000202@goop.org> (raw)
In-Reply-To: <1212498439-1283-2-git-send-email-kraxel@redhat.com>
Gerd Hoffmann wrote:
> +/*
> + * These structs MUST NOT be changed.
> + * They are the ABI between hypervisor and guest OS.
> + * Both Xen and KVM are using this.
> + *
> + * pvclock_vcpu_time_info holds the system time and the tsc timestamp
> + * of the last update. So the guest can use the tsc delta to get a
> + * more precise system time.
>
You should note that these are per-cpu parameters.
> + *
> + * pvclock_wall_clock references the point in time when the system
> + * time was zero (usually boot time), thus the guest calculates the
> + * current wall clock by adding the system time.
> + *
> + * Protocol for the "version" fields is: hypervisor raises it (making
> + * it uneven) before it starts updating the fields and raises it again
> + * (making it even) when it is done. Thus the guest can make sure the
> + * time values it got are consistent by checking the version before
> + * and after reading them.
> + */
> +
> +struct pvclock_vcpu_time_info {
> + uint32_t version;
>
Use the standard u32/u64 I think (or the __u32 forms, maybe).
> + uint32_t pad0;
> + uint64_t tsc_timestamp;
> + uint64_t system_time;
> + uint32_t tsc_to_system_mul;
> + int8_t tsc_shift;
> + int8_t pad[3];
> +} __attribute__((__packed__)); /* 32 bytes */
> +
> +struct pvclock_wall_clock {
> + uint32_t version;
> + uint32_t sec;
> + uint32_t nsec;
> +} __attribute__((__packed__));
> +
> +#endif /* __ASSEMBLY__ */
> +#endif /* _ASM_X86_PVCLOCK_ABI_H_ */
> diff --git a/include/asm-x86/pvclock.h b/include/asm-x86/pvclock.h
> new file mode 100644
> index 0000000..85b1bba
> --- /dev/null
> +++ b/include/asm-x86/pvclock.h
> @@ -0,0 +1,13 @@
> +#ifndef _ASM_X86_PVCLOCK_H_
> +#define _ASM_X86_PVCLOCK_H_
> +
> +#include <linux/clocksource.h>
> +#include <asm/pvclock-abi.h>
> +
> +/* some helper functions for xen and kvm pv clock sources */
> +cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
> +void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
> + struct pvclock_vcpu_time_info *vcpu,
> + struct timespec *ts);
> +
> +#endif /* _ASM_X86_PVCLOCK_H_ */
>
next prev parent reply other threads:[~2008-06-03 13:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 13:07 [PATCH 0/5] paravirt clock source patches, #4 Gerd Hoffmann
2008-06-03 13:07 ` [PATCH 1/5] Add structs and functions for paravirt clocksource Gerd Hoffmann
2008-06-03 13:34 ` Jeremy Fitzhardinge [this message]
2008-06-03 13:07 ` [PATCH 2/5] Make xen use the paravirt clocksource structs and functions Gerd Hoffmann
2008-06-03 13:41 ` Jeremy Fitzhardinge
2008-06-03 13:07 ` [PATCH 3/5] Make kvm host use the paravirt clocksource structs Gerd Hoffmann
2008-06-03 13:07 ` [PATCH 4/5] Make kvm guest use the paravirt clocksource structs and functions Gerd Hoffmann
2008-06-03 13:07 ` [PATCH 5/5] Remove now unused structs from kvm_para.h Gerd Hoffmann
2008-06-03 13:26 ` David Miller
2008-06-03 13:42 ` [PATCH 0/5] paravirt clock source patches, #4 Jeremy Fitzhardinge
2008-06-03 13:46 ` Gerd Hoffmann
2008-06-03 13:49 ` Gerd Hoffmann
2008-06-04 14:01 ` Avi Kivity
2008-06-16 13:53 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2008-06-03 14:17 [PATCH 0/5] paravirt clock source patches, #5 Gerd Hoffmann
2008-06-03 14:17 ` [PATCH 1/5] Add structs and functions for paravirt clocksource Gerd Hoffmann
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=4845484D.7000202@goop.org \
--to=jeremy@goop.org \
--cc=kraxel@redhat.com \
--cc=kvm-owner@vger.kernel.org \
--cc=virtualization@lists.osdl.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 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.