From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 1/7] x86/time: introduce helper to fetch Xen wallclock when running as a guest
Date: Wed, 4 Sep 2024 11:29:25 +0200 [thread overview]
Message-ID: <ZtgodW4MrFpy40jj@macbook.local> (raw)
In-Reply-To: <3788d706-7000-4382-b162-f25fa595144a@suse.com>
On Tue, Sep 03, 2024 at 04:48:41PM +0200, Jan Beulich wrote:
> On 03.09.2024 15:02, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/time.c
> > +++ b/xen/arch/x86/time.c
> > @@ -785,6 +785,31 @@ static struct platform_timesource __initdata_cf_clobber plt_xen_timer =
> > .resume = resume_xen_timer,
> > .counter_bits = 63,
> > };
> > +
> > +static unsigned long read_xen_wallclock(void)
> > +{
> > + struct shared_info *sh_info = XEN_shared_info;
> > + uint32_t wc_version;
> > + uint64_t wc_sec;
> > +
> > + ASSERT(xen_guest);
> > +
> > + do {
> > + wc_version = sh_info->wc_version & ~1;
> > + smp_rmb();
> > +
> > + wc_sec = sh_info->wc_sec;
> > + smp_rmb();
> > + } while ( wc_version != sh_info->wc_version );
> > +
> > + return wc_sec + read_xen_timer() / 1000000000;
> > +}
> > +#else
> > +static unsigned long read_xen_wallclock(void)
> > +{
> > + ASSERT_UNREACHABLE();
> > + return 0;
> > +}
> > #endif
>
> I understand you try to re-use an existing #ifdef here, but I wonder if I
> could talk you into not doing so and instead placing the #ifdef inside the
> (then single) function body. Less redundancy, less room for mistakes /
> oversights.
I don't mind much, I've assumed reducing the number of #ifdefs blocks
was better, but I don't have a strong opinion. Initially I just kept
the #ifdef block in get_wallclock_time().
Thanks, Roger.
next prev parent reply other threads:[~2024-09-04 9:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 13:02 [PATCH v3 0/7] x86/time: improvements to wallclock logic Roger Pau Monne
2024-09-03 13:02 ` [PATCH v3 1/7] x86/time: introduce helper to fetch Xen wallclock when running as a guest Roger Pau Monne
2024-09-03 14:48 ` Jan Beulich
2024-09-04 9:29 ` Roger Pau Monné [this message]
2024-09-03 13:02 ` [PATCH v3 2/7] x86/time: move CMOS edge detection into read helper Roger Pau Monne
2024-09-03 15:02 ` Jan Beulich
2024-09-04 9:46 ` Roger Pau Monné
2024-09-03 13:02 ` [PATCH v3 3/7] x86/time: split CMOS read and probe logic into function Roger Pau Monne
2024-09-03 15:16 ` Jan Beulich
2024-09-04 10:48 ` Roger Pau Monné
2024-09-03 13:03 ` [PATCH v3 4/7] x86/time: introduce probing logic for the wallclock Roger Pau Monne
2024-09-03 15:32 ` Jan Beulich
2024-09-04 10:58 ` Roger Pau Monné
2024-09-04 11:49 ` Jan Beulich
2024-09-04 12:30 ` Roger Pau Monné
2024-09-04 12:41 ` Jan Beulich
2024-09-03 13:03 ` [PATCH v3 5/7] x86/time: prefer CMOS over EFI_GET_TIME Roger Pau Monne
2024-09-03 13:03 ` [PATCH v3 6/7] x86/time: introduce command line option to select wallclock Roger Pau Monne
2024-09-03 15:37 ` Jan Beulich
2024-09-03 13:03 ` [PATCH v3 7/7] x86/time: probe the CMOS RTC by default Roger Pau Monne
2024-09-03 15:48 ` Jan Beulich
2024-09-04 12:45 ` Roger Pau Monné
2024-09-04 13:21 ` Jan Beulich
2024-09-03 15:38 ` [PATCH v3 0/7] x86/time: improvements to wallclock logic Jan Beulich
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=ZtgodW4MrFpy40jj@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dpsmith@apertussolutions.com \
--cc=jbeulich@suse.com \
--cc=marmarek@invisiblethingslab.com \
--cc=xen-devel@lists.xenproject.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.