linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Helge Deller <deller@gmx.de>
Cc: Parisc List <linux-parisc@vger.kernel.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: Re: [PATCH v2] parisc: Fix boot with kernel v5.14
Date: Mon, 6 Sep 2021 12:54:47 +0200	[thread overview]
Message-ID: <CAK8P3a0Tzi8L3+7YypPMukjDM+D8a_dxK1q7fOK357LATsouoA@mail.gmail.com> (raw)
In-Reply-To: <41e38a49-5a11-4f93-6771-b67d8184a673@gmx.de>

On Sun, Sep 5, 2021 at 11:40 PM Helge Deller <deller@gmx.de> wrote:
> On 9/2/21 10:41 PM, Arnd Bergmann wrote:
> >
> > The reason that the "output_len" access breaks is that gcc explicitly optimizes
> > the bytewise access  into word accesses because it assumes that global variables
> > are correctly declared, and that they are aligned according to the requirements
> > of the ABI.
> > This may be surprising and even unfortunate, but I can see why they did
> > this optimization, and that it helps in other cases as well.
>
> Arnd, you were absolutely correct and I was wrong.
>
> It seems to work nicely now after I changed the output_len variable to
> become an "extern char".

Ok, that's a relief, at least my patch wasn't the main cause then.

Changing the declaration to 'extern char' of course is still incorrect, so
this might cause other problems in the future, the same way that the
old declaration caused the problem by decaring the wrong alignment.

I think declaring it as an array of four characters, or a struct with reduced
alignment would be the safer choice here. Ideally however you would
change the linker script to insert a

    . = ALIGN(4);

before the output to make the variable properly aligned according to
the ABI. See 'git log arch/arm/kernel/vmlinux.lds.S' for a long history
of alignment changes we did there.

        Arnd

  reply	other threads:[~2021-09-06 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 20:46 [PATCH] parisc: Fix boot with kernel v5.14 Helge Deller
2021-09-02 14:06 ` [PATCH v2] " Helge Deller
2021-09-02 18:35   ` Arnd Bergmann
2021-09-02 19:48     ` Helge Deller
2021-09-02 20:19       ` Helge Deller
2021-09-02 20:41       ` Arnd Bergmann
2021-09-05 21:40         ` Helge Deller
2021-09-06 10:54           ` Arnd Bergmann [this message]
2021-09-06 20:15             ` Helge Deller
2021-09-06 21:49               ` Arnd Bergmann

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=CAK8P3a0Tzi8L3+7YypPMukjDM+D8a_dxK1q7fOK357LATsouoA@mail.gmail.com \
    --to=arnd@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    /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).