Skip to content

Commit

Permalink
locking, x86, iommu: Annotate qi->q_lock as raw
Browse files Browse the repository at this point in the history
The qi->q_lock lock can be taken in atomic context and therefore
cannot be preempted on -rt - annotate it.

In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Sep 13, 2011
1 parent 96f8e98 commit 3b8f404
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions drivers/iommu/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,11 @@ int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
restart:
rc = 0;

spin_lock_irqsave(&qi->q_lock, flags);
raw_spin_lock_irqsave(&qi->q_lock, flags);
while (qi->free_cnt < 3) {
spin_unlock_irqrestore(&qi->q_lock, flags);
raw_spin_unlock_irqrestore(&qi->q_lock, flags);
cpu_relax();
spin_lock_irqsave(&qi->q_lock, flags);
raw_spin_lock_irqsave(&qi->q_lock, flags);
}

index = qi->free_head;
Expand Down Expand Up @@ -965,15 +965,15 @@ int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu)
if (rc)
break;

spin_unlock(&qi->q_lock);
raw_spin_unlock(&qi->q_lock);
cpu_relax();
spin_lock(&qi->q_lock);
raw_spin_lock(&qi->q_lock);
}

qi->desc_status[index] = QI_DONE;

reclaim_free_desc(qi);
spin_unlock_irqrestore(&qi->q_lock, flags);
raw_spin_unlock_irqrestore(&qi->q_lock, flags);

if (rc == -EAGAIN)
goto restart;
Expand Down Expand Up @@ -1159,7 +1159,7 @@ int dmar_enable_qi(struct intel_iommu *iommu)
qi->free_head = qi->free_tail = 0;
qi->free_cnt = QI_LENGTH;

spin_lock_init(&qi->q_lock);
raw_spin_lock_init(&qi->q_lock);

__dmar_enable_qi(iommu);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/intel-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ struct qi_desc {
};

struct q_inval {
spinlock_t q_lock;
raw_spinlock_t q_lock;
struct qi_desc *desc; /* invalidation queue */
int *desc_status; /* desc status */
int free_head; /* first free entry */
Expand Down

0 comments on commit 3b8f404

Please sign in to comment.