LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 0/20] mmu: arch/mm: Port OOM changes to arch page fault handlers.
From: richard -rw- weinberger @ 2012-03-20 13:30 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: linux-m32r-ja, linux-am33-list, linux-ia64, linux-parisc,
	linux-cris-kernel, linux-sh, microblaze-uclinux, linux-alpha,
	linux-kernel, linux-mm, linux-m68k, linux, sparclinux,
	linux-hexagon, linuxppc-dev
In-Reply-To: <CAFPAmTQs9dOpQTaXU=6Or66YU+my_CnPw33TE4h++YArBNa38g@mail.gmail.com>

On Tue, Mar 20, 2012 at 2:18 PM, Kautuk Consul <consul.kautuk@gmail.com> wrote:
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
>
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
>
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
>
> I was facing hang and livelock problems on my ARM and MIPS boards when
> I invoked OOM by running the stress_32k.c test-case attached to this email.
>
> Since both the ARM and MIPS porting chainges were accepted, me and my
> co-worker decided to take the initiative to port these changes to all other
> MMU based architectures.
>
> Please review and do write back if there is any way I need to
> improve/rewrite any
> of these patches.
>

What about arch/um/?
Does UML not need this change?

-- 
Thanks,
//richard

^ permalink raw reply

* Re: [PATCH 0/20] mmu: arch/mm: Port OOM changes to arch page fault handlers.
From: Kautuk Consul @ 2012-03-20 13:34 UTC (permalink / raw)
  To: richard -rw- weinberger
  Cc: linux-m32r-ja, linux-am33-list, linux-ia64, linux-parisc,
	linux-cris-kernel, linux-sh, microblaze-uclinux, linux-alpha,
	linux-kernel, linux-mm, linux-m68k, linux, sparclinux,
	linux-hexagon, linuxppc-dev
In-Reply-To: <CAFLxGvwW2XcYSoidZZ0XF_a-pH3SwONqS+hCnpGUecQ__DLa_g@mail.gmail.com>

>
> What about arch/um/?
> Does UML not need this change?

Oh yes, extremely sorry I accidentally missed that one out.
Mind if I send it separately ?

>
> --
> Thanks,
> //richard

^ permalink raw reply

* Re: [PATCH 0/20] mmu: arch/mm: Port OOM changes to arch page fault handlers.
From: richard -rw- weinberger @ 2012-03-20 13:36 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: linux-m32r-ja, linux-am33-list, linux-ia64, linux-parisc,
	linux-cris-kernel, linux-sh, microblaze-uclinux, linux-alpha,
	linux-kernel, linux-mm, linux-m68k, linux, sparclinux,
	linux-hexagon, linuxppc-dev
In-Reply-To: <CAFPAmTSzV9mrkbP68p4PA-0i0o2Hz7JiBY=0A0V_myJEzWubjQ@mail.gmail.com>

On Tue, Mar 20, 2012 at 2:34 PM, Kautuk Consul <consul.kautuk@gmail.com> wrote:
>>
>> What about arch/um/?
>> Does UML not need this change?
>
> Oh yes, extremely sorry I accidentally missed that one out.
> Mind if I send it separately ?

No problem.
handle_page_fault() is the function you want to patch. :)

-- 
Thanks,
//richard

^ permalink raw reply

* Re: [PATCH 04/20] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Peter Zijlstra @ 2012-03-20 14:06 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: linux-kernel, Christian Dietrich, Paul Mackerras, Mohd. Faris,
	Ingo Molnar, linuxppc-dev
In-Reply-To: <1332249595-2678-1-git-send-email-consul.kautuk@gmail.com>

On Tue, 2012-03-20 at 09:19 -0400, Kautuk Consul wrote:
> +#ifd#ifdef CONFIG_PPC_SMLPAR
> +                       if (firmware_has_feature(FW_FEATURE_CMO)) {
> +                               preempt_disable();
> +                               get_lppaca()->page_ins +=3D (1 << PAGE_FA=
CTOR);
> +                               preempt_enable();
> +                       }
> +#end#endif=20

That's curious CPP usage....

^ permalink raw reply

* [PATCH 04/20 v2] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Kautuk Consul @ 2012-03-20 14:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Jimi Xenidis, Ingo Molnar,
	Peter Zijlstra, Christian Dietrich
  Cc: linuxppc-dev, linux-kernel, Mohd. Faris, Kautuk Consul

Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)

The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.

These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.

Port these changes to powerpc.

Signed-off-by: Mohd. Faris <mohdfarisq2010@gmail.com>
Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
 arch/powerpc/mm/fault.c |   51 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2f0d1b0..a3b1176 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -129,6 +129,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
 	int is_write = 0, ret;
 	int trap = TRAP(regs);
  	int is_exec = trap == 0x400;
+	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
 	/*
@@ -212,6 +213,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
 		if (!user_mode(regs) && !search_exception_tables(regs->nip))
 			goto bad_area_nosemaphore;
 
+retry:
 		down_read(&mm->mmap_sem);
 	}
 
@@ -313,6 +315,7 @@ good_area:
 	} else if (is_write) {
 		if (!(vma->vm_flags & VM_WRITE))
 			goto bad_area;
+		flags |= FAULT_FLAG_WRITE;
 	/* a read */
 	} else {
 		/* protection fault */
@@ -327,7 +330,11 @@ good_area:
 	 * make sure we exit gracefully rather than endlessly redo
 	 * the fault.
 	 */
-	ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
+	ret = handle_mm_fault(mm, vma, address, flags);
+
+	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+		return;
+
 	if (unlikely(ret & VM_FAULT_ERROR)) {
 		if (ret & VM_FAULT_OOM)
 			goto out_of_memory;
@@ -335,22 +342,36 @@ good_area:
 			goto do_sigbus;
 		BUG();
 	}
-	if (ret & VM_FAULT_MAJOR) {
-		current->maj_flt++;
-		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
-				     regs, address);
-#ifdef CONFIG_PPC_SMLPAR
-		if (firmware_has_feature(FW_FEATURE_CMO)) {
-			preempt_disable();
-			get_lppaca()->page_ins += (1 << PAGE_FACTOR);
-			preempt_enable();
+	if (flags & FAULT_FLAG_ALLOW_RETRY) {
+		if (ret & VM_FAULT_MAJOR) {
+			current->maj_flt++;
+			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
+					     regs, address);
+#ifdef CONFIG_PPC_SMLPAR
+			if (firmware_has_feature(FW_FEATURE_CMO)) {
+				preempt_disable();
+				get_lppaca()->page_ins += (1 << PAGE_FACTOR);
+				preempt_enable();
+			}
+#endif
+		} else {
+			current->min_flt++;
+			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
+					     regs, address);
+		}
+		if (fault & VM_FAULT_RETRY) {
+			flags &= ~FAULT_FLAG_ALLOW_RETRY;
+
+			/*
+			 * No need to up_read(&mm->mmap_sem) as we would
+			 * have already released it in __lock_page_or_retry
+			 * in mm/filemap.c.
+			 */
+
+			goto retry;
 		}
-#endif
-	} else {
-		current->min_flt++;
-		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
-				     regs, address);
 	}
+
 	up_read(&mm->mmap_sem);
 	return 0;
 
-- 
1.7.5.4

^ permalink raw reply related

* Re: [PATCH 04/20] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Kautuk Consul @ 2012-03-20 14:13 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, Christian Dietrich, Paul Mackerras, Mohd. Faris,
	Ingo Molnar, linuxppc-dev
In-Reply-To: <1332252387.18960.424.camel@twins>

On Tue, Mar 20, 2012 at 10:06 AM, Peter Zijlstra <a.p.zijlstra@chello.nl> w=
rote:
> On Tue, 2012-03-20 at 09:19 -0400, Kautuk Consul wrote:
>> +#ifd#ifdef CONFIG_PPC_SMLPAR
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (firmware_has_feature(F=
W_FEATURE_CMO)) {
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_di=
sable();
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_lppaca=
()->page_ins +=3D (1 << PAGE_FACTOR);
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_en=
able();
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> +#end#endif
>
> That's curious CPP usage....

Quite baffling.
I don't know how that happened.
I have sent a v2 for this already.

^ permalink raw reply

* Re: [PATCH 04/20 v2] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Kautuk Consul @ 2012-03-20 15:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Jimi Xenidis, Ingo Molnar,
	Peter Zijlstra, Christian Dietrich
  Cc: linuxppc-dev, linux-kernel, Mohd. Faris, Kautuk Consul
In-Reply-To: <1332252722-3794-1-git-send-email-consul.kautuk@gmail.com>

Hi,
Sorry I found one more defect in this patch below.

Im gonna send a v3 for this patch.

On Tue, Mar 20, 2012 at 10:12 AM, Kautuk Consul <consul.kautuk@gmail.com> w=
rote:
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
>
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
>
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
>
> Port these changes to powerpc.
>
> Signed-off-by: Mohd. Faris <mohdfarisq2010@gmail.com>
> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
> ---
> =A0arch/powerpc/mm/fault.c | =A0 51 +++++++++++++++++++++++++++++++++----=
---------
> =A01 files changed, 36 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 2f0d1b0..a3b1176 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -129,6 +129,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, uns=
igned long address,
> =A0 =A0 =A0 =A0int is_write =3D 0, ret;
> =A0 =A0 =A0 =A0int trap =3D TRAP(regs);
> =A0 =A0 =A0 =A0int is_exec =3D trap =3D=3D 0x400;
> + =A0 =A0 =A0 unsigned int flags =3D FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_=
KILLABLE;
>
> =A0#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
> =A0 =A0 =A0 =A0/*
> @@ -212,6 +213,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, uns=
igned long address,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!user_mode(regs) && !search_exception_=
tables(regs->nip))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto bad_area_nosemaphore;
>
> +retry:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0down_read(&mm->mmap_sem);
> =A0 =A0 =A0 =A0}
>
> @@ -313,6 +315,7 @@ good_area:
> =A0 =A0 =A0 =A0} else if (is_write) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!(vma->vm_flags & VM_WRITE))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto bad_area;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags |=3D FAULT_FLAG_WRITE;
> =A0 =A0 =A0 =A0/* a read */
> =A0 =A0 =A0 =A0} else {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* protection fault */
> @@ -327,7 +330,11 @@ good_area:
> =A0 =A0 =A0 =A0 * make sure we exit gracefully rather than endlessly redo
> =A0 =A0 =A0 =A0 * the fault.
> =A0 =A0 =A0 =A0 */
> - =A0 =A0 =A0 ret =3D handle_mm_fault(mm, vma, address, is_write ? FAULT_=
FLAG_WRITE : 0);
> + =A0 =A0 =A0 ret =3D handle_mm_fault(mm, vma, address, flags);
> +
> + =A0 =A0 =A0 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(curren=
t))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;

Incorrect!
This should return 0 or 1.

> +
> =A0 =A0 =A0 =A0if (unlikely(ret & VM_FAULT_ERROR)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ret & VM_FAULT_OOM)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out_of_memory;
> @@ -335,22 +342,36 @@ good_area:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto do_sigbus;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BUG();
> =A0 =A0 =A0 =A0}
> - =A0 =A0 =A0 if (ret & VM_FAULT_MAJOR) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 current->maj_flt++;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ=
, 1,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
regs, address);
> -#ifdef CONFIG_PPC_SMLPAR
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (firmware_has_feature(FW_FEATURE_CMO)) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_disable();
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_lppaca()->page_ins +=3D=
 (1 << PAGE_FACTOR);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_enable();
> + =A0 =A0 =A0 if (flags & FAULT_FLAG_ALLOW_RETRY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ret & VM_FAULT_MAJOR) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 current->maj_flt++;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 perf_sw_event(PERF_COUNT_SW=
_PAGE_FAULTS_MAJ, 1,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0regs, address);
> +#ifdef CONFIG_PPC_SMLPAR
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (firmware_has_feature(FW=
_FEATURE_CMO)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_dis=
able();
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 get_lppaca(=
)->page_ins +=3D (1 << PAGE_FACTOR);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preempt_ena=
ble();
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> +#endif
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 current->min_flt++;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 perf_sw_event(PERF_COUNT_SW=
_PAGE_FAULTS_MIN, 1,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0regs, address);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (fault & VM_FAULT_RETRY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags &=3D ~FAULT_FLAG_ALLO=
W_RETRY;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* No need to up_read(&mm=
->mmap_sem) as we would
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* have already released =
it in __lock_page_or_retry
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* in mm/filemap.c.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto retry;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> -#endif
> - =A0 =A0 =A0 } else {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 current->min_flt++;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN=
, 1,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
regs, address);
> =A0 =A0 =A0 =A0}
> +
> =A0 =A0 =A0 =A0up_read(&mm->mmap_sem);
> =A0 =A0 =A0 =A0return 0;
>
> --
> 1.7.5.4
>

^ permalink raw reply

* [PATCH 04/20 v3] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Kautuk Consul @ 2012-03-20 16:01 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Jimi Xenidis, Ingo Molnar,
	Peter Zijlstra, Christian Dietrich
  Cc: linuxppc-dev, linux-kernel, Mohd. Faris, Kautuk Consul

Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)

The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.

These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.

Port these changes to powerpc.

Signed-off-by: Mohd. Faris <mohdfarisq2010@gmail.com>
Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
 arch/powerpc/mm/fault.c |   51 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2f0d1b0..a3b1176 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -129,6 +129,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
 	int is_write = 0, ret;
 	int trap = TRAP(regs);
  	int is_exec = trap == 0x400;
+	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
 
 #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
 	/*
@@ -212,6 +213,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
 		if (!user_mode(regs) && !search_exception_tables(regs->nip))
 			goto bad_area_nosemaphore;
 
+retry:
 		down_read(&mm->mmap_sem);
 	}
 
@@ -313,6 +315,7 @@ good_area:
 	} else if (is_write) {
 		if (!(vma->vm_flags & VM_WRITE))
 			goto bad_area;
+		flags |= FAULT_FLAG_WRITE;
 	/* a read */
 	} else {
 		/* protection fault */
@@ -327,7 +330,11 @@ good_area:
 	 * make sure we exit gracefully rather than endlessly redo
 	 * the fault.
 	 */
-	ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
+	ret = handle_mm_fault(mm, vma, address, flags);
+
+	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+		return 0;
+
 	if (unlikely(ret & VM_FAULT_ERROR)) {
 		if (ret & VM_FAULT_OOM)
 			goto out_of_memory;
@@ -335,22 +342,36 @@ good_area:
 			goto do_sigbus;
 		BUG();
 	}
-	if (ret & VM_FAULT_MAJOR) {
-		current->maj_flt++;
-		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
-				     regs, address);
-#ifdef CONFIG_PPC_SMLPAR
-		if (firmware_has_feature(FW_FEATURE_CMO)) {
-			preempt_disable();
-			get_lppaca()->page_ins += (1 << PAGE_FACTOR);
-			preempt_enable();
+	if (flags & FAULT_FLAG_ALLOW_RETRY) {
+		if (ret & VM_FAULT_MAJOR) {
+			current->maj_flt++;
+			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
+					     regs, address);
+#ifdef CONFIG_PPC_SMLPAR
+			if (firmware_has_feature(FW_FEATURE_CMO)) {
+				preempt_disable();
+				get_lppaca()->page_ins += (1 << PAGE_FACTOR);
+				preempt_enable();
+			}
+#endif
+		} else {
+			current->min_flt++;
+			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
+					     regs, address);
+		}
+		if (fault & VM_FAULT_RETRY) {
+			flags &= ~FAULT_FLAG_ALLOW_RETRY;
+
+			/*
+			 * No need to up_read(&mm->mmap_sem) as we would
+			 * have already released it in __lock_page_or_retry
+			 * in mm/filemap.c.
+			 */
+
+			goto retry;
 		}
-#endif
-	} else {
-		current->min_flt++;
-		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
-				     regs, address);
 	}
+
 	up_read(&mm->mmap_sem);
 	return 0;
 
-- 
1.7.5.4

^ permalink raw reply related

* Re: [PATCH 5/5] powerpc/5200: convert mpc5200 to use of_platform_populate()
From: Anatolij Gustschin @ 2012-03-20 16:20 UTC (permalink / raw)
  To: Grant Likely; +Cc: devicetree-discuss, linuxppc-dev
In-Reply-To: <20110621184513.18176.24174.stgit@ponder>

On Tue, 21 Jun 2011 12:45:13 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:

> of_platform_populate() also handles nodes at the root of the tree,
> which is wanted for things like describing the sound complex.  This
> patch converts mpc5200 support to use of_platform_populate() instead
> of of_platform_bus_probe().
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  arch/powerpc/platforms/52xx/mpc52xx_common.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

Applied for mpc5xxx next, thanks.

Anatolij

^ permalink raw reply

* Re: [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT
From: Anatolij Gustschin @ 2012-03-20 16:28 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Heiko Schocher, Grant Likely, Wolfgang Denk
In-Reply-To: <1332147082-4363-1-git-send-email-agust@denx.de>

On Mon, 19 Mar 2012 09:51:22 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> From: Heiko Schocher <hs@denx.de>
> 
> If firmware does not setup the "GPS Port Configuration Register"
> and the "CDM 48MHz Fractional Divider Configuration Register",
> it can be corrected by additional properties in the device tree.
> Add appropriate code to utility functions and document used
> bindings.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> cc: devicetree-discuss@lists.ozlabs.org
> cc: linuxppc-dev@lists.ozlabs.org
> cc: Grant Likely <glikely@secretlab.ca>
> cc: Wolfgang Denk <wd@denx.de>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   17 ++++++++++++
>  arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
>  2 files changed, 44 insertions(+), 0 deletions(-)

Applied for mpc5xxx next, thanks.

Anatolij

^ permalink raw reply

* Please pull 'next' branch of 5xxx tree
From: Anatolij Gustschin @ 2012-03-20 17:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Hi Ben,

please pull some mpc5xxx patches for linux-next. Thanks!

Anatolij

The following changes since commit 01e8ec4417d3c484986af0adaa0ae6632e0a59cd:

  powerpc: Fix power4/970 idle code regression with lockdep (2012-03-16 09:28:17 +1100)

are available in the git repository at:
  git://git.denx.de/linux-2.6-agust.git next

Andrea Gelmini (1):
      Documentation/powerpc/mpc52xx.txt: Checkpatch cleanup

Grant Likely (1):
      powerpc/5200: convert mpc5200 to use of_platform_populate()

Heiko Schocher (4):
      powerpc/mpc5200: update mpc5200_defconfig to fit for charon board
      powerpc/mpc52xx: setup port_config and CDM settings through DT
      powerpc/mpc52xx: add a4m072 board support
      powerpc/mpc5200: add options to mpc5200_defconfig

 .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   17 ++
 Documentation/powerpc/mpc52xx.txt                  |   12 +-
 arch/powerpc/boot/dts/a4m072.dts                   |  168 ++++++++++++++++++++
 arch/powerpc/configs/mpc5200_defconfig             |   27 ++--
 arch/powerpc/platforms/52xx/mpc5200_simple.c       |    1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c       |   37 ++++-
 6 files changed, 236 insertions(+), 26 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/a4m072.dts

^ permalink raw reply

* Re: [PATCH] powerpc/85xx: don't call of_platform_bus_probe() twice
From: Grant Likely @ 2012-03-20 17:09 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Scott Wood, Dmitry Eremin-Solenikov, linuxppc-dev list
In-Reply-To: <4F677E51.8030905@freescale.com>

On Mon, 19 Mar 2012 13:43:29 -0500, Timur Tabi <timur@freescale.com> wrote:
> Grant Likely wrote:
> > The problem is that you want to create devices for grandchildren
> > nodes when the bus ids passed in don't match any of the child nodes so
> > the of_platform_bus_probe() doesn't iterate down to that level.  This
> > is correct and expected behaviour.
> 
> Well, I'm not still not 100% sure on what I'm supposed to do, so I tried this:
> 
> static struct of_device_id __initdata p1022_ds_ids[] = {
> 	/* The audio driver probes the SSI DMA channels individually */
> 	{ .compatible = "fsl,ssi-dma-channel", },
> 	{},
> };
> 
> static int __init p1022_ds_publish_devices(void)
> {
> 	struct device_node *np;
> 	int ret;
> 
> 	mpc85xx_common_publish_devices();
> 
> 	for_each_compatible_node(np, NULL, "fsl,eloplus-dma") {
> 		ret = of_platform_bus_probe(np, p1022_ds_ids, NULL);
> 		if (ret)
> 			return ret;

Does a driver bind against "fsl,eloplus-dma"?  If so, then I would
call of_platform_populate() from within the fsl,eloplus-dma driver's
probe method.

g.

^ permalink raw reply

* Re: [PATCH] powerpc/85xx: don't call of_platform_bus_probe() twice
From: Timur Tabi @ 2012-03-20 17:25 UTC (permalink / raw)
  To: Grant Likely; +Cc: Scott Wood, Dmitry Eremin-Solenikov, linuxppc-dev list
In-Reply-To: <20120320170942.0C4143E2834@localhost>

Grant Likely wrote:

> Does a driver bind against "fsl,eloplus-dma"?  If so, then I would
> call of_platform_populate() from within the fsl,eloplus-dma driver's
> probe method.

Well, there are two "DMA" drivers.

The one in drivers/dma binds on fsl,eloplus-dma, and then manually scans
for children with the "fsl,eloplus-dma-channel" compatible.  This driver
works today because the fsl,eloplus-dma nodes are children of the SOC
node, which is already probed.

The other is in sound/soc/fsl and binds on "fsl,ssi-dma-channel".  These
are also children of the fsl,eloplus-dma node.  This driver does NOT work
today, because the fsl,eloplus-dma is not probed.

I do not want the two drivers to depend on each other.  They are
completely separate.  So I don't want to call of_platform_populate() from
the drivers/dma driver.  I could call it from the sound/soc/fsl driver,
however.  I will try to see if that works.

They only problem I see with this is that I am thinking about modifying
the drivers/dma driver to probe on "fsl,eloplus-dma-channel" channels
directly.  If I do that, then who should call of_platform_populate()?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH] powerpc/crypto: caam - add backward compatible string sec4.0
From: Kumar Gala @ 2012-03-20 21:08 UTC (permalink / raw)
  To: Shengzhou Liu; +Cc: linuxppc-dev@lists.ozlabs.org list, stable
In-Reply-To: <1332137973-32660-1-git-send-email-Shengzhou.Liu@freescale.com>


On Mar 19, 2012, at 1:19 AM, Shengzhou Liu wrote:

> In some device trees of previous version, there were string "fsl,sec4.0".
> To be backward compatible with device trees, we have CAAM driver first
> check "fsl,sec-v4.0", if it fails, then check for "fsl,sec4.0".
> 
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
> drivers/crypto/caam/caamalg.c |   14 ++++++++++----
> drivers/crypto/caam/ctrl.c    |   16 ++++++++++++++++
> 2 files changed, 26 insertions(+), 4 deletions(-)

Should be sent to the linux crypto list & maintainer.

- k

^ permalink raw reply

* Re: [PATCH 04/20 v3] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Benjamin Herrenschmidt @ 2012-03-20 21:28 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: Peter Zijlstra, linux-kernel, Christian Dietrich, Paul Mackerras,
	Mohd. Faris, Ingo Molnar, linuxppc-dev
In-Reply-To: <1332259260-1943-1-git-send-email-consul.kautuk@gmail.com>

On Tue, 2012-03-20 at 12:01 -0400, Kautuk Consul wrote:
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
> 
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
> 
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
> 
> Port these changes to powerpc.

I have done that port already :-) It's in powerpc-next which I will send
to Linus to pull today or tomorrow....

Cheers,
Ben.

> Signed-off-by: Mohd. Faris <mohdfarisq2010@gmail.com>
> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
> ---
>  arch/powerpc/mm/fault.c |   51 +++++++++++++++++++++++++++++++++-------------
>  1 files changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 2f0d1b0..a3b1176 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -129,6 +129,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
>  	int is_write = 0, ret;
>  	int trap = TRAP(regs);
>   	int is_exec = trap == 0x400;
> +	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
>  
>  #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
>  	/*
> @@ -212,6 +213,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
>  		if (!user_mode(regs) && !search_exception_tables(regs->nip))
>  			goto bad_area_nosemaphore;
>  
> +retry:
>  		down_read(&mm->mmap_sem);
>  	}
>  
> @@ -313,6 +315,7 @@ good_area:
>  	} else if (is_write) {
>  		if (!(vma->vm_flags & VM_WRITE))
>  			goto bad_area;
> +		flags |= FAULT_FLAG_WRITE;
>  	/* a read */
>  	} else {
>  		/* protection fault */
> @@ -327,7 +330,11 @@ good_area:
>  	 * make sure we exit gracefully rather than endlessly redo
>  	 * the fault.
>  	 */
> -	ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
> +	ret = handle_mm_fault(mm, vma, address, flags);
> +
> +	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
> +		return 0;
> +
>  	if (unlikely(ret & VM_FAULT_ERROR)) {
>  		if (ret & VM_FAULT_OOM)
>  			goto out_of_memory;
> @@ -335,22 +342,36 @@ good_area:
>  			goto do_sigbus;
>  		BUG();
>  	}
> -	if (ret & VM_FAULT_MAJOR) {
> -		current->maj_flt++;
> -		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
> -				     regs, address);
> -#ifdef CONFIG_PPC_SMLPAR
> -		if (firmware_has_feature(FW_FEATURE_CMO)) {
> -			preempt_disable();
> -			get_lppaca()->page_ins += (1 << PAGE_FACTOR);
> -			preempt_enable();
> +	if (flags & FAULT_FLAG_ALLOW_RETRY) {
> +		if (ret & VM_FAULT_MAJOR) {
> +			current->maj_flt++;
> +			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
> +					     regs, address);
> +#ifdef CONFIG_PPC_SMLPAR
> +			if (firmware_has_feature(FW_FEATURE_CMO)) {
> +				preempt_disable();
> +				get_lppaca()->page_ins += (1 << PAGE_FACTOR);
> +				preempt_enable();
> +			}
> +#endif
> +		} else {
> +			current->min_flt++;
> +			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
> +					     regs, address);
> +		}
> +		if (fault & VM_FAULT_RETRY) {
> +			flags &= ~FAULT_FLAG_ALLOW_RETRY;
> +
> +			/*
> +			 * No need to up_read(&mm->mmap_sem) as we would
> +			 * have already released it in __lock_page_or_retry
> +			 * in mm/filemap.c.
> +			 */
> +
> +			goto retry;
>  		}
> -#endif
> -	} else {
> -		current->min_flt++;
> -		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
> -				     regs, address);
>  	}
> +
>  	up_read(&mm->mmap_sem);
>  	return 0;
>  

^ permalink raw reply

* Re: [PATCH 04/20 v3] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Benjamin Herrenschmidt @ 2012-03-20 21:29 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: Peter Zijlstra, linux-kernel, Christian Dietrich, Paul Mackerras,
	Mohd. Faris, Ingo Molnar, linuxppc-dev
In-Reply-To: <1332278936.2982.23.camel@pasglop>

On Wed, 2012-03-21 at 08:28 +1100, Benjamin Herrenschmidt wrote:
> On Tue, 2012-03-20 at 12:01 -0400, Kautuk Consul wrote:
> > Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> > (mm: retry page fault when blocking on disk transfer) and
> > commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> > (x86,mm: make pagefault killable)
> > 
> > The above commits introduced changes into the x86 pagefault handler
> > for making the page fault handler retryable as well as killable.
> > 
> > These changes reduce the mmap_sem hold time, which is crucial
> > during OOM killer invocation.
> > 
> > Port these changes to powerpc.
> 
> I have done that port already :-) It's in powerpc-next which I will send
> to Linus to pull today or tomorrow....

BTW. Feel free to review what I've done, it's quite possible that I have
screwed something up ...

Cheers,
Ben.

> Cheers,
> Ben.
> 
> > Signed-off-by: Mohd. Faris <mohdfarisq2010@gmail.com>
> > Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
> > ---
> >  arch/powerpc/mm/fault.c |   51 +++++++++++++++++++++++++++++++++-------------
> >  1 files changed, 36 insertions(+), 15 deletions(-)
> > 
> > diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> > index 2f0d1b0..a3b1176 100644
> > --- a/arch/powerpc/mm/fault.c
> > +++ b/arch/powerpc/mm/fault.c
> > @@ -129,6 +129,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> >  	int is_write = 0, ret;
> >  	int trap = TRAP(regs);
> >   	int is_exec = trap == 0x400;
> > +	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
> >  
> >  #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
> >  	/*
> > @@ -212,6 +213,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> >  		if (!user_mode(regs) && !search_exception_tables(regs->nip))
> >  			goto bad_area_nosemaphore;
> >  
> > +retry:
> >  		down_read(&mm->mmap_sem);
> >  	}
> >  
> > @@ -313,6 +315,7 @@ good_area:
> >  	} else if (is_write) {
> >  		if (!(vma->vm_flags & VM_WRITE))
> >  			goto bad_area;
> > +		flags |= FAULT_FLAG_WRITE;
> >  	/* a read */
> >  	} else {
> >  		/* protection fault */
> > @@ -327,7 +330,11 @@ good_area:
> >  	 * make sure we exit gracefully rather than endlessly redo
> >  	 * the fault.
> >  	 */
> > -	ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
> > +	ret = handle_mm_fault(mm, vma, address, flags);
> > +
> > +	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
> > +		return 0;
> > +
> >  	if (unlikely(ret & VM_FAULT_ERROR)) {
> >  		if (ret & VM_FAULT_OOM)
> >  			goto out_of_memory;
> > @@ -335,22 +342,36 @@ good_area:
> >  			goto do_sigbus;
> >  		BUG();
> >  	}
> > -	if (ret & VM_FAULT_MAJOR) {
> > -		current->maj_flt++;
> > -		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
> > -				     regs, address);
> > -#ifdef CONFIG_PPC_SMLPAR
> > -		if (firmware_has_feature(FW_FEATURE_CMO)) {
> > -			preempt_disable();
> > -			get_lppaca()->page_ins += (1 << PAGE_FACTOR);
> > -			preempt_enable();
> > +	if (flags & FAULT_FLAG_ALLOW_RETRY) {
> > +		if (ret & VM_FAULT_MAJOR) {
> > +			current->maj_flt++;
> > +			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
> > +					     regs, address);
> > +#ifdef CONFIG_PPC_SMLPAR
> > +			if (firmware_has_feature(FW_FEATURE_CMO)) {
> > +				preempt_disable();
> > +				get_lppaca()->page_ins += (1 << PAGE_FACTOR);
> > +				preempt_enable();
> > +			}
> > +#endif
> > +		} else {
> > +			current->min_flt++;
> > +			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
> > +					     regs, address);
> > +		}
> > +		if (fault & VM_FAULT_RETRY) {
> > +			flags &= ~FAULT_FLAG_ALLOW_RETRY;
> > +
> > +			/*
> > +			 * No need to up_read(&mm->mmap_sem) as we would
> > +			 * have already released it in __lock_page_or_retry
> > +			 * in mm/filemap.c.
> > +			 */
> > +
> > +			goto retry;
> >  		}
> > -#endif
> > -	} else {
> > -		current->min_flt++;
> > -		perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
> > -				     regs, address);
> >  	}
> > +
> >  	up_read(&mm->mmap_sem);
> >  	return 0;
> >  
> 

^ permalink raw reply

* Re: Please pull 'next' branch of 5xxx tree
From: Wolfram Sang @ 2012-03-20 22:30 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: linuxppc-dev
In-Reply-To: <20120320180450.5f6dffe4@wker>

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi,

>       powerpc/mpc52xx: setup port_config and CDM settings through DT

Can we skip this patch for 3.5? Between posting it and pushing it upstream were
about 24 hours, so one didn't have much chance of reviewing (and no linux-next
exposure).

I think the bindings leave space for questions, e.g. is it really desirable to
have the fractional divide ratios encoded like in the bits in the register? Why
not encode it like e.g. <11 11 11 11> (the actual divisor) or so? I could
imagine there are examples for setting dividers somewhere. Poking values into
registers tends to be suspicious, so I'd vote for giving all this more
exposure.

Thanks,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: Please pull 'next' branch of 5xxx tree
From: Benjamin Herrenschmidt @ 2012-03-20 23:32 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linuxppc-dev, Anatolij Gustschin, Stephen Rothwell
In-Reply-To: <20120320223017.GB6292@pengutronix.de>

On Tue, 2012-03-20 at 23:30 +0100, Wolfram Sang wrote:
> Hi,
> 
> >       powerpc/mpc52xx: setup port_config and CDM settings through DT
> 
> Can we skip this patch for 3.5? Between posting it and pushing it upstream were
> about 24 hours, so one didn't have much chance of reviewing (and no linux-next
> exposure).
> 
> I think the bindings leave space for questions, e.g. is it really desirable to
> have the fractional divide ratios encoded like in the bits in the register? Why
> not encode it like e.g. <11 11 11 11> (the actual divisor) or so? I could
> imagine there are examples for setting dividers somewhere. Poking values into
> registers tends to be suspicious, so I'd vote for giving all this more
> exposure.

I'll drop it from what I merge, thanks.

Anatolij, Can you organize with Stephen (CC) so that you tree is part of
linux-next for the next cycle ? Either that or make sure you send me
pull requests really early :-)

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH] EEH: remove eeh device from OF node
From: Benjamin Herrenschmidt @ 2012-03-21  0:14 UTC (permalink / raw)
  To: Gavin Shan; +Cc: sfr, linux-kernel, linux-next, paulus, linuxppc-dev
In-Reply-To: <1331721086-4314-1-git-send-email-shangw@linux.vnet.ibm.com>

On Wed, 2012-03-14 at 18:31 +0800, Gavin Shan wrote:
> Originally, the PCI sensitive OF node is tracing the eeh device
> through struct device_node::edev. However, it was regarded as
> bad idea.
> 
> The patch removes struct device_node::edev. In addition, the
> global list of eeh devices is introduced, and do retrival of
> eeh device according to the given OF node through the global
> list.

So I'm not too happy with that. The main problem I see is that
the code -constantly- calls of_node_to_eeh_dev.

IE. On any MMIO that happens to return all 1's, we'll call
eeh_check_failure() for example, which does that. In fact for a hot path
it's pretty horrid, it will:

 - Do an address cache lookup to get the pci_dev
 - Get the device-node frokm the pci_dev
 - Lookup your list to get the eeh_dev

Shouldn't we instead change the address cache to contain eeh_dev
instead ? And if you prefer keeping pci_dev, then it shouldn't be hard
to stick a pointer to the eeh_dev in there via either struct archdata or
maybe platform_data.

The EEH code still, even after your rework, constantly pass "dn"'s as
argument to functions just to convert it back to a struct eeh_dev rather
than trying to pass the eeh_dev.

So turning that into a list lookup will slow things down to a crawl.
Also your patch never seems to remove anything from your list, which
doesn't look right vs. hotplug.

I suggest we fix that with a two phase approach:

 1- ASAP so we can still get that into 3.4, move the eeh_dev pointer to
struct pci_dn instead of struct device_node. This structure is
accessible directly via dn->data and is ppc specific, that will be a
better temporary solution and and adding stuff to the generic struct
device_node.

 2- Then, what we need to do is generalize the use of eeh_dev rather
than device_node as the main object being worked on in the eeh layer and
thus as the argument to most functions.

Cheers,
Ben.

> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/eeh.h           |    7 +++++++
>  arch/powerpc/platforms/pseries/eeh_dev.c |   29 ++++++++++++++++++++++++++++-
>  include/linux/of.h                       |   10 ----------
>  3 files changed, 35 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
> index d60f998..591e0a1 100644
> --- a/arch/powerpc/include/asm/eeh.h
> +++ b/arch/powerpc/include/asm/eeh.h
> @@ -56,6 +56,7 @@ struct eeh_dev {
>  	struct pci_controller *phb;	/* Associated PHB		*/
>  	struct device_node *dn;		/* Associated device node	*/
>  	struct pci_dev *pdev;		/* Associated PCI device	*/
> +	struct list_head list;		/* Form the global link list	*/
>  };
>  
>  static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
> @@ -115,6 +116,7 @@ extern int eeh_subsystem_enabled;
>   */
>  #define EEH_MAX_ALLOWED_FREEZES 5
>  
> +struct eeh_dev *eeh_dev_from_of_node(struct device_node *dn);
>  void * __devinit eeh_dev_init(struct device_node *dn, void *data);
>  void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
>  void __init eeh_dev_phb_init(void);
> @@ -132,6 +134,11 @@ void eeh_add_device_tree_early(struct device_node *);
>  void eeh_add_device_tree_late(struct pci_bus *);
>  void eeh_remove_bus_device(struct pci_dev *);
>  
> +static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
> +{
> +	return eeh_dev_from_of_node(dn);
> +}
> +
>  /**
>   * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
>   *
> diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
> index f3aed7d..925d3a3 100644
> --- a/arch/powerpc/platforms/pseries/eeh_dev.c
> +++ b/arch/powerpc/platforms/pseries/eeh_dev.c
> @@ -34,6 +34,7 @@
>  #include <linux/export.h>
>  #include <linux/gfp.h>
>  #include <linux/init.h>
> +#include <linux/list.h>
>  #include <linux/kernel.h>
>  #include <linux/pci.h>
>  #include <linux/string.h>
> @@ -41,6 +42,30 @@
>  #include <asm/pci-bridge.h>
>  #include <asm/ppc-pci.h>
>  
> +/* eeh device list */
> +static LIST_HEAD(eeh_dev_list);
> +
> +/**
> + * eeh_dev_from_of_node - Retrieve EEH device according to OF node
> + * @dn: OF node
> + *
> + * All existing eeh devices have been put into the global list.
> + * In addition, the eeh device is tracing the corresponding
> + * OF node. The function is used to retrieve the corresponding
> + * eeh device according to the given OF node.
> + */
> +struct eeh_dev *eeh_dev_from_of_node(struct device_node *dn)
> +{
> +	struct eeh_dev *edev = NULL;
> +
> +	list_for_each_entry(edev, &eeh_dev_list, list) {
> +		if (edev->dn && edev->dn == dn)
> +			return edev;
> +	}
> +
> +	return NULL;
> +}
> +
>  /**
>   * eeh_dev_init - Create EEH device according to OF node
>   * @dn: device node
> @@ -62,10 +87,12 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
>  	}
>  
>  	/* Associate EEH device with OF node */
> -	dn->edev  = edev;
>  	edev->dn  = dn;
>  	edev->phb = phb;
>  
> +	/* Add to global list */
> +	list_add_tail(&edev->list, &eeh_dev_list);
> +
>  	return NULL;
>  }
>  
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 3e710d8..a75a831 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -58,9 +58,6 @@ struct device_node {
>  	struct	kref kref;
>  	unsigned long _flags;
>  	void	*data;
> -#if defined(CONFIG_EEH)
> -	struct eeh_dev *edev;
> -#endif
>  #if defined(CONFIG_SPARC)
>  	char	*path_component_name;
>  	unsigned int unique_id;
> @@ -75,13 +72,6 @@ struct of_phandle_args {
>  	uint32_t args[MAX_PHANDLE_ARGS];
>  };
>  
> -#if defined(CONFIG_EEH)
> -static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
> -{
> -	return dn->edev;
> -}
> -#endif
> -
>  #if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
>  /* Dummy ref counting routines - to be implemented later */
>  static inline struct device_node *of_node_get(struct device_node *node)

^ permalink raw reply

* Re: Please pull 'next' branch of 5xxx tree
From: Anatolij Gustschin @ 2012-03-21  0:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <1332286341.2982.26.camel@pasglop>

On Wed, 21 Mar 2012 10:32:21 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
...
> Anatolij, Can you organize with Stephen (CC) so that you tree is part of
> linux-next for the next cycle ? Either that or make sure you send me
> pull requests really early :-)

Yes. Stephen, could you please change linux-next to pull from my
mpc5xxx tree

 git://git.denx.de/linux-2.6-agust.git next

Thanks,
Anatolij

^ permalink raw reply

* Re: Please pull 'next' branch of 5xxx tree
From: Anatolij Gustschin @ 2012-03-21  0:56 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linuxppc-dev
In-Reply-To: <20120320223017.GB6292@pengutronix.de>

Hi,

On Tue, 20 Mar 2012 23:30:17 +0100
Wolfram Sang <w.sang@pengutronix.de> wrote:

> Hi,
> 
> >       powerpc/mpc52xx: setup port_config and CDM settings through DT
> 
> Can we skip this patch for 3.5? Between posting it and pushing it upstream were
> about 24 hours, so one didn't have much chance of reviewing (and no linux-next
> exposure).

Pretty much similar patch was posted nearly one year ago, so my
assumption was that people have had enough time to comment on it :-).
But I've dropped this patch from the next branch for now.

> I think the bindings leave space for questions, e.g. is it really desirable to
> have the fractional divide ratios encoded like in the bits in the register? Why
> not encode it like e.g. <11 11 11 11> (the actual divisor) or so? I could
> imagine there are examples for setting dividers somewhere. Poking values into
> registers tends to be suspicious, so I'd vote for giving all this more
> exposure.

At the end we will be poking values into registers anyway :-),
but I'm open for suggestions and discussion about them.

Thanks,
Anatolij

^ permalink raw reply

* [PATCH] powerpc/44x: Support CPM for Maui APM821xxx SoC and Bluestone board
From: Mai La @ 2012-03-21  2:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Josh Boyer, Matt Porter,
	Tirumala R Marri, Grant Likely, Michael Neuling, Kumar Gala,
	Anton Blanchard, linuxppc-dev, linux-kernel
  Cc: Mai La

In this patch:
- Add CPM node for Maui APM821xxx SoC and Bluestone board in DTS

Signed-off-by: Mai La <mla@apm.com>
---
 arch/powerpc/boot/dts/bluestone.dts |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/bluestone.dts b/arch/powerpc/boot/dts/bluestone.dts
index 2a56a0d..15a9516 100644
--- a/arch/powerpc/boot/dts/bluestone.dts
+++ b/arch/powerpc/boot/dts/bluestone.dts
@@ -117,6 +117,15 @@
 		dcr-reg = <0x00c 0x002>;
 	};
 
+	CPM0: cpm {
+		compatible = "ibm, cpm-apm821xx", "ibm,cpm";
+		cell-index = <0>;
+		dcr-reg = <0x160 0x003>;
+		er-offset = <0>;
+		idle-doze = <0x02000000>;
+		standby = <0x302570F0>;
+	};
+
 	plb {
 		compatible = "ibm,plb4";
 		#address-cells = <2>;
-- 
1.7.3.4

^ permalink raw reply related

* Re: [PATCH 04/20 v3] powerpc/mm/fault.c: Port OOM changes to do_page_fault
From: Kautuk Consul @ 2012-03-21  3:27 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Peter Zijlstra, linux-kernel, Christian Dietrich, Paul Mackerras,
	Mohd. Faris, Ingo Molnar, linuxppc-dev
In-Reply-To: <1332278973.2982.24.camel@pasglop>

>>
>> I have done that port already :-) It's in powerpc-next which I will send
>> to Linus to pull today or tomorrow....

Oops, sorry I didn't know that as I don't regularly follow the powerpc tree.
I just did this change for all architectures. :)

>
> BTW. Feel free to review what I've done, it's quite possible that I have
> screwed something up ...

Okay, I'll take a look at it. Thanks again. :)

>
> Cheers,
> Ben.

^ permalink raw reply

* [PATCH] Disable /dev/port interface on powerpc systems
From: Haren Myneni @ 2012-03-21  5:37 UTC (permalink / raw)
  To: benh, linuxppc-dev, anton


Some power systems do not have legacy ISA devices. So, /dev/port is not
a valid interface on these systems. User level tools such as kbdrate is
trying to access the device using this interface which is causing the
system crash. 

This patch will fix this issue by not creating this interface on these
powerpc systems. 

Signed-off-by: Haren Myneni <haren@us.ibm.com>


diff -Naurp linux.orig/arch/powerpc/kernel/isa-bridge.c
linux/arch/powerpc/kernel/isa-bridge.c
--- linux.orig/arch/powerpc/kernel/isa-bridge.c	2012-02-11
02:08:08.780005293 -0800
+++ linux/arch/powerpc/kernel/isa-bridge.c	2012-02-11 02:16:25.080003386
-0800
@@ -255,6 +255,14 @@ static struct notifier_block isa_bridge_
 	.notifier_call = isa_bridge_notify
 };
 
+int __init legacy_isa_device_found(void)
+{
+	if (isa_bridge_pcidev)
+		return 1;
+	
+	return 0;
+}
+
 /**
  * isa_bridge_init - register to be notified of ISA bridge
addition/removal
  *
diff -Naurp linux.orig/drivers/char/mem.c linux/drivers/char/mem.c
--- linux.orig/drivers/char/mem.c	2012-02-11 02:08:42.710002440 -0800
+++ linux/drivers/char/mem.c	2012-03-20 20:40:43.650000003 -0700
@@ -35,6 +35,8 @@
 # include <linux/efi.h>
 #endif
 
+#define DEVPORT_MINOR	4
+
 static inline unsigned long size_inside_page(unsigned long start,
 					     unsigned long size)
 {
@@ -910,6 +912,11 @@ static char *mem_devnode(struct device *
 
 static struct class *mem_class;
 
+int __init __weak legacy_isa_device_found(void)
+{
+	return 1;
+}
+
 static int __init chr_dev_init(void)
 {
 	int minor;
@@ -930,6 +937,13 @@ static int __init chr_dev_init(void)
 	for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) {
 		if (!devlist[minor].name)
 			continue;
+
+		/*
+		 * Create /dev/port? 
+		 */
+		if ((minor == DEVPORT_MINOR) && !legacy_isa_device_found())
+			continue;
+
 		device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
 			      NULL, devlist[minor].name);
 	}
diff -Naurp linux.orig/include/linux/isa.h linux/include/linux/isa.h
--- linux.orig/include/linux/isa.h	2012-02-11 02:07:52.030019810 -0800
+++ linux/include/linux/isa.h	2012-02-11 02:16:49.810002296 -0800
@@ -36,4 +36,5 @@ static inline void isa_unregister_driver
 }
 #endif
 
+extern int __init legacy_isa_device_found(void);
 #endif /* __LINUX_ISA_H */

^ permalink raw reply

* [PATCH 10/16] mm/powerpc: use vm_flags_t for vma flags
From: Konstantin Khlebnikov @ 2012-03-21  6:56 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linuxppc-dev, linux-kernel, Paul Mackerras
In-Reply-To: <20120321065140.13852.52315.stgit@zurg>

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/include/asm/mman.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
index d4a7f64..451de1c 100644
--- a/arch/powerpc/include/asm/mman.h
+++ b/arch/powerpc/include/asm/mman.h
@@ -44,7 +44,7 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot)
 }
 #define arch_calc_vm_prot_bits(prot) arch_calc_vm_prot_bits(prot)
 
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
+static inline pgprot_t arch_vm_get_page_prot(vm_flags_t vm_flags)
 {
 	return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
 }

^ permalink raw reply related


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