Skip to content

Commit

Permalink
iommu/amd: Remove redundant WARN_ON()
Browse files Browse the repository at this point in the history
The WARN_ON() was introduced in commit 272e4f9 ("iommu/amd: WARN
when __[attach|detach]_device are called with irqs enabled") to ensure
that the domain->lock is taken in proper irqs disabled context. This
is required, because the domain->lock is taken as well in irq
context.

The proper context check by the WARN_ON() is redundant, because it is
already covered by LOCKDEP. When working with locks and changing
context, a run with LOCKDEP is required anyway and would detect the
wrong lock context.

Furthermore all callers for those functions are within the same file
and all callers acquire another lock which already disables interrupts.

Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Anna-Maria Gleixner authored and Joerg Roedel committed Jul 20, 2018
1 parent 90fcffd commit f1a066f
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1946,12 +1946,6 @@ static int __attach_device(struct iommu_dev_data *dev_data,
{
int ret;

/*
* Must be called with IRQs disabled. Warn here to detect early
* when its not.
*/
WARN_ON(!irqs_disabled());

/* lock domain */
spin_lock(&domain->lock);

Expand Down Expand Up @@ -2117,12 +2111,6 @@ static void __detach_device(struct iommu_dev_data *dev_data)
{
struct protection_domain *domain;

/*
* Must be called with IRQs disabled. Warn here to detect early
* when its not.
*/
WARN_ON(!irqs_disabled());

domain = dev_data->domain;

spin_lock(&domain->lock);
Expand Down

0 comments on commit f1a066f

Please sign in to comment.