Skip to contentSkip to conversation

mips: dma-mapping: support debug_dma_mapping_error

PATCH New Shuah Khan 2 participants 9 messages Oct 25, 2012 – Nov 15, 2012 MIPS

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

PATCH 1/1 mips: dma-mapping: support debug_dma_mapping_error

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
 arch/mips/include/asm/dma-mapping.h |    1 +
 1 file changed, 1 insertion(+)
arch/mips/include/asm/dma-mapping.h +1 -0
index be39a12..0929b08 100644
@@ -40,6 +40,7 @@ static inline int dma_supported(struct device *dev, u64 mask)
 static inline int dma_mapping_error(struct device *dev, u64 mask)
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
+	debug_dma_mapping_error(dev, mask);
 	return ops->mapping_error(dev, mask);
 }
 
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH RESEND 1/1 mips: dma-mapping: support debug_dma_mapping_error

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
 arch/mips/include/asm/dma-mapping.h |    2 ++
 1 file changed, 2 insertions(+)
arch/mips/include/asm/dma-mapping.h +2 -0
index be39a12..006b43e 100644
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
 static inline int dma_mapping_error(struct device *dev, u64 mask)
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
+
+	debug_dma_mapping_error(dev, mask);
 	return ops->mapping_error(dev, mask);
 }
 
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 16 lines · Shuah Khan

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
  arch/mips/include/asm/dma-mapping.h |    2 ++
  1 file changed, 2 insertions(+)
arch/mips/include/asm/dma-mapping.h +0 -0
index be39a12..006b43e 100644

arch/mips/include/asm/dma-mapping.h static inline int dma_supported(struct device *dev, u64 mask) · line 47

Quoted 8 lines
arch/mips/include/asm/dma-mapping.h +2 -0
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
  static inline int dma_mapping_error(struct device *dev, u64 mask)
  {
  	struct dma_map_ops *ops = get_dma_ops(dev);
+
+	debug_dma_mapping_error(dev, mask);
  	return ops->mapping_error(dev, mask);
  }
 

Although this is a start, I don't think it is sufficient.

As far as I can tell, there are many missing calls to debug_dma_*() in the various MIPS commone and sub-architecture DMA code.

Really you (or someone) needs to look at *all* the functions in arch/mips/asm/dma-mapping.h, and arch/mips/mm/dma-default.c and find places missing a debug_dma_*().

Thanks,
David Daney

author
#3 lore raw
Quoted 28 lines · David Daney
Quoted 16 lines · Shuah Khan

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
  arch/mips/include/asm/dma-mapping.h |    2 ++
  1 file changed, 2 insertions(+)
arch/mips/include/asm/dma-mapping.h +0 -0
index be39a12..006b43e 100644

arch/mips/include/asm/dma-mapping.h static inline int dma_supported(struct device *dev, u64 mask) · line 47

Quoted 8 lines
arch/mips/include/asm/dma-mapping.h +2 -0
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
  static inline int dma_mapping_error(struct device *dev, u64 mask)
  {
  	struct dma_map_ops *ops = get_dma_ops(dev);
+
+	debug_dma_mapping_error(dev, mask);
  	return ops->mapping_error(dev, mask);
  }
 

Although this is a start, I don't think it is sufficient.

Quoted 6 lines

As far as I can tell, there are many missing calls to debug_dma_*() in the various MIPS commone and sub-architecture DMA code.

Really you (or someone) needs to look at *all* the functions in arch/mips/asm/dma-mapping.h, and arch/mips/mm/dma-default.c and find places missing a debug_dma_*().

Is it correct to assume that this patch is not needed on MIPS until debug_dma interfaces get added to MIPS common and sub-architecture DMA code.

When I didn't see dma_map_page() in arch/mips/include/asm/dma-mapping.h defined, and just an extern, I incorrectly assumed, it is getting picked up from <asm-generic/dma-mapping-common.h>, hence the need for this patch in the first place.

-- Shuah

#4 lore raw
Quoted 32 lines · Shuah Khan
Quoted 31 lines · David Daney
Quoted 16 lines · Shuah Khan

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
   arch/mips/include/asm/dma-mapping.h |    2 ++
   1 file changed, 2 insertions(+)
arch/mips/include/asm/dma-mapping.h +0 -0
index be39a12..006b43e 100644

arch/mips/include/asm/dma-mapping.h static inline int dma_supported(struct device *dev, u64 mask) · line 47

Quoted 8 lines
arch/mips/include/asm/dma-mapping.h +2 -0
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
   static inline int dma_mapping_error(struct device *dev, u64 mask)
   {
   	struct dma_map_ops *ops = get_dma_ops(dev);
+
+	debug_dma_mapping_error(dev, mask);
   	return ops->mapping_error(dev, mask);
   }
 

Although this is a start, I don't think it is sufficient.

As far as I can tell, there are many missing calls to debug_dma_*() in the various MIPS commone and sub-architecture DMA code.

Quoted 7 lines
Quoted 3 lines

Really you (or someone) needs to look at *all* the functions in arch/mips/asm/dma-mapping.h, and arch/mips/mm/dma-default.c and find places missing a debug_dma_*().

Is it correct to assume that this patch is not needed on MIPS until debug_dma interfaces get added to MIPS common and sub-architecture DMA code.

No, you have a false predicate here.

debug_dma_* *is* already mostly added. The problem is that it is incomplete. That is the nature of the problem. Your patch makes it slightly better, but doesn't fully fix the problems.

Quoted 10 lines

When I didn't see dma_map_page() in arch/mips/include/asm/dma-mapping.h defined, and just an extern, I incorrectly assumed, it is getting picked up from <asm-generic/dma-mapping-common.h>, hence the need for this patch in the first place.

-- Shuah

author
#5 lore raw
Quoted 41 lines · David Daney
Quoted 32 lines · Shuah Khan
Quoted 31 lines · David Daney
Quoted 16 lines · Shuah Khan

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

---
   arch/mips/include/asm/dma-mapping.h |    2 ++
   1 file changed, 2 insertions(+)
arch/mips/include/asm/dma-mapping.h +0 -0
index be39a12..006b43e 100644

arch/mips/include/asm/dma-mapping.h static inline int dma_supported(struct device *dev, u64 mask) · line 47

Quoted 8 lines
arch/mips/include/asm/dma-mapping.h +2 -0
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
   static inline int dma_mapping_error(struct device *dev, u64 mask)
   {
   	struct dma_map_ops *ops = get_dma_ops(dev);
+
+	debug_dma_mapping_error(dev, mask);
   	return ops->mapping_error(dev, mask);
   }
 

Although this is a start, I don't think it is sufficient.

As far as I can tell, there are many missing calls to debug_dma_*() in the various MIPS commone and sub-architecture DMA code.

Quoted 7 lines
Quoted 3 lines

Really you (or someone) needs to look at *all* the functions in arch/mips/asm/dma-mapping.h, and arch/mips/mm/dma-default.c and find places missing a debug_dma_*().

Is it correct to assume that this patch is not needed on MIPS until debug_dma interfaces get added to MIPS common and sub-architecture DMA code.

Quoted 5 lines

No, you have a false predicate here.

debug_dma_* *is* already mostly added. The problem is that it is incomplete. That is the nature of the problem. Your patch makes it slightly better, but doesn't fully fix the problems.

Got it. Thanks. I would volunteer to look at fixing all the problems, but unfortunately I don't have a MIPS box handy for a thorough testing that would be necessary for such a change.

-- Shuah

Quoted 13 lines
Quoted 12 lines

When I didn't see dma_map_page() in arch/mips/include/asm/dma-mapping.h defined, and just an extern, I incorrectly assumed, it is getting picked up from <asm-generic/dma-mapping-common.h>, hence the need for this patch in the first place.

-- Shuah

#6 lore raw
Quoted 5 lines · Shuah Khan
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Shuah Khan
Quoted 4 lines

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

I'm confused.

Your claim that a 'warning is generated' seems to be in conflict with...

[...]

Quoted 2 lines

Got it. Thanks. I would volunteer to look at fixing all the problems, but unfortunately I don't have a MIPS box handy

This statement that you don't have hardware that exhibits the problem.

How was the patch tested? How do you even know there is a problem?

David Daney

author
#7 lore raw
Quoted 13 lines · David Daney
Quoted 5 lines · Shuah Khan
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Shuah Khan
Quoted 4 lines

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

I'm confused.

Your claim that a 'warning is generated' seems to be in conflict with...

Quoted 7 lines

[...]

Quoted 2 lines

Got it. Thanks. I would volunteer to look at fixing all the problems, but unfortunately I don't have a MIPS box handy

This statement that you don't have hardware that exhibits the problem.

How was the patch tested? How do you even know there is a problem?

I enhanced the existing dma debug interfaces to add an interface to debug missing dma_mapping_error() checks. That went into linux-next. With this patch, when dma_map_page() and dma_map_single() are debugged with a call to debug_dma_map_page() and the corresponding dma_mapping_error() interface doesn't call debug_dma_mapping_error() interface, a warning will be generated. I have been sending changes to arch specific dma_mapping_error() routines to add this debug interface. That is why I marked this patch RFT requesting testing.

Thanks,
-- Shuah

author
#8 lore raw
Quoted 22 lines · Shuah Khan
Quoted 13 lines · David Daney
Quoted 5 lines · Shuah Khan
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Shuah Khan
Quoted 4 lines

Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated.

I'm confused.

Your claim that a 'warning is generated' seems to be in conflict with...

Quoted 7 lines

[...]

Quoted 2 lines

Got it. Thanks. I would volunteer to look at fixing all the problems, but unfortunately I don't have a MIPS box handy

This statement that you don't have hardware that exhibits the problem.

How was the patch tested? How do you even know there is a problem?

Quoted 8 lines

I enhanced the existing dma debug interfaces to add an interface to debug missing dma_mapping_error() checks. That went into linux-next. With this patch, when dma_map_page() and dma_map_single() are debugged with a call to debug_dma_map_page() and the corresponding dma_mapping_error() interface doesn't call debug_dma_mapping_error() interface, a warning will be generated. I have been sending changes to arch specific dma_mapping_error() routines to add this debug interface. That is why I marked this patch RFT requesting testing.

Marek,

This one is for mips to go through your tree with the other arch patches for debug_dma_mapping_error().

Thanks,
-- Shuah