2011-02-01 21:22:12

by Chuck Ebbert

[permalink] [raw]
Subject: Re: b44 driver causes panic when using swiotlb

On Tue, 1 Feb 2011 10:28:00 +0900
FUJITA Tomonori <[email protected]> wrote:

>
> swiotlb allocates the bounce buffer when a system boots up. We can't
> allocate much in GFP_DMA. swiotlb uses somewhere under 4GB. So it
> can't help devices that have odd dma_mask (that is, except for 4GB).
>
> Unfortunately, Such device needs to do own custom bouncing or needs
> their subsystem to does that.

I think we're chasing the wrong problem here.

swiotlb uses alloc_bootmem_low_pages() to try to get buffers as low
in memory as possible. I asked someone who is hitting this bug to
try 2.6.36 and he reports the buffers really are low there:

2.6.36: 5c00000
2.6.37: db600000

So something happened very early in the 2.6.37-rc cycle that changed
this behavior. I tried looking at the bootmem code but could not see
the problem. The only related option I could find in .config was this:

# CONFIG_NO_BOOTMEM is not set

It was set this way in both .36 and .37.


2011-02-02 00:07:09

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: b44 driver causes panic when using swiotlb

On Tue, 1 Feb 2011 16:18:59 -0500
Chuck Ebbert <[email protected]> wrote:

> > swiotlb allocates the bounce buffer when a system boots up. We can't
> > allocate much in GFP_DMA. swiotlb uses somewhere under 4GB. So it
> > can't help devices that have odd dma_mask (that is, except for 4GB).
> >
> > Unfortunately, Such device needs to do own custom bouncing or needs
> > their subsystem to does that.
>
> I think we're chasing the wrong problem here.
>
> swiotlb uses alloc_bootmem_low_pages() to try to get buffers as low
> in memory as possible. I asked someone who is hitting this bug to
> try 2.6.36 and he reports the buffers really are low there:
>
> 2.6.36: 5c00000
> 2.6.37: db600000
>
> So something happened very early in the 2.6.37-rc cycle that changed
> this behavior. I tried looking at the bootmem code but could not see
> the problem. The only related option I could find in .config was this:
>
> # CONFIG_NO_BOOTMEM is not set
>
> It was set this way in both .36 and .37.

I don't think this matters because we can't guarantee that swiotlb
can't allocate ZONE_DMA. Obviously, the default swiotlb bouncing
buffer size, 64MB, is too large for ZONE_DMA.

If you are lucky, you sometimes can allocate lower memory if swiotlb
allocates lower memory at the boot time. But you can't assume
that. swiotlb isn't designed to handle such.

Can you try the patch that I sent you? As I wrote, b44 has the own
bouncing mechanism, so we should be fine if swiotlb returns an
appropriate error instead of just panicking.

2011-02-02 00:10:25

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: b44 driver causes panic when using swiotlb

On Wed, 2 Feb 2011 09:06:34 +0900
FUJITA Tomonori <[email protected]> wrote:

> On Tue, 1 Feb 2011 16:18:59 -0500
> Chuck Ebbert <[email protected]> wrote:
>
> > > swiotlb allocates the bounce buffer when a system boots up. We can't
> > > allocate much in GFP_DMA. swiotlb uses somewhere under 4GB. So it
> > > can't help devices that have odd dma_mask (that is, except for 4GB).
> > >
> > > Unfortunately, Such device needs to do own custom bouncing or needs
> > > their subsystem to does that.
> >
> > I think we're chasing the wrong problem here.
> >
> > swiotlb uses alloc_bootmem_low_pages() to try to get buffers as low
> > in memory as possible. I asked someone who is hitting this bug to
> > try 2.6.36 and he reports the buffers really are low there:
> >
> > 2.6.36: 5c00000
> > 2.6.37: db600000
> >
> > So something happened very early in the 2.6.37-rc cycle that changed
> > this behavior. I tried looking at the bootmem code but could not see
> > the problem. The only related option I could find in .config was this:
> >
> > # CONFIG_NO_BOOTMEM is not set
> >
> > It was set this way in both .36 and .37.
>
> I don't think this matters because we can't guarantee that swiotlb
> can't allocate ZONE_DMA.

Oops, I meant that, we can't guarantee that swiotlb allocates
ZONE_DMA.

> Obviously, the default swiotlb bouncing
> buffer size, 64MB, is too large for ZONE_DMA.
>
> If you are lucky, you sometimes can allocate lower memory if swiotlb
> allocates lower memory at the boot time. But you can't assume
> that. swiotlb isn't designed to handle such.
>
> Can you try the patch that I sent you? As I wrote, b44 has the own
> bouncing mechanism, so we should be fine if swiotlb returns an
> appropriate error instead of just panicking.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/