public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] x86: copy_oldmem_page using cached addressing
@ 2010-09-08 15:14 Cliff Wickman
  2010-09-08 19:19 ` Eric W. Biederman
  2010-09-08 19:42 ` Andi Kleen
  0 siblings, 2 replies; 4+ messages in thread
From: Cliff Wickman @ 2010-09-08 15:14 UTC (permalink / raw)
  To: kexec, mingo; +Cc: linux-kernel

From: Cliff Wickman <cpw@sgi.com>

The copy of /proc/vmcore to a user buffer proceeds much faster
if the kernel addresses memory as cached.

With this patch we have seen an increase in transfer rate from less than
15MB/s to 80-460MB/s, depending on size of the transfer.  This makes
a big difference in time needed to save a system dump.

(Does anyone know of a reason why copy_oldmem_page() would need
 to use uncached addresses?)

Diffed against 2.6.36-rc3

Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
 arch/x86/kernel/crash_dump_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linus.current/arch/x86/kernel/crash_dump_64.c
===================================================================
--- linus.current.orig/arch/x86/kernel/crash_dump_64.c
+++ linus.current/arch/x86/kernel/crash_dump_64.c
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long p
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] x86: copy_oldmem_page using cached addressing
  2010-09-08 15:14 [PATCH] x86: copy_oldmem_page using cached addressing Cliff Wickman
@ 2010-09-08 19:19 ` Eric W. Biederman
  2010-09-09  7:48   ` Ingo Molnar
  2010-09-08 19:42 ` Andi Kleen
  1 sibling, 1 reply; 4+ messages in thread
From: Eric W. Biederman @ 2010-09-08 19:19 UTC (permalink / raw)
  To: Cliff Wickman; +Cc: mingo, kexec, linux-kernel

Cliff Wickman <cpw@sgi.com> writes:

> From: Cliff Wickman <cpw@sgi.com>
>
> The copy of /proc/vmcore to a user buffer proceeds much faster
> if the kernel addresses memory as cached.
>
> With this patch we have seen an increase in transfer rate from less than
> 15MB/s to 80-460MB/s, depending on size of the transfer.  This makes
> a big difference in time needed to save a system dump.
>
> (Does anyone know of a reason why copy_oldmem_page() would need
>  to use uncached addresses?)
>
> Diffed against 2.6.36-rc3

I believe this code simply predates being able to specify the
caching attributes at ioremap time.  Being cached in this case
actually looks more correct, as that is the default for RAM
and we are talking about RAM.

Ultimately either there is another cpu running wild with these pages
mapped with some random set of attributes, and we cannot get the
permissions right or we have captured all of the cpus and this is the
only mapping so it doesn't matter.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

>
> Signed-off-by: Cliff Wickman <cpw@sgi.com>
> ---
>  arch/x86/kernel/crash_dump_64.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linus.current/arch/x86/kernel/crash_dump_64.c
> ===================================================================
> --- linus.current.orig/arch/x86/kernel/crash_dump_64.c
> +++ linus.current/arch/x86/kernel/crash_dump_64.c
> @@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long p
>  	if (!csize)
>  		return 0;
>  
> -	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
> +	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
>  	if (!vaddr)
>  		return -ENOMEM;
>  
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] x86: copy_oldmem_page using cached addressing
  2010-09-08 15:14 [PATCH] x86: copy_oldmem_page using cached addressing Cliff Wickman
  2010-09-08 19:19 ` Eric W. Biederman
@ 2010-09-08 19:42 ` Andi Kleen
  1 sibling, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2010-09-08 19:42 UTC (permalink / raw)
  To: Cliff Wickman
  Cc: public-linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	public-kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	public-mingo-X9Un+BFzKDI



Cliff Wickman <cpw-sJ/iWh9BUns@public.gmane.org> writes:

> From: Cliff Wickman <cpw-sJ/iWh9BUns@public.gmane.org>
>
> The copy of /proc/vmcore to a user buffer proceeds much faster
> if the kernel addresses memory as cached.
>
> With this patch we have seen an increase in transfer rate from less than
> 15MB/s to 80-460MB/s, depending on size of the transfer.  This makes
> a big difference in time needed to save a system dump.
>
> (Does anyone know of a reason why copy_oldmem_page() would need
>  to use uncached addresses?)
>
> Diffed against 2.6.36-rc3

I had a similar patch somewhere in my private kernels,
yes it's a big win. I think it was simply a bug that was added
when ioremap was changed to default to uncached.

-Andi
-- 
ak@linux.intel.com -- Speaking for myself only.


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] x86: copy_oldmem_page using cached addressing
  2010-09-08 19:19 ` Eric W. Biederman
@ 2010-09-09  7:48   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2010-09-09  7:48 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: kexec, Cliff Wickman, linux-kernel


* Eric W. Biederman <ebiederm@xmission.com> wrote:

> Cliff Wickman <cpw@sgi.com> writes:
> 
> > From: Cliff Wickman <cpw@sgi.com>
> >
> > The copy of /proc/vmcore to a user buffer proceeds much faster
> > if the kernel addresses memory as cached.
> >
> > With this patch we have seen an increase in transfer rate from less than
> > 15MB/s to 80-460MB/s, depending on size of the transfer.  This makes
> > a big difference in time needed to save a system dump.
> >
> > (Does anyone know of a reason why copy_oldmem_page() would need
> >  to use uncached addresses?)
> >
> > Diffed against 2.6.36-rc3
> 
> I believe this code simply predates being able to specify the
> caching attributes at ioremap time.  Being cached in this case
> actually looks more correct, as that is the default for RAM
> and we are talking about RAM.
> 
> Ultimately either there is another cpu running wild with these pages
> mapped with some random set of attributes, and we cannot get the
> permissions right or we have captured all of the cpus and this is the
> only mapping so it doesn't matter.
> 
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

Applied, thanks guys. Note, i also added a -stable tag, as kdump is 
typically used with enterprise setups and we want this (low-risk, 
high-impact) improvement to be propagated far back the -stable series.

Thanks,

	Ingo

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2010-09-09  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-08 15:14 [PATCH] x86: copy_oldmem_page using cached addressing Cliff Wickman
2010-09-08 19:19 ` Eric W. Biederman
2010-09-09  7:48   ` Ingo Molnar
2010-09-08 19:42 ` Andi Kleen

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