linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-arch@vger.kernel.org, Andy Lutomirski <luto@amacapital.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH RFC 00/10] tools: Revamp the unaligned endian access functions
Date: Wed, 11 Jun 2014 14:52:36 -0700	[thread overview]
Message-ID: <5398CFA4.60202@zytor.com> (raw)
In-Reply-To: <20140611192111.GB16069@ravnborg.org>

On 06/11/2014 12:21 PM, Sam Ravnborg wrote:
> On Tue, Jun 10, 2014 at 04:13:04PM -0700, H. Peter Anvin wrote:
>> After a recent problem in the x86 tree, which seems to be the heaviest
>> but not the only user of these functions, I went through and did a
>> patchset to revamp the *user space* unaligned/endian accessor
>> functions.  As much as I think it is downright pathetic that this
>> functionality still isn't part of the C standard, that is life and we
>> have to deal with it.  Furthermore, although glibc has a pretty nice
>> set of functions for byte swapping in <endian.h>, taken from FreeBSD I
>> believe, some older systems don't support them.
>>
>> This variant tries to fill in all the holes.  It assumes that
>> <endian.h> define the functions as macros if they exist, as I don't
>> know any other way of probing for them without reaching for autoconf,
>> but that should be valid enough of an assumption in this case.
>>
>> The hope is that this should give reasonable, if not optimal, code
>> generation on most processors, and give a hook where arch maintainers
>> can add their own changes if needed.
> 
> This looks like a very complex solution to a simple problem.
> We want a shared implementation of the *user space*
> unaligned/endian accessor functions.
> But do we really want *fast* versions for our use?
> 
> This is not a new libc that should generate optimal code,
> but only something were we want to provide e working
> implmentation for use in our user-space tools.
> 
> A much simpler approach without any fallback to arch specific
> version etc. is everything we need.

It doesn't matter so much for things that are just done for the kernel
compile, no, but there are some tools that are built to be used as
standalone things, and it could matter there.

Please note that the code currently doesn't have any arch-specific bits
at all... the code is somewhat complex in part because it is very
generic and handles several levels of fallback.  It *can* get
arch-specific overrides if it matters, but the intent is that it
shouldn't be necessary in the vast majority of the cases.

	-hpa

  parent reply	other threads:[~2014-06-11 21:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 23:13 [PATCH RFC 00/10] tools: Revamp the unaligned endian access functions H. Peter Anvin
2014-06-10 23:13 ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 01/10] tools: Remove double-underscore symbols from user space byteshift functions H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 02/10] tools: Create <tools/unaligned.h> and an unaligned subdirectory H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 03/10] tools: Add le_direct/be_direct methods for unaligned access H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:25   ` Andy Lutomirski
2014-06-10 23:30     ` H. Peter Anvin
2014-06-10 23:30       ` H. Peter Anvin
2014-06-10 23:33       ` Andy Lutomirski
2014-06-10 23:33         ` Andy Lutomirski
2014-06-10 23:41         ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 04/10] tools: Add packed struct method for unaligned references H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 05/10] tools: Add <endian.h> libc support " H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 06/10] tools: Add gcc __builtin_bswap*() " H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 07/10] tools: Remove leading underscores from header guards H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 08/10] tools: Move unaligned common infrastructure into <tools/unaligned.h> H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 09/10] tools: Add common infrastructure for byte swapping H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-10 23:13 ` [PATCH RFC 10/10] tools: Use reasonable defaults for the default access H. Peter Anvin
2014-06-10 23:13   ` H. Peter Anvin
2014-06-11 19:21 ` [PATCH RFC 00/10] tools: Revamp the unaligned endian access functions Sam Ravnborg
2014-06-11 19:21   ` Sam Ravnborg
2014-06-11 21:52   ` H. Peter Anvin [this message]
2014-06-11 21:52     ` H. Peter Anvin
2014-06-13 20:04     ` Sam Ravnborg
2014-06-13 20:04       ` Sam Ravnborg

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=5398CFA4.60202@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).