Changeset d50acdbb in rtems for cpukit/libblock


Ignore:
Timestamp:
Mar 10, 2014, 7:25:32 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
28779c7
Parents:
ae88aa7
git-author:
Sebastian Huber <sebastian.huber@…> (03/10/14 07:25:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/11/14 09:58:09)
Message:

score: Add local context to SMP lock API

Add a local context structure to the SMP lock API for acquire and
release pairs. This context can be used to store the ISR level and
profiling information. It may be later used to enable more
sophisticated lock algorithms, e.g. MCS locks.

There is only one lock that cannot be used with a local context. This
is the per-CPU lock since here we would have to transfer the local
context through a context switch which is very complicated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/diskdevs.c

    rae88aa7 rd50acdbb  
    436436  rtems_status_code sc = RTEMS_SUCCESSFUL;
    437437  rtems_disk_device *dd = NULL;
    438   rtems_interrupt_level level;
    439 
    440   rtems_interrupt_lock_acquire(&diskdevs_lock, level);
     438  rtems_interrupt_lock_context lock_context;
     439
     440  rtems_interrupt_lock_acquire(&diskdevs_lock, &lock_context);
    441441  if (!diskdevs_protected) {
    442442    /* Frequent and quickest case */
    443443    dd = get_disk_entry(dev, false);
    444     rtems_interrupt_lock_release(&diskdevs_lock, level);
     444    rtems_interrupt_lock_release(&diskdevs_lock, &lock_context);
    445445  } else {
    446     rtems_interrupt_lock_release(&diskdevs_lock, level);
     446    rtems_interrupt_lock_release(&diskdevs_lock, &lock_context);
    447447
    448448    sc = disk_lock();
     
    459459rtems_disk_release(rtems_disk_device *dd)
    460460{
    461   rtems_interrupt_level level;
     461  rtems_interrupt_lock_context lock_context;
    462462  dev_t dev = dd->dev;
    463463  unsigned uses = 0;
    464464  bool deleted = false;
    465465
    466   rtems_interrupt_lock_acquire(&diskdevs_lock, level);
     466  rtems_interrupt_lock_acquire(&diskdevs_lock, &lock_context);
    467467  uses = --dd->uses;
    468468  deleted = dd->deleted;
    469   rtems_interrupt_lock_release(&diskdevs_lock, level);
     469  rtems_interrupt_lock_release(&diskdevs_lock, &lock_context);
    470470
    471471  if (uses == 0 && deleted) {
Note: See TracChangeset for help on using the changeset viewer.