Date: Mon, 30 Apr 2018 20:18:32 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333125 - in head/sys/x86: acpica include Message-ID: <201804302018.w3UKIW0n006122@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Apr 30 20:18:32 2018 New Revision: 333125 URL: https://svnweb.freebsd.org/changeset/base/333125 Log: Turn off IBRS on suspend. Resume starts CPU from the init state, which clears any loaded microcode updates. As result, IBRS MSRs are no longer available, until the microcode is reloaded. I have to forcibly clear cpu_stdext_feature3, which assumes that CPUID leaf 7 reg %ebx does not report anything except Meltdown/Spectre bugs bits. If future CPUs add new bits there, hw_ibrs_recalculate() and identify_cpu1()/identify_cpu2() need to be adjusted for that. Submitted and tested by: Michael Danilov <mike.d.ft402@gmail.com> PR: 227866 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D15236 Modified: head/sys/x86/acpica/acpi_wakeup.c head/sys/x86/include/x86_var.h Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Mon Apr 30 19:37:32 2018 (r333124) +++ head/sys/x86/acpica/acpi_wakeup.c Mon Apr 30 20:18:32 2018 (r333125) @@ -209,6 +209,10 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) { ACPI_STATUS status; struct pcb *pcb; +#ifdef __amd64__ + struct pcpu *pc; + int i; +#endif if (sc->acpi_wakeaddr == 0ul) return (-1); /* couldn't alloc wake memory */ @@ -236,6 +240,14 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { device_printf(sc->acpi_dev, "Failed to suspend APs\n"); return (0); /* couldn't sleep */ + } +#endif +#ifdef __amd64__ + hw_ibrs_active = 0; + cpu_stdext_feature3 = 0; + CPU_FOREACH(i) { + pc = pcpu_find(i); + pc->pc_ibpb_set = 0; } #endif Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Mon Apr 30 19:37:32 2018 (r333124) +++ head/sys/x86/include/x86_var.h Mon Apr 30 20:18:32 2018 (r333125) @@ -83,7 +83,8 @@ extern int _ugssel; extern int use_xsave; extern uint64_t xsave_mask; extern u_int max_apic_id; -extern int pti; +extern int pti; +extern int hw_ibrs_active; struct pcb; struct thread;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804302018.w3UKIW0n006122>