mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] MN10300: Fix ret_from_kernel_thread [ver #2]
@ 2013-05-28 19:21 David Howells
  2013-05-28 19:21 ` [PATCH 2/4] MN10300: Enable IRQs more in system call exit work path " David Howells
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Howells @ 2013-05-28 19:21 UTC (permalink / raw)
  To: torvalds; +Cc: Al Viro, linux-am33-list, linux-kernel, Ken Cox

ret_from_kernel_thread needs to set A2 to the thread_info pointer before
jumping to syscall_exit.

Without this, we never correctly start userspace.

This was caused by the rejuggling of the fork/exec paths in commit:

	ddf23e87a804cbf6fa3818076b33fe023cce09fd
	Author: Al Viro <viro@zeniv.linux.org.uk>
	Date:   Thu Oct 11 17:32:41 2012 -0400
	Subject: mn10300: switch to saner kernel_execve() semantics

Reported-by: Ken Cox <jkc@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ken Cox <jkc@redhat.com>
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
---

 arch/mn10300/kernel/entry.S |    1 +
 1 file changed, 1 insertion(+)


diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 68fcab8..9420057 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -60,6 +60,7 @@ ENTRY(ret_from_kernel_thread)
 	mov	(REG_D0,fp),d0
 	mov	(REG_A0,fp),a0
 	calls	(a0)
+	GET_THREAD_INFO a2		# A2 must be set on return from sys_exit()
 	clr	d0
 	mov	d0,(REG_D0,fp)
 	jmp	syscall_exit


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

* [PATCH 2/4] MN10300: Enable IRQs more in system call exit work path [ver #2]
  2013-05-28 19:21 [PATCH 1/4] MN10300: Fix ret_from_kernel_thread [ver #2] David Howells
@ 2013-05-28 19:21 ` David Howells
  2013-05-28 19:21 ` [PATCH 3/4] MN10300: ASB2305's PCI code needs the definition of XIRQ1 " David Howells
  2013-05-28 19:21 ` [PATCH 4/4] MN10300: Need pci_iomap() and __pci_ioport_map() defining " David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2013-05-28 19:21 UTC (permalink / raw)
  To: torvalds; +Cc: linux-am33-list, linux-kernel, Ken Cox

Enable IRQs when calling schedule() for TIF_NEED_RESCHED and
do_notify_resume().  If interrupts are enabled during do_notify_resume(), a
warning can be seen (see lower down).

Whilst we're at it, resume_userspace can be made local to entry.S as it is not
called outside of there and it can be merged with the part of work_resched that
occurs after schedule() is called.


------------[ cut here ]------------
WARNING: at kernel/softirq.c:160 local_bh_enable+0x42/0xa0()
Modules linked in:
Stack:
  00000000 93d63d88 90009916 901f618c 901f65a8 000000a0 900109b2 93d63db0
  93d62000 93d24d40 00000000 90009940 93d63eb3 93d63dbc 900109b2 00000009
  00000000 93d63dc0 900109b2 93d62000 93d63de0 93d63de0 9016cd1a 901124c8

Call Trace:
 [<90002b8f>] ? show_trace+0x13/0xb4
 [<90002cd0>] show_stack+0x7c/0x84
 [<901124c8>] ? skb_free_head+0x4c/0x54
 [<90002fc9>] dump_stack+0x11/0x18
 [<90009916>] warn_slowpath_common+0x4a/0x5c
 [<900109b2>] ? local_bh_enable+0x42/0xa0
 [<90009940>] warn_slowpath_null+0x18/0x20
 [<900109b2>] ? local_bh_enable+0x42/0xa0
 [<900109b2>] local_bh_enable+0x42/0xa0
 [<9016cd1a>] unix_release_sock+0x86/0x23c
 [<901124c8>] ? skb_free_head+0x4c/0x54
 [<9010e8b5>] ? sk_free+0x31/0x38
 [<9016cef0>] unix_release+0x20/0x28
 [<9010c647>] sock_release+0x17/0x88
 [<9010c874>] sock_close+0x20/0x28
 [<900678e9>] __fput+0xc9/0x1fc
 [<90067a27>] ____fput+0xb/0x10
 [<9001f5a8>] task_work_run+0x64/0x78
 [<9010bda7>] ? sys_connect+0x5b/0x80
 [<90002399>] do_notify_resume+0x53d/0x544
 [<90067dc6>] ? fput+0xce/0xd4
 [<90065117>] ? filp_close+0x5f/0x68
 [<9007bba0>] ? __close_fd+0x7c/0xb0
 [<900026c6>] work_notifysig+0xa/0xc

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ken Cox <jkc@redhat.com>
---

 arch/mn10300/kernel/entry.S |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)


diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 9420057..222152a 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -108,10 +108,10 @@ syscall_exit_work:
 	and	EPSW_nSL,d0
 	beq	resume_kernel		# returning to supervisor mode
 
-	btst	_TIF_SYSCALL_TRACE,d2
-	beq	work_pending
 	LOCAL_IRQ_ENABLE		# could let syscall_trace_exit() call
 					# schedule() instead
+	btst	_TIF_SYSCALL_TRACE,d2
+	beq	work_pending
 	mov	fp,d0
 	call	syscall_trace_exit[],0	# do_syscall_trace(regs)
 	jmp	resume_userspace
@@ -124,6 +124,7 @@ work_pending:
 work_resched:
 	call	schedule[],0
 
+resume_userspace:
 	# make sure we don't miss an interrupt setting need_resched or
 	# sigpending between sampling and the rti
 	LOCAL_IRQ_DISABLE
@@ -132,6 +133,8 @@ work_resched:
 	mov	(TI_flags,a2),d2
 	btst	_TIF_WORK_MASK,d2
 	beq	restore_all
+
+	LOCAL_IRQ_ENABLE
 	btst	_TIF_NEED_RESCHED,d2
 	bne	work_resched
 
@@ -170,17 +173,6 @@ ret_from_intr:
 	and	EPSW_nSL,d0
 	beq	resume_kernel		# returning to supervisor mode
 
-ENTRY(resume_userspace)
-	# make sure we don't miss an interrupt setting need_resched or
-	# sigpending between sampling and the rti
-	LOCAL_IRQ_DISABLE
-
-	# is there any work to be done on int/exception return?
-	mov	(TI_flags,a2),d2
-	btst	_TIF_WORK_MASK,d2
-	bne	work_pending
-	jmp	restore_all
-
 #ifdef CONFIG_PREEMPT
 ENTRY(resume_kernel)
 	LOCAL_IRQ_DISABLE


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

* [PATCH 3/4] MN10300: ASB2305's PCI code needs the definition of XIRQ1 [ver #2]
  2013-05-28 19:21 [PATCH 1/4] MN10300: Fix ret_from_kernel_thread [ver #2] David Howells
  2013-05-28 19:21 ` [PATCH 2/4] MN10300: Enable IRQs more in system call exit work path " David Howells
@ 2013-05-28 19:21 ` David Howells
  2013-05-28 19:21 ` [PATCH 4/4] MN10300: Need pci_iomap() and __pci_ioport_map() defining " David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2013-05-28 19:21 UTC (permalink / raw)
  To: torvalds; +Cc: linux-am33-list, linux-kernel, Ken Cox

The code for PCI in the ASB2305 needs the definition of XIRQ1 from proc/irq.h
otherwise the following error appears:

arch/mn10300/unit-asb2305/pci.c: In function 'unit_pci_init':
arch/mn10300/unit-asb2305/pci.c:481: error: 'XIRQ1' undeclared (first use in this function)
arch/mn10300/unit-asb2305/pci.c:481: error: (Each undeclared identifier is reported only once
arch/mn10300/unit-asb2305/pci.c:481: error: for each function it appears in.)

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ken Cox <jkc@redhat.com>
---

 arch/mn10300/unit-asb2305/pci.c |    1 +
 1 file changed, 1 insertion(+)


diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 1adcf02..e37fac0 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <asm/io.h>
+#include <asm/irq.h>
 #include "pci-asb2305.h"
 
 unsigned int pci_probe = 1;


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

* [PATCH 4/4] MN10300: Need pci_iomap() and __pci_ioport_map() defining [ver #2]
  2013-05-28 19:21 [PATCH 1/4] MN10300: Fix ret_from_kernel_thread [ver #2] David Howells
  2013-05-28 19:21 ` [PATCH 2/4] MN10300: Enable IRQs more in system call exit work path " David Howells
  2013-05-28 19:21 ` [PATCH 3/4] MN10300: ASB2305's PCI code needs the definition of XIRQ1 " David Howells
@ 2013-05-28 19:21 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2013-05-28 19:21 UTC (permalink / raw)
  To: torvalds; +Cc: linux-am33-list, linux-kernel, Ken Cox

Include the generic definitions of pci_iomap() and __pci_ioport_map()
otherwise we can get errors like:

lib/pci_iomap.c: In function 'pci_iomap':
lib/pci_iomap.c:37: error: implicit declaration of function '__pci_ioport_map'
lib/pci_iomap.c:37: warning: return makes pointer from integer without a cast

and:

drivers/pci/quirks.c: In function 'disable_igfx_irq':
drivers/pci/quirks.c:2893: error: implicit declaration of function 'pci_iomap'
drivers/pci/quirks.c:2893: warning: initialization makes pointer from integer without a cast
drivers/pci/quirks.c: In function 'reset_ivb_igd':
drivers/pci/quirks.c:3133: warning: assignment makes pointer from integer without a cast

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ken Cox <jkc@redhat.com>
---

 arch/mn10300/include/asm/pci.h |    2 ++
 1 file changed, 2 insertions(+)


diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 8137c25..6f31cc0 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -103,4 +103,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
+#include <asm-generic/pci_iomap.h>
+
 #endif /* _ASM_PCI_H */


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

end of thread, other threads:[~2013-05-28 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-28 19:21 [PATCH 1/4] MN10300: Fix ret_from_kernel_thread [ver #2] David Howells
2013-05-28 19:21 ` [PATCH 2/4] MN10300: Enable IRQs more in system call exit work path " David Howells
2013-05-28 19:21 ` [PATCH 3/4] MN10300: ASB2305's PCI code needs the definition of XIRQ1 " David Howells
2013-05-28 19:21 ` [PATCH 4/4] MN10300: Need pci_iomap() and __pci_ioport_map() defining " David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®