From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
x86@kernel.org
Cc: sstabellini@kernel.org, hpa@zytor.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, hans@knorrie.org,
stable@vger.kernel.org
Subject: Re: [PATCH] xen: Fix x86 sched_clock() interface for xen
Date: Thu, 10 Jan 2019 18:10:31 -0500 [thread overview]
Message-ID: <d8cc08b1-0ec1-6d12-f0df-a41845a69ea0@oracle.com> (raw)
In-Reply-To: <21d24fe0-f9bd-c312-7773-b43a8ff39ef1@oracle.com>
On 1/10/19 12:17 PM, Boris Ostrovsky wrote:
> On 1/10/19 11:14 AM, Juergen Gross wrote:
>> On 10/01/2019 16:34, Boris Ostrovsky wrote:
>>> On 1/10/19 5:07 AM, Juergen Gross wrote:
>>>>
>>>> +void xen_clocksource_suspend(void)
>>>> +{
>>>> + xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset;
>>> xen_clock_value_saved = xen_sched_clock() maybe?
>> I wanted xen_clocksource_suspend() and xen_clocksource_resume() to
>> be symmetrical to each other.
> OK.
>
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>
>> In case you are feeling strong about that, I'm not. :-) So in case
>> you insist on it I can change it. Or you can do so while committing.
I did some basic testing and noticed this (at loglevel=8):
[ 64.336488] Freezing user space processes ... (elapsed 0.001 seconds)
done.
[ 64.337805] OOM killer disabled.
[ 64.337814] Freezing remaining freezable tasks ... (elapsed 0.000
seconds) done.
[ 64.339066] suspending xenstore...
[ 85.888340] xen:grant_table: Grant tables using version 1 layout
[ 64.359729] OOM killer enabled.
[ 64.359736] Restarting tasks ... done.
Which made me think that perhaps we should do suspend/restore of the
clocksource as close as possible to HYPERVISOR_suspend() call, e.g. in
xen_arch_pre_suspend()/xen_arch_post_suspend():
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 45fc9caf3880..80ecba3fcc8c 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -22,6 +22,7 @@ static DEFINE_PER_CPU(u64, spec_ctrl);
void xen_arch_pre_suspend(void)
{
+ xen_clocksource_suspend();
xen_save_time_memory_area();
if (xen_pv_domain())
@@ -36,6 +37,7 @@ void xen_arch_post_suspend(int cancelled)
xen_hvm_post_suspend(cancelled);
xen_restore_time_memory_area();
+ xen_clocksource_resume();
}
static void xen_vcpu_notify_restore(void *data)
This still has a window of incorrect clock value (you can see it, for
example, when xen_hvm_post_suspend() does pr_info("Xen HVM callback
vector for event delivery is enabled\n")), but it's smaller than before.
In particular, we will make time right before dpm_resume_start() call.
-boris
next prev parent reply other threads:[~2019-01-10 23:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 10:07 Juergen Gross
2019-01-10 15:34 ` Boris Ostrovsky
2019-01-10 16:14 ` Juergen Gross
2019-01-10 17:17 ` Boris Ostrovsky
2019-01-10 23:10 ` Boris Ostrovsky [this message]
2019-01-11 7:15 ` Juergen Gross
2019-01-11 7:31 ` Juergen Gross
2019-01-10 16:19 ` Hans van Kranenburg
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=d8cc08b1-0ec1-6d12-f0df-a41845a69ea0@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=hans@knorrie.org \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sstabellini@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®