Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5761939imm; Mon, 23 Jul 2018 05:45:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpesZGDF7AN8PKKNI0ei59tbFGlq9CdQacDKoPqxbYO7WJmfp+uTY+/qHoXXvx2ANLPLSN+P X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr13047471pll.186.1532349934261; Mon, 23 Jul 2018 05:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532349934; cv=none; d=google.com; s=arc-20160816; b=t+1+pBMpTqjCPxubIf+EYBCTfpDXlTjhk554/A9EK07UOatAM3n+0DUCNFbsotDUbx V9thuoc+RMZV3mAYtoPSlLCBlh/+diuONkEwMxU/OTRP3G9xXMPf35mB4/R8TLquVGst vQrZINY2zMdiXd2gzmzz/XlxBU2EBcZ1PDtnd+fcrKae+gK33J41eYCspLZsf1ShDSgW hVwHHnI9Al7vPDvqng5xhxFp6pWK/YulqET85/O3chiQRVoVQYUyDNqRfhHhg9COMsmL qM6f6cleSuWiK+QJMjMDefKHf3Eoq4eN3mx29KlF91uIGTo5Xw8oNDbXDU87J8zsriYr UmJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VOeI+hL4r+X5sl50woajVNoXHkuVSnMIlILqnFrAbcs=; b=pnHSJiQkmODaCJcJbg24X7t1EPLIfXBQ+nRYZrmgnl82sF6LRztNR/52sFZpxBLpf5 y9GCIW1dHKJ5iTUsYdDbHgF7qm/Zvx73WVnyM0ZzpGsnzLNE/su2c2Hde0Dd40BJ9EtR BURwuoDQuj87g8XWVlF6H/HkKX+OdmnhlrB3zcnohDNOmfCs54DljG98yPJ+lDaHlJZ1 Ok+S4muZ1Nhn8j2Ax6Un7XF2aLEOb0i/1NpGklKIak9coGtmiU6mHilY+bv0mI+9hEsO a7PRe8OUu93TbLF3kU0RR+HQOGY/+lfiKyZlA6E4+cbw5+qkgHLMLpGDdAyzzNgH2i6F Vblw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1-v6si7669421pgh.65.2018.07.23.05.45.19; Mon, 23 Jul 2018 05:45:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388403AbeGWNpO (ORCPT + 99 others); Mon, 23 Jul 2018 09:45:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49166 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388032AbeGWNpN (ORCPT ); Mon, 23 Jul 2018 09:45:13 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6A6D0C9D; Mon, 23 Jul 2018 12:44:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Thomas Gleixner , Jan Beulich , xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, "Srivatsa S. Bhat" , "Matt Helsley (VMware)" , Alexey Makhalov , Bo Gan Subject: [PATCH 4.4 036/107] x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend Date: Mon, 23 Jul 2018 14:41:30 +0200 Message-Id: <20180723122414.674999043@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit 71c208dd54ab971036d83ff6d9837bae4976e623 upstream. Older Xen versions (4.5 and before) might have problems migrating pv guests with MSR_IA32_SPEC_CTRL having a non-zero value. So before suspending zero that MSR and restore it after being resumed. Signed-off-by: Juergen Gross Signed-off-by: Thomas Gleixner Reviewed-by: Jan Beulich Cc: stable@vger.kernel.org Cc: xen-devel@lists.xenproject.org Cc: boris.ostrovsky@oracle.com Link: https://lkml.kernel.org/r/20180226140818.4849-1-jgross@suse.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Srivatsa S. Bhat Reviewed-by: Matt Helsley (VMware) Reviewed-by: Alexey Makhalov Reviewed-by: Bo Gan Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/suspend.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -1,11 +1,14 @@ #include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -68,6 +71,8 @@ static void xen_pv_post_suspend(int susp xen_mm_unpin_all(); } +static DEFINE_PER_CPU(u64, spec_ctrl); + void xen_arch_pre_suspend(void) { if (xen_pv_domain()) @@ -84,6 +89,9 @@ void xen_arch_post_suspend(int cancelled static void xen_vcpu_notify_restore(void *data) { + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) + wrmsrl(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl)); + /* Boot processor notified via generic timekeeping_resume() */ if (smp_processor_id() == 0) return; @@ -93,7 +101,15 @@ static void xen_vcpu_notify_restore(void static void xen_vcpu_notify_suspend(void *data) { + u64 tmp; + tick_suspend_local(); + + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { + rdmsrl(MSR_IA32_SPEC_CTRL, tmp); + this_cpu_write(spec_ctrl, tmp); + wrmsrl(MSR_IA32_SPEC_CTRL, 0); + } } void xen_arch_resume(void)