Xeon Phi: fixing race condition when booting two cards simultaneously. release2015-07-14
authorReto Achermann <reto.achermann@inf.ethz.ch>
Tue, 30 Jun 2015 16:48:39 +0000 (18:48 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Tue, 30 Jun 2015 16:48:39 +0000 (18:48 +0200)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

usr/drivers/xeon_phi/interphi.c
usr/drivers/xeon_phi/main_host.c
usr/drivers/xeon_phi/service.c

index 0f04a88..b5597f2 100644 (file)
@@ -939,8 +939,6 @@ errval_t interphi_wait_for_client(struct xeon_phi *phi)
 
     struct xnode *node = &phi->topology[phi->id];
 
-    assert(node->state == XNODE_STATE_WAIT_CONNECTION);
-
     while (node->state == XNODE_STATE_WAIT_CONNECTION) {
         uint32_t data = 0x0;
         uint32_t serial_recv = 0xF;
index 124df14..06449cb 100644 (file)
@@ -223,11 +223,6 @@ int main(int argc,
         USER_PANIC_ERR(err, "could not do the card initialization\n");
     }
 
-    err = service_register(&xphi, irefs, num);
-    if (err_is_fail(err)) {
-        USER_PANIC_ERR(err, "could not register with the other drivers");
-    }
-
     err = xeon_phi_boot(&xphi, xeon_phi_mod_uri, xeon_phi_mod_list);
     if (err_is_fail(err)) {
         USER_PANIC_ERR(err, "could not boot the card\n");
@@ -235,6 +230,11 @@ int main(int argc,
 
     interphi_wait_for_client(&xphi);
 
+    err = service_register(&xphi, irefs, num);
+    if (err_is_fail(err)) {
+        USER_PANIC_ERR(err, "could not register with the other drivers");
+    }
+
     if (xeon_phi_dma_enabled) {
         err = xdma_service_init(&xphi);
         if (err_is_fail(err)) {
index 0fb7e98..067135b 100644 (file)
@@ -229,6 +229,8 @@ static void register_call_recv(struct xeon_phi_driver_binding *_binding,
 {
     struct xeon_phi *phi = _binding->st;
 
+    interphi_wait_for_client(phi);
+    
     assert(id < XEON_PHI_NUM_MAX);
     phi->topology[id].binding = _binding;
     phi->topology[id].state = XNODE_STATE_READY;