Re: [sparc64] stall on CPU with current git master

From: Arnd Bergmann
Date: Fri Jan 31 2020 - 11:40:41 EST


On Fri, Jan 31, 2020 at 4:07 PM Anatoly Pugachev <matorola@xxxxxxxxx> wrote:
>
> Hello!
>
> Current git master branch (at the time of writing
> 5.5.0-07763-gccaaaf6fe5a5 ) started to hang on my sparc64 ldom.
> Bisected "stall on CPU" (which occasionally leads to machine hang) to
> this patch:
>
> $ git bisect bad
> 251ec1c159e4874fbede0c3c586e317e177c0c9b is the first bad commit
> commit 251ec1c159e4874fbede0c3c586e317e177c0c9b
> Author: Arnd Bergmann <arnd@xxxxxxxx>
> Date: Wed Dec 11 21:07:23 2019 +0100
>
> y2038: sparc: remove use of struct timex
>
> 'struct timex' is one of the last users of 'struct timeval' and is
> only referenced in one place in the kernel any more, to convert the
> user space timex into the kernel-internal version on sparc64, with a
> different tv_usec member type.
>
> As a preparation for hiding the time_t definition and everything
> using that in the kernel, change the implementation once more
> to only convert the timeval member, and then enclose the
> struct definition in an #ifdef.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> arch/sparc/kernel/sys_sparc_64.c | 33 +++++++++++++++++----------------
> include/uapi/linux/timex.h | 2 ++
> 2 files changed, 19 insertions(+), 16 deletions(-)
>
> $ git desc 251ec1c159e4874fbede0c3c586e317e177c0c9b
> v5.5-rc1-19-g251ec1c159e4
>
> kernel 5.5.0-rc1-00018-g4f9fbd893fe8 - works perfectly (i.e. does not
> hang or produce "stall on CPU" )
>
> current master with the patch reverted -
> 5.5.0-07763-gccaaaf6fe5a5-dirty - works perfectly
>
> current master 5.5.0-07763-gccaaaf6fe5a5 - stalls, hangs
>
>
> Can someone look what is wrong with it and/or probably revert it ?!
> Thanks.

Thanks for the report, I think I found the problem! Can you try this patch?

Arnd

diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 34917617f258..6b92fadb6ec7 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -551,7 +551,7 @@ SYSCALL_DEFINE2(getdomainname, char __user *,
name, int, len)
SYSCALL_DEFINE1(sparc_adjtimex, struct __kernel_timex __user *, txc_p)
{
struct __kernel_timex txc;
- struct __kernel_old_timeval *tv = (void *)&txc_p->time;
+ struct __kernel_old_timeval *tv = (void *)&txc.time;
int ret;

/* Copy the user data space into the kernel copy
@@ -576,7 +576,7 @@ SYSCALL_DEFINE2(sparc_clock_adjtime, const
clockid_t, which_clock,
struct __kernel_timex __user *, txc_p)
{
struct __kernel_timex txc;
- struct __kernel_old_timeval *tv = (void *)&txc_p->time;
+ struct __kernel_old_timeval *tv = (void *)&txc.time;
int ret;

if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) {
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 34917617f258..6b92fadb6ec7 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -551,7 +551,7 @@ SYSCALL_DEFINE2(getdomainname, char __user *, name, int, len)
SYSCALL_DEFINE1(sparc_adjtimex, struct __kernel_timex __user *, txc_p)
{
struct __kernel_timex txc;
- struct __kernel_old_timeval *tv = (void *)&txc_p->time;
+ struct __kernel_old_timeval *tv = (void *)&txc.time;
int ret;

/* Copy the user data space into the kernel copy
@@ -576,7 +576,7 @@ SYSCALL_DEFINE2(sparc_clock_adjtime, const clockid_t, which_clock,
struct __kernel_timex __user *, txc_p)
{
struct __kernel_timex txc;
- struct __kernel_old_timeval *tv = (void *)&txc_p->time;
+ struct __kernel_old_timeval *tv = (void *)&txc.time;
int ret;

if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) {