This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: glibc 2.21 - Machine maintainers, please test your machines.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Chris Metcalf <cmetcalf at ezchip dot com>, "Carlos O'Donell" <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, David Miller <davem at davemloft dot net>, Richard Henderson <rth at redhat dot com>, Mike Frysinger <vapier at gentoo dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>, Thomas Schwinge <thomas at codesourcery dot com>, Marcus Shawcroft <marcus dot shawcroft at linaro dot org>, Chung-Lin Tang <chunglin_tang at mentor dot com>, Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Mon, 26 Jan 2015 06:38:24 -0800
- Subject: Re: glibc 2.21 - Machine maintainers, please test your machines.
- Authentication-results: sourceware.org; auth=none
- References: <54C2BDD7 dot 7000304 at redhat dot com> <54C3B6D5 dot 3090308 at ezchip dot com> <1422119595 dot 29655 dot 42 dot camel at triegel dot csb> <54C5094A dot 8060300 at ezchip dot com> <54C51D94 dot 6030007 at ezchip dot com> <CAMe9rOpOuuC_Bf1eHs9iaiUY6V-fVMHUCKZPAwje_NemBy84wA at mail dot gmail dot com> <20150125215150 dot GA15033 at gmail dot com> <54C569E5 dot 9050305 at ezchip dot com> <CAMe9rOrundPWENuw-Ne=pW6706Rc9RLpkw7Zx859M9G1JRFk0A at mail dot gmail dot com> <mvmd261rj1p dot fsf at hawking dot suse dot de> <CAMe9rOotZWCHsp4Wizrk4_i+-CWVVxjrRy9n_9_sF7yuW9TyiQ at mail dot gmail dot com> <mvmlhkpps9f dot fsf at hawking dot suse dot de> <CAMe9rOoKMiLm1sUmQYFEkkO=SRTPqZkmHuBh7_4jLqFADTcZbA at mail dot gmail dot com> <1422280314 dot 29655 dot 110 dot camel at triegel dot csb> <CAMe9rOpsRFQBXyMGFg4jj02hC+bVxdb90FvDiFtOGU4Ow9dO9w at mail dot gmail dot com> <1422282931 dot 29655 dot 115 dot camel at triegel dot csb>
On Mon, Jan 26, 2015 at 6:35 AM, Torvald Riegel <triegel@redhat.com> wrote:
> On Mon, 2015-01-26 at 05:58 -0800, H.J. Lu wrote:
>> On Mon, Jan 26, 2015 at 5:51 AM, Torvald Riegel <triegel@redhat.com> wrote:
>> > On Mon, 2015-01-26 at 05:50 -0800, H.J. Lu wrote:
>> >> On Mon, Jan 26, 2015 at 5:48 AM, Andreas Schwab <schwab@suse.de> wrote:
>> >> > "H.J. Lu" <hjl.tools@gmail.com> writes:
>> >> >
>> >> >> On Mon, Jan 26, 2015 at 1:24 AM, Andreas Schwab <schwab@suse.de> wrote:
>> >> >>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>> >> >>>
>> >> >>>> It doesn't change the size, only increases alignment from 4 bytes to 8 bytes.
>> >> >>>
>> >> >>> Alignment is part of the ABI.
>> >> >>>
>> >> >>
>> >> >> For x32, we can increase alignment from 4 bytes to 8 bytes without breaking
>> >> >> existing binaries.
>> >> >
>> >> > The compiler may generate code to take advantage of the bigger
>> >> > alignment, which will fail if not fulfilled (this is not just about
>> >> > unaligned accesses).
>> >> >
>> >>
>> >> Failure shouldn't happen on x32 in this case.
>> >>
>> >
>> > Then please provide a *detailed* comment why this is the case along with
>> > the alignment change in x86 semaphore.h. Given that we're discussing
>> > whether this is safe or not, I think we should have detailed
>> > documentation. And this will also help conclude the discussion.
>> >
>>
>> This the part of x86 specification. From vol 1 of x86 SDM:
>>
>> 4.1.1 Alignment of Words, Doublewords, Quadwords, and Double Quadwords
>>
>> Words, doublewords, and quadwords do not need to be aligned in memory
>> on natural boundaries. The natural
>> boundaries for words, double words, and quadwords are even-numbered
>> addresses, addresses evenly divisible by
>> four, and addresses evenly divisible by eight, respectively. However,
>> to improve the performance of programs, data
>> structures (especially stacks) should be aligned on natural boundaries
>> whenever possible. The reason for this is
>> that the processor requires two memory accesses to make an unaligned
>> memory access; aligned accesses require
>> only one memory access. A word or doubleword operand that crosses a
>> 4-byte boundary or a quadword operand
>> that crosses an 8-byte boundary is considered unaligned and requires
>> two separate memory bus cycles for access.
>>
>> Do I really to quote this?
>>
>
> It made an experienced glibc developer wonder whether it would work, so
> personally, I think a comment in the code is useful. If we need to
> exchange emails about this, it's likely that others will wonder too, so
> a comment doesn't hurt.
> For example, I believe that if such a comment would have been part of
> the patch, we wouldn't need to have to discuss this, because it would
> have been clear from the start.
>
> IMO, we should want to make glibc simple instead of creating puzzles :)
>
> For the comment, I think that you could point to just this section, or
> summarize in a way that clarifies that unaligned is not an issue for
> x32, or something like that.
>
I will prepare a patch to include some comments.
--
H.J.
- References:
- glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.
- Re: glibc 2.21 - Machine maintainers, please test your machines.