All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Simon Gaiser <simon@invisiblethingslab.com>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH 2/3] x86: suppress BTI mitigations around S3 suspend/resume
Date: Fri, 13 Apr 2018 19:27:02 +0100	[thread overview]
Message-ID: <14156d42-af09-3f51-6b5f-69aa654757d2@citrix.com> (raw)
In-Reply-To: <93d8078e-b0c6-81a6-ab28-aa856c9ef0d5@invisiblethingslab.com>

On 13/04/18 19:25, Simon Gaiser wrote:
> Jan Beulich:
>> NMI and #MC can occur at any time after S3 resume, yet the MSR_SPEC_CTRL
>> may become available only once we're reloaded microcode. Make
>> SPEC_CTRL_ENTRY_FROM_INTR_IST and DO_SPEC_CTRL_EXIT_TO_XEN no-ops for
>> the critical period of time.
>>
>> Also set the MSR back to its intended value.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> --- a/xen/arch/x86/acpi/power.c
>> +++ b/xen/arch/x86/acpi/power.c
>> @@ -28,6 +28,7 @@
>>  #include <asm/tboot.h>
>>  #include <asm/apic.h>
>>  #include <asm/io_apic.h>
>> +#include <asm/spec_ctrl.h>
>>  #include <acpi/cpufreq/cpufreq.h>
>>  
>>  uint32_t system_reset_counter = 1;
>> @@ -163,6 +164,7 @@ static int enter_state(u32 state)
>>  {
>>      unsigned long flags;
>>      int error;
>> +    struct cpu_info *ci;
>>      unsigned long cr4;
>>  
>>      if ( (state <= ACPI_STATE_S0) || (state > ACPI_S_STATES_MAX) )
>> @@ -210,6 +212,10 @@ static int enter_state(u32 state)
>>      else
>>          error = 0;
>>  
>> +    ci = get_cpu_info();
>> +    ci->use_shadow_spec_ctrl = 0;
>> +    ci->bti_ist_info = 0;
>> +
>>      ACPI_FLUSH_CPU_CACHE();
>>  
>>      switch ( state )
>> @@ -248,6 +254,11 @@ static int enter_state(u32 state)
>>  
>>      microcode_resume_cpu(0);
>>  
>> +    ci->bti_ist_info = default_bti_ist_info;
>> +    asm volatile (ALTERNATIVE("", "wrmsr", X86_FEATURE_XEN_IBRS_SET)
> This does not compile for me:
>
>   power.c: Assembler messages:
>   power.c:272: Error: value of 257 too large for field of 1 bytes at 0
>
> Changing the alternative based on the other "wrmsr" calls fixes it:
>
>   asm volatile (ALTERNATIVE(ASM_NOP3, "wrmsr", X86_FEATURE_XEN_IBRS_SET)

Ah - you're presumably back-porting this to 4.8?

Jan's code is correct for staging, and your version here is correct for
all currently-released versions of Xen.  (I've done quite a lot of
playing with alternatives generation for 4.11.)

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-04-13 18:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 11:49 [PATCH 0/3] x86: S3 resume adjustments Jan Beulich
2018-04-13 11:56 ` [PATCH 1/3] x86: correct ordering of operations during S3 resume Jan Beulich
2018-04-13 11:57 ` [PATCH 2/3] x86: suppress BTI mitigations around S3 suspend/resume Jan Beulich
2018-04-13 18:25   ` Simon Gaiser
2018-04-13 18:27     ` Andrew Cooper [this message]
2018-04-13 18:34       ` Simon Gaiser
2018-04-13 11:58 ` [PATCH 3/3] x86: check feature flags after resume Jan Beulich
2018-04-13 18:29   ` Simon Gaiser
2018-04-13 18:56     ` Simon Gaiser
2018-04-16 10:16       ` Jan Beulich
2018-04-13 12:01 ` [PATCH 0/3] x86: S3 resume adjustments Andrew Cooper
2018-04-16 11:57   ` Juergen Gross
2018-04-14  5:49 ` Simon Gaiser
2018-04-15 13:08   ` Andrew Cooper
2018-04-15 15:52     ` Simon Gaiser
2018-04-15 17:34       ` Andrew Cooper
2018-04-15 20:15         ` Simon Gaiser
2018-04-16 13:13           ` Jan Beulich

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=14156d42-af09-3f51-6b5f-69aa654757d2@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=simon@invisiblethingslab.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.