Hello Linus,
please pull s390 changes for 5.15-rc6.
Thank you,
Vasily
The following changes since commit a46044a92add6a400f4dada7b943b30221f7cc80:
s390/pci: fix zpci_zdev_put() on reserve (2021-10-04 09:49:10 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git tags/s390-5.15-6
for you to fetch changes up to 8b7216439e2e2128f6f1a19ad4b6be94d8b0e23d:
s390: add Alexander Gordeev as reviewer (2021-10-13 14:37:44 +0200)
----------------------------------------------------------------
s390 update for v5.15-rc6
- Maintainers and reviewers changes:
- Cornelia decided to free up her time and step down from vfio-ccw
maintainer and s390 kvm reviewer duties.
- Add Alexander Gordeev as s390 arch code reviewer.
- Fix broken strrchr implementation.
----------------------------------------------------------------
Cornelia Huck (2):
KVM: s390: remove myself as reviewer
vfio-ccw: step down as maintainer
Heiko Carstens (1):
s390: add Alexander Gordeev as reviewer
Roberto Sassu (1):
s390: fix strrchr() implementation
MAINTAINERS | 3 +--
arch/s390/lib/string.c | 15 +++++++--------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index abdcbcfef73d..888b329413d3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10275,7 +10275,6 @@ KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
M: Christian Borntraeger <[email protected]>
M: Janosch Frank <[email protected]>
R: David Hildenbrand <[email protected]>
-R: Cornelia Huck <[email protected]>
R: Claudio Imbrenda <[email protected]>
L: [email protected]
S: Supported
@@ -16297,6 +16296,7 @@ S390
M: Heiko Carstens <[email protected]>
M: Vasily Gorbik <[email protected]>
M: Christian Borntraeger <[email protected]>
+R: Alexander Gordeev <[email protected]>
L: [email protected]
S: Supported
W: http://www.ibm.com/developerworks/linux/linux390/
@@ -16375,7 +16375,6 @@ F: drivers/s390/crypto/vfio_ap_ops.c
F: drivers/s390/crypto/vfio_ap_private.h
S390 VFIO-CCW DRIVER
-M: Cornelia Huck <[email protected]>
M: Eric Farman <[email protected]>
M: Matthew Rosato <[email protected]>
R: Halil Pasic <[email protected]>
diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c
index cfcdf76d6a95..a95ca6df4e5e 100644
--- a/arch/s390/lib/string.c
+++ b/arch/s390/lib/string.c
@@ -259,14 +259,13 @@ EXPORT_SYMBOL(strcmp);
#ifdef __HAVE_ARCH_STRRCHR
char *strrchr(const char *s, int c)
{
- size_t len = __strend(s) - s;
-
- if (len)
- do {
- if (s[len] == (char) c)
- return (char *) s + len;
- } while (--len > 0);
- return NULL;
+ ssize_t len = __strend(s) - s;
+
+ do {
+ if (s[len] == (char)c)
+ return (char *)s + len;
+ } while (--len >= 0);
+ return NULL;
}
EXPORT_SYMBOL(strrchr);
#endif
The pull request you sent on Sat, 16 Oct 2021 11:26:08 +0200:
> git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git tags/s390-5.15-6
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/304040fb4909f7771caf6f8e8c61dbe51c93505a
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
On Sat, Oct 16, 2021 at 2:26 AM Vasily Gorbik <[email protected]> wrote:
>
> - Fix broken strrchr implementation.
I pulled this, but had to look at this commit just because it struck me as odd.
Is the generic strrchr() implementation so bad for s390 that it shows
up? It looks like the s390 implementation wants to avoid checking
separately against the final NUL character and basically uses the
optimized strlen function to do so, but when strrchr has to walk the
string _anyway_ this all looks a bit odd.
Not a big deal. I just get the feeling that s390 (and probably other
architectures) might be a bit too eager to make their own helper
string functions for reasons that may be historical ("we didn't have
generic string functions at all long ago") or misguided ("we'll do an
architecture-optimized version even for things that don't matter").
Linus
On Sat, Oct 16, 2021 at 09:22:12AM -0700, Linus Torvalds wrote:
> On Sat, Oct 16, 2021 at 2:26 AM Vasily Gorbik <[email protected]> wrote:
> >
> > - Fix broken strrchr implementation.
>
> I pulled this, but had to look at this commit just because it struck me as odd.
>
> Is the generic strrchr() implementation so bad for s390 that it shows
> up? It looks like the s390 implementation wants to avoid checking
> separately against the final NUL character and basically uses the
> optimized strlen function to do so, but when strrchr has to walk the
> string _anyway_ this all looks a bit odd.
The difference is that it walks the string from the end to the start,
taking into account that searching for the end of the string can be
considered fast.
> Not a big deal. I just get the feeling that s390 (and probably other
> architectures) might be a bit too eager to make their own helper
> string functions for reasons that may be historical ("we didn't have
> generic string functions at all long ago") or misguided ("we'll do an
> architecture-optimized version even for things that don't matter").
This function exists for historical reasons, and in this case it is
probably more the "optimized version for things that don't matter".
The only caller which sort of gets called more frequently seems to be
kbasename().
Some numbers, running 1.000.000 strrchr on an 80 byte string:
s390 generic search for
57us 55us first character in string
15us 55us last character in string
44us 55us character in middle of string
So yes, we could probably just drop our own implementation, given that
it hardly matters in real life.