From: Greg McGary <greg@mcgary.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-arch@vger.kernel.org
Subject: Re: Proposal: (u)intptr_t replaces (unsigned) long as opaque type
Date: Sun, 19 Sep 2010 09:53:40 -0700 [thread overview]
Message-ID: <4C964014.4090005@mcgary.org> (raw)
In-Reply-To: <20100919040635.GE25139@parisc-linux.org>
On 09/18/10 21:06, Matthew Wilcox wrote:
> But it's only the beginnings of your problems. There's so much userspace
> code that's written assuming ILP32 / LP64. Even inside the kernel,
> people are going to constantly break your port by introducing new code
> that doesn't use uintptr_t.
Actually, the kernel is my final problem. The userspace problem turned-out to
be quite manageable. Within a year, working mostly alone, I have complete binutils,
GCC, uClibc, busybox and QEMU (Linux userland mode) ports running and I didn't even
come close to pulling-out my hair. I have two-thirds of the SPEC2000 benchmarks
running correctly on QEMU, and I expect the remaining third to yield when I have
some time to debug them. QEMU required the most surgery, and of the same kind as
Linux needs: s/target_long/target_intptr_t/ for vars that hold addresses. uClibc
was also fast & loose in a few places regarding pointer/integer casts, but for the
most part, non-kernel code uses void* as the opaque type and char* or void* for
doing address arithmetic. The kernel is the sloppiest of all regarding
pointer/integer casts.
I'm unconcerned about future breakage. Over time, people will catch-on to the new
convention and breakage will diminish. I'm much happier about fixing new problems
as they arise than about maintaining a port that is perpetually far from the mainline.
> Then there are other things we use unsigned long for, like interrupt
> status flags (spin_lock_irqsave and friends). Should those be converted
> to some new type?
The only types that should be converted are for (a) opaque data that might hold
either a long or a pointer (e.g., ioctl arg, fcnt arg, generic callback function
args) and (b) data on which Linux does address arithmetic. If an interrupt status
flag is not intended to hold an address, then there's no reason to change it.
> Essentially, you're asking us to take on a huge number of changes in
> order to make your new processor's performance not suck. I don't think
> it likely you're going to find much sympathy here.
I propose this because (a) there is no impact on generated code for other ports,
and (b) it benefits code quality, flexibility, portability and self-documentation.
If the kernel is so ossified that avoiding changes has become the cardinal virtue,
then I guess I'm hosed. 8^) As stated before, I'm prepared to submit changes
slowly over time in order to moderate the impact.
G
next prev parent reply other threads:[~2010-09-19 16:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 21:42 Proposal: (u)intptr_t replaces (unsigned) long as opaque type Greg McGary
2010-09-18 23:54 ` Matthew Wilcox
2010-09-19 2:43 ` Greg McGary
2010-09-19 4:06 ` Matthew Wilcox
2010-09-19 16:53 ` Greg McGary [this message]
2010-09-20 9:30 ` Arnd Bergmann
2010-09-20 20:28 ` Greg McGary
2010-09-21 6:32 ` Arnd Bergmann
2010-09-19 4:33 ` Alexey Zaytsev
2010-09-19 6:50 ` David Howells
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=4C964014.4090005@mcgary.org \
--to=greg@mcgary.org \
--cc=linux-arch@vger.kernel.org \
--cc=matthew@wil.cx \
/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