From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Hennerich, Michael" <Michael.Hennerich@analog.com>
Cc: Bryan Wu <cooloney@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Robin Getz <rgetz@blackfin.uclinux.org>,
"Frysinger, Michael" <Michael.Frysinger@analog.com>
Subject: Re: [PATCH] USB/ISP1760: Fix for unaligned exceptions
Date: Wed, 19 Nov 2008 11:55:06 +0100 [thread overview]
Message-ID: <4923F08A.3020702@linutronix.de> (raw)
In-Reply-To: <8A42379416420646B9BFAC9682273B6D069B15C2@limkexm3.ad.analog.com>
Hennerich, Michael wrote:
> I know the issue is originated in either RTL8150 set_registers or
> get_registers. We get some unaligned address from the stack to the
> ISP1760 priv_read/wite_copy.
>
> The RTL8150 driver does something like this:
>
> u8 data[3], tmp;
>
> data[0] = phy;
> data[1] = data[2] = 0;
> tmp = indx | PHY_READ | PHY_GO;
> i = 0;
>
> set_registers(dev, PHYADD, sizeof(data), data);
ach. So that's wrong anyway. There are arches which can't DMA stack
memory. So fixing this properly does not fix just your arch.
>>> I wonder if it's only us (NOMMU) seeing these odd aligned buffers?
>> Not sure. The only problem I have with this patch is that you might
>> cover bugs in drivers and you don't notice it anymore since you choose
>> "voluntary" the slow path.
>
> Well here I disagree, but I agree with the fact that there are buggy
> drivers.
>
> Since most processors running Linux do have unaligned access handling,
> this issue goes unnoticed for all of them. Believe me the penalty taken
> by any Processor doing this automatically and unnoticed is typically
> much higher than using get/put_unaligned.
Okay. A packed struct with a u8 followed by u16 which is required by the
spec can't be fixed. unaligned helper is the only solution. I agree here.
Allocating memory on the stack for a dma transfer is wrong.
On PowerPC and X86 get_unaligned() does not behave any different than a
normal dereference. So I doubt that there is a performance improvement.
> I'm tiered fixing all unaligned issues in drivers. It's a hassle getting
> them merged, since most people don't care. Having a workaround in a
> single place, the hcd driver is much easier.
Having a fixup in the exception handler like sparc does is probably little
slower than the fixup here. On the other hand you would not have to fix
unaligned access anymore.
>>> -Michael
Sebastian
prev parent reply other threads:[~2008-11-19 10:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 9:22 [PATCH] USB/ISP1760: Fix for unaligned exceptions Bryan Wu
2008-11-18 10:52 ` Sebastian Andrzej Siewior
2008-11-18 15:41 ` Hennerich, Michael
2008-11-19 9:18 ` Sebastian Andrzej Siewior
2008-11-19 10:30 ` Hennerich, Michael
2008-11-19 10:55 ` Sebastian Andrzej Siewior [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=4923F08A.3020702@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=Michael.Frysinger@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=cooloney@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rgetz@blackfin.uclinux.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.