All of lore.kernel.org
 help / color / mirror / Atom feed
From: oneukum@suse.de (Oliver Neukum)
To: linux-arm-kernel@lists.infradead.org
Subject: Problem with non aligned DMA in usbnet on ARM
Date: Fri, 13 Aug 2010 12:58:54 +0200	[thread overview]
Message-ID: <201008131258.55016.oneukum@suse.de> (raw)
In-Reply-To: <4C65193E.4090807@gmail.com>

Am Freitag, 13. August 2010, 12:06:54 schrieb Martin Fuzzey:

> So I think a policy needs to be defined to ensure this and enforced in
> the code. I can see two possible methods:
> 
> 1) Require that usb drivers submit buffers obtained from kmalloc() and
> friends with no extra offsets. If they want some other alignment later
> they can use memmove in the completion handler. Enforce this in the core
> by checking the buffer pointers are aligned to ARCH_KMALLOC_MINALIGN
> 
> or
> 
> 2) Require that usb_submit_urb() accept byte aligned buffers. Enforce
> this by a new test in usbtest (which all HCDs are expected to pass).
> Implement it either in individual HCDs that require it or by letting
> HCDs inform the core of their requirements and have the core do the
> alignment (as it already does the dma mapping). Of course HCDs that can
> implement byte aligned transfers (either natively or using tricks such
> as the one Russell suggested) should do so.
> 
> I think 2) is the better solution because:
> a) Solution 1 will impose a runtime overhead even on platforms / HCDs
> that don't need it (including the most common cases)
> b) There are more drivers than HCDs

Yes. But it doesn't prevent you from publishing this information so
drivers can help the lower levels.
	Regards
		Oliver

WARNING: multiple messages have this Message-ID (diff)
From: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
To: mfuzzey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: Matthieu CASTET
	<matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>,
	"Russell King - ARM Linux"
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Gary King <GKing-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-usb" <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
Subject: Re: Problem with non aligned DMA in usbnet on ARM
Date: Fri, 13 Aug 2010 12:58:54 +0200	[thread overview]
Message-ID: <201008131258.55016.oneukum@suse.de> (raw)
In-Reply-To: <4C65193E.4090807-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Am Freitag, 13. August 2010, 12:06:54 schrieb Martin Fuzzey:

> So I think a policy needs to be defined to ensure this and enforced in
> the code. I can see two possible methods:
> 
> 1) Require that usb drivers submit buffers obtained from kmalloc() and
> friends with no extra offsets. If they want some other alignment later
> they can use memmove in the completion handler. Enforce this in the core
> by checking the buffer pointers are aligned to ARCH_KMALLOC_MINALIGN
> 
> or
> 
> 2) Require that usb_submit_urb() accept byte aligned buffers. Enforce
> this by a new test in usbtest (which all HCDs are expected to pass).
> Implement it either in individual HCDs that require it or by letting
> HCDs inform the core of their requirements and have the core do the
> alignment (as it already does the dma mapping). Of course HCDs that can
> implement byte aligned transfers (either natively or using tricks such
> as the one Russell suggested) should do so.
> 
> I think 2) is the better solution because:
> a) Solution 1 will impose a runtime overhead even on platforms / HCDs
> that don't need it (including the most common cases)
> b) There are more drivers than HCDs

Yes. But it doesn't prevent you from publishing this information so
drivers can help the lower levels.
	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-08-13 10:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11  9:41 Problem with non aligned DMA in usbnet on ARM Martin Fuzzey
2010-08-11  9:41 ` Martin Fuzzey
2010-08-11  9:54 ` Russell King - ARM Linux
2010-08-11  9:54   ` Russell King - ARM Linux
2010-08-11 10:11   ` Martin Fuzzey
2010-08-11 10:11     ` Martin Fuzzey
2010-08-11 15:04     ` Greg KH
2010-08-11 15:04       ` Greg KH
2010-08-11 16:08       ` Martin Fuzzey
2010-08-11 16:08         ` Martin Fuzzey
2010-08-11 17:42         ` Greg KH
2010-08-11 17:42           ` Greg KH
2010-08-11 19:07           ` Martin Fuzzey
2010-08-11 19:07             ` Martin Fuzzey
2010-08-11 20:13             ` Greg KH
2010-08-11 20:13               ` Greg KH
2010-08-11 22:31               ` Martin Fuzzey
2010-08-11 22:31                 ` Martin Fuzzey
2010-08-12 17:01                 ` Matthieu CASTET
2010-08-12 17:01                   ` Matthieu CASTET
2010-08-11 19:10           ` Oliver Neukum
2010-08-11 19:10             ` Oliver Neukum
2010-08-11  9:59 ` Matthieu CASTET
2010-08-11  9:59   ` Matthieu CASTET
2010-08-11 11:38   ` Martin Fuzzey
2010-08-11 11:38     ` Martin Fuzzey
2010-08-11 15:54     ` Gary King
2010-08-11 20:35       ` Russell King - ARM Linux
2010-08-11 22:20         ` Martin Fuzzey
2010-08-11 22:20           ` Martin Fuzzey
2010-08-11 22:47           ` Russell King - ARM Linux
2010-08-11 22:47             ` Russell King - ARM Linux
2010-08-12 17:08           ` Matthieu CASTET
2010-08-12 17:08             ` Matthieu CASTET
2010-08-13 10:06             ` Martin Fuzzey
2010-08-13 10:06               ` Martin Fuzzey
2010-08-13 10:58               ` Oliver Neukum [this message]
2010-08-13 10:58                 ` Oliver Neukum
2010-08-13 13:42                 ` David Brownell
2010-08-13 13:42                   ` David Brownell
2010-08-13 13:53                   ` Oliver Neukum
2010-08-13 13:53                     ` Oliver Neukum

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=201008131258.55016.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.