Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5817789imm; Tue, 12 Jun 2018 13:58:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI8Iu11Zkc9kGHigpAqpyLTmSD+zVNz7MiwJBCacBQ181pqxwakiVsy5oVsxw+BeHCMi5qC X-Received: by 2002:a17:902:854a:: with SMTP id d10-v6mr2082745plo.106.1528837084186; Tue, 12 Jun 2018 13:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528837084; cv=none; d=google.com; s=arc-20160816; b=vjaz+lLk+172I3+DKm0IYZ4YDa06Qv9hyUfrwC+IpIuaboNIstEs6WXLJOi8+mIiM7 IWNlRI9XKtUb4pF+VwmfV+WBA4fqo7UiUB++zqfhy3qG1JWZtUq64xs8dlzWBJR2qTMN 4l+z2u9FlVLyBi8katCW0ooutaOPOglpYPUdhCBL3nEZOXyatgeAnMkp38xySlhrco8Z rkW5okY8U8kUZPDRCze7DBapuB2SWafbAlzhFgeUmJ7UlUhiWfWNlmm/O21zGmkznbtz xg6cRV6l72b5+iuzcZaQfmadsfASZRuDVV8JoG4FjDwqq2YdVlFavjzvCkHWIbG2k0zj ikLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Yw2zPwrO0M5CiRMiqXHX1y3V/D58hCoOhuENVMBy8i0=; b=OzI4GFtv+QWu/7W9mkSoXgTNtps35WxDYBc11R8qMIJSVv6hyT/pQ+1NeI4wb8Jx9q DhZN6ToO1so1vcazwc3dwLt5v5kXQ4f/PjwaKTsJR7vbSgia6Y49LFPl1HJULNx4qzrT T/DIQcIWoYOtqF5YW8D8Il/4RD4c+r4I06ZQOecj96UtHnekWR4dupW587UT1navCrep diIUgreeKhL2MaDlzqf/AuiAanAU7zqU8y5xUs5uB1C9KuSjtL/5jMLl37taN0xpvuqk ZPkmtB/+GsWb+AIiE0X8G+lR2Hal26563aSzK//PqHY0lxcQVYFjx2MBh3cJN+tiBmYR Hykg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=XInkU9MP; 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 k79-v6si977849pfb.34.2018.06.12.13.57.49; Tue, 12 Jun 2018 13:58:04 -0700 (PDT) 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=XInkU9MP; 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 S934730AbeFLU45 (ORCPT + 99 others); Tue, 12 Jun 2018 16:56:57 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:31600 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934335AbeFLU4o (ORCPT ); Tue, 12 Jun 2018 16:56:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1528837004; x=1560373004; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Yw2zPwrO0M5CiRMiqXHX1y3V/D58hCoOhuENVMBy8i0=; b=XInkU9MPDdf3f6uxFg/qSThaABTbbrF1Jxp3imqy8PdtmZtvJSWFNS9x 10T85wAPEBsnhYb6UKCzknGMMk+5n8XKXJlB8VPItOlDlsucpgfeJ070n R04yubTSoT9dtL44assI4eR12ooWGZ58JZ4cutW5TRIJx49L4zuxxHkWU k=; X-IronPort-AV: E=Sophos;i="5.51,216,1526342400"; d="scan'208";a="682679290" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-55156cd4.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Jun 2018 20:56:42 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-55156cd4.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w5CKueZc017015 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 12 Jun 2018 20:56:40 GMT Received: from EX13D02UWB002.ant.amazon.com (10.43.161.80) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:37 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D02UWB002.ant.amazon.com (10.43.161.80) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:36 +0000 Received: from localhost (10.25.15.63) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Jun 2018 20:56:35 +0000 From: Anchal Agarwal To: , , , CC: , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 09/12] x86/xen: save and restore steal clock Date: Tue, 12 Jun 2018 20:56:16 +0000 Message-ID: <20180612205619.28156-10-anchalag@amazon.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180612205619.28156-1-anchalag@amazon.com> References: <20180612205619.28156-1-anchalag@amazon.com> MIME-Version: 1.0 Content-Type: text/plain 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 Reviewed-by: Munehisa Kamata Reviewed-by: Eduardo Valentin --- 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 784c448..dae0f74 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 e0f1bcf..85f8534 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -523,6 +523,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.7.4