Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2284066ybv; Fri, 14 Feb 2020 15:29:03 -0800 (PST) X-Google-Smtp-Source: APXvYqz8hSmXpcm1Wo2U155cpcZHORbgxBS6GmkyZe/VkXNm8KgqaLq3KIAKaHamFxZgMx4KMMa+ X-Received: by 2002:a05:6808:618:: with SMTP id y24mr3407664oih.86.1581722943864; Fri, 14 Feb 2020 15:29:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581722943; cv=none; d=google.com; s=arc-20160816; b=ZfF9Y1J51z3LM9FTMd2F9Oqhsk9D2yOPFkr3b2oV7phMHb8OfhPzW2aATfmzxBZRO7 UHYuBYyWLAnS0IcKKFMceDZufJRsTVO84g5xDE6LelnzV3U2lJr88C28AY4NYHeAyZVA IVpgjau4r5oGXgBft1NsJEXfQFOjBDAkCNbLhyMzgKEt5wt9DTlv1E6Z4xz+WewYz8HW KTzc6FPbRE0t7lo9e5JzC607g+kOFZ1K3wiyGyiOR7ZHM8RSQLwS2STRxF91bgcBqoD1 2jZ7tH++7qlx2yinuyREW5yQv4Clhp9QPc5VWtMPwtejapkKELBU5/uqUJ2UvvNTpOj8 YG4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:ironport-sdr:dkim-signature; bh=twtwEReB4vMkPmSnf9+l1xK/swlwTJyqpy55MdpJ7fk=; b=VIY0UcWdkQprPfiMK7yO5YjFohAAW5vx7LvRSdeUv/IMyz3GMxTbA4qBTZ0tZiN80q qsh9VBohQEGczAVK25fXx+vMtd+mxJQtoh3E47t28xWp6Tgsu4LHxjAuIqnHfFggFTeA WWXT6XYaeTSS8LaCnkcoFtSsOvMpWPB6kvhAekj1HOUZ1+UCfMnLAVY0YEk43gTG1bN/ 2z/DNRz8/H+A+PNXgllKRCCrYxBBSjPuIJ01o5ffuxEgdcvVmJUk23S4ISE8nhhMLUWn q6ud17oyf39YomqKRxFwdCCpRnh2qGzBf4INrIEMGNeSGpDVYL66bD+zLWolX+3V+fRM xokQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=hUwkb4Jw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si3141786oiv.267.2020.02.14.15.28.51; Fri, 14 Feb 2020 15:29:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=hUwkb4Jw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728116AbgBNX1i (ORCPT + 99 others); Fri, 14 Feb 2020 18:27:38 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:65509 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbgBNX1i (ORCPT ); Fri, 14 Feb 2020 18:27:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1581722857; x=1613258857; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=twtwEReB4vMkPmSnf9+l1xK/swlwTJyqpy55MdpJ7fk=; b=hUwkb4JwKjAWgSEgHvwIwwhZ1bD4y+5GQ8v815HLQH7d1PVQ+6PmKxyk j5YpgwJCVNG8HKiYs2U4r6iQSdTjkcI3cEUVgNKt1+PNQrFPgnUimcyKa PxjP4N42L5legzat5NcvO7ljbCbt4DDicpgSz0y/vYuJGKp/6LkojO3i1 M=; IronPort-SDR: 0NYhP0y0gcnaLbWj28x+E2/jgUI4gGpKUH11hprNLe3x8BJa1vSsS6GgCFZdKL3U2He/tfqsAM hOUpZ7VBqHBA== X-IronPort-AV: E=Sophos;i="5.70,442,1574121600"; d="scan'208";a="26558936" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 14 Feb 2020 23:27:35 +0000 Received: from EX13MTAUEB002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-2c665b5d.us-east-1.amazon.com (Postfix) with ESMTPS id B67BEA22B3; Fri, 14 Feb 2020 23:27:28 +0000 (UTC) Received: from EX13D08UEB002.ant.amazon.com (10.43.60.107) by EX13MTAUEB002.ant.amazon.com (10.43.60.12) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 14 Feb 2020 23:27:05 +0000 Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX13D08UEB002.ant.amazon.com (10.43.60.107) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 14 Feb 2020 23:27:05 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 14 Feb 2020 23:27:05 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id DB8AA4028E; Fri, 14 Feb 2020 23:27:04 +0000 (UTC) Date: Fri, 14 Feb 2020 23:27:04 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH v3 09/12] x86/xen: save and restore steal clock Message-ID: <47d0ad88d45360b034bf472802e9f43637155fb3.1581721799.git.anchalag@amazon.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Munehisa Kamata Save steal clock values of all present CPUs in the system core ops suspend callbacks. Also, restore a boot CPU's steal clock in the system core resume callback. For non-boot CPUs, restore after they're brought up, because runstate info for non-boot CPUs are not active until then. Signed-off-by: Munehisa Kamata Signed-off-by: Anchal Agarwal --- arch/x86/xen/suspend.c | 13 ++++++++++++- arch/x86/xen/time.c | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 784c4484100b..dae0f74f5390 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -91,12 +91,20 @@ void xen_arch_suspend(void) static int xen_syscore_suspend(void) { struct xen_remove_from_physmap xrfp; - int ret; + int cpu, ret; /* Xen suspend does similar stuffs in its own logic */ if (xen_suspend_mode_is_xen_suspend()) return 0; + for_each_present_cpu(cpu) { + /* + * Nonboot CPUs are already offline, but the last copy of + * runstate info is still accessible. + */ + xen_save_steal_clock(cpu); + } + xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; @@ -118,6 +126,9 @@ static void xen_syscore_resume(void) pvclock_resume(); + /* Nonboot CPUs will be resumed when they're brought up */ + xen_restore_steal_clock(smp_processor_id()); + gnttab_resume(); } diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index befbdd8b17f0..8cf632dda605 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -537,6 +537,9 @@ static void xen_hvm_setup_cpu_clockevents(void) { int cpu = smp_processor_id(); xen_setup_runstate_info(cpu); + if (cpu) + xen_restore_steal_clock(cpu); + /* * xen_setup_timer(cpu) - snprintf is bad in atomic context. Hence * doing it xen_hvm_cpu_notify (which gets called by smp_init during -- 2.24.1.AMZN