https://github.com/torvalds/linux
Revision bdbc29c19b2633b1d9c52638fb732bcde7a2031a authored by Paul Mackerras on 27 August 2013, 06:07:49 UTC, committed by Benjamin Herrenschmidt on 27 August 2013, 06:59:30 UTC
On 64-bit, __pa(&static_var) gets miscompiled by recent versions of
gcc as something like:

        addis 3,2,.LANCHOR1+4611686018427387904@toc@ha
        addi 3,3,.LANCHOR1+4611686018427387904@toc@l

This ends up effectively ignoring the offset, since its bottom 32 bits
are zero, and means that the result of __pa() still has 0xC in the top
nibble.  This happens with gcc 4.8.1, at least.

To work around this, for 64-bit we make __pa() use an AND operator,
and for symmetry, we make __va() use an OR operator.  Using an AND
operator rather than a subtraction ends up with slightly shorter code
since it can be done with a single clrldi instruction, whereas it
takes three instructions to form the constant (-PAGE_OFFSET) and add
it on.  (Note that MEMORY_START is always 0 on 64-bit.)

CC: <stable@vger.kernel.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent f5f6cbb
History
Tip revision: bdbc29c19b2633b1d9c52638fb732bcde7a2031a authored by Paul Mackerras on 27 August 2013, 06:07:49 UTC
powerpc: Work around gcc miscompilation of __pa() on 64-bit
Tip revision: bdbc29c
File Mode Size
netfilter
Kconfig -rw-r--r-- 21.4 KB
Makefile -rw-r--r-- 2.3 KB
af_inet.c -rw-r--r-- 44.2 KB
ah4.c -rw-r--r-- 12.4 KB
arp.c -rw-r--r-- 35.0 KB
cipso_ipv4.c -rw-r--r-- 63.4 KB
datagram.c -rw-r--r-- 2.7 KB
devinet.c -rw-r--r-- 56.1 KB
esp4.c -rw-r--r-- 16.8 KB
fib_frontend.c -rw-r--r-- 27.2 KB
fib_lookup.h -rw-r--r-- 1.5 KB
fib_rules.c -rw-r--r-- 7.2 KB
fib_semantics.c -rw-r--r-- 30.9 KB
fib_trie.c -rw-r--r-- 61.0 KB
gre_demux.c -rw-r--r-- 9.1 KB
gre_offload.c -rw-r--r-- 2.8 KB
icmp.c -rw-r--r-- 26.5 KB
igmp.c -rw-r--r-- 64.2 KB
inet_connection_sock.c -rw-r--r-- 26.2 KB
inet_diag.c -rw-r--r-- 28.6 KB
inet_fragment.c -rw-r--r-- 8.7 KB
inet_hashtables.c -rw-r--r-- 15.6 KB
inet_lro.c -rw-r--r-- 13.6 KB
inet_timewait_sock.c -rw-r--r-- 14.4 KB
inetpeer.c -rw-r--r-- 17.8 KB
ip_forward.c -rw-r--r-- 3.4 KB
ip_fragment.c -rw-r--r-- 20.1 KB
ip_gre.c -rw-r--r-- 22.1 KB
ip_input.c -rw-r--r-- 13.0 KB
ip_options.c -rw-r--r-- 15.3 KB
ip_output.c -rw-r--r-- 37.9 KB
ip_sockglue.c -rw-r--r-- 31.3 KB
ip_tunnel.c -rw-r--r-- 23.6 KB
ip_tunnel_core.c -rw-r--r-- 3.0 KB
ip_vti.c -rw-r--r-- 20.2 KB
ipcomp.c -rw-r--r-- 4.5 KB
ipconfig.c -rw-r--r-- 39.1 KB
ipip.c -rw-r--r-- 13.1 KB
ipmr.c -rw-r--r-- 63.6 KB
netfilter.c -rw-r--r-- 5.3 KB
ping.c -rw-r--r-- 28.5 KB
proc.c -rw-r--r-- 18.8 KB
protocol.c -rw-r--r-- 2.4 KB
raw.c -rw-r--r-- 24.9 KB
route.c -rw-r--r-- 65.9 KB
syncookies.c -rw-r--r-- 10.5 KB
sysctl_net_ipv4.c -rw-r--r-- 21.8 KB
tcp.c -rw-r--r-- 81.1 KB
tcp_bic.c -rw-r--r-- 6.2 KB
tcp_cong.c -rw-r--r-- 9.8 KB
tcp_cubic.c -rw-r--r-- 14.0 KB
tcp_diag.c -rw-r--r-- 1.8 KB
tcp_fastopen.c -rw-r--r-- 2.2 KB
tcp_highspeed.c -rw-r--r-- 4.9 KB
tcp_htcp.c -rw-r--r-- 7.4 KB
tcp_hybla.c -rw-r--r-- 4.9 KB
tcp_illinois.c -rw-r--r-- 8.2 KB
tcp_input.c -rw-r--r-- 162.8 KB
tcp_ipv4.c -rw-r--r-- 74.4 KB
tcp_lp.c -rw-r--r-- 8.8 KB
tcp_memcontrol.c -rw-r--r-- 7.1 KB
tcp_metrics.c -rw-r--r-- 27.1 KB
tcp_minisocks.c -rw-r--r-- 24.1 KB
tcp_offload.c -rw-r--r-- 7.5 KB
tcp_output.c -rw-r--r-- 91.6 KB
tcp_probe.c -rw-r--r-- 6.2 KB
tcp_scalable.c -rw-r--r-- 1.4 KB
tcp_timer.c -rw-r--r-- 18.2 KB
tcp_vegas.c -rw-r--r-- 9.6 KB
tcp_vegas.h -rw-r--r-- 902 bytes
tcp_veno.c -rw-r--r-- 5.7 KB
tcp_westwood.c -rw-r--r-- 8.0 KB
tcp_yeah.c -rw-r--r-- 6.9 KB
tunnel4.c -rw-r--r-- 4.1 KB
udp.c -rw-r--r-- 59.4 KB
udp_diag.c -rw-r--r-- 5.4 KB
udp_impl.h -rw-r--r-- 1.3 KB
udp_offload.c -rw-r--r-- 2.5 KB
udplite.c -rw-r--r-- 3.4 KB
xfrm4_input.c -rw-r--r-- 4.1 KB
xfrm4_mode_beet.c -rw-r--r-- 3.7 KB
xfrm4_mode_transport.c -rw-r--r-- 2.1 KB
xfrm4_mode_tunnel.c -rw-r--r-- 4.6 KB
xfrm4_output.c -rw-r--r-- 2.3 KB
xfrm4_policy.c -rw-r--r-- 7.2 KB
xfrm4_state.c -rw-r--r-- 2.4 KB
xfrm4_tunnel.c -rw-r--r-- 2.7 KB

back to top