From: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org, Andreas Larsson <andreas@gaisler.com>,
Anthony Yznaga <anthony.yznaga@oracle.com>
Subject: Re: [PATCH 4/4] sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara 4
Date: Fri, 29 Aug 2025 15:24:58 +0200 [thread overview]
Message-ID: <98cced9a-8bb2-4984-9db4-562bec9f462d@mkarcher.dialup.fu-berlin.de> (raw)
In-Reply-To: <4c827eba2ce2c501cb4e0b820653ae582ae87daf.camel@physik.fu-berlin.de>
Am 28.08.2025 um 22:21 schrieb John Paul Adrian Glaubitz:
> On Tue, 2025-08-26 at 18:03 +0200, Michael Karcher wrote:
>> EX_ST(STORE(stx, %g1, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
>> EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
>> - EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
>> + EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
>> EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
> Verified to not cause any regressions on SPARC T4. Whether it improved anything is
> hard to say. It might be that previously observed crashes after long uptimes are
> gone now.
I don't see how my patch will generate observable improvements. The patch is
"obviously correct", as it fixes the arithmetic progression 32/24/16/8, which
was originally interrupted, and also my test program agrees that the return
value is what it is "supposed to be" after applying the patch.
The old (likely unintended) code returns 8 more bytes left to copy than there
actually are left. This means that all bytes that are not indicated as "left
to copy" have actually been successfully copied, as well as 8 "hidden" bytes.
So the return value is kind-of valid.
Thus I think verifying that there are no regressions and reviewing the code
are the only quality assurance measures we can apply to this patch. I'm afraid
that this patch most likely will not fix the previously observed crashes, as
in this case, the return value was never too low (which could cause the kernel
to trust ouput bytes that have not been copied), and always less than the
amount requested to copy. Returning more bytes left than actually requested
can cause any kind of strange behaviour, as this is not expected by the callers
of this function, and can generate invalid states (like we observed with
negative file offsets in folio-enabled ext4 code with transparent huge pages
enabled on UltraSparc III).
Thanks for testing that there are indeed no regressions!
Kind regards,
Michael Karcher
prev parent reply other threads:[~2025-08-29 13:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 16:03 Fix accurate exception reporting in SPARC assembly Michael Karcher
2025-08-26 16:03 ` [PATCH 1/4] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC Michael Karcher
2025-08-29 10:53 ` John Paul Adrian Glaubitz
2025-09-02 16:33 ` Rene Rebe
2025-08-26 16:03 ` [PATCH 2/4] sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC III Michael Karcher
2025-08-27 6:34 ` John Paul Adrian Glaubitz
2025-08-28 15:53 ` John Paul Adrian Glaubitz
2025-08-30 1:57 ` Anthony Yznaga
2025-08-30 8:35 ` Michael Karcher
2025-09-02 16:38 ` Rene Rebe
2025-08-26 16:03 ` [PATCH 3/4] sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara Michael Karcher
2025-08-29 21:44 ` John Paul Adrian Glaubitz
2025-09-02 16:40 ` Rene Rebe
2025-09-02 16:47 ` John Paul Adrian Glaubitz
2025-09-02 16:51 ` Rene Rebe
2025-09-02 16:53 ` John Paul Adrian Glaubitz
2025-09-02 17:04 ` Rene Rebe
2025-09-02 17:11 ` John Paul Adrian Glaubitz
2025-09-02 21:51 ` René Rebe
2025-08-26 16:03 ` [PATCH 4/4] sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara 4 Michael Karcher
2025-08-27 6:37 ` John Paul Adrian Glaubitz
2025-08-28 20:21 ` John Paul Adrian Glaubitz
2025-08-29 13:24 ` Michael Karcher [this message]
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=98cced9a-8bb2-4984-9db4-562bec9f462d@mkarcher.dialup.fu-berlin.de \
--to=kernel@mkarcher.dialup.fu-berlin.de \
--cc=andreas@gaisler.com \
--cc=anthony.yznaga@oracle.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sparclinux@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).