All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Hommel, Thomas (GE EntSol,
	Intelligent Platforms)"  <Thomas.Hommel@gefanuc.com>,
	USB list <linux-usb@vger.kernel.org>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: ISP1760 driver crashes
Date: Wed, 19 Nov 2008 16:39:23 +0100	[thread overview]
Message-ID: <20081119153923.GR26308@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0811191027540.2418-100000@iolanthe.rowland.org>

On Wed, Nov 19 2008, Alan Stern wrote:
> On Wed, 19 Nov 2008, Jens Axboe wrote:
> 
> > On Wed, Nov 19 2008, Alan Stern wrote:
> > > On Wed, 19 Nov 2008, Sebastian Andrzej Siewior wrote:
> > > 
> > > > Hommel, Thomas (GE EntSol, Intelligent Platforms) wrote:
> > > > 
> > > > > I indeed have HIGHMEM enabled in my configuration.
> > > > > I recompiled the kernel without HIGHMEM and it works. I don't think that
> > > > > this a satisfying solution for a board with up to 2GB of RAM and
> > > > > considerable amount of VMALLOC space, but at least this works.
> > > > > If you have any more ideas how to circumvent this, please let me know.
> > > > Sure, this is not a sollution but atleast now I know what happens:
> > > > - The kernel allocates memory for transfer
> > > > - the memory is highmem and not in kernel so the buffer is NULL
> > > > - we don't have a dma-mask and therefore the dma address is 0
> > > > - boom
> > > > 
> > > > The sollution would be probably to prevent the usb-storage core to 
> > > > allocate memory from HIGHMEM.
> > > 
> > > usb-storage doesn't allocate the memory.  The memory is allocated by 
> > > the block layer or the filesystem.
> > > 
> > > > Now I don't if there is a flag for something 
> > > > like that and I am not using that. On the other hand this may be broken 
> > > > for a long time and you are the first one which has that much memory with 
> > > > no DMA-capable USB controller.
> > > 
> > > Jens, is there any way to tell the kernel that a device uses PIO and 
> > > therefore its buffers shouldn't be allocated in high memory?  For 
> > > example, shouldn't a NULL dma_mask do this?
> > 
> > Sure, just use blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH), then you are
> > certain that you will always have a virtual mapping for the IO you
> > receive.
> > 
> > Or you can use the bio kmap/kunmap helpers to get such a mapping
> > temporarily if you wish. But if your pio condition is permanent, you may
> > as well just use bouncing.
> 
> Thank you.
> 
> Thomas, the blk_queue_bounce_limit() routine is called in 
> drivers/scsi/scsi_lib.c:__scsi_alloc_queue().  The value it passes is 
> computed by scsi_calculate_bounce_limit(), and in that routine 
> host_dev->dma_mask should be NULL (since isp1760-hcd sets the mask to 
> NULL).  Therefore the bounce limit should be 0xffffffff.
> 
> Now maybe this value isn't correct.  You can try the patch below to see 
> if it helps.  If it doesn't, add a printk in __scsi_alloc_queue() to 
> see what bounce limit value is getting used.
> 
> Alan Stern
> 
> 
> 
> Index: usb-2.6/drivers/scsi/scsi_lib.c
> ===================================================================
> --- usb-2.6.orig/drivers/scsi/scsi_lib.c
> +++ usb-2.6/drivers/scsi/scsi_lib.c
> @@ -1684,7 +1684,7 @@ static void scsi_request_fn(struct reque
>  u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
>  {
>  	struct device *host_dev;
> -	u64 bounce_limit = 0xffffffff;
> +	u64 bounce_limit = BLK_BOUNCE_HIGH;
>  
>  	if (shost->unchecked_isa_dma)
>  		return BLK_BOUNCE_ISA;
> 

The best solution is probably to either provide a "doesn't do highmem"
in the scsi host template, or provide an appropriate DMA mask for the
pci device to indicate it through that setting instead.

-- 
Jens Axboe


  reply	other threads:[~2008-11-19 15:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4923F120.6000303@linutronix.de>
2008-11-19 14:59 ` ISP1760 driver crashes Alan Stern
2008-11-19 15:00   ` Jens Axboe
2008-11-19 15:36     ` Alan Stern
2008-11-19 15:39       ` Jens Axboe [this message]
2008-11-19 16:33         ` Alan Stern
2008-11-19 17:21           ` Jens Axboe
2008-11-20  5:40             ` FUJITA Tomonori
2008-11-20  7:33               ` Jens Axboe
2008-11-20 15:28               ` Alan Stern
2008-11-20 17:50                 ` Jens Axboe
2008-11-21 10:58                 ` Hommel, Thomas (GE EntSol, Intelligent Platforms)
2008-11-19 15:59       ` Hommel, Thomas (GE EntSol, Intelligent Platforms)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081119153923.GR26308@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=Thomas.Hommel@gefanuc.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.