linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
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:23:29 +0100	[thread overview]
Message-ID: <39547002-74f3-66c4-93ce-9adf72841b8e@gmail.com> (raw)
In-Reply-To: <20190125190715.GG22211@lunn.ch>

On 25.01.2019 20:07, Andrew Lunn wrote:
>> 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
> 

Thanks, good to know.

The following doesn't hurt us here, but things like this have to be
considered too. According to chip spec:

"The ID registers 0-5 are only permitted to write by 4-byte access.
Read access can be byte, word, or double word access."

Heiner

  reply	other threads:[~2019-01-25 19:23 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
2019-01-25 19:23       ` Heiner Kallweit [this message]
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=39547002-74f3-66c4-93ce-9adf72841b8e@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --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).