Re: [U-Boot] Unaligned memory accesses exception

2018-08-24 Thread Tom Rini
On Wed, Aug 22, 2018 at 09:44:16AM +0200, Fernando AE wrote:

> Hello all,
> 
> I'm bringing up U-Boot for an iMX6UL board, and I've encountered
> unaligned memory accesses exceptions while I was trying to test the
> ETH commands (e.g., 'ping').
> 
> After investigation, I found out that the iMX6UL processor traps
> unaligned memory accesses by default. As a workaround, I disabled
> theses checks, hoping for negligible performance loss.
> 
> I'm wondering if it is a bad idea to disable unaligned memory accesses
> during the U-Boot execution, regarding performance issues or other
> drawbacks at the kernel level.

What exactly do you mean by encountered?  Can you post logs?  Thanks.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Unaligned memory accesses exception

2018-08-22 Thread Bin Meng
Hi Fernando,

On Wed, Aug 22, 2018 at 5:16 PM, Fernando AE  wrote:
> Hi Bin,
>
> The problem lies in these 2 lines, in the ping_send function:
>
> eth_hdr_size = net_set_ether(net_tx_packet, net_null_ethaddr, PROT_IP);
> pkt = (uchar *)net_tx_packet + eth_hdr_size;
>
> While net_tx_packet is aligned to 32 bits, eth_hdr_size is 14. As a
> result 'pkt' is not aligned to 32 bits.

Thanks for the information. I see the alignment issue here.

>
> Further in the code structs like ip_hdr and icmp_hdr (correctly
> defined with words aligned to 32 bits) will point to 'pkt', generating
> the exceptions.
>
> Just to highlight, that I'm rather OK with U-Boot having the alignment
> exception disabled. I'm just wondering if the kernel expects such
> traps enabled or not, and the performance impact of userspace programs
> (further developed without alignment in mind).

Like I mentioned in the previous email, did you check how other ARMv7
targets behave? Do they turn off this check? My understanding is that
newer ARM targets support unaligned access by default. Added Tom to
this loop as he has more ARM experience than me.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Unaligned memory accesses exception

2018-08-22 Thread Bin Meng
Hi Fernando,

On Wed, Aug 22, 2018 at 3:44 PM, Fernando AE  wrote:
> Hello all,
>
> I'm bringing up U-Boot for an iMX6UL board, and I've encountered
> unaligned memory accesses exceptions while I was trying to test the
> ETH commands (e.g., 'ping').
>

Have you located the place where this unaligned memory access happens
in U-Boot source codes?

> After investigation, I found out that the iMX6UL processor traps
> unaligned memory accesses by default. As a workaround, I disabled
> theses checks, hoping for negligible performance loss.
>

How does other ARMv7 targets behave? Do they all turn ff the unaligned
memory access trap?

> I'm wondering if it is a bad idea to disable unaligned memory accesses
> during the U-Boot execution, regarding performance issues or other
> drawbacks at the kernel level.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Unaligned memory accesses exception

2018-08-22 Thread Fernando AE
Hello all,

I'm bringing up U-Boot for an iMX6UL board, and I've encountered
unaligned memory accesses exceptions while I was trying to test the
ETH commands (e.g., 'ping').

After investigation, I found out that the iMX6UL processor traps
unaligned memory accesses by default. As a workaround, I disabled
theses checks, hoping for negligible performance loss.

I'm wondering if it is a bad idea to disable unaligned memory accesses
during the U-Boot execution, regarding performance issues or other
drawbacks at the kernel level.

Thanks for your suggestions.
Best regards,
Fernando A. E.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot