public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Gilad Ben-Yossef <gilad@codefidence.com>
Cc: Laurent Pinchart <laurent.pinchart@skynet.be>,
	LKML <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] USB: use stack allocation for struct usb_ctrlrequest
Date: Wed, 10 Dec 2008 22:23:01 +0800	[thread overview]
Message-ID: <20081210142301.GA11490@localhost> (raw)
In-Reply-To: <493FCD12.30000@codefidence.com>

On Wed, Dec 10, 2008 at 04:07:14PM +0200, Gilad Ben-Yossef wrote:
> Wu Fengguang wrote:
> 
> > Hi Laurent,
> >
> > On Wed, Dec 10, 2008 at 11:40:09AM +0200, Laurent Pinchart wrote:
> >   
> >> Hi Wu,
> >>
> >> On Wednesday 10 December 2008, Wu Fengguang wrote:
> >>     
> >>> sizeof(struct usb_ctrlrequest) = 8, which is as small as the *dt pointer
> >>> in a 64bit system.
> >>>       
> >> The usb_ctrlrequest pointer is passed down to the hardware and must point to 
> >> DMA-able memory. For this reason you can't use the stack and must kmalloc() 
> >> the structure.
> >>     
> >
> > Ah thanks for the background. Does GFP_NOIO guarantee that?
> >   
> No, GFP_NOIO means - do not generate block IO operations (e.g. move 
> pages to swap, sync dirty buffers to permanent storage etc.) in order to 
> fulfill this allocation.
> 
> The reason for this flag here is presumably that such block IO 
> operations may very cause USB transaction of the very same kind we're 
> trying to service now, which can easily get us to a loop.

Right.

> > e.g. what if the memory is allocated from ZONE_HIGHMEM?
> >   
> In many cases there is no problem to DMA high memory. If you happen to 
> be working with a device that does have problems with full 32 bit 
> addresses then GFP_DMA would be the right flag, not GFP_NOIO.

For 64bit systems, we can easily go beyond 4GB physical memory.
So at least we should add GFP_DMA32 in addition to GFP_NOIO?

Thanks,
Fengguang


  reply	other threads:[~2008-12-10 14:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10  7:32 [PATCH] USB: use stack allocation for struct usb_ctrlrequest Wu Fengguang
2008-12-10  9:40 ` Laurent Pinchart
2008-12-10 12:43   ` Wu Fengguang
2008-12-10 14:07     ` Gilad Ben-Yossef
2008-12-10 14:23       ` Wu Fengguang [this message]
2008-12-10 14:31         ` Gilad Ben-Yossef
2008-12-11  0:01         ` Pete Zaitcev
2008-12-11  0:57           ` Robert Hancock
2008-12-11  0:59         ` Robert Hancock

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=20081210142301.GA11490@localhost \
    --to=fengguang.wu@intel.com \
    --cc=gilad@codefidence.com \
    --cc=gregkh@suse.de \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox