Index: trunk/kernel/kern/cluster.h
===================================================================
--- trunk/kernel/kern/cluster.h	(revision 19)
+++ trunk/kernel/kern/cluster.h	(revision 23)
@@ -4,5 +4,5 @@
  * authors  Ghassan Almaless (2008,2009,2010,2011,2012)
  *          Mohamed Lamine Karaoui (2015)
- *          Alain Greiner (2016)
+ *          Alain Greiner (2016,2017)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -49,5 +49,4 @@
 struct core_s;
 struct process_s;
-struct device_s;
 
 
@@ -56,18 +55,19 @@
  * For any process P, the process descriptor is replicated in all clusters containing
  * at least one thread of process P, but only the "reference" cluster descriptor contains
- * the reference (complete) structures such as the GPT, the VSL, or the FDT.
- * The "owner" cluster is in charge to allocate a lpid (local process index),
- * for all process owned by a cluster K, and to register the "reference" cluster for
- * all process owned by K.
+ * the reference (complete) GPT, VSL, and FDT structures. 
+ * The "owner" cluster K is in charge to allocate a lpid (local process index), 
+ * to the owned processes, and to register the "reference" cluster for these processes.
  *
  * Warning : the "owner" cluster, and the "reference" cluster can be different clusters.
  *
  * The process manager of a cluster K maintains three structures:
- * 1) The pref_tbl[] is an array indexed by lpid, for all processes owned by cluster K.
+ * 1) The pref_tbl[] is an array indexed by lpid. There is one entry per owned process.
  *    Each entry contains an extended pointer on the reference process descriptor.
+ *
  * 2) The local_root is the root of the local list of process descriptors in cluster K.
  *    A process descriptor P is present in K, as soon as P has a thread in cluster K.
- * 3) The copies_root[] array is indexed by lpid. Each entry contains the root of
- *    the xlist of copies for a given process owned by cluster K.
+ *
+ * 3) The copies_root[] array is indexed by lpid. There is one entry per owned process,
+ *    and each each entry contains the root of the xlist of copies for this process.
  ******************************************************************************************/
 
@@ -78,6 +78,6 @@
     uint32_t          pref_nr;                /*! number of processes owned by cluster    */
 
-    list_entry_t      local_root;             /*! root of list of process in cluster      */
-    spinlock_t        local_lock;             /*! lock protecting access to local list    */
+    xlist_entry_t     local_root;             /*! root of list of process in cluster      */
+    remote_spinlock_t local_lock;             /*! lock protecting access to local list    */
     uint32_t          local_nr;               /*! number of process in cluster            */
 
@@ -96,42 +96,41 @@
 typedef struct cluster_s
 {
-	spinlock_t        kcm_lock;           /*! local, protect creation of KCM allocators   */
+	spinlock_t        kcm_lock;        /*! local, protect creation of KCM allocators      */
 
     // global parameters
 
-	uint32_t          paddr_width;        /*! numer of bits in physical address           */
-    uint32_t          x_width;            /*! number of bits to code x_size  (can be 0)   */
-    uint32_t          y_width;            /*! number of bits to code y_size  (can be 0)   */
-	uint32_t          x_size;             /*! number of clusters in a row    (can be 1)   */
-	uint32_t          y_size;             /*! number of clusters in a column (can be 1)   */
-	cxy_t             io_cxy;             /*! io cluster identifier                       */
-    uint32_t          dqdt_root_level;    /*! index of root node in dqdt_tbl[]            */
+	uint32_t          paddr_width;     /*! numer of bits in physical address              */
+    uint32_t          x_width;         /*! number of bits to code x_size  (can be 0)      */
+    uint32_t          y_width;         /*! number of bits to code y_size  (can be 0)      */
+	uint32_t          x_size;          /*! number of clusters in a row    (can be 1)      */
+	uint32_t          y_size;          /*! number of clusters in a column (can be 1)      */
+	cxy_t             io_cxy;          /*! io cluster identifier                          */
+    uint32_t          dqdt_root_level; /*! index of root node in dqdt_tbl[]               */
 
     // local parameters
 
-	uint32_t          cores_nr;           /*! number of cores in cluster                  */
-    uint32_t          cores_in_kernel;    /*! number of cores currently in kernel mode    */
+	uint32_t          cores_nr;        /*! number of cores in cluster                     */
+    uint32_t          cores_in_kernel; /*! number of cores currently in kernel mode       */
 
 	core_t            core_tbl[CONFIG_MAX_LOCAL_CORES];         /*! embedded cores        */
 
-	ppm_t             ppm;                /*! embedded kernel page manager                */
-	khm_t             khm;                /*! embedded kernel heap manager                */
-	kcm_t             kcm;                /*! embedded kernel cache manager (for KCMs)    */
+	ppm_t             ppm;             /*! embedded kernel page manager                   */
+	khm_t             khm;             /*! embedded kernel heap manager                   */
+	kcm_t             kcm;             /*! embedded kernel cache manager (for KCMs)       */
 
     kcm_t           * kcm_tbl[KMEM_TYPES_NR];         /*! pointers on allocated KCMs      */
 
-    uint32_t          ram_size;           /*! physical memory size                        */
-    uint32_t          ram_base;           /*! physical memory base (local address)        */
-
-	rpc_fifo_t        rpc_fifo;           /*! cluster RPC fifo (shared)                   */
-	list_entry_t      devlist;            /*! root of list of devices in cluster          */
-    struct device_s * icu;                /*! pointer on local XCU device                 */
-
-    int32_t           pages_var;          /*! pages number increment from last update     */
-    int32_t           threads_var;        /*! threads number increment from last update   */
+    uint32_t          ram_size;        /*! physical memory size                           */
+    uint32_t          ram_base;        /*! physical memory base (local address)           */
+
+	rpc_fifo_t        rpc_fifo;        /*! cluster RPC fifo (shared)                      */
+	list_entry_t      devlist;         /*! root of list of devices in cluster             */
+
+    int32_t           pages_var;       /*! pages number increment from last DQQT update   */
+    int32_t           threads_var;     /*! threads number increment from last DQDT update */
 
 	dqdt_node_t       dqdt_tbl[CONFIG_MAX_DQDT_DEPTH];     /*! embedded DQDT nodes        */
 
-    pmgr_t            pmgr;               /*! embedded process manager                    */
+    pmgr_t            pmgr;            /*! embedded process manager                       */
 
 	char              name[CONFIG_SYSFS_NAME_LEN];
@@ -192,9 +191,9 @@
 /******************************************************************************************
  * This function returns an extended pointer on the reference process descriptor
- * from the process PID.  It can be called by any thread running in any cluster,
- * as it uses a RPC to the owner cluster if the current cluster is not the owner.
+ * from the process PID. This PID can be be different from the calling thread process.
+ * It can be called by any thread running in any cluster,
  ******************************************************************************************
  * @ pid  : process identifier.
- * @ return extended pointer on the reference process descriptor.
+ * @ return extended pointer on reference process if success / return XPTR_NULL if error.
  *****************************************************************************************/
 xptr_t cluster_get_reference_process_from_pid( pid_t pid );
