HomeFreeBSD

x86 cpususpend_handler: call wbinvd after setting suspend state bits

Description

x86 cpususpend_handler: call wbinvd after setting suspend state bits

Without a subsequent wbinvd the changes to suspended_cpus (and
resuming_cpus) can be lost at least on AMD systems that use MOESI cache
coherency protocol. That can happen because one of APs ends up as an
Owner of the corresponding cache line(s) and the changes may never reach
the main memory before the AP is reset.

While here, move clearing of suspended_cpus a little bit earlier as the
fact of returning from savectx (with zero return value) means that the
CPU has fully restored it execution context.

Also, rework the comment that describes the need for resuming_cpus.

This change fixed suspend to RAM a previously broken AMD-based system.

Reviewed by: kib
Discussed with: bde
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D15295

Details

Provenance
avgAuthored on
Reviewer
kib
Differential Revision
D15295: x86 cpususpend_handler: call wbinvd after setting suspend state bits
Parents
rS333320: clk: clk_set_assigned: Skip frequency of value 0
Branches
Unknown
Tags
Unknown