public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: Daniel Mack <zonque@gmail.com>
Cc: linux-usb@vger.kernel.org, alsa-devel@alsa-project.org,
	Takashi Iwai <tiwai@suse.de>,
	Clemens Ladisch <clemens@ladisch.de>,
	florian@mickler.org, pedrib@gmail.com,
	William Light <wrl@illest.net>, Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Allocating buffers for USB transfers (again)
Date: Thu, 7 Jul 2011 15:53:59 +0200	[thread overview]
Message-ID: <20110707135359.GA4000@sig21.net> (raw)
In-Reply-To: <CACTFLANCYMXH=z+NxEF0aqpMGZp21Q16_uB=J3rndM3pW74qeA@mail.gmail.com>

On Thu, Jul 07, 2011 at 01:53:46PM +0200, Daniel Mack wrote:
> So my approach was to force the driver using memory that is DMA
> coherent, which leads to 32bit addressable memory if the device's
> DMA_MASK is set accordingly. Other drivers do the same, and the patch
> for doing this is found here: http://lkml.org/lkml/2010/5/7/61. Users
> that see the bug all report that this patch fixes their problem with
> my driver. However, it was rejected back then as other developers said
> it was fixing the wrong end, and that the driver doesn't necessarily
> need coherent memory.

I think this is a valid approach, and since it avoids
using bounce buffers it is potentially better wrt performance.
BTW, usb_alloc_coherent() doc comment says you need to set the
URB_NO_TRANSFER_DMA_MAP flag, which your patch fails to do.

> Takashi recently posted a patch to the bugzilla entry which uses a
> different approach: it introduces a function to determine suitable GFP
> flags for USB devices, and passes __DMA32 to kmalloc() eventually.
> However, using this flags directly with the SLUB allocator is illegal
> and causes a BUG() in mm/slub.c, cache_grow().

from gfp.h:
  /* Do not use these with a slab allocator */
  #define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)

I think it means you can only use __GFP_DMA32 for
get_free_pages(), not for kmalloc().

> 2. Find out exactly why these machines fail to install bounce buffers
> or set up their IOMMU correctly

I think this needs to be done.


Johannes

      parent reply	other threads:[~2011-07-07 13:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 11:53 Allocating buffers for USB transfers (again) Daniel Mack
2011-07-07 12:14 ` Clemens Ladisch
2011-07-07 12:29   ` Daniel Mack
2011-07-07 12:33 ` Oliver Neukum
2011-07-07 12:38   ` Daniel Mack
2011-07-07 13:08     ` Oliver Neukum
2011-07-08 15:13       ` Daniel Mack
2011-07-07 15:06     ` Alan Stern
2011-07-07 15:16     ` Florian Mickler
2011-08-10  7:51       ` Daniel Mack
2011-08-10 14:32         ` Alan Stern
2011-08-10 15:33           ` Daniel Mack
2011-08-10 18:06             ` Takashi Iwai
2011-08-10 23:15             ` Sarah Sharp
2011-08-11  0:57               ` Daniel Mack
2011-08-11 16:45                 ` Sarah Sharp
2011-08-11 17:27                   ` Daniel Mack
2011-08-11 18:05                     ` Sarah Sharp
2011-08-11 21:39                       ` Daniel Mack
2011-08-11 23:29                         ` Matěj Laitl
2011-08-11 23:40                           ` Daniel Mack
2011-08-11 23:50                             ` Matěj Laitl
2011-08-12  1:28                               ` Daniel Mack
2011-08-12  4:46                                 ` Sarah Sharp
2011-08-12  9:55                                   ` Daniel Mack
2011-08-11  3:22               ` Andiry Xu
2011-08-11 14:36                 ` Alan Stern
2011-07-07 13:53 ` Johannes Stezenbach [this message]

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=20110707135359.GA4000@sig21.net \
    --to=js@sig21.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=florian@mickler.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pedrib@gmail.com \
    --cc=tiwai@suse.de \
    --cc=wrl@illest.net \
    --cc=zonque@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox