All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* implementation of software suspend on MIPS. (system log)
@ 2007-10-30 19:15 Hyon Lim
       [not found] ` <20071031132553.GF14187@linux-mips.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Hyon Lim @ 2007-10-30 19:15 UTC (permalink / raw
  To: linux-mips

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

[DEBUG] Swsusp_write() @ kernel/power/swsusp.c,874
[DEBUG] write_suspend_image(), kernel/power/swsusp.c,407
[DEBUG] init_header(), kernel/power/swsusp.c,337
[DEBUG] dump_info(), kernel/power/swsusp.c,321
 swsusp: Version: 132618
 swsusp: Num Pages: 8192
 swsusp: UTS Sys: Linux
 swsusp: UTS Node: (none)
 swsusp: UTS Release: 2.6.10_SELP_MIPS
 swsusp: UTS Version: #95 Wed Oct 30 03:46:35 KST 2007
 swsusp: UTS Machine: mips
 swsusp: UTS Domain: (none)
 swsusp: CPUs: 1
 swsusp: Image: 1896 Pages
 swsusp: Pagedir: 0 Pages
[DEBUG] data_write(), kernel/power/swsusp.c,303
Writing data to swap (1896 pages)... done
Writing pagedir (8 pages)
S|
Powering off system
Cold reset

This is system log of my implementation.

-- 
Hyon Lim (임현)
Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
Fax. 032-232-0578 (Intl' Available)
Homepage : http://www.alexlab.net
Blog : http://www.alexlab.net/blog

[-- Attachment #2: Type: text/html, Size: 1174 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
       [not found] ` <20071031132553.GF14187@linux-mips.org>
@ 2007-10-31 18:15   ` Hyon Lim
  2007-10-31 18:30     ` Ralf Baechle
  2007-10-31 18:32       ` Uhler, Mike
  0 siblings, 2 replies; 11+ messages in thread
From: Hyon Lim @ 2007-10-31 18:15 UTC (permalink / raw
  To: Ralf Baechle; +Cc: linux-mips

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

The problem is resume process.
Some page copy and other remaining process wasn't implemented.
The code of resume process should be implemented on arch/xxx/power/swsusp.S
So it should be implemented by assembly.
That's the problem...
I've no idea about complex assembly programming. :-)
Could you recommend any pdf or website?

On 10/31/07, Ralf Baechle <ralf@linux-mips.org> wrote:
>
> On Wed, Oct 31, 2007 at 04:15:57AM +0900, Hyon Lim wrote:
>
> > [DEBUG] Swsusp_write() @ kernel/power/swsusp.c,874
> > [DEBUG] write_suspend_image(), kernel/power/swsusp.c,407
> > [DEBUG] init_header(), kernel/power/swsusp.c,337
> > [DEBUG] dump_info(), kernel/power/swsusp.c,321
> >  swsusp: Version: 132618
> >  swsusp: Num Pages: 8192
> >  swsusp: UTS Sys: Linux
> >  swsusp: UTS Node: (none)
> >  swsusp: UTS Release: 2.6.10_SELP_MIPS
> >  swsusp: UTS Version: #95 Wed Oct 30 03:46:35 KST 2007
> >  swsusp: UTS Machine: mips
> >  swsusp: UTS Domain: (none)
> >  swsusp: CPUs: 1
> >  swsusp: Image: 1896 Pages
> >  swsusp: Pagedir: 0 Pages
> > [DEBUG] data_write(), kernel/power/swsusp.c,303
> > Writing data to swap (1896 pages)... done
> > Writing pagedir (8 pages)
> > S|
> > Powering off system
> > Cold reset
> >
> > This is system log of my implementation.
>
> Excellent, this is looking promising.
>
> Do you still need any help?
>
> Ralf
>



-- 
Hyon Lim (임현)
Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
Fax. 032-232-0578 (Intl' Available)
Homepage : http://www.alexlab.net
Blog : http://www.alexlab.net/blog

[-- Attachment #2: Type: text/html, Size: 2207 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-10-31 18:15   ` Hyon Lim
@ 2007-10-31 18:30     ` Ralf Baechle
  2007-10-31 18:32       ` Uhler, Mike
  1 sibling, 0 replies; 11+ messages in thread
From: Ralf Baechle @ 2007-10-31 18:30 UTC (permalink / raw
  To: Hyon Lim; +Cc: linux-mips

On Thu, Nov 01, 2007 at 03:15:11AM +0900, Hyon Lim wrote:

> The problem is resume process.
> Some page copy and other remaining process wasn't implemented.
> The code of resume process should be implemented on arch/xxx/power/swsusp.S
> So it should be implemented by assembly.
> That's the problem...
> I've no idea about complex assembly programming. :-)
> Could you recommend any pdf or website?

See MIPS Run (ISBN 0120884216) is _the_ best book on this topic.  Maybe
a library near you already has it, it's the de facto standard book on
the topic.

  Ralf

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

* RE: implementation of software suspend on MIPS. (system log)
@ 2007-10-31 18:32       ` Uhler, Mike
  0 siblings, 0 replies; 11+ messages in thread
From: Uhler, Mike @ 2007-10-31 18:32 UTC (permalink / raw
  To: Hyon Lim, Ralf Baechle; +Cc: linux-mips

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

There are various sources of information available on MIPS assembly language programming.  The easiest way to get what you want is to write the code in C, then push it through the compiler to see what instructions it generates.  You can then hack that code to work in your context.
 
Beyond that, Ralf mentioned the book "See MIPS Run Linux", by Dominic Sweetman.  There is also the GNU gas manual and the MIPS SDE Programmer's Guide (see http://www.mips.com/products/resource-library/product-materials/software) or other references on MIPS assembly language programming.
 

/gmu
---
Michael Uhler, VP Architecture, Software and Platform Engineering
MIPS Technologies, Inc.   Email: uhler AT mips.com
1225 Charleston Road      Voice:  (650)567-5025 
Mountain View, CA 94043
  

  

 


________________________________

	From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Hyon Lim
	Sent: Wednesday, October 31, 2007 11:15 AM
	To: Ralf Baechle
	Cc: linux-mips@linux-mips.org
	Subject: Re: implementation of software suspend on MIPS. (system log)
	
	
	The problem is resume process.
	Some page copy and other remaining process wasn't implemented.
	The code of resume process should be implemented on arch/xxx/power/swsusp.S
	So it should be implemented by assembly.
	That's the problem...
	I've no idea about complex assembly programming. :-)
	Could you recommend any pdf or website?
	 
	On 10/31/07, Ralf Baechle <ralf@linux-mips.org> wrote: 

		On Wed, Oct 31, 2007 at 04:15:57AM +0900, Hyon Lim wrote:
		
		> [DEBUG] Swsusp_write() @ kernel/power/swsusp.c,874 
		> [DEBUG] write_suspend_image(), kernel/power/swsusp.c,407
		> [DEBUG] init_header(), kernel/power/swsusp.c,337
		> [DEBUG] dump_info(), kernel/power/swsusp.c,321
		>  swsusp: Version: 132618
		>  swsusp: Num Pages: 8192 
		>  swsusp: UTS Sys: Linux
		>  swsusp: UTS Node: (none)
		>  swsusp: UTS Release: 2.6.10_SELP_MIPS
		>  swsusp: UTS Version: #95 Wed Oct 30 03:46:35 KST 2007
		>  swsusp: UTS Machine: mips
		>  swsusp: UTS Domain: (none) 
		>  swsusp: CPUs: 1
		>  swsusp: Image: 1896 Pages
		>  swsusp: Pagedir: 0 Pages
		> [DEBUG] data_write(), kernel/power/swsusp.c,303
		> Writing data to swap (1896 pages)... done
		> Writing pagedir (8 pages) 
		> S|
		> Powering off system
		> Cold reset
		>
		> This is system log of my implementation.
		
		Excellent, this is looking promising.
		
		Do you still need any help?
		
		Ralf
		




	-- 
	Hyon Lim (임현)
	Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
	Fax. 032-232-0578 (Intl' Available)
	Homepage : http://www.alexlab.net 
	Blog : http://www.alexlab.net/blog 


[-- Attachment #2: Type: text/html, Size: 4710 bytes --]

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

* RE: implementation of software suspend on MIPS. (system log)
@ 2007-10-31 18:32       ` Uhler, Mike
  0 siblings, 0 replies; 11+ messages in thread
From: Uhler, Mike @ 2007-10-31 18:32 UTC (permalink / raw
  To: Hyon Lim, Ralf Baechle; +Cc: linux-mips

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

There are various sources of information available on MIPS assembly language programming.  The easiest way to get what you want is to write the code in C, then push it through the compiler to see what instructions it generates.  You can then hack that code to work in your context.
 
Beyond that, Ralf mentioned the book "See MIPS Run Linux", by Dominic Sweetman.  There is also the GNU gas manual and the MIPS SDE Programmer's Guide (see http://www.mips.com/products/resource-library/product-materials/software) or other references on MIPS assembly language programming.
 

/gmu
---
Michael Uhler, VP Architecture, Software and Platform Engineering
MIPS Technologies, Inc.   Email: uhler AT mips.com
1225 Charleston Road      Voice:  (650)567-5025 
Mountain View, CA 94043
  

  

 


________________________________

	From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Hyon Lim
	Sent: Wednesday, October 31, 2007 11:15 AM
	To: Ralf Baechle
	Cc: linux-mips@linux-mips.org
	Subject: Re: implementation of software suspend on MIPS. (system log)
	
	
	The problem is resume process.
	Some page copy and other remaining process wasn't implemented.
	The code of resume process should be implemented on arch/xxx/power/swsusp.S
	So it should be implemented by assembly.
	That's the problem...
	I've no idea about complex assembly programming. :-)
	Could you recommend any pdf or website?
	 
	On 10/31/07, Ralf Baechle <ralf@linux-mips.org> wrote: 

		On Wed, Oct 31, 2007 at 04:15:57AM +0900, Hyon Lim wrote:
		
		> [DEBUG] Swsusp_write() @ kernel/power/swsusp.c,874 
		> [DEBUG] write_suspend_image(), kernel/power/swsusp.c,407
		> [DEBUG] init_header(), kernel/power/swsusp.c,337
		> [DEBUG] dump_info(), kernel/power/swsusp.c,321
		>  swsusp: Version: 132618
		>  swsusp: Num Pages: 8192 
		>  swsusp: UTS Sys: Linux
		>  swsusp: UTS Node: (none)
		>  swsusp: UTS Release: 2.6.10_SELP_MIPS
		>  swsusp: UTS Version: #95 Wed Oct 30 03:46:35 KST 2007
		>  swsusp: UTS Machine: mips
		>  swsusp: UTS Domain: (none) 
		>  swsusp: CPUs: 1
		>  swsusp: Image: 1896 Pages
		>  swsusp: Pagedir: 0 Pages
		> [DEBUG] data_write(), kernel/power/swsusp.c,303
		> Writing data to swap (1896 pages)... done
		> Writing pagedir (8 pages) 
		> S|
		> Powering off system
		> Cold reset
		>
		> This is system log of my implementation.
		
		Excellent, this is looking promising.
		
		Do you still need any help?
		
		Ralf
		




	-- 
	Hyon Lim (임현)
	Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
	Fax. 032-232-0578 (Intl' Available)
	Homepage : http://www.alexlab.net 
	Blog : http://www.alexlab.net/blog 


[-- Attachment #2: Type: text/html, Size: 4710 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
       [not found] <DDAE9570F73FC744918E843E20BE598B096E8E@server1.RightHand.righthandtech.com>
@ 2007-11-01  1:46 ` Hyon Lim
  2007-11-01  2:27   ` J. Scott Kasten
  0 siblings, 1 reply; 11+ messages in thread
From: Hyon Lim @ 2007-11-01  1:46 UTC (permalink / raw
  To: Andrew Dyer; +Cc: linux-mips

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

Yes. you're right. I did same as you said.
However, is there any options for disassembly with variable name?
Often I cannot find that variable's allocated register.
There is only r0,r1... but I want a comment for variable assignment status.

On 11/1/07, Andrew Dyer <adyer@righthandtech.com> wrote:
>
> > The code of resume process should be implemented on
> arch/xxx/power/swsusp.S
> > So it should be implemented by assembly.
> > That's the problem...
> > I've no idea about complex assembly programming. :-)
> > Could you recommend any pdf or website?
>
> Whenever I have to do something moderately complex in assy. language, I
> often find it helpful to code the thing in C and run it through the compiler
> and look at the generated assy. language.  Oftentimes you can modify the
> output of the compiler without too much trouble.
>
>


-- 
Hyon Lim (임현)
Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
Fax. 032-232-0578 (Intl' Available)
Homepage : http://www.alexlab.net
Blog : http://www.alexlab.net/blog

[-- Attachment #2: Type: text/html, Size: 1505 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-11-01  1:46 ` implementation of software suspend on MIPS. (system log) Hyon Lim
@ 2007-11-01  2:27   ` J. Scott Kasten
  2007-11-01  9:11     ` Hyon Lim
  0 siblings, 1 reply; 11+ messages in thread
From: J. Scott Kasten @ 2007-11-01  2:27 UTC (permalink / raw
  To: Hyon Lim; +Cc: linux-mips


On Thu, 1 Nov 2007, Hyon Lim wrote:

> Yes. you're right. I did same as you said.
> However, is there any options for disassembly with variable name?
> Often I cannot find that variable's allocated register.
> There is only r0,r1... but I want a comment for variable assignment 
> status.

I just have to ask the question, but is it really necessary to code the 
whole thing in assembly?  I understand that the interface probably does 
need to be, but the main body of the function?  If it's very large or 
complicated, it would seem simpler to use C and write assembly glue to 
pull it all together rather than trying to debug hand assembly.  Many of 
us here have spent hours before tracking down problems with stale data in 
branch delay slots.  The compiler is a tad more convienient.

Regards,

-S-

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-11-01  2:27   ` J. Scott Kasten
@ 2007-11-01  9:11     ` Hyon Lim
  2007-11-01 13:41       ` J. Scott Kasten
  0 siblings, 1 reply; 11+ messages in thread
From: Hyon Lim @ 2007-11-01  9:11 UTC (permalink / raw
  To: J. Scott Kasten; +Cc: linux-mips

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

I think the reason of assembly implementation is processor context
replacement.
Processor context should be replaced when suspend or resume process.
So I think that code should be implemented using assembly language.
The second reason that I thinking is calling convention of C language.
How do you think?

On 11/1/07, J. Scott Kasten <jscottkasten@yahoo.com> wrote:
>
>
> On Thu, 1 Nov 2007, Hyon Lim wrote:
>
> > Yes. you're right. I did same as you said.
> > However, is there any options for disassembly with variable name?
> > Often I cannot find that variable's allocated register.
> > There is only r0,r1... but I want a comment for variable assignment
> > status.
>
> I just have to ask the question, but is it really necessary to code the
> whole thing in assembly?  I understand that the interface probably does
> need to be, but the main body of the function?  If it's very large or
> complicated, it would seem simpler to use C and write assembly glue to
> pull it all together rather than trying to debug hand assembly.  Many of
> us here have spent hours before tracking down problems with stale data in
> branch delay slots.  The compiler is a tad more convienient.
>
> Regards,
>
> -S-
>
>


-- 
Hyon Lim (임현)
Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
Fax. 032-232-0578 (Intl' Available)
Homepage : http://www.alexlab.net
Blog : http://www.alexlab.net/blog

[-- Attachment #2: Type: text/html, Size: 1929 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-11-01  9:11     ` Hyon Lim
@ 2007-11-01 13:41       ` J. Scott Kasten
  2007-11-01 14:37         ` Hyon Lim
  0 siblings, 1 reply; 11+ messages in thread
From: J. Scott Kasten @ 2007-11-01 13:41 UTC (permalink / raw
  To: Hyon Lim; +Cc: linux-mips



On Thu, 1 Nov 2007, Hyon Lim wrote:

> I think the reason of assembly implementation is processor context
> replacement.

Understood.  Assembly may indeed be required for specific things like 
restoring register state or fiddling with the cache if there aren't 
already macros or functions in the kernel that do exactly what you need.

> The second reason that I thinking is calling convention of C language.

It's not uncommon at all to have assembly language glue, say between a 
BIOS callback and the C language routine that does the work.

In your original post, you mentioned tracking variables and things that 
suggested a module that does much more that just load some odd registers 
or flip around a function call stack.  If that is indeed the case, then 
for sake of maintainablility and readability, one would be strongly 
encouraged to write the core stuff in plain old C and sprinkle in assembly 
glue code as required.

Think about it this way.  MIPS is a pretty large family of CPUs, each with 
it's own strange behaviors.  Several of those people on this list spend a 
lot of time tweeking that assembly to make it work cleanly across various 
CPUs.  It's a lot easier to understand 25 lines of assembly interface code 
and 200 lines of C code, than an entire 1000 line module written in 
assembly.  It's also a lot easier when you can shove most of the work over 
to the compiler, especially if others like your work and want to 
generalize it for use on many other MIPS CPUs.

I guess the real question here is how complex do you think your code needs 
to be?  That should determine your path.

Regards,

-S-

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-11-01 13:41       ` J. Scott Kasten
@ 2007-11-01 14:37         ` Hyon Lim
  2007-11-01 15:00           ` J. Scott Kasten
  0 siblings, 1 reply; 11+ messages in thread
From: Hyon Lim @ 2007-11-01 14:37 UTC (permalink / raw
  To: J. Scott Kasten; +Cc: linux-mips

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

Thank you for comments.
The remain work of my software suspend on MIPS project is resume procedure.
I already confirmed that suspend function was work. (See my post which
contains system log).

In an i386 implementation, there are only few assembly code for suspend and
resume procedure.
(You can refer :
http://lxr.linux.no/source/arch/i386/power/swsusp.S?v=2.6.10)
So, my work will be similar with i386 implementation. Assembly code used in
i386 implementation are several processor context related job
and copy saved page to memory. Instruction used in my MIPS implementation
will be compatible to most of MIPS processor.
Because the instruction used in implementation is very basic (store and load
and branch).

I agree your opinion related to maintainability and readability. So I
implement my work with C and few assembly code.
Thank you for advice.

On 11/1/07, J. Scott Kasten <jscottkasten@yahoo.com> wrote:
>
>
>
> On Thu, 1 Nov 2007, Hyon Lim wrote:
>
> > I think the reason of assembly implementation is processor context
> > replacement.
>
> Understood.  Assembly may indeed be required for specific things like
> restoring register state or fiddling with the cache if there aren't
> already macros or functions in the kernel that do exactly what you need.
>
> > The second reason that I thinking is calling convention of C language.
>
> It's not uncommon at all to have assembly language glue, say between a
> BIOS callback and the C language routine that does the work.
>
> In your original post, you mentioned tracking variables and things that
> suggested a module that does much more that just load some odd registers
> or flip around a function call stack.  If that is indeed the case, then
> for sake of maintainablility and readability, one would be strongly
> encouraged to write the core stuff in plain old C and sprinkle in assembly
> glue code as required.
>
> Think about it this way.  MIPS is a pretty large family of CPUs, each with
> it's own strange behaviors.  Several of those people on this list spend a
> lot of time tweeking that assembly to make it work cleanly across various
> CPUs.  It's a lot easier to understand 25 lines of assembly interface code
> and 200 lines of C code, than an entire 1000 line module written in
> assembly.  It's also a lot easier when you can shove most of the work over
> to the compiler, especially if others like your work and want to
> generalize it for use on many other MIPS CPUs.
>
> I guess the real question here is how complex do you think your code needs
> to be?  That should determine your path.
>
> Regards,
>
> -S-
>



-- 
Hyon Lim (임현)
Mobile. 010-8212-1240 (Intl' Call : +82-10-8212-1240)
Fax. 032-232-0578 (Intl' Available)
Homepage : http://www.alexlab.net
Blog : http://www.alexlab.net/blog

[-- Attachment #2: Type: text/html, Size: 3553 bytes --]

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

* Re: implementation of software suspend on MIPS. (system log)
  2007-11-01 14:37         ` Hyon Lim
@ 2007-11-01 15:00           ` J. Scott Kasten
  0 siblings, 0 replies; 11+ messages in thread
From: J. Scott Kasten @ 2007-11-01 15:00 UTC (permalink / raw
  To: Hyon Lim; +Cc: linux-mips


On Thu, 1 Nov 2007, Hyon Lim wrote:

> Thank you for comments.
> The remain work of my software suspend on MIPS project is resume procedure.
> I already confirmed that suspend function was work. (See my post which
> contains system log).
>
> In an i386 implementation, there are only few assembly code for suspend and
> resume procedure.
> (You can refer :
> http://lxr.linux.no/source/arch/i386/power/swsusp.S?v=2.6.10)
> So, my work will be similar with i386 implementation. Assembly code used in
> i386 implementation are several processor context related job
> and copy saved page to memory. Instruction used in my MIPS implementation
> will be compatible to most of MIPS processor.
> Because the instruction used in implementation is very basic (store and load
> and branch).
>
> I agree your opinion related to maintainability and readability. So I
> implement my work with C and few assembly code.
> Thank you for advice.
>

I look forward to your eventual success. :)

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

end of thread, other threads:[~2007-11-01 15:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <DDAE9570F73FC744918E843E20BE598B096E8E@server1.RightHand.righthandtech.com>
2007-11-01  1:46 ` implementation of software suspend on MIPS. (system log) Hyon Lim
2007-11-01  2:27   ` J. Scott Kasten
2007-11-01  9:11     ` Hyon Lim
2007-11-01 13:41       ` J. Scott Kasten
2007-11-01 14:37         ` Hyon Lim
2007-11-01 15:00           ` J. Scott Kasten
2007-10-30 19:15 Hyon Lim
     [not found] ` <20071031132553.GF14187@linux-mips.org>
2007-10-31 18:15   ` Hyon Lim
2007-10-31 18:30     ` Ralf Baechle
2007-10-31 18:32     ` Uhler, Mike
2007-10-31 18:32       ` Uhler, Mike

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.