Ignore:
Timestamp:
May 17, 2019, 9:27:04 AM (5 years ago)
Author:
alain
Message:

Remove the "giant" rwlock protecting the GPT, and
use the GPT_LOCKED attribute in each PTE to prevent
concurrent modifications of one GPT entry.
The version number has been incremented to 2.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/rwlock.c

    r623 r629  
    22 * rwlock.c - kernel local read/write lock implementation.
    33 *
    4  * Author  Alain Greiner     (2016,2017,2018)
     4 * Author  Alain Greiner     (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5252#if DEBUG_RWLOCK_TYPE
    5353thread_t * this = CURRENT_THREAD;
    54 if( DEBUG_RWLOCK_TYPE == type )
     54if( (type           == DEBUG_RWLOCK_TYPE) &&
     55    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     56    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    5557printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
    5658__FUNCTION__, this->process->pid, this->trdid,
     
    8082
    8183#if DEBUG_RWLOCK_TYPE
    82 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     84if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     85    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     86    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    8387printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
    8488__FUNCTION__, this->process->pid, this->trdid,
     
    105109
    106110#if DEBUG_RWLOCK_TYPE
    107 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     111if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     112    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     113    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    108114printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
    109115__FUNCTION__, this->process->pid, this->trdid,
     
    136142
    137143#if DEBUG_RWLOCK_TYPE
    138 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     144if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     145    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     146    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    139147printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
    140148__FUNCTION__, this->process->pid, this->trdid,
     
    161169
    162170#if DEBUG_RWLOCK_TYPE
    163 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     171if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     172    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     173    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    164174printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
    165175__FUNCTION__, this->process->pid, this->trdid,
     
    187197thread_t * this = CURRENT_THREAD;
    188198uint32_t lock_type = lock->lock.type;
    189 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     199if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     200    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     201    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    190202printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
    191203__FUNCTION__, this->process->pid, this->trdid,
     
    201213
    202214#if DEBUG_RWLOCK_TYPE
    203 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     215if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     216    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     217    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    204218printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    205219__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
     
    223237
    224238#if DEBUG_RWLOCK_TYPE
    225 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     239if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     240    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     241    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    226242printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    227243__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
     
    257273thread_t * this = CURRENT_THREAD;
    258274uint32_t lock_type = lock->lock.type;
    259 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     275if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     276    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     277    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    260278printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
    261279__FUNCTION__, this->process->pid, this->trdid,
     
    270288
    271289#if DEBUG_RWLOCK_TYPE
    272 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     290if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     291    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     292    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    273293printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    274294__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
     
    291311
    292312#if DEBUG_RWLOCK_TYPE
    293 if( (DEBUG_RWLOCK_TYPE == lock_type) || (DEBUG_RWLOCK_TYPE == 1000) )
     313if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
     314    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
     315    (local_cxy      == DEBUG_RWLOCK_CXY ) )
    294316printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
    295317__FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
Note: See TracChangeset for help on using the changeset viewer.