Received: by 10.223.185.111 with SMTP id b44csp913223wrg; Fri, 9 Mar 2018 16:42:26 -0800 (PST) X-Google-Smtp-Source: AG47ELv0NcyBiet62v+3TQzZz0WxelHUnaf8HZi+smMxQvxw0lodWaBL7V/iJDE7/pPdF+nTeBZ+ X-Received: by 2002:a17:902:8697:: with SMTP id g23-v6mr349602plo.393.1520642546048; Fri, 09 Mar 2018 16:42:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642546; cv=none; d=google.com; s=arc-20160816; b=UGeORTL0WujWEcBDnh49IFqny35aXtoP8tU99qDM8Lqg+ywRKD+5olmgyNlL0fGB0G uziPrjJ/H4lzBBrNRC0J/mtv2dOVeCc+AkVSBOWxBt7jHcTVg69icb0nTZCxGL56j+1t yTP7OvQ0Ne0+NLfW37oKAqJMdjmj9jVJSPkWYg6TobL939BcWWpn+I3edvv+/VhJDHPp sQAmvezULdoLPjtbGpzRHRspVBq/lf+YrF5F7y3i9jRXymPPF6rmMdM3+XSgFiBXwPT0 EqupNtSVsYoPT73xsH9bq30Od4uzhVnCGHTbsIx2XKRiviMqSkn/t2LKNMlLkoqcrAqz sX2w== 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=1JW0mQw+MgHTV9BFiYz0/oPT/ONbyZ+NA9exJwiwTxU=; b=HtOpe0eDji16qpdEVLYRItR2x6K/lJbrzyqm7Ybio5QEqegXEyd8xoD6m1Z19XzkBG Nod4X+SR4W4L76teBvm4YvFJ+Xw+aBMJDyztcqIXxHL18zqwqWxBmGy/EbzCyoND/YUw 0bYh6DkRlA3laZKyQ3ev0rOTwpb9zXKi3TGKMQvZ7BDio9JlURQMF0jK6Qe0C+gF8Ohu rI5U1giB4M/OT0b2XrvTMpixg+A5Srncuz70bqs3jbb+w7x3nQFwfLhukLW0vUIm7FUp yYFSH+NVSBo6CRUY18yR4nM9qtWHrbHgT3mXhZFQjleljEhMwlRN5la3MwhI+RByPH44 HK4Q== 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 a100-v6si1768415pli.483.2018.03.09.16.42.11; Fri, 09 Mar 2018 16:42:26 -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; 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 S933671AbeCJAlX (ORCPT + 99 others); Fri, 9 Mar 2018 19:41:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39422 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932906AbeCJAVJ (ORCPT ); Fri, 9 Mar 2018 19:21:09 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8645C10C3; Sat, 10 Mar 2018 00:21:08 +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 Subject: [PATCH 4.9 15/65] x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend Date: Fri, 9 Mar 2018 16:18:15 -0800 Message-Id: <20180310001826.213960392@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001824.927996722@linuxfoundation.org> References: <20180310001824.927996722@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.9-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 --- 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)