All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
To: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	"linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2 1/2] i2c/busses: Diolan U2C-12 USB/I2C adapter driver
Date: Wed, 26 Jan 2011 23:49:53 +0000	[thread overview]
Message-ID: <20110126234953.GF15795@trinity.fluff.org> (raw)
In-Reply-To: <1295475373.9786.422.camel@groeck-laptop>

On Wed, Jan 19, 2011 at 02:16:13PM -0800, Guenter Roeck wrote:
> On Wed, 2011-01-19 at 16:14 -0500, Ben Dooks wrote:
> > On Wed, Jan 19, 2011 at 01:26:37PM -0800, Guenter Roeck wrote:
> > > Signed-off-by: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
>  [ ... ]
> 
> > > +/* Structure to hold all of our device specific stuff */
> > > +struct i2c_diolan_u2c {
> > > +	struct usb_device *usb_dev;	/* the usb device for this device */
> > > +	struct usb_interface *interface;/* the interface for this device */
> > > +	struct i2c_adapter adapter;	/* i2c related things */
> > > +	int olen;			/* Output buffer length */
> > > +	int ocount;			/* Number of enqueued messages */
> > > +	u8 obuffer[DIOLAN_OUTBUF_LEN];	/* output buffer */
> > > +	u8 ibuffer[DIOLAN_INBUF_LEN];	/* input buffer */
> > 
> > you should cache-line align the buffers to avoid any problems with
> > dma-vs-cache, etc.
> > 
> There are several other drivers which don't cache-align the buffers used
> with usb_bulk_msg(). Do those all have potential problems, or is this
> only relevant for optimization ?
> 
> If it is just for optimization, I'd argue that the speed here is so slow
> that it won't make much of a difference, if any, if the buffers were
> aligned.

It is more to do with the way some architectures/cpus deal with cache
coherency with resepect to DMA... in some cases it is possible for hardware
to be dealing with a buffer that the cpu may still be using if they are
not appropriately aligned. I forget the exact case, but losing a few bytes
in a buffer is preferable to the other case.

I also believe that X86 style architectures do not have this problem.

-- 
Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

  reply	other threads:[~2011-01-26 23:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 21:26 [PATCH v2 0/2] Add support for Diolan U2C-12 USB/I2C adapter Guenter Roeck
     [not found] ` <1295472398-705-1-git-send-email-guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2011-01-19 21:26   ` [PATCH v2 1/2] i2c/busses: Diolan U2C-12 USB/I2C adapter driver Guenter Roeck
     [not found]     ` <1295472398-705-2-git-send-email-guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2011-01-19 21:14       ` Ben Dooks
     [not found]         ` <20110119211403.GM5432-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2011-01-19 21:47           ` Guenter Roeck
2011-01-19 22:16           ` Guenter Roeck
2011-01-26 23:49             ` Ben Dooks [this message]
2011-01-19 21:26   ` [PATCH v2 2/2] MAINTAINERS: Add maintainer for Diolan U2C-12 I2C " Guenter Roeck
     [not found]     ` <1295472398-705-3-git-send-email-guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2011-01-19 20:56       ` Ben Dooks
     [not found]         ` <20110119205631.GL5432-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2011-01-19 21:10           ` Guenter Roeck
2011-01-26 23:47             ` Ben Dooks

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=20110126234953.GF15795@trinity.fluff.org \
    --to=ben-i2c-elnmno+kys3ytjvyw6ydsg@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.