summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2019-01-18 13:50:07 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2019-01-21 08:54:51 -0600
commit17ba81ec0a525707be8539d12ec0e2050227c354 (patch)
treeae83370d7509834963cf7481c56181b5695c5a9d /src/kernel
parentad1c30eb712f64b0cb826b9592090d4a218b2a81 (diff)
downloadtalos-hostboot-17ba81ec0a525707be8539d12ec0e2050227c354.tar.gz
talos-hostboot-17ba81ec0a525707be8539d12ec0e2050227c354.zip
Add msgsync to doorbell wakeup logic to avoid weak consistency bug
POWER9 added a new sync mode called 'msgsync' that is required to avoid weak consistency issues when you are using doorbell (msgsnd) functions. See POWER ISA Section 5.9.2 for details, excerpt here: The ordering done by sync (and ptesync) provides the appearance of "causality" across a sequence of msgsnd instructions, as in the following example. "msgsnd->T1" means "msgsnd instruction target- ting thread T1". "<DHDI 0>" means "occurrence of Directed Hypervisor Doorbell interrupt caused by msgsnd executed on T0". On T0, register r1 is assumed to contain the value 1. T0 T1 T2 std r1,X <DHDI 0> <DHDI 1> sync msgsnd->T2 msgsync msgsnd->T1 ld r1,X In this example, T2's load from X must return 1. The change here adds the msgsync call to the code that executes any time we handle a doorbell interrupt. In addition there is a POWER9 DD2 errata that indicates we also require a lwsync to ensure consistency. Change-Id: Ib0f3571926d71efcbffa205093278e2a1d58df85 CQ: SW454611 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70648 Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Dean Sanner <dsanner@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/syscall.C8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 8b7f02243..c293d5067 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2010,2018 */
+/* Contributors Listed Below - COPYRIGHT 2010,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -52,6 +52,12 @@
extern "C"
void kernel_execute_hyp_doorbell()
{
+ // Per POWER ISA Section 5.9.2, to avoid any weak consistency
+ // issues we must use a msgsync instruction before consuming
+ // any data set by a different thread following a doorbell
+ // wakeup.
+ msgsync();
+
task_t* t = TaskManager::getCurrentTask();
task_t* l_task_post = nullptr;
doorbell_clear();
OpenPOWER on IntegriCloud