public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/6] scsi: warn and avoid creating dma caches if DMA support is disabled
       [not found] <alpine.DEB.2.00.1105241650230.29780@chino.kir.corp.google.com>
@ 2011-05-24 23:53 ` David Rientjes
  2011-05-24 23:53 ` [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC David Rientjes
  1 sibling, 0 replies; 6+ messages in thread
From: David Rientjes @ 2011-05-24 23:53 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: Pekka Enberg, Christoph Lameter, linux-scsi, linux-kernel

__GFP_DMA may not be passed to scsi_{get,put}_host_cmd_pool() if
CONFIG_ZONE_DMA is disabled, which is now possible on x86.  If passed,
emit a warning and return.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 drivers/scsi/scsi.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -359,6 +359,11 @@ EXPORT_SYMBOL(scsi_put_command);
 static struct scsi_host_cmd_pool *scsi_get_host_cmd_pool(gfp_t gfp_mask)
 {
 	struct scsi_host_cmd_pool *retval = NULL, *pool;
+
+#ifndef CONFIG_ZONE_DMA
+	if (WARN_ON_ONCE(gfp_mask & __GFP_DMA))
+		return NULL;
+#endif
 	/*
 	 * Select a command slab for this host and create it if not
 	 * yet existent.
@@ -393,6 +398,10 @@ static void scsi_put_host_cmd_pool(gfp_t gfp_mask)
 {
 	struct scsi_host_cmd_pool *pool;
 
+#ifndef CONFIG_ZONE_DMA
+        if (WARN_ON_ONCE(gfp_mask & __GFP_DMA))
+                return;
+#endif
 	mutex_lock(&host_cmd_pool_mutex);
 	pool = (gfp_mask & __GFP_DMA) ? &scsi_cmd_dma_pool :
 		&scsi_cmd_pool;

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

* [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
       [not found] <alpine.DEB.2.00.1105241650230.29780@chino.kir.corp.google.com>
  2011-05-24 23:53 ` [patch 2/6] scsi: warn and avoid creating dma caches if DMA support is disabled David Rientjes
@ 2011-05-24 23:53 ` David Rientjes
  2011-05-25  8:04   ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: David Rientjes @ 2011-05-24 23:53 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: Pekka Enberg, Christoph Lameter, linux-scsi, linux-kernel

The Cisco FNIC driver requires creating a SLAB_CACHE_DMA cache, which is
not possible if CONFIG_ZONE_DMA is disasbled.  Avoid compiling it without
DMA support.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 drivers/scsi/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -688,7 +688,7 @@ config FCOE
 
 config FCOE_FNIC
 	tristate "Cisco FNIC Driver"
-	depends on PCI && X86
+	depends on PCI && X86 && ZONE_DMA
 	select LIBFCOE
 	help
 	  This is support for the Cisco PCI-Express FCoE HBA.

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

* Re: [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
  2011-05-24 23:53 ` [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC David Rientjes
@ 2011-05-25  8:04   ` Christoph Hellwig
  2011-05-25 19:28     ` Roland Dreier
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2011-05-25  8:04 UTC (permalink / raw)
  To: David Rientjes
  Cc: James E.J. Bottomley, Pekka Enberg, Christoph Lameter, linux-scsi,
	linux-kernel

On Tue, May 24, 2011 at 04:53:50PM -0700, David Rientjes wrote:
> The Cisco FNIC driver requires creating a SLAB_CACHE_DMA cache, which is
> not possible if CONFIG_ZONE_DMA is disasbled.  Avoid compiling it without
> DMA support.

And you're sure it actually needs it and isn't some sort of typo?  It
might help to Cc the maintainer to figure that out.

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

* Re: [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
  2011-05-25  8:04   ` Christoph Hellwig
@ 2011-05-25 19:28     ` Roland Dreier
  2011-05-25 23:35       ` Abhijeet Joglekar (abjoglek)
  0 siblings, 1 reply; 6+ messages in thread
From: Roland Dreier @ 2011-05-25 19:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: David Rientjes, James E.J. Bottomley, Pekka Enberg,
	Christoph Lameter, linux-scsi, linux-kernel, Abhijeet Joglekar,
	Joe Eykholt

On Wed, May 25, 2011 at 1:04 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> The Cisco FNIC driver requires creating a SLAB_CACHE_DMA cache, which is
>> not possible if CONFIG_ZONE_DMA is disasbled.  Avoid compiling it without
>> DMA support.
>
> And you're sure it actually needs it and isn't some sort of typo?  It
> might help to Cc the maintainer to figure that out.

Yes, almost certainly it is due to a misunderstanding of what
SLAB_CACHE_DMA means.
(fnic is a modern PCIe device that doesn't have 24-bit DMA restrictions ;)

So the correct fix would likely be to delete the SLAB_CACHE_DMA from the driver.

In any case cc'ing Cisco people as hch suggested...

 - R.

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

* RE: [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
  2011-05-25 19:28     ` Roland Dreier
@ 2011-05-25 23:35       ` Abhijeet Joglekar (abjoglek)
  2011-05-25 23:40         ` David Rientjes
  0 siblings, 1 reply; 6+ messages in thread
From: Abhijeet Joglekar (abjoglek) @ 2011-05-25 23:35 UTC (permalink / raw)
  To: Roland Dreier, Christoph Hellwig
  Cc: David Rientjes, James E.J. Bottomley, Pekka Enberg,
	Christoph Lameter, linux-scsi, linux-kernel

> -----Original Message-----
> From: roland@purestorage.com [mailto:roland@purestorage.com] On Behalf
> Of Roland Dreier
> Sent: Wednesday, May 25, 2011 12:29 PM
> To: Christoph Hellwig
> Cc: David Rientjes; James E.J. Bottomley; Pekka Enberg; Christoph
> Lameter; linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org;
> Abhijeet Joglekar (abjoglek); Joe Eykholt
> Subject: Re: [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
> 
> On Wed, May 25, 2011 at 1:04 AM, Christoph Hellwig <hch@infradead.org>
> wrote:
> >> The Cisco FNIC driver requires creating a SLAB_CACHE_DMA cache,
> which is
> >> not possible if CONFIG_ZONE_DMA is disasbled.  Avoid compiling it
> without
> >> DMA support.
> >
> > And you're sure it actually needs it and isn't some sort of typo?  It
> > might help to Cc the maintainer to figure that out.
> 
> Yes, almost certainly it is due to a misunderstanding of what
> SLAB_CACHE_DMA means.
> (fnic is a modern PCIe device that doesn't have 24-bit DMA restrictions
> ;)
> 
> So the correct fix would likely be to delete the SLAB_CACHE_DMA from
> the driver.
> 
> In any case cc'ing Cisco people as hch suggested...
> 
>  - R.

You are right, fnic hardware does not have any 24-bit DMA restrictions. When I coded it up, I misunderstood the flag as something that is required for allocating memory that hardware DMAs in/out of.

As Roland indicated, the correct fix would be to remove the SLAB_CACHE_DMA flag from the call to kmem_cache, and the GFP_DMA from the call to the mempool allocation routine.

I can create a patch (attributing the fix to David and Roland) and send out for review. Or if David wants, he can modify the patch he submitted to include this fix. David, please let me know how you want to proceed.

Thanks
-- abhijeet

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

* RE: [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC
  2011-05-25 23:35       ` Abhijeet Joglekar (abjoglek)
@ 2011-05-25 23:40         ` David Rientjes
  0 siblings, 0 replies; 6+ messages in thread
From: David Rientjes @ 2011-05-25 23:40 UTC (permalink / raw)
  To: Abhijeet Joglekar (abjoglek)
  Cc: Roland Dreier, Christoph Hellwig, James E.J. Bottomley,
	Pekka Enberg, Christoph Lameter, linux-scsi, linux-kernel

On Wed, 25 May 2011, Abhijeet Joglekar (abjoglek) wrote:

> As Roland indicated, the correct fix would be to remove the 
> SLAB_CACHE_DMA flag from the call to kmem_cache, and the GFP_DMA from 
> the call to the mempool allocation routine.
> 
> I can create a patch (attributing the fix to David and Roland) and send 
> out for review. Or if David wants, he can modify the patch he submitted 
> to include this fix. David, please let me know how you want to proceed.
> 

It'd be great if you could create a patch, you would certainly be able to 
speak with more authority on the hardware requirements in the changelog 
than I would :)

Thanks Roland, Christoph, and Abhijeet!

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

end of thread, other threads:[~2011-05-25 23:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <alpine.DEB.2.00.1105241650230.29780@chino.kir.corp.google.com>
2011-05-24 23:53 ` [patch 2/6] scsi: warn and avoid creating dma caches if DMA support is disabled David Rientjes
2011-05-24 23:53 ` [patch 3/6] scsi, fnic: require DMA support for Cisco FNIC David Rientjes
2011-05-25  8:04   ` Christoph Hellwig
2011-05-25 19:28     ` Roland Dreier
2011-05-25 23:35       ` Abhijeet Joglekar (abjoglek)
2011-05-25 23:40         ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox