All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org,
	kexec@lists.infradead.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Shani Moideen <shani.moideen@wipro.com>
Subject: Re: [KJ PATCH] Replacing memcpy(dest, src, PAGE_SIZE) with copy_page(dest, src) in arch/i386/kernel/machine_kexec.c
Date: Wed, 13 Jun 2007 19:46:54 +0000	[thread overview]
Message-ID: <20070613194653.GA8273@ucw.cz> (raw)
In-Reply-To: <466ECF37.6040303@zytor.com>

Hi!

> >> Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in
> >> arch/i386/kernel/machine_kexec.c.
> > 
> > Please no.
> > 
> > People get creative in copy_page (especially mmx_copy_page),
> > and this code path need something simple and stupid, that
> > will work every time, especially when things are messed up
> > elsewhere.
> 
> memcpy() is pretty creative, too.  If you want something really dumb and
> robust, you should probably create an inline:
> 
> /*
>  * Eric sez: his code path need something simple and stupid, that
>  * will work every time, especially when things are messed up
>  * elsewhere.
>  */
> static inline void braindead_copy_page(void *dst, void *src)
> {
> 	unsigned long ctr = PAGE_SIZE >> 2;
> 
> 	asm volatile("cld; rep; movsl"
> 			: "+D" (dst), "+S" (src), "+c" (ctr)
> 			: : "memory");
> }
> 
> (FWIW, the "cld" is supposed to be redundant, as DF=0 is supposed to be
> guaranteed by the ABI.)

Actually, swsusp would be second user for that. We currently do it
with for loop in C, but...

...well, we'd probably need it for i386, ppc, x86-64, ppc64 and maybe
arm...

(But you should probably add a comment into kexec )
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Shani Moideen <shani.moideen@wipro.com>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	kernel-janitors@lists.osdl.org
Subject: [KJ] Re: [KJ PATCH] Replacing memcpy(dest, src,
Date: Wed, 13 Jun 2007 19:46:54 +0000	[thread overview]
Message-ID: <20070613194653.GA8273@ucw.cz> (raw)
In-Reply-To: <466ECF37.6040303@zytor.com>

Hi!

> >> Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in
> >> arch/i386/kernel/machine_kexec.c.
> > 
> > Please no.
> > 
> > People get creative in copy_page (especially mmx_copy_page),
> > and this code path need something simple and stupid, that
> > will work every time, especially when things are messed up
> > elsewhere.
> 
> memcpy() is pretty creative, too.  If you want something really dumb and
> robust, you should probably create an inline:
> 
> /*
>  * Eric sez: his code path need something simple and stupid, that
>  * will work every time, especially when things are messed up
>  * elsewhere.
>  */
> static inline void braindead_copy_page(void *dst, void *src)
> {
> 	unsigned long ctr = PAGE_SIZE >> 2;
> 
> 	asm volatile("cld; rep; movsl"
> 			: "+D" (dst), "+S" (src), "+c" (ctr)
> 			: : "memory");
> }
> 
> (FWIW, the "cld" is supposed to be redundant, as DF=0 is supposed to be
> guaranteed by the ABI.)

Actually, swsusp would be second user for that. We currently do it
with for loop in C, but...

...well, we'd probably need it for i386, ppc, x86-64, ppc64 and maybe
arm...

(But you should probably add a comment into kexec )
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Shani Moideen <shani.moideen@wipro.com>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	kernel-janitors@lists.osdl.org
Subject: Re: [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/kernel/machine_kexec.c
Date: Wed, 13 Jun 2007 19:46:54 +0000	[thread overview]
Message-ID: <20070613194653.GA8273@ucw.cz> (raw)
In-Reply-To: <466ECF37.6040303@zytor.com>

Hi!

> >> Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in
> >> arch/i386/kernel/machine_kexec.c.
> > 
> > Please no.
> > 
> > People get creative in copy_page (especially mmx_copy_page),
> > and this code path need something simple and stupid, that
> > will work every time, especially when things are messed up
> > elsewhere.
> 
> memcpy() is pretty creative, too.  If you want something really dumb and
> robust, you should probably create an inline:
> 
> /*
>  * Eric sez: his code path need something simple and stupid, that
>  * will work every time, especially when things are messed up
>  * elsewhere.
>  */
> static inline void braindead_copy_page(void *dst, void *src)
> {
> 	unsigned long ctr = PAGE_SIZE >> 2;
> 
> 	asm volatile("cld; rep; movsl"
> 			: "+D" (dst), "+S" (src), "+c" (ctr)
> 			: : "memory");
> }
> 
> (FWIW, the "cld" is supposed to be redundant, as DF=0 is supposed to be
> guaranteed by the ABI.)

Actually, swsusp would be second user for that. We currently do it
with for loop in C, but...

...well, we'd probably need it for i386, ppc, x86-64, ppc64 and maybe
arm...

(But you should probably add a comment into kexec )
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2007-06-13 20:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12  2:45 [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/kernel/machine_kexec.c Shani Moideen
2007-06-12  2:57 ` [KJ] [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with Shani Moideen
2007-06-12  2:45 ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/kernel/machine_kexec.c Shani Moideen
2007-06-12  5:32 ` [KJ PATCH] Replacing memcpy(dest, src, PAGE_SIZE) with copy_page(dest, src) " Eric W. Biederman
2007-06-12  5:32   ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) " Eric W. Biederman
2007-06-12  5:32   ` [KJ] Re: [KJ PATCH] Replacing memcpy(dest, src, Eric W. Biederman
2007-06-12 16:52   ` [KJ PATCH] Replacing memcpy(dest, src, PAGE_SIZE) with copy_page(dest, src) in arch/i386/kernel/machine_kexec.c H. Peter Anvin
2007-06-12 16:52     ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) " H. Peter Anvin
2007-06-12 16:52     ` [KJ] Re: [KJ PATCH] Replacing memcpy(dest, src, H. Peter Anvin
2007-06-13 19:46     ` Pavel Machek [this message]
2007-06-13 19:46       ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/kernel/machine_kexec.c Pavel Machek
2007-06-13 19:46       ` [KJ] Re: [KJ PATCH] Replacing memcpy(dest, src, Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2007-06-12  3:16 [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/mm/init.c Shani Moideen
2007-06-12  3:28 ` [KJ] [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with Shani Moideen
2007-06-12  3:16 ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/mm/init.c Shani Moideen
2007-06-13 19:47 ` [KJ] Re: [KJ PATCH] Replacing memcpy(dest, src, Pavel Machek
2007-06-13 19:47   ` [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/mm/init.c Pavel Machek
2007-06-13 19:47   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070613194653.GA8273@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shani.moideen@wipro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.