Closed iguryanov closed 4 years ago
issue was actually reported against old u-boot 2009.06. It was already addressed in u-boot couple years ago - https://patchwork.ozlabs.org/patch/792238/
I see one of the reasons for this issue now is that structure type is not packed and variable is not volatile. Most reliable would be to build whole 2009.06 with "-fno-store-merging"
void
NetSetIP(volatile uchar * xip, IPaddr_t dest, int dport, int sport, int len)
{
IP_t *ip = (IP_t *)xip;
... ip->ip_p = 17; /* UDP */
ip->ip_sum = 0;
...
}
Hi,
new optimization introduced around 2018.09 release merges short memory accesses. This is an issue for existing arc700 code at least. For example - u-boot. That codebase does not rely much on volatiles and pointers to complex structures are often passed as uchar*.
Perhaps such optimization should not be applied to packed structures?
(as a side note, even Linux might suffer is it would fire unaligned exception handler for disassembling such unaligned accesses more often - all performance gains might be lost in a worst case).
Here are some pieces from u-boot use-case:
Old logic preserved if nop is inserted manually :
And this is how things are merged now (sorry, don't have bigger context):
Regards, Igor.