From: Ed L Cashin <ecashin@coraid.com>
To: trivial@rustcorp.com.au
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Roland Dreier <rolandd@cisco.com>
Subject: [patch 2.6.13] document alignment and byteorder macros
Date: Mon, 19 Sep 2005 15:22:01 -0400 [thread overview]
Message-ID: <87ll1suali.fsf@coraid.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
"David S. Miller" <davem@davemloft.net> writes:
> From: Ed L Cashin <ecashin@coraid.com>
> Date: Mon, 19 Sep 2005 10:24:00 -0400
>
>> 1) Passing le64_to_cpup an unaligned pointer is "OK" and within the
>> intended use of the function. I'm having trouble finding whether
>> this is documented somewhere.
>>
>> 2) These new changes to the sparc64 unaligned access fault handling
>> will make it OK to leave the aoe driver the way it is in the
>> mainline kernel.
>
> Both #1 and #2 are true.
>
> Although it's very much discouraged to dereference unaligned pointers,
> especially in performance critical code (which this AOE case is not,
> thankfully), because performance will be really bad as the trap
> handler has to fix up the access on RISC platforms.
Roland Dreier <rolandd@cisco.com> writes:
> David> Although it's very much discouraged to dereference
> David> unaligned pointers, especially in performance critical code
> David> (which this AOE case is not, thankfully), because
> David> performance will be really bad as the trap handler has to
> David> fix up the access on RISC platforms.
>
> Also, ia64 has a tendency to print an ugly message in the kernel log
> for unaligned accesses. Has anyone tried AoE on ia64?
>
> It might be better to change the AoE code to use get_unaligned(), just
> to document what's going on. Although clearly the sparc64 patch is
> correct as well -- we should never silently return the wrong data.
This patch comments the fact that although passing le64_to_cpup et
al. is within the intended use of the byteorder macros, using
get_unaligned is the recommended way to go.
Please speak up if there's a better place for this documentation to go
or a better way to say it.
document alignment and byteorder macros
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 745 bytes --]
Index: linux-2.6.13/include/linux/byteorder/generic.h
===================================================================
--- linux-2.6.13.orig/include/linux/byteorder/generic.h 2005-08-31 17:00:15.000000000 -0400
+++ linux-2.6.13/include/linux/byteorder/generic.h 2005-09-19 15:15:37.000000000 -0400
@@ -5,6 +5,10 @@
* linux/byteorder_generic.h
* Generic Byte-reordering support
*
+ * The "... p" macros, like le64_to_cpup, can be used with pointers
+ * to unaligned data, but there will be a performance penalty on
+ * some architectures. Use get_unaligned for unaligned data.
+ *
* Francois-Rene Rideau <fare@tunes.org> 19970707
* gathered all the good ideas from all asm-foo/byteorder.h into one file,
* cleaned them up.
[-- Attachment #3: Type: text/plain, Size: 41 bytes --]
--
Ed L Cashin <ecashin@coraid.com>
next reply other threads:[~2005-09-19 19:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-19 19:22 Ed L Cashin [this message]
2005-09-19 22:26 ` David S. Miller
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=87ll1suali.fsf@coraid.com \
--to=ecashin@coraid.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rolandd@cisco.com \
--cc=trivial@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®