lkml.org 
[lkml]   [2009]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix blktrace unaligned memory access
Jens Axboe wrote:
> On Fri, Jul 10 2009, Li Zefan wrote:
>> Jens Axboe wrote:
>>> Hi,
>>>
>>> It seems that relay_reserve() (or the ring_buffer_event_data(), that one
>>> still needs some love) can return unaligned memory, there's no way
>>> around that when you have pdu lengths that aren't a nice size. This can
>>> cause unaligned access warnings on platforms that care about alignment.
>>>
>> Seems relay_reserve() does nothing for alignment..On the other hand,
>> ring_buffer_event_data() returns a ptr which is 32bit-aligned, but
>> this still means it can cause unaligned accesses on 64bits arch, while
>> I think it's fixable in ring buffer, it's certainly not an easy job.
>
> Right, it's a bit nasty...
>

Lai Jiangshan noticed this issue long ago and had some ideas in mind
how to fix ring buffer, but never try it out for it will probably be
frustrating..

>>> This is an RFC, perhaps we can fix this in some other way. This one takes
>>> the simple approach, use an on-stack copy and memcpy() that to the
>>> destination.
>>>
>> or get_unaligned() ?
>
> put_unaligned(), you mean? The big question is then which is faster, using
> put_unaligned() or doing the memcpy() of the structure...
>

Ah, I meant put_unaligned().

I think the patch you posted can be a workaround at least for now, and
can be improved by detecting HAVE_EFFICIENT_UNALIGNED_ACCESS



\
 
 \ /
  Last update: 2009-07-10 11:33    [W:2.713 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site