LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH]iova-lockdep-false-alarm-fix.
@ 2008-02-21  0:35 mark gross
  2008-02-23  8:05 ` [PATCH]iova-lockdep-false-alarm-fix Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: mark gross @ 2008-02-21  0:35 UTC (permalink / raw)
  To: Andrew Morton, lkml

lockdep goes off on the iova copy_reserved_iova because it and a
function it calls grabs locks in the from, and the to of the copy
operation.

This patch gives the reserved_ioval_list locks special lockdep classes.


--mgross

Signed-off-by: <mgross@linux.intel.com>


Index: linux-2.6.24-mm1/drivers/pci/intel-iommu.c
===================================================================
--- linux-2.6.24-mm1.orig/drivers/pci/intel-iommu.c	2008-02-20 15:52:23.000000000 -0800
+++ linux-2.6.24-mm1/drivers/pci/intel-iommu.c	2008-02-20 16:08:27.000000000 -0800
@@ -1127,6 +1127,8 @@
 }
 
 static struct iova_domain reserved_iova_list;
+static struct lock_class_key reserved_alloc_key;
+static struct lock_class_key reserved_rbtree_key;
 
 static void dmar_init_reserved_ranges(void)
 {
@@ -1137,6 +1139,11 @@
 
 	init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN);
 
+	lockdep_set_class(&reserved_iova_list.iova_alloc_lock,
+		&reserved_alloc_key);
+	lockdep_set_class(&reserved_iova_list.iova_rbtree_lock,
+		&reserved_rbtree_key);
+
 	/* IOAPIC ranges shouldn't be accessed by DMA */
 	iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START),
 		IOVA_PFN(IOAPIC_RANGE_END));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]iova-lockdep-false-alarm-fix.
  2008-02-21  0:35 [PATCH]iova-lockdep-false-alarm-fix mark gross
@ 2008-02-23  8:05 ` Andrew Morton
  2008-02-25 15:55   ` [PATCH]iova-lockdep-false-alarm-fix mark gross
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-02-23  8:05 UTC (permalink / raw)
  To: mgross; +Cc: lkml


> Subject: [PATCH]iova-lockdep-false-alarm-fix.

Nice English titles, please...

On Wed, 20 Feb 2008 16:35:28 -0800 mark gross <mgross@linux.intel.com> wrote:

> lockdep goes off on the iova copy_reserved_iova because it and a
> function it calls grabs locks in the from, and the to of the copy
> operation.
> 
> This patch gives the reserved_ioval_list locks special lockdep classes.
> 
> 

Confused.  Why not fix the ranking inconsistency instead?

Your changelog doesn't tell us why this isn't a real bug?

> Index: linux-2.6.24-mm1/drivers/pci/intel-iommu.c
> ===================================================================
> --- linux-2.6.24-mm1.orig/drivers/pci/intel-iommu.c	2008-02-20 15:52:23.000000000 -0800
> +++ linux-2.6.24-mm1/drivers/pci/intel-iommu.c	2008-02-20 16:08:27.000000000 -0800
> @@ -1127,6 +1127,8 @@
>  }
>  
>  static struct iova_domain reserved_iova_list;
> +static struct lock_class_key reserved_alloc_key;
> +static struct lock_class_key reserved_rbtree_key;
>  
>  static void dmar_init_reserved_ranges(void)
>  {
> @@ -1137,6 +1139,11 @@
>  
>  	init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN);
>  
> +	lockdep_set_class(&reserved_iova_list.iova_alloc_lock,
> +		&reserved_alloc_key);
> +	lockdep_set_class(&reserved_iova_list.iova_rbtree_lock,
> +		&reserved_rbtree_key);
> +
>  	/* IOAPIC ranges shouldn't be accessed by DMA */
>  	iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START),
>  		IOVA_PFN(IOAPIC_RANGE_END));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]iova-lockdep-false-alarm-fix.
  2008-02-23  8:05 ` [PATCH]iova-lockdep-false-alarm-fix Andrew Morton
@ 2008-02-25 15:55   ` mark gross
  0 siblings, 0 replies; 3+ messages in thread
From: mark gross @ 2008-02-25 15:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml

On Sat, Feb 23, 2008 at 12:05:12AM -0800, Andrew Morton wrote:
> 
> > Subject: [PATCH]iova-lockdep-false-alarm-fix.
> 
> Nice English titles, please...
> 
> On Wed, 20 Feb 2008 16:35:28 -0800 mark gross <mgross@linux.intel.com> wrote:
> 
> > lockdep goes off on the iova copy_reserved_iova because it and a
> > function it calls grabs locks in the from, and the to of the copy
> > operation.
> > 
> > This patch gives the reserved_ioval_list locks special lockdep classes.
> > 
> > 
> 
> Confused.  Why not fix the ranking inconsistency instead?

Its not a ranking inconsistency issues the function grab locks of the
same lock classes triggering the warning.  The first lock grabbed is for
the constant reserved areas that is never accessed after early boot.
Technically you could do without grabbing the locks for the "from"
structure its copying reserved areas from.

But dropping the from locks to me looks wrong, even though it would be ok.

The affected code only runs in early boot as its setting up the DMAR
engines.

--mgross

> 
> Your changelog doesn't tell us why this isn't a real bug?
> 
> > Index: linux-2.6.24-mm1/drivers/pci/intel-iommu.c
> > ===================================================================
> > --- linux-2.6.24-mm1.orig/drivers/pci/intel-iommu.c	2008-02-20 15:52:23.000000000 -0800
> > +++ linux-2.6.24-mm1/drivers/pci/intel-iommu.c	2008-02-20 16:08:27.000000000 -0800
> > @@ -1127,6 +1127,8 @@
> >  }
> >  
> >  static struct iova_domain reserved_iova_list;
> > +static struct lock_class_key reserved_alloc_key;
> > +static struct lock_class_key reserved_rbtree_key;
> >  
> >  static void dmar_init_reserved_ranges(void)
> >  {
> > @@ -1137,6 +1139,11 @@
> >  
> >  	init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN);
> >  
> > +	lockdep_set_class(&reserved_iova_list.iova_alloc_lock,
> > +		&reserved_alloc_key);
> > +	lockdep_set_class(&reserved_iova_list.iova_rbtree_lock,
> > +		&reserved_rbtree_key);
> > +
> >  	/* IOAPIC ranges shouldn't be accessed by DMA */
> >  	iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START),
> >  		IOVA_PFN(IOAPIC_RANGE_END));

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-25 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-21  0:35 [PATCH]iova-lockdep-false-alarm-fix mark gross
2008-02-23  8:05 ` [PATCH]iova-lockdep-false-alarm-fix Andrew Morton
2008-02-25 15:55   ` [PATCH]iova-lockdep-false-alarm-fix mark gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).