usermode/library/mtm/src/mode/pwb-common/pwb_i.h

00001 /*
00002     Copyright (C) 2011 Computer Sciences Department, 
00003     University of Wisconsin -- Madison
00004 
00005     ----------------------------------------------------------------------
00006 
00007     This file is part of Mnemosyne: Lightweight Persistent Memory, 
00008     originally developed at the University of Wisconsin -- Madison.
00009 
00010     Mnemosyne was originally developed primarily by Haris Volos
00011     with contributions from Andres Jaan Tack.
00012 
00013     ----------------------------------------------------------------------
00014 
00015     Mnemosyne is free software; you can redistribute it and/or
00016     modify it under the terms of the GNU General Public License
00017     as published by the Free Software Foundation, version 2
00018     of the License.
00019  
00020     Mnemosyne is distributed in the hope that it will be useful,
00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023     GNU General Public License for more details.
00024 
00025     You should have received a copy of the GNU General Public License
00026     along with this program; if not, write to the Free Software
00027     Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00028     Boston, MA  02110-1301, USA.
00029 
00030 ### END HEADER ###
00031 */
00032 
00040 #ifndef _PWB_COMMON_INTERNAL_IOK811_H
00041 #define _PWB_COMMON_INTERNAL_IOK811_H
00042 
00043 #include <pcm.h>
00044 #include <log.h>
00045 
00046 #include "mtm_i.h"
00047 #include "mode/dtable.h"
00048 #include "local.h"
00049 #include "mode/pwb-common/locks.h"
00050 #include "mode/pwb-common/tmlog.h"
00051 
00052 
00053 //#undef MTM_DEBUG_PRINT
00054 //# define MTM_DEBUG_PRINT(...)               printf(__VA_ARGS__); fflush(NULL)
00055 
00056 void ITM_NORETURN mtm_pwb_restart_transaction (mtm_tx_t *tx, mtm_restart_reason r);
00057 
00058 
00059 typedef struct mtm_pwb_r_entry_s      mtm_pwb_r_entry_t;
00060 typedef struct mtm_pwb_r_set_s        mtm_pwb_r_set_t;
00061 typedef struct mtm_pwb_w_entry_s      mtm_pwb_w_entry_t;
00062 typedef struct mtm_pwb_w_set_s        mtm_pwb_w_set_t;
00063 typedef struct mtm_pwb_mode_data_s    mtm_pwb_mode_data_t;
00064 typedef struct mtm_pwb_r_entry_s      r_entry_t;
00065 typedef struct mtm_pwb_r_set_s        r_set_t;
00066 typedef struct mtm_pwb_w_entry_s      w_entry_t;
00067 typedef struct mtm_pwb_w_set_s        w_set_t;
00068 typedef struct mtm_pwb_mode_data_s    mode_data_t;
00069 
00070 
00071 
00072 /* Read set entry */
00073 struct mtm_pwb_r_entry_s {
00074   mtm_word_t          version;          /* Version read */
00075   volatile mtm_word_t *lock;            /* Pointer to lock (for fast access) */
00076 };
00077 
00078 
00079 /* Read set */
00080 struct mtm_pwb_r_set_s {                  
00081   mtm_pwb_r_entry_t   *entries;         /* Array of entries */
00082   int                 nb_entries;       /* Number of entries */
00083   int                 size;             /* Size of array */
00084 };
00085 
00086 
00087 /* Volatile write set entry */
00088 struct mtm_pwb_w_entry_s {
00089         union {                                                  /* For padding... */
00090                 struct {
00091                         volatile mtm_word_t         *addr;               /* Address written */
00092                         mtm_word_t                  value;               /* New (write-back) or old (write-through) value */
00093                         mtm_word_t                  mask;                /* Write mask */
00094                         mtm_word_t                  version;             /* Version overwritten */
00095                         int                         is_nonvolatile;      /* Write access is to non-volatile memory */
00096                         volatile mtm_word_t         *lock;               /* Pointer to lock (for fast access) */
00097 #if defined(CONFLICT_TRACKING)
00098                         struct mtm_tx_s             *tx;                 /* Transaction owning the write set */
00099 #endif /* defined(CONFLICT_TRACKING) */
00100                         struct mtm_pwb_w_entry_s    *next;               /* Next address covered by same lock (if any) */
00101                         struct mtm_pwb_w_entry_s*   next_cache_neighbor; /* Next address covered by same lock and falls within the same cacheline. These entries can be written together with a single cache-line flush. */
00102                 };
00103 #if CM == CM_PRIORITY
00104                 mtm_word_t padding[12];                              /* Padding (must be a multiple of 32 bytes) */
00105 #endif /* CM == CM_PRIORITY */
00106         };
00107 };
00108 
00109 
00110 /* Write set */
00111 struct mtm_pwb_w_set_s {             
00112         mtm_pwb_w_entry_t *entries;           /* Array of entries */
00113         int               nb_entries;         /* Number of entries */
00114         int               size;               /* Size of array */
00115         int               reallocate;         /* Reallocate on next start */
00116 };
00117 
00118 
00123 struct mtm_pwb_mode_data_s
00124 {
00125         mtm_word_t      start;
00126         mtm_word_t      end;
00127 
00128         mtm_pwb_r_set_t r_set;
00129         mtm_pwb_w_set_t w_set;
00130         
00131         m_log_dsc_t     *ptmlog_dsc; 
00132         M_TMLOG_T       *ptmlog;     
00133 };
00134 
00135 #endif /* _PWB_COMMON_INTERNAL_IOK811_H */

Generated on Sat Apr 23 11:43:36 2011 for Mnemosyne by  doxygen 1.4.7