linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] r8169: Load MAC address from device tree if present
Date: Fri, 25 Jan 2019 20:07:15 +0100	[thread overview]
Message-ID: <20190125190715.GG22211@lunn.ch> (raw)
In-Reply-To: <42d32783-c433-b859-6ba4-f2864f034871@gmail.com>

> Andrew, for my understanding: What do you think is wrong with the 
> alignment requirement? It was introduced because we do a 32 bit access
> to the start address of the array and want to avoid an unaligned access.

Hi Heiner

Because you are doing pointer aliasing, the compiler will by default
generate bad code, doing unaligned access. Adding the attribute works
around this. But it is just a work around. Since this is very slow
path code, i would just avoid the pointer aliasing, write a bit more C
code as Thierry suggested, and the optimiser will probably figure out
what is going on and produce reasonable code.

Also, in general, by avoiding pointer aliasing, you allow static code
checkers to work better. They are more likely to discover buffer
overruns, etc.

    Andrew

  reply	other threads:[~2019-01-25 19:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 10:18 [PATCH] r8169: Load MAC address from device tree if present Thierry Reding
2019-01-25 14:57 ` Andrew Lunn
2019-01-25 15:33   ` Thierry Reding
2019-01-25 18:26   ` Heiner Kallweit
2019-01-25 19:07     ` Andrew Lunn [this message]
2019-01-25 19:23       ` Heiner Kallweit
2019-01-25 18:34 ` Heiner Kallweit
2019-01-29 17:40   ` Thierry Reding
2019-01-29 18:51     ` Heiner Kallweit

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=20190125190715.GG22211@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=thierry.reding@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).