linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
@ 2020-05-12 17:15 Christian Brauner
  2020-05-12 17:15 ` [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Christian Brauner @ 2020-05-12 17:15 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arnd Bergmann, Guo Ren, linux-csky, linux-kernel, sparclinux,
	Christian Brauner

Hey Dave,

I've tested this series with qemu-system-sparc64 and a Debian Sid image
and it comes up no problem (Here's a little recording
https://asciinema.org/a/329510 ). Process creation works fine for
fork(), vfork(), and clone() afaict. For sparc 32bit I tried my best,
but couldn't get my hands on either a compiler or a useable distro image
for pure sparc32. The changes should be straightforward though but
anyone who can test I'd appreciate it.

This is more or less the explanation also present in the first patch:

This is part of ongoing work that aims at getting rid of the
copy_thread()/copy_thread_tls() split that makes the process creation
codepaths in the kernel more convoluted and error-prone than they need
to be.

This is the sparc specific bit and _if_ you agree with the changes here
it'd be nice if I could get your review, and if technically correct,
your ack so I can fold this into a larger series and move on to the next
arch.

It also unblocks implementing clone3() on architectures not support
copy_thread_tls(). Any architecture that wants to implement clone3()
will need to select HAVE_COPY_THREAD_TLS and thus need to implement
copy_thread_tls(). So both goals are connected but independently
beneficial.

HAVE_COPY_THREAD_TLS means that a given architecture supports
CLONE_SETTLS and not setting it should usually mean that the
architectures doesn't implement it but that's not how things are. In
fact all architectures support CLONE_TLS it's just that they don't
follow the calling convention that HAVE_COPY_THREAD_TLS implies. That
means all architectures can be switched over to select
HAVE_COPY_THREAD_TLS. Once that is done we can remove that macro (yay,
less code), the unnecessary do_fork() export in kernel/fork.c, and also
rename copy_thread_tls() back to copy_thread(). At this point
copy_thread() becomes the main architecture specific part of process
creation but it will be the same layout and calling convention for all
architectures. (Once that is done we can probably cleanup each
copy_thread() function even more but that's for the future.)

Since sparc does support CLONE_SETTLS there's no reason to not select
HAVE_COPY_THREAD_TLS. This brings us one step closer to getting rid of
the copy_thread()/copy_thread_tls() split we still have and ultimately
the HAVE_COPY_THREAD_TLS define in general. A lot of architectures have
already converted and sparc is one of the few hat haven't yet. This also
unblocks implementing the clone3() syscall on sparc which I will follow
up later (if no one gets there before me). Once that is done we can get
of another ARCH_WANTS_* macro.

This patch just switches sparc64 over to HAVE_COPY_THREAD_TLS but not
sparc32 which will be done in the next patch. Once Any architecture that
supports HAVE_COPY_THREAD_TLS cannot call the do_fork() helper anymore.
This is fine and intended since it should be removed in favor of the
new, cleaner _do_fork() calling convention based on struct
kernel_clone_args. In fact, most architectures have already switched.
With this patch, sparc joins the other arches which can't use the
fork(), vfork(), clone(), clone3() syscalls directly and who follow the
new process creation calling convention that is based on struct
kernel_clone_args which we introduced a while back. This means less
custom assembly in the architectures entry path to set up the registers
before calling into the process creation helper and it is easier to to
support new features without having to adapt calling conventions. It
also unifies all process creation paths between fork(), vfork(),
clone(), and clone3(). (We can't fix the ABI nightmare that legacy
clone() is but we can prevent stuff like this happening in the future.)

Note that sparc can't easily call into the syscalls directly because of
its return value conventions when a new process is created which
needs to clobber the UREG_I1 register in copy_thread{_tls()} and it
needs to restore it if process creation fails. That's not a big deal
since the new process creation calling convention makes things simpler.

This removes sparc_do_fork() and replaces it with 3 clean helpers,
sparc_fork(), sparc_vfork(), and sparc_clone(). That means a little more
C code until the next patch unifies sparc 32bit and sparc64. It has the
advantage that we can remove quite a bit of assembler and it makes the
whole syscall.S process creation bits easier to read.
The follow-up patch will remove the custom sparc_do_fork() helper for
32bi sparc and move sparc_fork(), sparc_vfork(), and sparc_clone() into
a common process.c file. This allows us to remove quite a bit of
custom assembly form 32bit sparc's entry.S file too and allows to remove
even more code because now all helpers are shared between 32bit sparc
and sparc64 instead of having to maintain two separate sparc_do_fork()
implementations.

For some more context, please see:
commit 606e9ad20094f6d500166881d301f31a51bc8aa7
Merge: ac61145a725a 457677c70c76
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Jan 11 15:33:48 2020 -0800

    Merge tag 'clone3-tls-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

    Pull thread fixes from Christian Brauner:
     "This contains a series of patches to fix CLONE_SETTLS when used with
      clone3().

      The clone3() syscall passes the tls argument through struct clone_args
      instead of a register. This means, all architectures that do not
      implement copy_thread_tls() but still support CLONE_SETTLS via
      copy_thread() expecting the tls to be located in a register argument
      based on clone() are currently unfortunately broken. Their tls value
      will be garbage.

      The patch series fixes this on all architectures that currently define
      __ARCH_WANT_SYS_CLONE3. It also adds a compile-time check to ensure
      that any architecture that enables clone3() in the future is forced to
      also implement copy_thread_tls().

      My ultimate goal is to get rid of the copy_thread()/copy_thread_tls()
      split and just have copy_thread_tls() at some point in the not too
      distant future (Maybe even renaming copy_thread_tls() back to simply
      copy_thread() once the old function is ripped from all arches). This
      is dependent now on all arches supporting clone3().

      While all relevant arches do that now there are still four missing:
      ia64, m68k, sh and sparc. They have the system call reserved, but not
      implemented. Once they all implement clone3() we can get rid of
      ARCH_WANT_SYS_CLONE3 and HAVE_COPY_THREAD_TLS.

Note that in the meantime, m68k has already switched to the new calling
convention.

Christian Brauner (3):
  sparc64: enable HAVE_COPY_THREAD_TLS
  sparc: share process creation helpers between sparc and sparc64
  sparc: unconditionally enable HAVE_COPY_THREAD_TLS

 arch/sparc/Kconfig                |   1 +
 arch/sparc/include/asm/syscalls.h |   7 +-
 arch/sparc/kernel/Makefile        |   1 +
 arch/sparc/kernel/entry.S         |  29 ++------
 arch/sparc/kernel/kernel.h        |   7 +-
 arch/sparc/kernel/process.c       | 111 ++++++++++++++++++++++++++++++
 arch/sparc/kernel/process_32.c    |  34 ++-------
 arch/sparc/kernel/process_64.c    |  41 ++---------
 arch/sparc/kernel/syscalls.S      |  23 ++++---
 9 files changed, 147 insertions(+), 107 deletions(-)
 create mode 100644 arch/sparc/kernel/process.c


base-commit: 0e698dfa282211e414076f9dc7e83c1c288314fd
-- 
2.26.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS
  2020-05-12 17:15 [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args Christian Brauner
@ 2020-05-12 17:15 ` Christian Brauner
  2020-05-12 20:04   ` David Miller
  2020-05-12 17:15 ` [PATCH 2/3] sparc: share process creation helpers between sparc and sparc64 Christian Brauner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Christian Brauner @ 2020-05-12 17:15 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arnd Bergmann, Guo Ren, linux-csky, linux-kernel, sparclinux,
	Christian Brauner

This is part of a larger series that aims at getting rid of the
copy_thread()/copy_thread_tls() split that makes the process creation
codepaths in the kernel more convoluted and error-prone than they need
to be.
It also unblocks implementing clone3() on architectures not support
copy_thread_tls(). Any architecture that wants to implement clone3()
will need to select HAVE_COPY_THREAD_TLS and thus need to implement
copy_thread_tls(). So both goals are connected but independently
beneficial.

HAVE_COPY_THREAD_TLS means that a given architecture supports
CLONE_SETTLS and not setting it should usually mean that the
architectures doesn't implement it but that's not how things are. In
fact all architectures support CLONE_TLS it's just that they don't
follow the calling convention that HAVE_COPY_THREAD_TLS implies. That
means all architectures can be switched over to select
HAVE_COPY_THREAD_TLS. Once that is done we can remove that macro (yay,
less code), the unnecessary do_fork() export in kernel/fork.c, and also
rename copy_thread_tls() back to copy_thread(). At this point
copy_thread() becomes the main architecture specific part of process
creation but it will be the same layout and calling convention for all
architectures. (Once that is done we can probably cleanup each
copy_thread() function even more but that's for the future.)

Since sparc does support CLONE_SETTLS there's no reason to not select
HAVE_COPY_THREAD_TLS. This brings us one step closer to getting rid of
the copy_thread()/copy_thread_tls() split we still have and ultimately
the HAVE_COPY_THREAD_TLS define in general. A lot of architectures have
already converted and sparc is one of the few hat haven't yet. This also
unblocks implementing the clone3() syscall on sparc which I will follow
up later (if no one gets there before me). Once that is done we can get
of another ARCH_WANTS_* macro.

This patch just switches sparc64 over to HAVE_COPY_THREAD_TLS but not
sparc32 which will be done in the next patch. Once Any architecture that
supports HAVE_COPY_THREAD_TLS cannot call the do_fork() helper anymore.
This is fine and intended since it should be removed in favor of the
new, cleaner _do_fork() calling convention based on struct
kernel_clone_args. In fact, most architectures have already switched.
With this patch, sparc joins the other arches which can't use the
fork(), vfork(), clone(), clone3() syscalls directly and who follow the
new process creation calling convention that is based on struct
kernel_clone_args which we introduced a while back. This means less
custom assembly in the architectures entry path to set up the registers
before calling into the process creation helper and it is easier to to
support new features without having to adapt calling conventions. It
also unifies all process creation paths between fork(), vfork(),
clone(), and clone3(). (We can't fix the ABI nightmare that legacy
clone() is but we can prevent stuff like this happening in the future.)

Note that sparc can't easily call into the syscalls directly because of
its return value conventions when a new process is created which
needs to clobber the UREG_I1 register in copy_thread{_tls()} and it
needs to restore it if process creation fails. That's not a big deal
since the new process creation calling convention makes things simpler.

This removes sparc_do_fork() and replaces it with 3 clean helpers,
sparc_fork(), sparc_vfork(), and sparc_clone(). That means a little more
C code until the next patch unifies sparc 32bit and sparc64. It has the
advantage that we can remove quite a bit of assembler and it makes the
whole syscall.S process creation bits easier to read.
The follow-up patch will remove the custom sparc_do_fork() helper for
32bi sparc and move sparc_fork(), sparc_vfork(), and sparc_clone() into
a common process.c file. This allows us to remove quite a bit of
custom assembly form 32bit sparc's entry.S file too and allows to remove
even more code because now all helpers are shared between 32bit sparc
and sparc64 instead of having to maintain two separate sparc_do_fork()
implementations.

For some more context, please see:
commit 606e9ad20094f6d500166881d301f31a51bc8aa7
Merge: ac61145a725a 457677c70c76
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Jan 11 15:33:48 2020 -0800

    Merge tag 'clone3-tls-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

    Pull thread fixes from Christian Brauner:
     "This contains a series of patches to fix CLONE_SETTLS when used with
      clone3().

      The clone3() syscall passes the tls argument through struct clone_args
      instead of a register. This means, all architectures that do not
      implement copy_thread_tls() but still support CLONE_SETTLS via
      copy_thread() expecting the tls to be located in a register argument
      based on clone() are currently unfortunately broken. Their tls value
      will be garbage.

      The patch series fixes this on all architectures that currently define
      __ARCH_WANT_SYS_CLONE3. It also adds a compile-time check to ensure
      that any architecture that enables clone3() in the future is forced to
      also implement copy_thread_tls().

      My ultimate goal is to get rid of the copy_thread()/copy_thread_tls()
      split and just have copy_thread_tls() at some point in the not too
      distant future (Maybe even renaming copy_thread_tls() back to simply
      copy_thread() once the old function is ripped from all arches). This
      is dependent now on all arches supporting clone3().

      While all relevant arches do that now there are still four missing:
      ia64, m68k, sh and sparc. They have the system call reserved, but not
      implemented. Once they all implement clone3() we can get rid of
      ARCH_WANT_SYS_CLONE3 and HAVE_COPY_THREAD_TLS.

Note that in the meantime, m68k has already switched to the new calling
convention.

See: d95b56c77ef ("openrisc: Cleanup copy_thread_tls docs and comments")
See: 0b9f386c4be ("csky: Implement copy_thread_tls")
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guo Ren <guoren@kernel.org>
Cc: linux-csky@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 arch/sparc/Kconfig                |  1 +
 arch/sparc/include/asm/syscalls.h |  7 +--
 arch/sparc/kernel/process_64.c    | 94 ++++++++++++++++++++++++++-----
 arch/sparc/kernel/syscalls.S      | 23 ++++----
 4 files changed, 96 insertions(+), 29 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index da515fdad83d..423f6bc41de2 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -95,6 +95,7 @@ config SPARC64
 	select ARCH_HAS_PTE_SPECIAL
 	select PCI_DOMAINS if PCI
 	select ARCH_HAS_GIGANTIC_PAGE
+	select HAVE_COPY_THREAD_TLS
 
 config ARCH_PROC_KCORE_TEXT
 	def_bool y
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h
index 1d819f5e21da..35575fbfb9dc 100644
--- a/arch/sparc/include/asm/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
@@ -4,9 +4,8 @@
 
 struct pt_regs;
 
-asmlinkage long sparc_do_fork(unsigned long clone_flags,
-			      unsigned long stack_start,
-			      struct pt_regs *regs,
-			      unsigned long stack_size);
+asmlinkage long sparc_fork(struct pt_regs *regs);
+asmlinkage long sparc_vfork(struct pt_regs *regs);
+asmlinkage long sparc_clone(struct pt_regs *regs);
 
 #endif /* _SPARC64_SYSCALLS_H */
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 4282116e28e7..0222f638bdb2 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -573,31 +573,94 @@ void fault_in_user_windows(struct pt_regs *regs)
 	force_sig(SIGSEGV);
 }
 
-asmlinkage long sparc_do_fork(unsigned long clone_flags,
-			      unsigned long stack_start,
-			      struct pt_regs *regs,
-			      unsigned long stack_size)
+asmlinkage long sparc_fork(struct pt_regs *regs)
 {
-	int __user *parent_tid_ptr, *child_tid_ptr;
 	unsigned long orig_i1 = regs->u_regs[UREG_I1];
 	long ret;
+	struct kernel_clone_args args = {
+		.exit_signal	= SIGCHLD,
+		/* Reuse the parent's stack for the child. */
+		.stack		= regs->u_regs[UREG_FP],
+	};
+
+	ret = _do_fork(&args);
+
+	/* If we get an error and potentially restart the system
+	 * call, we're screwed because copy_thread_tls() clobbered
+	 * the parent's %o1.  So detect that case and restore it
+	 * here.
+	 */
+	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
+		regs->u_regs[UREG_I1] = orig_i1;
+
+	return ret;
+}
+
+asmlinkage long sparc_vfork(struct pt_regs *regs)
+{
+	unsigned long orig_i1 = regs->u_regs[UREG_I1];
+	long ret;
+
+	struct kernel_clone_args args = {
+		.flags		= CLONE_VFORK | CLONE_VM,
+		.exit_signal	= SIGCHLD,
+		/* Reuse the parent's stack for the child. */
+		.stack		= regs->u_regs[UREG_FP],
+	};
+
+	ret = _do_fork(&args);
+
+	/* If we get an error and potentially restart the system
+	 * call, we're screwed because copy_thread_tls() clobbered
+	 * the parent's %o1.  So detect that case and restore it
+	 * here.
+	 */
+	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
+		regs->u_regs[UREG_I1] = orig_i1;
+
+	return ret;
+}
+
+asmlinkage long sparc_clone(struct pt_regs *regs)
+{
+	unsigned long orig_i1 = regs->u_regs[UREG_I1];
+	unsigned int flags = lower_32_bits(regs->u_regs[UREG_I0]);
+	long ret;
+
+	struct kernel_clone_args args = {
+		.flags		= (flags & ~CSIGNAL),
+		.exit_signal	= (flags & CSIGNAL),
+		.tls		= regs->u_regs[UREG_I3],
+	};
 
 #ifdef CONFIG_COMPAT
 	if (test_thread_flag(TIF_32BIT)) {
-		parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
-		child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
+		args.pidfd	= compat_ptr(regs->u_regs[UREG_I2]);
+		args.child_tid	= compat_ptr(regs->u_regs[UREG_I4]);
+		args.parent_tid	= compat_ptr(regs->u_regs[UREG_I2]);
 	} else
 #endif
 	{
-		parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
-		child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
+		args.pidfd	= (int __user *)regs->u_regs[UREG_I2];
+		args.child_tid	= (int __user *)regs->u_regs[UREG_I4];
+		args.parent_tid	= (int __user *)regs->u_regs[UREG_I2];
 	}
 
-	ret = do_fork(clone_flags, stack_start, stack_size,
-		      parent_tid_ptr, child_tid_ptr);
+	/* Did userspace setup a separate stack for the child or are we
+	 * copying the parent's?
+	 */
+	if (regs->u_regs[UREG_I1])
+		args.stack = regs->u_regs[UREG_I1];
+	else
+		args.stack = regs->u_regs[UREG_FP];
+
+	if (!legacy_clone_args_valid(&args))
+		return -EINVAL;
+
+	ret = _do_fork(&args);
 
 	/* If we get an error and potentially restart the system
-	 * call, we're screwed because copy_thread() clobbered
+	 * call, we're screwed because copy_thread_tls() clobbered
 	 * the parent's %o1.  So detect that case and restore it
 	 * here.
 	 */
@@ -612,8 +675,9 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
  * Parent -->  %o0 == childs  pid, %o1 == 0
  * Child  -->  %o0 == parents pid, %o1 == 1
  */
-int copy_thread(unsigned long clone_flags, unsigned long sp,
-		unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
+		    unsigned long arg, struct task_struct *p,
+		    unsigned long tls)
 {
 	struct thread_info *t = task_thread_info(p);
 	struct pt_regs *regs = current_pt_regs();
@@ -671,7 +735,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
 	regs->u_regs[UREG_I1] = 0;
 
 	if (clone_flags & CLONE_SETTLS)
-		t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
+		t->kregs->u_regs[UREG_G7] = tls;
 
 	return 0;
 }
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index db42b4fb3708..192f3a28a2b7 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -86,19 +86,22 @@ sys32_rt_sigreturn:
 	 * during system calls...
 	 */
 	.align	32
-sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
-	sethi	%hi(0x4000 | 0x0100 | SIGCHLD), %o0
-	or	%o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
-	ba,pt	%xcc, sys_clone
+sys_vfork:
+	flushw
+	ba,pt	%xcc, sparc_vfork
+	add	%sp, PTREGS_OFF, %o0
+
+	.align	32
 sys_fork:
-	 clr	%o1
-	mov	SIGCHLD, %o0
+	flushw
+	ba,pt	%xcc, sparc_fork
+	add	%sp, PTREGS_OFF, %o0
+
+	.align	32
 sys_clone:
 	flushw
-	movrz	%o1, %fp, %o1
-	mov	0, %o3
-	ba,pt	%xcc, sparc_do_fork
-	 add	%sp, PTREGS_OFF, %o2
+	ba,pt	%xcc, sparc_clone
+	add	%sp, PTREGS_OFF, %o0
 
 	.globl	ret_from_fork
 ret_from_fork:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] sparc: share process creation helpers between sparc and sparc64
  2020-05-12 17:15 [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args Christian Brauner
  2020-05-12 17:15 ` [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
@ 2020-05-12 17:15 ` Christian Brauner
  2020-05-12 17:15 ` [PATCH 3/3] sparc: unconditionally enable HAVE_COPY_THREAD_TLS Christian Brauner
  2020-05-12 20:06 ` [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args David Miller
  3 siblings, 0 replies; 12+ messages in thread
From: Christian Brauner @ 2020-05-12 17:15 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arnd Bergmann, Guo Ren, linux-csky, linux-kernel, sparclinux,
	Christian Brauner

As promised in the previous patch, this moves the process creation
helpers into a common process.c file that is shared between sparc and
sparc64. It allows us to get rid of quite a bit custom assembler and the
to remove the separe 32bit specific sparc_do_fork() call.

One thing to note, is that when clone() was called with a separate stack
for the child the assembler would align it. But copy_thread() has always
been doing that too so that line wasn't needed and can thus simply be
removed.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guo Ren <guoren@kernel.org>
Cc: linux-csky@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 arch/sparc/kernel/Makefile     |   1 +
 arch/sparc/kernel/entry.S      |  29 +++------
 arch/sparc/kernel/kernel.h     |   7 +--
 arch/sparc/kernel/process.c    | 111 +++++++++++++++++++++++++++++++++
 arch/sparc/kernel/process_32.c |  27 --------
 arch/sparc/kernel/process_64.c |  97 ----------------------------
 6 files changed, 122 insertions(+), 150 deletions(-)
 create mode 100644 arch/sparc/kernel/process.c

diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 97c0e19263d1..d3a0e072ebe8 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -33,6 +33,7 @@ obj-y                   += irq_$(BITS).o
 obj-$(CONFIG_SPARC32)   += sun4m_irq.o sun4d_irq.o
 
 obj-y                   += process_$(BITS).o
+obj-y                   += process.o
 obj-y                   += signal_$(BITS).o
 obj-y                   += sigutil_$(BITS).o
 obj-$(CONFIG_SPARC32)   += ioport.o
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 4d3696973325..7925e8e5092b 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -869,14 +869,11 @@ flush_patch_two:
 	ld	[%curptr + TI_TASK], %o4
 	rd	%psr, %g4
 	WRITE_PAUSE
-	mov	SIGCHLD, %o0			! arg0:	clone flags
 	rd	%wim, %g5
 	WRITE_PAUSE
-	mov	%fp, %o1			! arg1:	usp
 	std	%g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
-	add	%sp, STACKFRAME_SZ, %o2		! arg2:	pt_regs ptr
-	mov	0, %o3
-	call	sparc_do_fork
+	add	%sp, STACKFRAME_SZ, %o0
+	call	sparc_fork
 	 mov	%l5, %o7
 
 	/* Whee, kernel threads! */
@@ -888,19 +885,11 @@ flush_patch_three:
 	ld	[%curptr + TI_TASK], %o4
 	rd	%psr, %g4
 	WRITE_PAUSE
-
-	/* arg0,1: flags,usp  -- loaded already */
-	cmp	%o1, 0x0			! Is new_usp NULL?
 	rd	%wim, %g5
 	WRITE_PAUSE
-	be,a	1f
-	 mov	%fp, %o1			! yes, use callers usp
-	andn	%o1, 7, %o1			! no, align to 8 bytes
-1:
 	std	%g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
-	add	%sp, STACKFRAME_SZ, %o2		! arg2:	pt_regs ptr
-	mov	0, %o3
-	call	sparc_do_fork
+	add	%sp, STACKFRAME_SZ, %o0
+	call	sparc_clone
 	 mov	%l5, %o7
 
 	/* Whee, real vfork! */
@@ -914,13 +903,9 @@ flush_patch_four:
 	rd	%wim, %g5
 	WRITE_PAUSE
 	std	%g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
-	sethi	%hi(0x4000 | 0x0100 | SIGCHLD), %o0
-	mov	%fp, %o1
-	or	%o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
-	sethi	%hi(sparc_do_fork), %l1
-	mov	0, %o3
-	jmpl	%l1 + %lo(sparc_do_fork), %g0
-	 add	%sp, STACKFRAME_SZ, %o2
+	sethi	%hi(sparc_vfork), %l1
+	jmpl	%l1 + %lo(sparc_vfork), %g0
+	 add	%sp, STACKFRAME_SZ, %o0
 
         .align  4
 linux_sparc_ni_syscall:
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index f6f498ba3198..3529e16ece20 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -154,10 +154,9 @@ extern unsigned long sun4m_cpu_startup;
 extern unsigned long sun4d_cpu_startup;
 
 /* process_32.c */
-asmlinkage int sparc_do_fork(unsigned long clone_flags,
-                             unsigned long stack_start,
-                             struct pt_regs *regs,
-                             unsigned long stack_size);
+asmlinkage int sparc_clone(struct pt_regs *regs);
+asmlinkage int sparc_fork(struct pt_regs *regs);
+asmlinkage int sparc_vfork(struct pt_regs *regs);
 
 /* signal_32.c */
 asmlinkage void do_sigreturn(struct pt_regs *regs);
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
new file mode 100644
index 000000000000..9d81edafbad5
--- /dev/null
+++ b/arch/sparc/kernel/process.c
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * This file handles the architecture independent parts of process handling..
+ */
+
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/ptrace.h>
+#include <linux/sched.h>
+#include <linux/sched/task.h>
+#include <linux/sched/task_stack.h>
+#include <linux/signal.h>
+
+asmlinkage long sparc_fork(struct pt_regs *regs)
+{
+	unsigned long orig_i1 = regs->u_regs[UREG_I1];
+	long ret;
+	struct kernel_clone_args args = {
+		.exit_signal	= SIGCHLD,
+		/* Reuse the parent's stack for the child. */
+		.stack		= regs->u_regs[UREG_FP],
+	};
+
+	ret = _do_fork(&args);
+
+	/* If we get an error and potentially restart the system
+	 * call, we're screwed because copy_thread_tls() clobbered
+	 * the parent's %o1.  So detect that case and restore it
+	 * here.
+	 */
+	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
+		regs->u_regs[UREG_I1] = orig_i1;
+
+	return ret;
+}
+
+asmlinkage long sparc_vfork(struct pt_regs *regs)
+{
+	unsigned long orig_i1 = regs->u_regs[UREG_I1];
+	long ret;
+
+	struct kernel_clone_args args = {
+		.flags		= CLONE_VFORK | CLONE_VM,
+		.exit_signal	= SIGCHLD,
+		/* Reuse the parent's stack for the child. */
+		.stack		= regs->u_regs[UREG_FP],
+	};
+
+	ret = _do_fork(&args);
+
+	/* If we get an error and potentially restart the system
+	 * call, we're screwed because copy_thread_tls() clobbered
+	 * the parent's %o1.  So detect that case and restore it
+	 * here.
+	 */
+	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
+		regs->u_regs[UREG_I1] = orig_i1;
+
+	return ret;
+}
+
+asmlinkage long sparc_clone(struct pt_regs *regs)
+{
+	unsigned long orig_i1 = regs->u_regs[UREG_I1];
+	unsigned int flags = lower_32_bits(regs->u_regs[UREG_I0]);
+	long ret;
+
+	struct kernel_clone_args args = {
+		.flags		= (flags & ~CSIGNAL),
+		.exit_signal	= (flags & CSIGNAL),
+		.tls		= regs->u_regs[UREG_I3],
+	};
+
+#ifdef CONFIG_COMPAT
+	if (test_thread_flag(TIF_32BIT)) {
+		args.pidfd	= compat_ptr(regs->u_regs[UREG_I2]);
+		args.child_tid	= compat_ptr(regs->u_regs[UREG_I4]);
+		args.parent_tid	= compat_ptr(regs->u_regs[UREG_I2]);
+	} else
+#endif
+	{
+		args.pidfd	= (int __user *)regs->u_regs[UREG_I2];
+		args.child_tid	= (int __user *)regs->u_regs[UREG_I4];
+		args.parent_tid	= (int __user *)regs->u_regs[UREG_I2];
+	}
+
+	/* Did userspace give setup a separate stack for the child or are we
+	 * reusing the parent's?
+	 */
+	if (regs->u_regs[UREG_I1])
+		args.stack = regs->u_regs[UREG_I1];
+	else
+		args.stack = regs->u_regs[UREG_FP];
+
+	if (!legacy_clone_args_valid(&args))
+		return -EINVAL;
+
+	ret = _do_fork(&args);
+
+	/* If we get an error and potentially restart the system
+	 * call, we're screwed because copy_thread_tls() clobbered
+	 * the parent's %o1.  So detect that case and restore it
+	 * here.
+	 */
+	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
+		regs->u_regs[UREG_I1] = orig_i1;
+
+	return ret;
+}
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 26cca65e9246..9c510e6625aa 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -258,33 +258,6 @@ clone_stackframe(struct sparc_stackf __user *dst,
 	return sp;
 }
 
-asmlinkage int sparc_do_fork(unsigned long clone_flags,
-                             unsigned long stack_start,
-                             struct pt_regs *regs,
-                             unsigned long stack_size)
-{
-	unsigned long parent_tid_ptr, child_tid_ptr;
-	unsigned long orig_i1 = regs->u_regs[UREG_I1];
-	long ret;
-
-	parent_tid_ptr = regs->u_regs[UREG_I2];
-	child_tid_ptr = regs->u_regs[UREG_I4];
-
-	ret = do_fork(clone_flags, stack_start, stack_size,
-		      (int __user *) parent_tid_ptr,
-		      (int __user *) child_tid_ptr);
-
-	/* If we get an error and potentially restart the system
-	 * call, we're screwed because copy_thread() clobbered
-	 * the parent's %o1.  So detect that case and restore it
-	 * here.
-	 */
-	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
-		regs->u_regs[UREG_I1] = orig_i1;
-
-	return ret;
-}
-
 /* Copy a Sparc thread.  The fork() return value conventions
  * under SunOS are nothing short of bletcherous:
  * Parent -->  %o0 == childs  pid, %o1 == 0
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 0222f638bdb2..309e17f3d01c 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -573,103 +573,6 @@ void fault_in_user_windows(struct pt_regs *regs)
 	force_sig(SIGSEGV);
 }
 
-asmlinkage long sparc_fork(struct pt_regs *regs)
-{
-	unsigned long orig_i1 = regs->u_regs[UREG_I1];
-	long ret;
-	struct kernel_clone_args args = {
-		.exit_signal	= SIGCHLD,
-		/* Reuse the parent's stack for the child. */
-		.stack		= regs->u_regs[UREG_FP],
-	};
-
-	ret = _do_fork(&args);
-
-	/* If we get an error and potentially restart the system
-	 * call, we're screwed because copy_thread_tls() clobbered
-	 * the parent's %o1.  So detect that case and restore it
-	 * here.
-	 */
-	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
-		regs->u_regs[UREG_I1] = orig_i1;
-
-	return ret;
-}
-
-asmlinkage long sparc_vfork(struct pt_regs *regs)
-{
-	unsigned long orig_i1 = regs->u_regs[UREG_I1];
-	long ret;
-
-	struct kernel_clone_args args = {
-		.flags		= CLONE_VFORK | CLONE_VM,
-		.exit_signal	= SIGCHLD,
-		/* Reuse the parent's stack for the child. */
-		.stack		= regs->u_regs[UREG_FP],
-	};
-
-	ret = _do_fork(&args);
-
-	/* If we get an error and potentially restart the system
-	 * call, we're screwed because copy_thread_tls() clobbered
-	 * the parent's %o1.  So detect that case and restore it
-	 * here.
-	 */
-	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
-		regs->u_regs[UREG_I1] = orig_i1;
-
-	return ret;
-}
-
-asmlinkage long sparc_clone(struct pt_regs *regs)
-{
-	unsigned long orig_i1 = regs->u_regs[UREG_I1];
-	unsigned int flags = lower_32_bits(regs->u_regs[UREG_I0]);
-	long ret;
-
-	struct kernel_clone_args args = {
-		.flags		= (flags & ~CSIGNAL),
-		.exit_signal	= (flags & CSIGNAL),
-		.tls		= regs->u_regs[UREG_I3],
-	};
-
-#ifdef CONFIG_COMPAT
-	if (test_thread_flag(TIF_32BIT)) {
-		args.pidfd	= compat_ptr(regs->u_regs[UREG_I2]);
-		args.child_tid	= compat_ptr(regs->u_regs[UREG_I4]);
-		args.parent_tid	= compat_ptr(regs->u_regs[UREG_I2]);
-	} else
-#endif
-	{
-		args.pidfd	= (int __user *)regs->u_regs[UREG_I2];
-		args.child_tid	= (int __user *)regs->u_regs[UREG_I4];
-		args.parent_tid	= (int __user *)regs->u_regs[UREG_I2];
-	}
-
-	/* Did userspace setup a separate stack for the child or are we
-	 * copying the parent's?
-	 */
-	if (regs->u_regs[UREG_I1])
-		args.stack = regs->u_regs[UREG_I1];
-	else
-		args.stack = regs->u_regs[UREG_FP];
-
-	if (!legacy_clone_args_valid(&args))
-		return -EINVAL;
-
-	ret = _do_fork(&args);
-
-	/* If we get an error and potentially restart the system
-	 * call, we're screwed because copy_thread_tls() clobbered
-	 * the parent's %o1.  So detect that case and restore it
-	 * here.
-	 */
-	if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
-		regs->u_regs[UREG_I1] = orig_i1;
-
-	return ret;
-}
-
 /* Copy a Sparc thread.  The fork() return value conventions
  * under SunOS are nothing short of bletcherous:
  * Parent -->  %o0 == childs  pid, %o1 == 0
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] sparc: unconditionally enable HAVE_COPY_THREAD_TLS
  2020-05-12 17:15 [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args Christian Brauner
  2020-05-12 17:15 ` [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
  2020-05-12 17:15 ` [PATCH 2/3] sparc: share process creation helpers between sparc and sparc64 Christian Brauner
@ 2020-05-12 17:15 ` Christian Brauner
  2020-05-12 20:06 ` [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args David Miller
  3 siblings, 0 replies; 12+ messages in thread
From: Christian Brauner @ 2020-05-12 17:15 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arnd Bergmann, Guo Ren, linux-csky, linux-kernel, sparclinux,
	Christian Brauner

Now that both sparc and sparc64 support copy_thread_tls() and don't rely
on do_fork() anymore, turn on HAVE_COPY_THREAD_TLS unconditionally. Once
all architectures are switched over this macro will be removed and
the old do_fork() calling convention fully abandoned in favor of the
cleaner struct kernel_clone_args one.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guo Ren <guoren@kernel.org>
Cc: linux-csky@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 arch/sparc/Kconfig             | 2 +-
 arch/sparc/kernel/process_32.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 423f6bc41de2..9f44afe1f73d 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -48,6 +48,7 @@ config SPARC
 	select LOCKDEP_SMALL if LOCKDEP
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
+	select HAVE_COPY_THREAD_TLS
 
 config SPARC32
 	def_bool !64BIT
@@ -95,7 +96,6 @@ config SPARC64
 	select ARCH_HAS_PTE_SPECIAL
 	select PCI_DOMAINS if PCI
 	select ARCH_HAS_GIGANTIC_PAGE
-	select HAVE_COPY_THREAD_TLS
 
 config ARCH_PROC_KCORE_TEXT
 	def_bool y
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 9c510e6625aa..575bfbda7373 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -274,8 +274,9 @@ clone_stackframe(struct sparc_stackf __user *dst,
 extern void ret_from_fork(void);
 extern void ret_from_kernel_thread(void);
 
-int copy_thread(unsigned long clone_flags, unsigned long sp,
-		unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
+		    unsigned long arg, struct task_struct *p,
+		    unsigned long tls)
 {
 	struct thread_info *ti = task_thread_info(p);
 	struct pt_regs *childregs, *regs = current_pt_regs();
@@ -377,7 +378,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
 	regs->u_regs[UREG_I1] = 0;
 
 	if (clone_flags & CLONE_SETTLS)
-		childregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
+		childregs->u_regs[UREG_G7] = tls;
 
 	return 0;
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS
  2020-05-12 17:15 ` [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
@ 2020-05-12 20:04   ` David Miller
  0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2020-05-12 20:04 UTC (permalink / raw)
  To: christian.brauner; +Cc: arnd, guoren, linux-csky, linux-kernel, sparclinux

From: Christian Brauner <christian.brauner@ubuntu.com>
Date: Tue, 12 May 2020 19:15:25 +0200

> +sys_vfork:
> +	flushw
> +	ba,pt	%xcc, sparc_vfork
> +	add	%sp, PTREGS_OFF, %o0

Please follow the convention of indenting an extra space before
instructions in the delay slot of branch instructions.

> +	ba,pt	%xcc, sparc_fork
> +	add	%sp, PTREGS_OFF, %o0

Likewise.

>  sys_clone:
>  	flushw
> -	movrz	%o1, %fp, %o1
> -	mov	0, %o3
> -	ba,pt	%xcc, sparc_do_fork
> -	 add	%sp, PTREGS_OFF, %o2
> +	ba,pt	%xcc, sparc_clone
> +	add	%sp, PTREGS_OFF, %o0

Likewise.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-12 17:15 [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args Christian Brauner
                   ` (2 preceding siblings ...)
  2020-05-12 17:15 ` [PATCH 3/3] sparc: unconditionally enable HAVE_COPY_THREAD_TLS Christian Brauner
@ 2020-05-12 20:06 ` David Miller
  2020-05-17 15:01   ` Christian Brauner
  3 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2020-05-12 20:06 UTC (permalink / raw)
  To: christian.brauner; +Cc: arnd, guoren, linux-csky, linux-kernel, sparclinux

From: Christian Brauner <christian.brauner@ubuntu.com>
Date: Tue, 12 May 2020 19:15:24 +0200

> I've tested this series with qemu-system-sparc64 and a Debian Sid image
> and it comes up no problem (Here's a little recording
> https://asciinema.org/a/329510 ).

Can you show how you put this environment together and also what
compilation tools you used?  Looks great.

> This is the sparc specific bit and _if_ you agree with the changes here
> it'd be nice if I could get your review, and if technically correct,
> your ack so I can fold this into a larger series and move on to the next
> arch.

With the delay slot instruction indentation fixed:

Acked-by: David S. Miller <davem@davemloft.net>

Thank you.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-12 20:06 ` [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args David Miller
@ 2020-05-17 15:01   ` Christian Brauner
  2020-05-17 16:34     ` Mark Cave-Ayland
  0 siblings, 1 reply; 12+ messages in thread
From: Christian Brauner @ 2020-05-17 15:01 UTC (permalink / raw)
  To: David Miller; +Cc: arnd, guoren, linux-csky, linux-kernel, sparclinux

On Tue, May 12, 2020 at 01:06:33PM -0700, David Miller wrote:
> From: Christian Brauner <christian.brauner@ubuntu.com>
> Date: Tue, 12 May 2020 19:15:24 +0200
> 
> > I've tested this series with qemu-system-sparc64 and a Debian Sid image
> > and it comes up no problem (Here's a little recording
> > https://asciinema.org/a/329510 ).
> 
> Can you show how you put this environment together and also what
> compilation tools you used?  Looks great.

Sorry for the delay. That mail somehow got lost in my inbox.

So in general, I used qemu-system-sparc64 which is available in Universe
with either Debian or Ubuntu and that's what I've been using as host
distro. So you need a 

deb http://us.archive.ubuntu.com/ubuntu/ <release-name> universe
deb-src http://us.archive.ubuntu.com/ubuntu/ <release-name> universe
deb http://us.archive.ubuntu.com/ubuntu/ <release-name>-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ <release-name>-updates universe

int /etc/apt/sources.list

So after this, you should be able to install

apt install qemu-system-sparc

Now we need an image and believe it or not there's a guy who lives in
Berlin too who builds Debian images for all crazy architectures. You can
download them from:

https://cdimage.debian.org/cdimage/ports/

They're built quite frequently. Sometimes you get unlucky because a new
kernel won't boot anymore then going a couple of months back usually
helps. So for this experiment I downloaded:

https://cdimage.debian.org/cdimage/ports/9.0/sparc64/iso-cd/debian-9.0-sparc64-NETINST-1.iso

then I did:

cd .local/share/qemu
truncate -s 15GB sparc64.img

And then to _install_:

qemu-system-sparc64 \
        -m 4096 \
  	-device virtio-blk-pci,bus=pciB,drive=hd \
  	-drive file=/home/brauner/Downloads/debian-9.0-sparc64-NETINST-1.iso,format=raw,if=ide,bus=1,unit=0,media=cdrom,readonly=on \
	-drive file=/home/brauner/.local/share/qemu/sparc64.img,format=raw,if=none,id=hd \
	-boot order=d \
        -net nic \
	-net user \
	-nographic \

Then the Debian install will run after it finishes you can boot with:

qemu-system-sparc64 \
	-name debian-unstable-sparc64 -machine sun4u,accel=tcg,usb=off -m 4096 \
	-smp 1,sockets=1,cores=1,threads=1 \
	-uuid ccd8b5c2-b8e4-4d5e-af19-9322cd8e55bf -rtc base=utc -no-reboot -no-shutdown \
	-boot strict=on \
	-drive file=/home/brauner/.local/share/qemu/sparc64.img,if=none,id=drive-ide0-0-1,format=raw,cache=none,aio=native \
	-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \
	-msg timestamp=on -nographic

If the install isn't setting up the repos right and you can't install
stuff the correct url is:
http://ftp.ports.debian.org/debian-ports/
to put into sources.list

> 
> > This is the sparc specific bit and _if_ you agree with the changes here
> > it'd be nice if I could get your review, and if technically correct,
> > your ack so I can fold this into a larger series and move on to the next
> > arch.
> 
> With the delay slot instruction indentation fixed:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Thank you, Dave!
Christian

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-17 15:01   ` Christian Brauner
@ 2020-05-17 16:34     ` Mark Cave-Ayland
  2020-05-17 22:13       ` Al Viro
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Cave-Ayland @ 2020-05-17 16:34 UTC (permalink / raw)
  To: Christian Brauner, David Miller
  Cc: arnd, guoren, linux-csky, linux-kernel, sparclinux

On 17/05/2020 16:01, Christian Brauner wrote:

> On Tue, May 12, 2020 at 01:06:33PM -0700, David Miller wrote:
>> From: Christian Brauner <christian.brauner@ubuntu.com>
>> Date: Tue, 12 May 2020 19:15:24 +0200
>>
>>> I've tested this series with qemu-system-sparc64 and a Debian Sid image
>>> and it comes up no problem (Here's a little recording
>>> https://asciinema.org/a/329510 ).
>>
>> Can you show how you put this environment together and also what
>> compilation tools you used?  Looks great.
> 
> Sorry for the delay. That mail somehow got lost in my inbox.
> 
> So in general, I used qemu-system-sparc64 which is available in Universe
> with either Debian or Ubuntu and that's what I've been using as host
> distro. So you need a 
> 
> deb http://us.archive.ubuntu.com/ubuntu/ <release-name> universe
> deb-src http://us.archive.ubuntu.com/ubuntu/ <release-name> universe
> deb http://us.archive.ubuntu.com/ubuntu/ <release-name>-updates universe
> deb-src http://us.archive.ubuntu.com/ubuntu/ <release-name>-updates universe
> 
> int /etc/apt/sources.list
> 
> So after this, you should be able to install
> 
> apt install qemu-system-sparc
> 
> Now we need an image and believe it or not there's a guy who lives in
> Berlin too who builds Debian images for all crazy architectures. You can
> download them from:
> 
> https://cdimage.debian.org/cdimage/ports/
> 
> They're built quite frequently. Sometimes you get unlucky because a new
> kernel won't boot anymore then going a couple of months back usually
> helps. So for this experiment I downloaded:
> 
> https://cdimage.debian.org/cdimage/ports/9.0/sparc64/iso-cd/debian-9.0-sparc64-NETINST-1.iso
> 
> then I did:
> 
> cd .local/share/qemu
> truncate -s 15GB sparc64.img
> 
> And then to _install_:
> 
> qemu-system-sparc64 \
>         -m 4096 \
>   	-device virtio-blk-pci,bus=pciB,drive=hd \
>   	-drive file=/home/brauner/Downloads/debian-9.0-sparc64-NETINST-1.iso,format=raw,if=ide,bus=1,unit=0,media=cdrom,readonly=on \
> 	-drive file=/home/brauner/.local/share/qemu/sparc64.img,format=raw,if=none,id=hd \
> 	-boot order=d \
>         -net nic \
> 	-net user \
> 	-nographic \
> 
> Then the Debian install will run after it finishes you can boot with:
> 
> qemu-system-sparc64 \
> 	-name debian-unstable-sparc64 -machine sun4u,accel=tcg,usb=off -m 4096 \
> 	-smp 1,sockets=1,cores=1,threads=1 \
> 	-uuid ccd8b5c2-b8e4-4d5e-af19-9322cd8e55bf -rtc base=utc -no-reboot -no-shutdown \
> 	-boot strict=on \
> 	-drive file=/home/brauner/.local/share/qemu/sparc64.img,if=none,id=drive-ide0-0-1,format=raw,cache=none,aio=native \
> 	-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \
> 	-msg timestamp=on -nographic
> 
> If the install isn't setting up the repos right and you can't install
> stuff the correct url is:
> http://ftp.ports.debian.org/debian-ports/
> to put into sources.list

FWIW if you're running a more recent version of QEMU (>=3.1) then you can also boot
from the virtio-blk-pci device directly instead of having to switch back to the IDE
device after installation as you have done above. Should be something like:

qemu-system-sparc64 \
         -m 4096 \
   	-device virtio-blk-pci,bus=pciB,drive=hd \
 	-drive
file=/home/brauner/.local/share/qemu/sparc64.img,format=raw,if=none,id=hd,bootindex=0 \
        -net nic \
 	-net user \
 	-nographic

Note the removal of the legacy -boot argument and the addition of "bootindex=0" to
the -drive argument.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-17 16:34     ` Mark Cave-Ayland
@ 2020-05-17 22:13       ` Al Viro
  2020-05-18 18:18         ` Al Viro
  0 siblings, 1 reply; 12+ messages in thread
From: Al Viro @ 2020-05-17 22:13 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: Christian Brauner, David Miller, arnd, guoren, linux-csky,
	linux-kernel, sparclinux

On Sun, May 17, 2020 at 05:34:34PM +0100, Mark Cave-Ayland wrote:

> FWIW if you're running a more recent version of QEMU (>=3.1) then you can also boot
> from the virtio-blk-pci device directly instead of having to switch back to the IDE
> device after installation as you have done above. Should be something like:
> 
> qemu-system-sparc64 \
>          -m 4096 \
>    	-device virtio-blk-pci,bus=pciB,drive=hd \
>  	-drive
> file=/home/brauner/.local/share/qemu/sparc64.img,format=raw,if=none,id=hd,bootindex=0 \
>         -net nic \
>  	-net user \
>  	-nographic
> 
> Note the removal of the legacy -boot argument and the addition of "bootindex=0" to
> the -drive argument.

	Is virtio-blk-pci more resilent to lost interrupt bug introduced in 
"sun4u: update PCI topology to include simba PCI bridges"?  I hadn't tried
it yet (reverted to the last working mainline qemu commit for now); IDE
definitely is screwed by that - both the Linux and NetBSD drivers, actually.

	A 50Mb worth of wget(1) is more than enough to trigger that crap;

commit 063833a6ec
Merge: d634fc0499 bcf9e2c2f2
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Thu Oct 19 18:42:51 2017 +0100

    Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging

hangs, d634fc0499 works, bcf9e2c2f2 hangs.

I hadn't looked into details (the branch itself is only two commits long, but it
incorporates an openbios update - 35 commits there, some obviously pci- and
sun4u-related), but it's really easy to reproduce - -m 1024 and -hda <image>
are probably the only relevant arguments.  Even dd if=/dev/sda of=/dev/null bs=64m
is often enough to hang it, so I rather doubt that networking (e1000 on pciB,
FWIW, with tap for backend) has anything to do with that.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-17 22:13       ` Al Viro
@ 2020-05-18 18:18         ` Al Viro
  2020-05-18 18:23           ` Christian Brauner
  2020-05-18 19:58           ` Mark Cave-Ayland
  0 siblings, 2 replies; 12+ messages in thread
From: Al Viro @ 2020-05-18 18:18 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: Christian Brauner, David Miller, arnd, guoren, linux-csky,
	linux-kernel, sparclinux

On Sun, May 17, 2020 at 11:13:47PM +0100, Al Viro wrote:

> 	Is virtio-blk-pci more resilent to lost interrupt bug introduced in 
> "sun4u: update PCI topology to include simba PCI bridges"?  I hadn't tried
> it yet (reverted to the last working mainline qemu commit for now); IDE
> definitely is screwed by that - both the Linux and NetBSD drivers, actually.
> 
> 	A 50Mb worth of wget(1) is more than enough to trigger that crap;
> 
> commit 063833a6ec
> Merge: d634fc0499 bcf9e2c2f2
> Author: Peter Maydell <peter.maydell@linaro.org>
> Date:   Thu Oct 19 18:42:51 2017 +0100
> 
>     Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
> 
> hangs, d634fc0499 works, bcf9e2c2f2 hangs.
> 
> I hadn't looked into details (the branch itself is only two commits long, but it
> incorporates an openbios update - 35 commits there, some obviously pci- and
> sun4u-related), but it's really easy to reproduce - -m 1024 and -hda <image>
> are probably the only relevant arguments.  Even dd if=/dev/sda of=/dev/null bs=64m
> is often enough to hang it, so I rather doubt that networking (e1000 on pciB,
> FWIW, with tap for backend) has anything to do with that.

	FWIW, virtio-blk-pci does appear to be much more resilent; I hadn't been
able to reproduce hangs on that, while mounting identical fs from pata_cmd64x
and doing the same aptitude dist-upgrade --download-only ended up with

...
Note: Using 'Download Only' mode, no other actions will be performed.
Do you want to continue? [Y/n/?] y
Get: 1 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-modules-5.30 all 5.30.2-1 [2,806 kB]
Get: 2 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libperl5.30 sparc64 5.30.2-1 [3,388 kB]
Get: 3 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl sparc64 5.30.2-1 [290 kB]
Get: 4 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-base sparc64 5.30.2-1 [1,427 kB]
Get: 5 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libsystemd0 sparc64 245.5-3 [309 kB]
Get: 6 http://ftp.ports.debian.org/debian-ports sid/main sparc64 udev sparc64 245.5-3 [1,356 kB]
Get: 7 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libudev1 sparc64 245.5-3 [153 kB]
[ 1472.613660] ata2: lost interrupt (Status 0x58)
[ 1472.615124] ata1: lost interrupt (Status 0x50)
[ 1472.615812] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1472.616515] ata1.00: failed command: WRITE DMA
[ 1472.617145] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
[ 1472.617145]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1472.618229] ata1.00: status: { DRDY }
[ 1472.618743] ata1: soft resetting link
[ 1472.779489] ata1.00: configured for UDMA/33
[ 1472.781211] ata1: EH complete
[ 1477.977424] ata2.00: qc timeout (cmd 0xa0)
[ 1477.977897] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
[ 1483.353324] ata2.00: qc timeout (cmd 0xa0)
[ 1483.353697] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
[ 1483.354453] ata2.00: limiting speed to UDMA/33:PIO3
[ 1488.729323] ata2.00: qc timeout (cmd 0xa0)
[ 1488.730255] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
[ 1488.731320] ata2.00: disabled
[ 1503.333388] ata1: lost interrupt (Status 0x50)
[ 1503.333838] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1503.334309] ata1.00: failed command: WRITE DMA EXT
[ 1503.334647] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
[ 1503.334647]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1503.335494] ata1.00: status: { DRDY }
[ 1503.335858] ata1: soft resetting link
[ 1503.494764] ata1.00: configured for UDMA/33
[ 1503.495313] ata1: EH complete
[ 1534.041532] ata1: lost interrupt (Status 0x50)
[ 1534.042043] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1534.042627] ata1.00: failed command: WRITE DMA
[ 1534.042969] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
[ 1534.042969]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1534.043902] ata1.00: status: { DRDY }
[ 1534.044306] ata1: soft resetting link
[ 1534.202625] ata1.00: configured for UDMA/33
[ 1534.203119] ata1: EH complete
[ 1564.761561] ata1: lost interrupt (Status 0x50)
[ 1564.762351] ata1.00: limiting speed to UDMA/25:PIO4
[ 1564.762831] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1564.763388] ata1.00: failed command: WRITE DMA EXT
[ 1564.763790] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
[ 1564.763790]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1564.764784] ata1.00: status: { DRDY }
[ 1564.765470] ata1: soft resetting link
[ 1564.926509] ata1.00: configured for UDMA/25
[ 1564.927516] ata1: EH complete
[ 1575.001438] INFO: task jbd2/sda2-8:143 blocked for more than 120 seconds.
[ 1575.002273]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1575.002755] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1575.003323] jbd2/sda2-8     D    0   143      2 0x07000000
[ 1575.003867] Call Trace:
[ 1575.004228]  [0000000000b10834] schedule+0x54/0x100
[ 1575.004598]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1575.004922]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
[ 1575.009472]  [00000000007b5274] wbt_wait+0x74/0xe0
[ 1575.009832]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
[ 1575.010191]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
[ 1575.010558]  [000000000078b418] generic_make_request+0x98/0x2e0
[ 1575.010923]  [000000000078b6b8] submit_bio+0x58/0x200
[ 1575.011245]  [000000000067f100] submit_bh_wbc+0x1c0/0x200
[ 1575.011583]  [000000000067f91c] submit_bh+0x1c/0x40
[ 1575.012627]  [0000000010167d7c] jbd2_journal_commit_transaction+0x69c/0x1740 [jbd2]
[ 1575.013300]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
[ 1575.013706]  [000000000048913c] kthread+0xdc/0x120
[ 1575.014012]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
[ 1575.014565]  [0000000000000000] 0x0
[ 1575.014888] INFO: task http:1294 blocked for more than 120 seconds.
[ 1575.015287]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1575.015728] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1575.016208] http            D    0  1294   1283 0x208000105000000
[ 1575.016616] Call Trace:
[ 1575.016803]  [0000000000b10834] schedule+0x54/0x100
[ 1575.017289]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1575.017654]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
[ 1575.018011]  [00000000007b5274] wbt_wait+0x74/0xe0
[ 1575.018328]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
[ 1575.018677]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
[ 1575.019047]  [000000000078b418] generic_make_request+0x98/0x2e0
[ 1575.019421]  [000000000078b6b8] submit_bio+0x58/0x200
[ 1575.019825]  [00000000101dcf64] ext4_io_submit+0x44/0x60 [ext4]
[ 1575.020249]  [00000000101c0108] ext4_writepages+0x508/0xc20 [ext4]
[ 1575.020634]  [00000000005b0790] do_writepages+0x30/0xe0
[ 1575.021000]  [00000000005a7618] __filemap_fdatawrite_range+0xb8/0x100
[ 1575.021542]  [00000000005a76bc] filemap_flush+0x1c/0x40
[ 1575.021944]  [00000000101bce24] ext4_alloc_da_blocks+0x24/0x80 [ext4]
[ 1575.022387]  [00000000101abf30] ext4_release_file+0x90/0xe0 [ext4]
[ 1575.022777]  [000000000063d1cc] __fput+0xac/0x280
[ 1595.481559] ata1: lost interrupt (Status 0x50)
[ 1595.482352] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1595.483223] ata1.00: failed command: WRITE DMA
[ 1595.483799] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
[ 1595.483799]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1595.485513] ata1.00: status: { DRDY }
[ 1595.489629] ata1: soft resetting link
[ 1595.650743] ata1.00: configured for UDMA/25
[ 1595.651259] ata1: EH complete
[ 1626.201466] ata1: lost interrupt (Status 0x50)
[ 1626.202778] ata1.00: limiting speed to PIO4
[ 1626.203678] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1626.205103] ata1.00: failed command: WRITE DMA EXT
[ 1626.206127] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
[ 1626.206127]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1626.208832] ata1.00: status: { DRDY }
[ 1626.209856] ata1: soft resetting link
[ 1626.370839] ata1.00: configured for PIO4
[ 1626.371357] ata1: EH complete
[ 1656.921546] ata1: lost interrupt (Status 0x58)
[ 1656.922076] ata1.00: limiting speed to PIO3
[ 1656.922390] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1656.922837] ata1.00: failed command: WRITE MULTIPLE
[ 1656.923190] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
[ 1656.923190]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1656.924057] ata1.00: status: { DRDY }
[ 1656.924441] ata1: soft resetting link
[ 1657.082383] ata1.00: configured for PIO3
[ 1657.082940] ata1: EH complete
[ 1687.641729] ata1: lost interrupt (Status 0x58)
[ 1687.642217] ata1.00: limiting speed to PIO0
[ 1687.642526] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1687.642963] ata1.00: failed command: WRITE MULTIPLE EXT
[ 1687.643336] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
[ 1687.643336]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1687.644276] ata1.00: status: { DRDY }
[ 1687.644649] ata1: soft resetting link
[ 1687.802485] ata1.00: configured for PIO0
[ 1687.802946] ata1: EH complete
[ 1695.833443] INFO: task jbd2/sda2-8:143 blocked for more than 241 seconds.
[ 1695.834181]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1695.834915] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1695.835667] jbd2/sda2-8     D    0   143      2 0x07000000
[ 1695.836230] Call Trace:
[ 1695.836537]  [0000000000b10834] schedule+0x54/0x100
[ 1695.837186]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1695.837753]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
[ 1695.838244]  [00000000007b5274] wbt_wait+0x74/0xe0
[ 1695.838717]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
[ 1695.839247]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
[ 1695.839811]  [000000000078b418] generic_make_request+0x98/0x2e0
[ 1695.840366]  [000000000078b6b8] submit_bio+0x58/0x200
[ 1695.840841]  [000000000067f100] submit_bh_wbc+0x1c0/0x200
[ 1695.841561]  [000000000067f91c] submit_bh+0x1c/0x40
[ 1695.842111]  [0000000010167d7c] jbd2_journal_commit_transaction+0x69c/0x1740 [jbd2]
[ 1695.842851]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
[ 1695.843392]  [000000000048913c] kthread+0xdc/0x120
[ 1695.843860]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
[ 1695.844355]  [0000000000000000] 0x0
[ 1695.844707] INFO: task http:1294 blocked for more than 241 seconds.
[ 1695.845478]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1695.846180] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1695.846905] http            D    0  1294   1283 0x208000105000000
[ 1695.847500] Call Trace:
[ 1695.847786]  [0000000000b10834] schedule+0x54/0x100
[ 1695.848272]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1695.848757]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
[ 1695.849477]  [00000000007b5274] wbt_wait+0x74/0xe0
[ 1695.850000]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
[ 1695.850557]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
[ 1695.851107]  [000000000078b418] generic_make_request+0x98/0x2e0
[ 1695.851650]  [000000000078b6b8] submit_bio+0x58/0x200
[ 1695.852214]  [00000000101dcf64] ext4_io_submit+0x44/0x60 [ext4]
[ 1695.852837]  [00000000101c0108] ext4_writepages+0x508/0xc20 [ext4]
[ 1695.853638]  [00000000005b0790] do_writepages+0x30/0xe0
[ 1695.854162]  [00000000005a7618] __filemap_fdatawrite_range+0xb8/0x100
[ 1695.854765]  [00000000005a76bc] filemap_flush+0x1c/0x40
[ 1695.855316]  [00000000101bce24] ext4_alloc_da_blocks+0x24/0x80 [ext4]
[ 1695.855973]  [00000000101abf30] ext4_release_file+0x90/0xe0 [ext4]
[ 1695.856568]  [000000000063d1cc] __fput+0xac/0x280
[ 1695.857152] INFO: task kworker/0:3:1295 blocked for more than 120 seconds.
[ 1695.857878]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1695.858550] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1695.859262] kworker/0:3     D    0  1295      2 0x01000000
[ 1695.860238] Workqueue: events ata_scsi_dev_rescan [libata]
[ 1695.860828] Call Trace:
[ 1695.861273]  [0000000000b10834] schedule+0x54/0x100
[ 1695.861814]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1695.862295]  [000000000079a33c] blk_mq_get_tag+0x11c/0x2c0
[ 1695.862826]  [0000000000794e28] blk_mq_get_request+0xc8/0x3a0
[ 1695.863294]  [000000000079514c] blk_mq_alloc_request+0x4c/0xa0
[ 1695.863686]  [00000000007896f0] blk_get_request+0x30/0xe0
[ 1695.864093]  [000000001003bd14] __scsi_execute+0x34/0x1a0 [scsi_mod]
[ 1695.864544]  [0000000010034c6c] scsi_vpd_inquiry+0x6c/0xc0 [scsi_mod]
[ 1695.865018]  [0000000010034dec] scsi_get_vpd_buf+0x4c/0x80 [scsi_mod]
[ 1695.865640]  [0000000010035afc] scsi_attach_vpd+0x3c/0x180 [scsi_mod]
[ 1695.866099]  [00000000100402f8] scsi_rescan_device+0x18/0xa0 [scsi_mod]
[ 1695.866568]  [00000000100a6620] ata_scsi_dev_rescan+0x80/0xe0 [libata]
[ 1695.867009]  [0000000000482eb4] process_one_work+0x194/0x480
[ 1695.867392]  [00000000004832e4] worker_thread+0x144/0x540
[ 1695.867759]  [000000000048913c] kthread+0xdc/0x120
[ 1695.868095]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
[ 1718.361472] ata1: lost interrupt (Status 0x58)
[ 1718.362753] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1718.364199] ata1.00: failed command: WRITE MULTIPLE
[ 1718.365436] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
[ 1718.365436]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1718.368421] ata1.00: status: { DRDY }
[ 1718.369510] ata1: soft resetting link
[ 1718.530645] ata1.00: configured for PIO0
[ 1718.531608] ata1: EH complete
[ 1749.081528] ata1: lost interrupt (Status 0x58)
[ 1749.082016] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1749.082490] ata1.00: failed command: WRITE MULTIPLE EXT
[ 1749.082861] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
[ 1749.082861]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1749.083785] ata1.00: status: { DRDY }
[ 1749.084186] ata1: soft resetting link
[ 1749.242344] ata1.00: configured for PIO0
[ 1749.242776] ata1: EH complete
[ 1779.801525] ata1: lost interrupt (Status 0x58)
[ 1779.802194] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1779.802933] ata1.00: failed command: WRITE MULTIPLE
[ 1779.803424] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
[ 1779.803424]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1779.804678] ata1.00: status: { DRDY }
[ 1779.805327] ata1: soft resetting link
[ 1779.966461] ata1.00: configured for PIO0
[ 1779.968232] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=338s
[ 1779.969221] sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current] 
[ 1779.969921] sd 0:0:0:0: [sda] tag#0 Add. Sense: Unaligned write command
[ 1779.971038] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 23 9b 0c 00 00 60 00
[ 1779.971722] blk_update_request: I/O error, dev sda, sector 2333452 op 0x1:(WRITE) flags 0x0 phys_seg 1 prio class 0
[ 1779.972504] EXT4-fs warning (device sda2): ext4_end_bio:347: I/O error 10 writing to inode 130691 starting block 291693)
[ 1779.973770] ata1: EH complete
[ 1810.521509] ata1: lost interrupt (Status 0x58)
[ 1810.522165] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1810.522895] ata1.00: failed command: WRITE MULTIPLE EXT
[ 1810.523415] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
[ 1810.523415]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1810.524696] ata1.00: status: { DRDY }
[ 1810.525363] ata1: soft resetting link
[ 1810.686255] ata1.00: configured for PIO0
[ 1810.686951] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=337s
[ 1810.687809] sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current] 
[ 1810.688449] sd 0:0:0:0: [sda] tag#0 Add. Sense: Unaligned write command
[ 1810.689213] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 23 7b 0c 00 01 30 00
[ 1810.689966] blk_update_request: I/O error, dev sda, sector 2325260 op 0x1:(WRITE) flags 0x0 phys_seg 3 prio class 0
[ 1810.690901] EXT4-fs warning (device sda2): ext4_end_bio:347: I/O error 10 writing to inode 130696 starting block 290695)
[ 1810.692093] ata1: EH complete
[ 1841.253842] ata1: lost interrupt (Status 0x58)
[ 1841.254522] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1841.255276] ata1.00: failed command: WRITE MULTIPLE
[ 1841.255781] ata1.00: cmd c5/00:78:d4:61:49/00:00:00:00:00/e0 tag 0 pio 61440 out
[ 1841.255781]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1841.257269] ata1.00: status: { DRDY }
[ 1841.257820] ata1: soft resetting link
[ 1841.418388] ata1.00: configured for PIO0
[ 1841.418961] ata1: EH complete
[ 1871.973375] ata1: lost interrupt (Status 0x58)
[ 1871.973863] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1871.974338] ata1.00: failed command: WRITE MULTIPLE
[ 1871.974727] ata1.00: cmd c5/00:a0:8c:0e:3b/00:00:00:00:00/e0 tag 0 pio 81920 out
[ 1871.974727]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1871.975707] ata1.00: status: { DRDY }
[ 1871.976096] ata1: soft resetting link
[ 1872.134384] ata1.00: configured for PIO0
[ 1872.134988] ata1: EH complete
[ 1902.681573] ata1: lost interrupt (Status 0x58)
[ 1902.682340] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1902.683115] ata1.00: failed command: WRITE MULTIPLE
[ 1902.683674] ata1.00: cmd c5/00:78:d4:61:49/00:00:00:00:00/e0 tag 0 pio 61440 out
[ 1902.683674]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1902.685158] ata1.00: status: { DRDY }
[ 1902.689610] ata1: soft resetting link
[ 1902.850306] ata1.00: configured for PIO0
[ 1902.850767] ata1: EH complete
[ 1933.401429] ata1: lost interrupt (Status 0x58)
[ 1933.401961] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 1933.402474] ata1.00: failed command: WRITE MULTIPLE
[ 1933.402878] ata1.00: cmd c5/00:a0:8c:0e:3b/00:00:00:00:00/e0 tag 0 pio 81920 out
[ 1933.402878]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
[ 1933.403875] ata1.00: status: { DRDY }
[ 1933.404289] ata1: soft resetting link
[ 1933.562384] ata1.00: configured for PIO0
[ 1933.562869] ata1: EH complete
[ 1937.497217] INFO: task jbd2/sda2-8:143 blocked for more than 120 seconds.
[ 1937.497777]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1937.498257] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1937.498777] jbd2/sda2-8     D    0   143      2 0x03000000
[ 1937.499174] Call Trace:
[ 1937.499400]  [0000000000b10834] schedule+0x54/0x100
[ 1937.499746]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1937.500100]  [0000000000b1108c] bit_wait_io+0xc/0x80
[ 1937.500450]  [0000000000b10c80] __wait_on_bit+0x60/0x100
[ 1937.500815]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
[ 1937.501357]  [000000000067d6d0] __wait_on_buffer+0x30/0x40
[ 1937.501796]  [00000000101685d4] jbd2_journal_commit_transaction+0xef4/0x1740 [jbd2]
[ 1937.502330]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
[ 1937.502728]  [000000000048913c] kthread+0xdc/0x120
[ 1937.503061]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
[ 1937.503407]  [0000000000000000] 0x0
[ 1937.503658] INFO: task kworker/u2:2:1138 blocked for more than 120 seconds.
[ 1937.504096]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1937.504544] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1937.505128] kworker/u2:2    D    0  1138      2 0x05000000
[ 1937.505677] Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work [ext4]
[ 1937.506109] Call Trace:
[ 1937.506306]  [0000000000b10834] schedule+0x54/0x100
[ 1937.506643]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1937.507007]  [0000000000b1108c] bit_wait_io+0xc/0x80
[ 1937.507361]  [0000000000b10c80] __wait_on_bit+0x60/0x100
[ 1937.507717]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
[ 1937.508150]  [0000000010166138] do_get_write_access+0x2f8/0x440 [jbd2]
[ 1937.508587]  [0000000010166300] jbd2_journal_get_write_access+0x80/0xa0 [jbd2]
[ 1937.509203]  [000000001019c400] __ext4_journal_get_write_access+0x20/0x60 [ext4]
[ 1937.509812]  [00000000101bf824] ext4_reserve_inode_write+0x84/0xc0 [ext4]
[ 1937.510301]  [00000000101bfa48] ext4_mark_inode_dirty+0x28/0x1e0 [ext4]
[ 1937.510766]  [000000001019ce74] __ext4_ext_dirty.isra.0+0x54/0xa0 [ext4]
[ 1937.511234]  [00000000101a66c8] ext4_ext_map_blocks+0x828/0x17c0 [ext4]
[ 1937.511699]  [00000000101bb638] ext4_map_blocks+0xd8/0x6a0 [ext4]
[ 1937.512134]  [00000000101a882c] ext4_convert_unwritten_extents+0x14c/0x200 [ext4]
[ 1937.512706]  [00000000101a894c] ext4_convert_unwritten_io_end_vec+0x6c/0x100 [ext4]
[ 1937.513388]  [00000000101dca00] ext4_end_io_rsv_work+0xe0/0x1c0 [ext4]
[ 1937.513853] INFO: task http:1294 blocked for more than 120 seconds.
[ 1937.514287]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1937.514735] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1937.515277] http            D    0  1294   1283 0x208000103000000
[ 1937.515732] Call Trace:
[ 1937.515925]  [0000000000b10834] schedule+0x54/0x100
[ 1937.516254]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1937.516586]  [0000000000b1108c] bit_wait_io+0xc/0x80
[ 1937.516924]  [0000000000b10c80] __wait_on_bit+0x60/0x100
[ 1937.517426]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
[ 1937.517897]  [0000000010166138] do_get_write_access+0x2f8/0x440 [jbd2]
[ 1937.518346]  [0000000010166300] jbd2_journal_get_write_access+0x80/0xa0 [jbd2]
[ 1937.518855]  [000000001019c400] __ext4_journal_get_write_access+0x20/0x60 [ext4]
[ 1937.519369]  [00000000101bf824] ext4_reserve_inode_write+0x84/0xc0 [ext4]
[ 1937.519883]  [00000000101bfa48] ext4_mark_inode_dirty+0x28/0x1e0 [ext4]
[ 1937.520365]  [00000000101c3c6c] ext4_dirty_inode+0x4c/0x80 [ext4]
[ 1937.520755]  [000000000066fe30] __mark_inode_dirty+0x130/0x340
[ 1937.521307]  [00000000101c38ec] ext4_setattr+0x50c/0x840 [ext4]
[ 1937.521744]  [000000000065c8c4] notify_change+0x384/0x560
[ 1937.522093]  [0000000000677104] utimes_common.isra.0+0xc4/0x1a0
[ 1937.522469]  [00000000006772e0] do_utimes+0x100/0x180
[ 1937.522799] INFO: task kworker/0:3:1295 blocked for more than 120 seconds.
[ 1937.523233]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
[ 1937.523685] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1937.524186] kworker/0:3     D    0  1295      2 0x02000000
[ 1937.524633] Workqueue: events ata_scsi_dev_rescan [libata]
[ 1937.525100] Call Trace:
[ 1937.525348]  [0000000000b10834] schedule+0x54/0x100
[ 1937.525703]  [0000000000b10bf4] io_schedule+0x14/0x40
[ 1937.526040]  [000000000079a33c] blk_mq_get_tag+0x11c/0x2c0
[ 1937.526394]  [0000000000794e28] blk_mq_get_request+0xc8/0x3a0
[ 1937.526766]  [000000000079514c] blk_mq_alloc_request+0x4c/0xa0
[ 1937.527186]  [00000000007896f0] blk_get_request+0x30/0xe0
[ 1937.527581]  [000000001003bd14] __scsi_execute+0x34/0x1a0 [scsi_mod]
[ 1937.528022]  [0000000010034c6c] scsi_vpd_inquiry+0x6c/0xc0 [scsi_mod]
[ 1937.528485]  [0000000010034dec] scsi_get_vpd_buf+0x4c/0x80 [scsi_mod]
[ 1937.528938]  [0000000010034e30] scsi_update_vpd_page+0x10/0x60 [scsi_mod]
[ 1937.529530]  [0000000010035b90] scsi_attach_vpd+0xd0/0x180 [scsi_mod]
[ 1937.529988]  [00000000100402f8] scsi_rescan_device+0x18/0xa0 [scsi_mod]
[ 1937.530489]  [00000000100a6620] ata_scsi_dev_rescan+0x80/0xe0 [libata]
[ 1937.530906]  [0000000000482eb4] process_one_work+0x194/0x480
[ 1937.531270]  [00000000004832e4] worker_thread+0x144/0x540
[ 1937.531618]  [000000000048913c] kthread+0xdc/0x120

... at which point I killed the damn thing.  Unpingable, doesn't react to serial
console (the output is obviously there, the input doesn't reach shell, at the
very least).  That was on current debian kernel (5.6.0-based), but the mainline
5.7-rc1 behaves the same way.  qemu is (yesterday) mainline:

commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9 (HEAD -> master, origin/master, origin/HEAD)
Merge: 66706192de 9ecaf5ccec
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Fri May 15 19:51:16 2020 +0100

    Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging

and anything since bcf9e2c2f2 exhibits that behaviour.  qemu arguments:
../qemu1/build/sparc64-softmmu/qemu-system-sparc64 \
        -hda sid.img \
        -drive id=hd,if=none,file=foo.raw,format=raw \
        -device virtio-blk-pci,bus=pciB,drive=hd \
        -netdev tap,ifname=tap4,script=no,downscript=no,id=net \
        -device e1000,bus=pciB,netdev=net \
        -nographic -m 1024
foo.raw and sid.img have the same contents (sid.img is qcow2 - might or might not
cause enough timing differences to trigger whatever's happening).

Looks like something got screwed in PCI interrupt routing in that sun4u branch back in
2017.  If you have any suggestions on debugging that, I'd be glad to help; I'm not
familiar with openbios guts, though ;-/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-18 18:18         ` Al Viro
@ 2020-05-18 18:23           ` Christian Brauner
  2020-05-18 19:58           ` Mark Cave-Ayland
  1 sibling, 0 replies; 12+ messages in thread
From: Christian Brauner @ 2020-05-18 18:23 UTC (permalink / raw)
  To: Al Viro
  Cc: Mark Cave-Ayland, David Miller, arnd, guoren, linux-csky,
	linux-kernel, sparclinux

On Mon, May 18, 2020 at 07:18:25PM +0100, Al Viro wrote:
> On Sun, May 17, 2020 at 11:13:47PM +0100, Al Viro wrote:
> 
> > 	Is virtio-blk-pci more resilent to lost interrupt bug introduced in 
> > "sun4u: update PCI topology to include simba PCI bridges"?  I hadn't tried
> > it yet (reverted to the last working mainline qemu commit for now); IDE
> > definitely is screwed by that - both the Linux and NetBSD drivers, actually.
> > 
> > 	A 50Mb worth of wget(1) is more than enough to trigger that crap;
> > 
> > commit 063833a6ec
> > Merge: d634fc0499 bcf9e2c2f2
> > Author: Peter Maydell <peter.maydell@linaro.org>
> > Date:   Thu Oct 19 18:42:51 2017 +0100
> > 
> >     Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging
> > 
> > hangs, d634fc0499 works, bcf9e2c2f2 hangs.
> > 
> > I hadn't looked into details (the branch itself is only two commits long, but it
> > incorporates an openbios update - 35 commits there, some obviously pci- and
> > sun4u-related), but it's really easy to reproduce - -m 1024 and -hda <image>
> > are probably the only relevant arguments.  Even dd if=/dev/sda of=/dev/null bs=64m
> > is often enough to hang it, so I rather doubt that networking (e1000 on pciB,
> > FWIW, with tap for backend) has anything to do with that.
> 
> 	FWIW, virtio-blk-pci does appear to be much more resilent; I hadn't been
> able to reproduce hangs on that, while mounting identical fs from pata_cmd64x
> and doing the same aptitude dist-upgrade --download-only ended up with
> 
> ...
> Note: Using 'Download Only' mode, no other actions will be performed.
> Do you want to continue? [Y/n/?] y
> Get: 1 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-modules-5.30 all 5.30.2-1 [2,806 kB]
> Get: 2 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libperl5.30 sparc64 5.30.2-1 [3,388 kB]
> Get: 3 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl sparc64 5.30.2-1 [290 kB]
> Get: 4 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-base sparc64 5.30.2-1 [1,427 kB]
> Get: 5 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libsystemd0 sparc64 245.5-3 [309 kB]
> Get: 6 http://ftp.ports.debian.org/debian-ports sid/main sparc64 udev sparc64 245.5-3 [1,356 kB]
> Get: 7 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libudev1 sparc64 245.5-3 [153 kB]
> [ 1472.613660] ata2: lost interrupt (Status 0x58)
> [ 1472.615124] ata1: lost interrupt (Status 0x50)
> [ 1472.615812] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1472.616515] ata1.00: failed command: WRITE DMA
> [ 1472.617145] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
> [ 1472.617145]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1472.618229] ata1.00: status: { DRDY }
> [ 1472.618743] ata1: soft resetting link
> [ 1472.779489] ata1.00: configured for UDMA/33
> [ 1472.781211] ata1: EH complete
> [ 1477.977424] ata2.00: qc timeout (cmd 0xa0)
> [ 1477.977897] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1483.353324] ata2.00: qc timeout (cmd 0xa0)
> [ 1483.353697] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1483.354453] ata2.00: limiting speed to UDMA/33:PIO3
> [ 1488.729323] ata2.00: qc timeout (cmd 0xa0)
> [ 1488.730255] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1488.731320] ata2.00: disabled
> [ 1503.333388] ata1: lost interrupt (Status 0x50)
> [ 1503.333838] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1503.334309] ata1.00: failed command: WRITE DMA EXT
> [ 1503.334647] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
> [ 1503.334647]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1503.335494] ata1.00: status: { DRDY }
> [ 1503.335858] ata1: soft resetting link
> [ 1503.494764] ata1.00: configured for UDMA/33
> [ 1503.495313] ata1: EH complete
> [ 1534.041532] ata1: lost interrupt (Status 0x50)
> [ 1534.042043] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1534.042627] ata1.00: failed command: WRITE DMA
> [ 1534.042969] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
> [ 1534.042969]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1534.043902] ata1.00: status: { DRDY }
> [ 1534.044306] ata1: soft resetting link
> [ 1534.202625] ata1.00: configured for UDMA/33
> [ 1534.203119] ata1: EH complete
> [ 1564.761561] ata1: lost interrupt (Status 0x50)
> [ 1564.762351] ata1.00: limiting speed to UDMA/25:PIO4
> [ 1564.762831] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1564.763388] ata1.00: failed command: WRITE DMA EXT
> [ 1564.763790] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
> [ 1564.763790]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1564.764784] ata1.00: status: { DRDY }
> [ 1564.765470] ata1: soft resetting link
> [ 1564.926509] ata1.00: configured for UDMA/25
> [ 1564.927516] ata1: EH complete
> [ 1575.001438] INFO: task jbd2/sda2-8:143 blocked for more than 120 seconds.
> [ 1575.002273]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1575.002755] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1575.003323] jbd2/sda2-8     D    0   143      2 0x07000000
> [ 1575.003867] Call Trace:
> [ 1575.004228]  [0000000000b10834] schedule+0x54/0x100
> [ 1575.004598]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1575.004922]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
> [ 1575.009472]  [00000000007b5274] wbt_wait+0x74/0xe0
> [ 1575.009832]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
> [ 1575.010191]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
> [ 1575.010558]  [000000000078b418] generic_make_request+0x98/0x2e0
> [ 1575.010923]  [000000000078b6b8] submit_bio+0x58/0x200
> [ 1575.011245]  [000000000067f100] submit_bh_wbc+0x1c0/0x200
> [ 1575.011583]  [000000000067f91c] submit_bh+0x1c/0x40
> [ 1575.012627]  [0000000010167d7c] jbd2_journal_commit_transaction+0x69c/0x1740 [jbd2]
> [ 1575.013300]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
> [ 1575.013706]  [000000000048913c] kthread+0xdc/0x120
> [ 1575.014012]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
> [ 1575.014565]  [0000000000000000] 0x0
> [ 1575.014888] INFO: task http:1294 blocked for more than 120 seconds.
> [ 1575.015287]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1575.015728] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1575.016208] http            D    0  1294   1283 0x208000105000000
> [ 1575.016616] Call Trace:
> [ 1575.016803]  [0000000000b10834] schedule+0x54/0x100
> [ 1575.017289]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1575.017654]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
> [ 1575.018011]  [00000000007b5274] wbt_wait+0x74/0xe0
> [ 1575.018328]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
> [ 1575.018677]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
> [ 1575.019047]  [000000000078b418] generic_make_request+0x98/0x2e0
> [ 1575.019421]  [000000000078b6b8] submit_bio+0x58/0x200
> [ 1575.019825]  [00000000101dcf64] ext4_io_submit+0x44/0x60 [ext4]
> [ 1575.020249]  [00000000101c0108] ext4_writepages+0x508/0xc20 [ext4]
> [ 1575.020634]  [00000000005b0790] do_writepages+0x30/0xe0
> [ 1575.021000]  [00000000005a7618] __filemap_fdatawrite_range+0xb8/0x100
> [ 1575.021542]  [00000000005a76bc] filemap_flush+0x1c/0x40
> [ 1575.021944]  [00000000101bce24] ext4_alloc_da_blocks+0x24/0x80 [ext4]
> [ 1575.022387]  [00000000101abf30] ext4_release_file+0x90/0xe0 [ext4]
> [ 1575.022777]  [000000000063d1cc] __fput+0xac/0x280
> [ 1595.481559] ata1: lost interrupt (Status 0x50)
> [ 1595.482352] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1595.483223] ata1.00: failed command: WRITE DMA
> [ 1595.483799] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
> [ 1595.483799]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1595.485513] ata1.00: status: { DRDY }
> [ 1595.489629] ata1: soft resetting link
> [ 1595.650743] ata1.00: configured for UDMA/25
> [ 1595.651259] ata1: EH complete
> [ 1626.201466] ata1: lost interrupt (Status 0x50)
> [ 1626.202778] ata1.00: limiting speed to PIO4
> [ 1626.203678] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1626.205103] ata1.00: failed command: WRITE DMA EXT
> [ 1626.206127] ata1.00: cmd 35/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 dma 155648 out
> [ 1626.206127]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1626.208832] ata1.00: status: { DRDY }
> [ 1626.209856] ata1: soft resetting link
> [ 1626.370839] ata1.00: configured for PIO4
> [ 1626.371357] ata1: EH complete
> [ 1656.921546] ata1: lost interrupt (Status 0x58)
> [ 1656.922076] ata1.00: limiting speed to PIO3
> [ 1656.922390] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1656.922837] ata1.00: failed command: WRITE MULTIPLE
> [ 1656.923190] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
> [ 1656.923190]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1656.924057] ata1.00: status: { DRDY }
> [ 1656.924441] ata1: soft resetting link
> [ 1657.082383] ata1.00: configured for PIO3
> [ 1657.082940] ata1: EH complete
> [ 1687.641729] ata1: lost interrupt (Status 0x58)
> [ 1687.642217] ata1.00: limiting speed to PIO0
> [ 1687.642526] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1687.642963] ata1.00: failed command: WRITE MULTIPLE EXT
> [ 1687.643336] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
> [ 1687.643336]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1687.644276] ata1.00: status: { DRDY }
> [ 1687.644649] ata1: soft resetting link
> [ 1687.802485] ata1.00: configured for PIO0
> [ 1687.802946] ata1: EH complete
> [ 1695.833443] INFO: task jbd2/sda2-8:143 blocked for more than 241 seconds.
> [ 1695.834181]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1695.834915] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1695.835667] jbd2/sda2-8     D    0   143      2 0x07000000
> [ 1695.836230] Call Trace:
> [ 1695.836537]  [0000000000b10834] schedule+0x54/0x100
> [ 1695.837186]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1695.837753]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
> [ 1695.838244]  [00000000007b5274] wbt_wait+0x74/0xe0
> [ 1695.838717]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
> [ 1695.839247]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
> [ 1695.839811]  [000000000078b418] generic_make_request+0x98/0x2e0
> [ 1695.840366]  [000000000078b6b8] submit_bio+0x58/0x200
> [ 1695.840841]  [000000000067f100] submit_bh_wbc+0x1c0/0x200
> [ 1695.841561]  [000000000067f91c] submit_bh+0x1c/0x40
> [ 1695.842111]  [0000000010167d7c] jbd2_journal_commit_transaction+0x69c/0x1740 [jbd2]
> [ 1695.842851]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
> [ 1695.843392]  [000000000048913c] kthread+0xdc/0x120
> [ 1695.843860]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
> [ 1695.844355]  [0000000000000000] 0x0
> [ 1695.844707] INFO: task http:1294 blocked for more than 241 seconds.
> [ 1695.845478]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1695.846180] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1695.846905] http            D    0  1294   1283 0x208000105000000
> [ 1695.847500] Call Trace:
> [ 1695.847786]  [0000000000b10834] schedule+0x54/0x100
> [ 1695.848272]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1695.848757]  [00000000007a6ac4] rq_qos_wait+0xc4/0x160
> [ 1695.849477]  [00000000007b5274] wbt_wait+0x74/0xe0
> [ 1695.850000]  [00000000007a6760] __rq_qos_throttle+0x20/0x40
> [ 1695.850557]  [00000000007975f0] blk_mq_make_request+0xf0/0x5a0
> [ 1695.851107]  [000000000078b418] generic_make_request+0x98/0x2e0
> [ 1695.851650]  [000000000078b6b8] submit_bio+0x58/0x200
> [ 1695.852214]  [00000000101dcf64] ext4_io_submit+0x44/0x60 [ext4]
> [ 1695.852837]  [00000000101c0108] ext4_writepages+0x508/0xc20 [ext4]
> [ 1695.853638]  [00000000005b0790] do_writepages+0x30/0xe0
> [ 1695.854162]  [00000000005a7618] __filemap_fdatawrite_range+0xb8/0x100
> [ 1695.854765]  [00000000005a76bc] filemap_flush+0x1c/0x40
> [ 1695.855316]  [00000000101bce24] ext4_alloc_da_blocks+0x24/0x80 [ext4]
> [ 1695.855973]  [00000000101abf30] ext4_release_file+0x90/0xe0 [ext4]
> [ 1695.856568]  [000000000063d1cc] __fput+0xac/0x280
> [ 1695.857152] INFO: task kworker/0:3:1295 blocked for more than 120 seconds.
> [ 1695.857878]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1695.858550] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1695.859262] kworker/0:3     D    0  1295      2 0x01000000
> [ 1695.860238] Workqueue: events ata_scsi_dev_rescan [libata]
> [ 1695.860828] Call Trace:
> [ 1695.861273]  [0000000000b10834] schedule+0x54/0x100
> [ 1695.861814]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1695.862295]  [000000000079a33c] blk_mq_get_tag+0x11c/0x2c0
> [ 1695.862826]  [0000000000794e28] blk_mq_get_request+0xc8/0x3a0
> [ 1695.863294]  [000000000079514c] blk_mq_alloc_request+0x4c/0xa0
> [ 1695.863686]  [00000000007896f0] blk_get_request+0x30/0xe0
> [ 1695.864093]  [000000001003bd14] __scsi_execute+0x34/0x1a0 [scsi_mod]
> [ 1695.864544]  [0000000010034c6c] scsi_vpd_inquiry+0x6c/0xc0 [scsi_mod]
> [ 1695.865018]  [0000000010034dec] scsi_get_vpd_buf+0x4c/0x80 [scsi_mod]
> [ 1695.865640]  [0000000010035afc] scsi_attach_vpd+0x3c/0x180 [scsi_mod]
> [ 1695.866099]  [00000000100402f8] scsi_rescan_device+0x18/0xa0 [scsi_mod]
> [ 1695.866568]  [00000000100a6620] ata_scsi_dev_rescan+0x80/0xe0 [libata]
> [ 1695.867009]  [0000000000482eb4] process_one_work+0x194/0x480
> [ 1695.867392]  [00000000004832e4] worker_thread+0x144/0x540
> [ 1695.867759]  [000000000048913c] kthread+0xdc/0x120
> [ 1695.868095]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
> [ 1718.361472] ata1: lost interrupt (Status 0x58)
> [ 1718.362753] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1718.364199] ata1.00: failed command: WRITE MULTIPLE
> [ 1718.365436] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
> [ 1718.365436]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1718.368421] ata1.00: status: { DRDY }
> [ 1718.369510] ata1: soft resetting link
> [ 1718.530645] ata1.00: configured for PIO0
> [ 1718.531608] ata1: EH complete
> [ 1749.081528] ata1: lost interrupt (Status 0x58)
> [ 1749.082016] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1749.082490] ata1.00: failed command: WRITE MULTIPLE EXT
> [ 1749.082861] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
> [ 1749.082861]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1749.083785] ata1.00: status: { DRDY }
> [ 1749.084186] ata1: soft resetting link
> [ 1749.242344] ata1.00: configured for PIO0
> [ 1749.242776] ata1: EH complete
> [ 1779.801525] ata1: lost interrupt (Status 0x58)
> [ 1779.802194] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1779.802933] ata1.00: failed command: WRITE MULTIPLE
> [ 1779.803424] ata1.00: cmd c5/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 pio 49152 out
> [ 1779.803424]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1779.804678] ata1.00: status: { DRDY }
> [ 1779.805327] ata1: soft resetting link
> [ 1779.966461] ata1.00: configured for PIO0
> [ 1779.968232] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=338s
> [ 1779.969221] sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current] 
> [ 1779.969921] sd 0:0:0:0: [sda] tag#0 Add. Sense: Unaligned write command
> [ 1779.971038] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 23 9b 0c 00 00 60 00
> [ 1779.971722] blk_update_request: I/O error, dev sda, sector 2333452 op 0x1:(WRITE) flags 0x0 phys_seg 1 prio class 0
> [ 1779.972504] EXT4-fs warning (device sda2): ext4_end_bio:347: I/O error 10 writing to inode 130691 starting block 291693)
> [ 1779.973770] ata1: EH complete
> [ 1810.521509] ata1: lost interrupt (Status 0x58)
> [ 1810.522165] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1810.522895] ata1.00: failed command: WRITE MULTIPLE EXT
> [ 1810.523415] ata1.00: cmd 39/00:30:0c:7b:23/00:01:00:00:00/e0 tag 0 pio 155648 out
> [ 1810.523415]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1810.524696] ata1.00: status: { DRDY }
> [ 1810.525363] ata1: soft resetting link
> [ 1810.686255] ata1.00: configured for PIO0
> [ 1810.686951] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=337s
> [ 1810.687809] sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current] 
> [ 1810.688449] sd 0:0:0:0: [sda] tag#0 Add. Sense: Unaligned write command
> [ 1810.689213] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 23 7b 0c 00 01 30 00
> [ 1810.689966] blk_update_request: I/O error, dev sda, sector 2325260 op 0x1:(WRITE) flags 0x0 phys_seg 3 prio class 0
> [ 1810.690901] EXT4-fs warning (device sda2): ext4_end_bio:347: I/O error 10 writing to inode 130696 starting block 290695)
> [ 1810.692093] ata1: EH complete
> [ 1841.253842] ata1: lost interrupt (Status 0x58)
> [ 1841.254522] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1841.255276] ata1.00: failed command: WRITE MULTIPLE
> [ 1841.255781] ata1.00: cmd c5/00:78:d4:61:49/00:00:00:00:00/e0 tag 0 pio 61440 out
> [ 1841.255781]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1841.257269] ata1.00: status: { DRDY }
> [ 1841.257820] ata1: soft resetting link
> [ 1841.418388] ata1.00: configured for PIO0
> [ 1841.418961] ata1: EH complete
> [ 1871.973375] ata1: lost interrupt (Status 0x58)
> [ 1871.973863] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1871.974338] ata1.00: failed command: WRITE MULTIPLE
> [ 1871.974727] ata1.00: cmd c5/00:a0:8c:0e:3b/00:00:00:00:00/e0 tag 0 pio 81920 out
> [ 1871.974727]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1871.975707] ata1.00: status: { DRDY }
> [ 1871.976096] ata1: soft resetting link
> [ 1872.134384] ata1.00: configured for PIO0
> [ 1872.134988] ata1: EH complete
> [ 1902.681573] ata1: lost interrupt (Status 0x58)
> [ 1902.682340] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1902.683115] ata1.00: failed command: WRITE MULTIPLE
> [ 1902.683674] ata1.00: cmd c5/00:78:d4:61:49/00:00:00:00:00/e0 tag 0 pio 61440 out
> [ 1902.683674]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1902.685158] ata1.00: status: { DRDY }
> [ 1902.689610] ata1: soft resetting link
> [ 1902.850306] ata1.00: configured for PIO0
> [ 1902.850767] ata1: EH complete
> [ 1933.401429] ata1: lost interrupt (Status 0x58)
> [ 1933.401961] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1933.402474] ata1.00: failed command: WRITE MULTIPLE
> [ 1933.402878] ata1.00: cmd c5/00:a0:8c:0e:3b/00:00:00:00:00/e0 tag 0 pio 81920 out
> [ 1933.402878]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1933.403875] ata1.00: status: { DRDY }
> [ 1933.404289] ata1: soft resetting link
> [ 1933.562384] ata1.00: configured for PIO0
> [ 1933.562869] ata1: EH complete
> [ 1937.497217] INFO: task jbd2/sda2-8:143 blocked for more than 120 seconds.
> [ 1937.497777]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1937.498257] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1937.498777] jbd2/sda2-8     D    0   143      2 0x03000000
> [ 1937.499174] Call Trace:
> [ 1937.499400]  [0000000000b10834] schedule+0x54/0x100
> [ 1937.499746]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1937.500100]  [0000000000b1108c] bit_wait_io+0xc/0x80
> [ 1937.500450]  [0000000000b10c80] __wait_on_bit+0x60/0x100
> [ 1937.500815]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
> [ 1937.501357]  [000000000067d6d0] __wait_on_buffer+0x30/0x40
> [ 1937.501796]  [00000000101685d4] jbd2_journal_commit_transaction+0xef4/0x1740 [jbd2]
> [ 1937.502330]  [000000001016d530] kjournald2+0x90/0x220 [jbd2]
> [ 1937.502728]  [000000000048913c] kthread+0xdc/0x120
> [ 1937.503061]  [0000000000405fa4] ret_from_fork+0x1c/0x2c
> [ 1937.503407]  [0000000000000000] 0x0
> [ 1937.503658] INFO: task kworker/u2:2:1138 blocked for more than 120 seconds.
> [ 1937.504096]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1937.504544] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1937.505128] kworker/u2:2    D    0  1138      2 0x05000000
> [ 1937.505677] Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work [ext4]
> [ 1937.506109] Call Trace:
> [ 1937.506306]  [0000000000b10834] schedule+0x54/0x100
> [ 1937.506643]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1937.507007]  [0000000000b1108c] bit_wait_io+0xc/0x80
> [ 1937.507361]  [0000000000b10c80] __wait_on_bit+0x60/0x100
> [ 1937.507717]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
> [ 1937.508150]  [0000000010166138] do_get_write_access+0x2f8/0x440 [jbd2]
> [ 1937.508587]  [0000000010166300] jbd2_journal_get_write_access+0x80/0xa0 [jbd2]
> [ 1937.509203]  [000000001019c400] __ext4_journal_get_write_access+0x20/0x60 [ext4]
> [ 1937.509812]  [00000000101bf824] ext4_reserve_inode_write+0x84/0xc0 [ext4]
> [ 1937.510301]  [00000000101bfa48] ext4_mark_inode_dirty+0x28/0x1e0 [ext4]
> [ 1937.510766]  [000000001019ce74] __ext4_ext_dirty.isra.0+0x54/0xa0 [ext4]
> [ 1937.511234]  [00000000101a66c8] ext4_ext_map_blocks+0x828/0x17c0 [ext4]
> [ 1937.511699]  [00000000101bb638] ext4_map_blocks+0xd8/0x6a0 [ext4]
> [ 1937.512134]  [00000000101a882c] ext4_convert_unwritten_extents+0x14c/0x200 [ext4]
> [ 1937.512706]  [00000000101a894c] ext4_convert_unwritten_io_end_vec+0x6c/0x100 [ext4]
> [ 1937.513388]  [00000000101dca00] ext4_end_io_rsv_work+0xe0/0x1c0 [ext4]
> [ 1937.513853] INFO: task http:1294 blocked for more than 120 seconds.
> [ 1937.514287]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1937.514735] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1937.515277] http            D    0  1294   1283 0x208000103000000
> [ 1937.515732] Call Trace:
> [ 1937.515925]  [0000000000b10834] schedule+0x54/0x100
> [ 1937.516254]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1937.516586]  [0000000000b1108c] bit_wait_io+0xc/0x80
> [ 1937.516924]  [0000000000b10c80] __wait_on_bit+0x60/0x100
> [ 1937.517426]  [0000000000b10d9c] out_of_line_wait_on_bit+0x7c/0xa0
> [ 1937.517897]  [0000000010166138] do_get_write_access+0x2f8/0x440 [jbd2]
> [ 1937.518346]  [0000000010166300] jbd2_journal_get_write_access+0x80/0xa0 [jbd2]
> [ 1937.518855]  [000000001019c400] __ext4_journal_get_write_access+0x20/0x60 [ext4]
> [ 1937.519369]  [00000000101bf824] ext4_reserve_inode_write+0x84/0xc0 [ext4]
> [ 1937.519883]  [00000000101bfa48] ext4_mark_inode_dirty+0x28/0x1e0 [ext4]
> [ 1937.520365]  [00000000101c3c6c] ext4_dirty_inode+0x4c/0x80 [ext4]
> [ 1937.520755]  [000000000066fe30] __mark_inode_dirty+0x130/0x340
> [ 1937.521307]  [00000000101c38ec] ext4_setattr+0x50c/0x840 [ext4]
> [ 1937.521744]  [000000000065c8c4] notify_change+0x384/0x560
> [ 1937.522093]  [0000000000677104] utimes_common.isra.0+0xc4/0x1a0
> [ 1937.522469]  [00000000006772e0] do_utimes+0x100/0x180
> [ 1937.522799] INFO: task kworker/0:3:1295 blocked for more than 120 seconds.
> [ 1937.523233]       Tainted: G            E     5.6.0-1-sparc64 #1 Debian 5.6.7-1
> [ 1937.523685] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 1937.524186] kworker/0:3     D    0  1295      2 0x02000000
> [ 1937.524633] Workqueue: events ata_scsi_dev_rescan [libata]
> [ 1937.525100] Call Trace:
> [ 1937.525348]  [0000000000b10834] schedule+0x54/0x100
> [ 1937.525703]  [0000000000b10bf4] io_schedule+0x14/0x40
> [ 1937.526040]  [000000000079a33c] blk_mq_get_tag+0x11c/0x2c0
> [ 1937.526394]  [0000000000794e28] blk_mq_get_request+0xc8/0x3a0
> [ 1937.526766]  [000000000079514c] blk_mq_alloc_request+0x4c/0xa0
> [ 1937.527186]  [00000000007896f0] blk_get_request+0x30/0xe0
> [ 1937.527581]  [000000001003bd14] __scsi_execute+0x34/0x1a0 [scsi_mod]
> [ 1937.528022]  [0000000010034c6c] scsi_vpd_inquiry+0x6c/0xc0 [scsi_mod]
> [ 1937.528485]  [0000000010034dec] scsi_get_vpd_buf+0x4c/0x80 [scsi_mod]
> [ 1937.528938]  [0000000010034e30] scsi_update_vpd_page+0x10/0x60 [scsi_mod]
> [ 1937.529530]  [0000000010035b90] scsi_attach_vpd+0xd0/0x180 [scsi_mod]
> [ 1937.529988]  [00000000100402f8] scsi_rescan_device+0x18/0xa0 [scsi_mod]
> [ 1937.530489]  [00000000100a6620] ata_scsi_dev_rescan+0x80/0xe0 [libata]
> [ 1937.530906]  [0000000000482eb4] process_one_work+0x194/0x480
> [ 1937.531270]  [00000000004832e4] worker_thread+0x144/0x540
> [ 1937.531618]  [000000000048913c] kthread+0xdc/0x120
> 
> ... at which point I killed the damn thing.  Unpingable, doesn't react to serial
> console (the output is obviously there, the input doesn't reach shell, at the
> very least).  That was on current debian kernel (5.6.0-based), but the mainline
> 5.7-rc1 behaves the same way.  qemu is (yesterday) mainline:
> 
> commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9 (HEAD -> master, origin/master, origin/HEAD)
> Merge: 66706192de 9ecaf5ccec
> Author: Peter Maydell <peter.maydell@linaro.org>
> Date:   Fri May 15 19:51:16 2020 +0100
> 
>     Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging
> 
> and anything since bcf9e2c2f2 exhibits that behaviour.  qemu arguments:
> ../qemu1/build/sparc64-softmmu/qemu-system-sparc64 \
>         -hda sid.img \
>         -drive id=hd,if=none,file=foo.raw,format=raw \
>         -device virtio-blk-pci,bus=pciB,drive=hd \
>         -netdev tap,ifname=tap4,script=no,downscript=no,id=net \
>         -device e1000,bus=pciB,netdev=net \
>         -nographic -m 1024
> foo.raw and sid.img have the same contents (sid.img is qcow2 - might or might not
> cause enough timing differences to trigger whatever's happening).
> 
> Looks like something got screwed in PCI interrupt routing in that sun4u branch back in
> 2017.  If you have any suggestions on debugging that, I'd be glad to help; I'm not
> familiar with openbios guts, though ;-/

Fwiw, I'm getting access to a Sparc T5 soon if you want I can ping you
once I do in case you have something that you'd rather test on real
hardware.

Christian

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args
  2020-05-18 18:18         ` Al Viro
  2020-05-18 18:23           ` Christian Brauner
@ 2020-05-18 19:58           ` Mark Cave-Ayland
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Cave-Ayland @ 2020-05-18 19:58 UTC (permalink / raw)
  To: Al Viro
  Cc: Christian Brauner, David Miller, arnd, guoren, linux-csky,
	linux-kernel, sparclinux

On 18/05/2020 19:18, Al Viro wrote:

>> I hadn't looked into details (the branch itself is only two commits long, but it
>> incorporates an openbios update - 35 commits there, some obviously pci- and
>> sun4u-related), but it's really easy to reproduce - -m 1024 and -hda <image>
>> are probably the only relevant arguments.  Even dd if=/dev/sda of=/dev/null bs=64m
>> is often enough to hang it, so I rather doubt that networking (e1000 on pciB,
>> FWIW, with tap for backend) has anything to do with that.
> 
> 	FWIW, virtio-blk-pci does appear to be much more resilent; I hadn't been
> able to reproduce hangs on that, while mounting identical fs from pata_cmd64x
> and doing the same aptitude dist-upgrade --download-only ended up with
> 
> ...
> Note: Using 'Download Only' mode, no other actions will be performed.
> Do you want to continue? [Y/n/?] y
> Get: 1 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-modules-5.30 all 5.30.2-1 [2,806 kB]
> Get: 2 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libperl5.30 sparc64 5.30.2-1 [3,388 kB]
> Get: 3 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl sparc64 5.30.2-1 [290 kB]
> Get: 4 http://ftp.ports.debian.org/debian-ports sid/main sparc64 perl-base sparc64 5.30.2-1 [1,427 kB]
> Get: 5 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libsystemd0 sparc64 245.5-3 [309 kB]
> Get: 6 http://ftp.ports.debian.org/debian-ports sid/main sparc64 udev sparc64 245.5-3 [1,356 kB]
> Get: 7 http://ftp.ports.debian.org/debian-ports sid/main sparc64 libudev1 sparc64 245.5-3 [153 kB]
> [ 1472.613660] ata2: lost interrupt (Status 0x58)
> [ 1472.615124] ata1: lost interrupt (Status 0x50)
> [ 1472.615812] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> [ 1472.616515] ata1.00: failed command: WRITE DMA
> [ 1472.617145] ata1.00: cmd ca/00:60:0c:9b:23/00:00:00:00:00/e0 tag 0 dma 49152 out
> [ 1472.617145]          res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
> [ 1472.618229] ata1.00: status: { DRDY }
> [ 1472.618743] ata1: soft resetting link
> [ 1472.779489] ata1.00: configured for UDMA/33
> [ 1472.781211] ata1: EH complete
> [ 1477.977424] ata2.00: qc timeout (cmd 0xa0)
> [ 1477.977897] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1483.353324] ata2.00: qc timeout (cmd 0xa0)
> [ 1483.353697] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1483.354453] ata2.00: limiting speed to UDMA/33:PIO3
> [ 1488.729323] ata2.00: qc timeout (cmd 0xa0)
> [ 1488.730255] ata2.00: TEST_UNIT_READY failed (err_mask=0x5)
> [ 1488.731320] ata2.00: disabled
> [ 1503.333388] ata1: lost interrupt (Status 0x50)

(lots cut)

Well it certainly looks like there's an IRQ going missing somewhere, but glad to hear
the virtio-blk-pci is working much better for you. Presumably the virtio-net-pci NIC
also works?

> ... at which point I killed the damn thing.  Unpingable, doesn't react to serial
> console (the output is obviously there, the input doesn't reach shell, at the
> very least).  That was on current debian kernel (5.6.0-based), but the mainline
> 5.7-rc1 behaves the same way.  qemu is (yesterday) mainline:
> 
> commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9 (HEAD -> master, origin/master, origin/HEAD)
> Merge: 66706192de 9ecaf5ccec
> Author: Peter Maydell <peter.maydell@linaro.org>
> Date:   Fri May 15 19:51:16 2020 +0100
> 
>     Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging
> 
> and anything since bcf9e2c2f2 exhibits that behaviour.  qemu arguments:
> ../qemu1/build/sparc64-softmmu/qemu-system-sparc64 \
>         -hda sid.img \
>         -drive id=hd,if=none,file=foo.raw,format=raw \
>         -device virtio-blk-pci,bus=pciB,drive=hd \
>         -netdev tap,ifname=tap4,script=no,downscript=no,id=net \
>         -device e1000,bus=pciB,netdev=net \
>         -nographic -m 1024
> foo.raw and sid.img have the same contents (sid.img is qcow2 - might or might not
> cause enough timing differences to trigger whatever's happening).
> 
> Looks like something got screwed in PCI interrupt routing in that sun4u branch back in
> 2017.  If you have any suggestions on debugging that, I'd be glad to help; I'm not
> familiar with openbios guts, though ;-/

I've had one other report of a cmd646 hang on Linux several years ago and that was on
some pretty high end hardware; however when tracing was enabled everything worked as
it should. Despite my best attempts I can't seem to reproduce it here on my normal i7
laptop which is quite frustrating.

Before bcf9e2c2f2 the on-board NIC (sunhme) and cmd646 were wired to sabre's PCI IRQ
lines directly onto a single PCI bus, and after that commit they were rewired via
simba PCI bridges to legacy OBIO IRQs since some OSs like NetBSD hard-coded the
legacy IRQ numbers for on-board devices. I'm not sure whether this is relevant to the
kernel or not, or perhaps there is some magic register somewhere missing from
emulation that should be helping here.

One thing to check is whether you see any network hangs using the sunhme NIC since
that is wired in exactly the same way as cmd646. That should help determine whether
it's related to the IRQs routing via the simba PCI bridge or just the cmd646 device.

If you able to reproduce the issue consistently and can help figure out what's going
on then that would be a great help. Perhaps it might make sense to split this into a
separate thread and drop the non-sparc lists?


ATB,

Mark.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-18 19:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 17:15 [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args Christian Brauner
2020-05-12 17:15 ` [PATCH 1/3] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
2020-05-12 20:04   ` David Miller
2020-05-12 17:15 ` [PATCH 2/3] sparc: share process creation helpers between sparc and sparc64 Christian Brauner
2020-05-12 17:15 ` [PATCH 3/3] sparc: unconditionally enable HAVE_COPY_THREAD_TLS Christian Brauner
2020-05-12 20:06 ` [PATCH 0/3] sparc: port to copy_thread_tls() and struct kernel_clone_args David Miller
2020-05-17 15:01   ` Christian Brauner
2020-05-17 16:34     ` Mark Cave-Ayland
2020-05-17 22:13       ` Al Viro
2020-05-18 18:18         ` Al Viro
2020-05-18 18:23           ` Christian Brauner
2020-05-18 19:58           ` Mark Cave-Ayland

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).