linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATH] Port software to UML.
       [not found] <20020505214819.19cb9a86.gang_hu@soul.com.cn>
@ 2002-05-05 19:05 ` Pavel Machek
  2002-05-06  0:22 ` Jeff Dike
  2002-05-06  0:36 ` Jeff Dike
  2 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2002-05-05 19:05 UTC (permalink / raw)
  To: hugang; +Cc: jdike, glonnon, Pavel Machek, seasons, linux-kernel

Hi!

>   Now I try port software to UML(user mode linux).
> This patch is for the 2.4.18 + uml-patch-2.4.18-22.

Hmm, I had same idea myself few hours ago (but no time :-( ).
> 
> -- Now the patch is make the kernek can suspend, BUT can not resume.
> 
> Here is the error message.
> 
> Ther problem in bread. I check the ubd drivers, in ubd_user.c the do_io is lseek64 the descriptor is error, The right descriptor is swap.a, But in here it is an socket. I think problem possbile in ubd, because in ide disk it can works fine.
> 

Swap file should not be a socket, right?
									Pavel
-- 
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.

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

* Re: [PATH] Port software to UML.
       [not found] <20020505214819.19cb9a86.gang_hu@soul.com.cn>
  2002-05-05 19:05 ` [PATH] Port software to UML Pavel Machek
@ 2002-05-06  0:22 ` Jeff Dike
  2002-05-06  2:50   ` hugang
  2002-05-06  0:36 ` Jeff Dike
  2 siblings, 1 reply; 8+ messages in thread
From: Jeff Dike @ 2002-05-06  0:22 UTC (permalink / raw)
  To: hugang; +Cc: glonnon, Pavel Machek, seasons, linux-kernel

gang_hu@soul.com.cn said:
> Ther problem in bread.

No, the problem is in not understanding UML.

UML's state is somewhat more complicated than the state of a native kernel.

You also need to recreate 
	the host processes
	the ptrace relationships between the tracing thread and the other 
processes
	open file descriptors
	and maybe a few other things that aren't coming to mind

				Jeff


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

* Re: [PATH] Port software to UML.
       [not found] <20020505214819.19cb9a86.gang_hu@soul.com.cn>
  2002-05-05 19:05 ` [PATH] Port software to UML Pavel Machek
  2002-05-06  0:22 ` Jeff Dike
@ 2002-05-06  0:36 ` Jeff Dike
  2 siblings, 0 replies; 8+ messages in thread
From: Jeff Dike @ 2002-05-06  0:36 UTC (permalink / raw)
  To: hugang; +Cc: glonnon, Pavel Machek, seasons, linux-kernel

gang_hu@soul.com.cn said:
>   Now I try port software to UML(user mode linux). 

I should have mentioned in my last message that swsusp would be very cool
to port to UML and I'd love to see it working.  There are lots of interesting
things that you'd be able to do as a result.

You just need to understand UML internals enough to save and restore all
of UML's host state, not just the memory image.

				Jeff


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

* Re: [PATH] Port software to UML.
  2002-05-06  0:22 ` Jeff Dike
@ 2002-05-06  2:50   ` hugang
  2002-05-06 15:18     ` Pavel Machek
  0 siblings, 1 reply; 8+ messages in thread
From: hugang @ 2002-05-06  2:50 UTC (permalink / raw)
  To: Jeff Dike; +Cc: glonnon, pavel, seasons, linux-kernel

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

On Sun, 05 May 2002 19:22:39 -0500
Jeff Dike <jdike@karaya.com> wrote:

> gang_hu@soul.com.cn said:
> > Ther problem in bread.
> 
> No, the problem is in not understanding UML.
> 
> UML's state is somewhat more complicated than the state of a native kernel.
> 
> You also need to recreate 
> 	the host processes
> 	the ptrace relationships between the tracing thread and the other 
> processes
> 	open file descriptors
> 	and maybe a few other things that aren't coming to mind
> 
> 				Jeff

Now , I found the Problem. Fix that have two way 
--1 after the register disk , We not close it.
--2 at prepare_request , We check the dev->count, it not open , must open it first.

The 1.diff is use the 1 way.
the 2.diff is use the 2 way.

Which is the best?
  
-- 
thanks with regards!
hugang.

***********************************
Beijing Soul Technology Co.,Ltd.
Tel:010-68425741/42/43/44
Fax:010-68425745
email:gang_hu@soul.com.cn
web:http://www.soul.com.cn
***********************************


[-- Attachment #2: 2.diff --]
[-- Type: text/plain, Size: 606 bytes --]

--- ubd.c~	Mon May  6 10:42:56 2002
+++ ubd.c.2	Mon May  6 10:46:06 2002
@@ -720,7 +720,22 @@
 		end_request(0);
 		return(1);
 	}
-
+	if(!dev->count) {
+		if (dev->file) {
+			if(ubd_open_dev(dev) < 0){
+				printk(KERN_ERR "unable to open %s for validation\n",
+				       dev->file);
+				return 1;
+			}
+		} else  return 1;
+		
+		/* have to recompute sizes since we opened it */
+		err = ubd_file_size(dev, &dev->size);
+		if(err) {
+			ubd_close(dev);
+			return 1;
+		}
+	}
         req->sector += ubd_part[minor].start_sect;
         block = req->sector;
         nsect = req->current_nr_sectors;

[-- Attachment #3: 1.diff --]
[-- Type: text/plain, Size: 1239 bytes --]

--- ubd.c~	Mon May  6 10:42:56 2002
+++ ubd.c	Mon May  6 10:49:11 2002
@@ -888,33 +888,26 @@
 	/* If it already has been opened we can check the partitions 
 	 * directly 
 	 */
-	if(dev->count){
-		part->start_sect = 0;
-		register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, 
-			      &ubd_blops, part->nr_sects);
-	} 
-	else if(dev->file){
-		if(ubd_open_dev(dev) < 0){
-			printk(KERN_ERR "unable to open %s for validation\n",
-			       dev->file);
-			return 1;
-		}
-
+	part->start_sect = 0;
+	if(!dev->count) {
+		if (dev->file) {
+			if(ubd_open_dev(dev) < 0){
+				printk(KERN_ERR "unable to open %s for validation\n",
+				       dev->file);
+				return 1;
+			}
+		} else  return 1;
+		
 		/* have to recompute sizes since we opened it */
 		err = ubd_file_size(dev, &dev->size);
 		if(err) {
 			ubd_close(dev);
 			return 1;
 		}
-		part->start_sect = 0;
 		part->nr_sects = dev->size / hardsect_sizes[offset];
-		register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, 
-			      &ubd_blops, part->nr_sects);
-
-		/* we are done so close it */
-		ubd_close(dev);
-	} 
-	else return(1);
+	}
+	register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, 
+		      &ubd_blops, part->nr_sects);
 	return(0);
 }
 

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

* Re: [PATH] Port software to UML.
  2002-05-06  2:50   ` hugang
@ 2002-05-06 15:18     ` Pavel Machek
  2002-05-06 16:17       ` [PATH] Port software suspend " hugang
  2002-05-06 17:03       ` [PATH] Port software " Jeff Dike
  0 siblings, 2 replies; 8+ messages in thread
From: Pavel Machek @ 2002-05-06 15:18 UTC (permalink / raw)
  To: hugang; +Cc: Jeff Dike, glonnon, seasons, linux-kernel

Hi!

> > > Ther problem in bread.
> > 
> > No, the problem is in not understanding UML.
> > 
> > UML's state is somewhat more complicated than the state of a native kernel.
> > 
> > You also need to recreate 
> > 	the host processes
> > 	the ptrace relationships between the tracing thread and the other 
> > processes
> > 	open file descriptors
> > 	and maybe a few other things that aren't coming to mind
> > 
> > 				Jeff
> 
> Now , I found the Problem. Fix that have two way 
> --1 after the register disk , We not close it.
> --2 at prepare_request , We check the dev->count, it not open , must open it first.
> 
> The 1.diff is use the 1 way.
> the 2.diff is use the 2 way.

Jeff is right that you might recreate a little more state...

However, with a little luck, what you do might partly work. Does it
successfully resume for you?
								Pavel
PS: Jeff, any chance of uml going to 2.5. soon? It would be difficult
for me to merge swsusp/uml patches when uml is not in the kernel :-(.
-- 
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.

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

* Re: [PATH] Port software suspend to UML.
  2002-05-06 15:18     ` Pavel Machek
@ 2002-05-06 16:17       ` hugang
  2002-05-06 19:05         ` Jeff Dike
  2002-05-06 17:03       ` [PATH] Port software " Jeff Dike
  1 sibling, 1 reply; 8+ messages in thread
From: hugang @ 2002-05-06 16:17 UTC (permalink / raw)
  To: Pavel Machek; +Cc: jdike, glonnon, seasons, linux-kernel

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

On Mon, 6 May 2002 17:18:05 +0200
Pavel Machek <pavel@suse.cz> wrote:

> Hi!
> 
>
> Jeff is right that you might recreate a little more state...
> 
> However, with a little luck, what you do might partly work. Does it
> successfully resume for you?
> 								Pavel

-- Yes, Jeff is right.
-- Now The kernel can read the swap data into memory. possible somethinks is lost , the kernel can not switch the register to old. 

The attache file is the last patch for 2.4.18 + uml-22 .

-- thanks with regards! hugang.

***********************************
Beijing Soul Technology Co.,Ltd.
Tel:010-68425741/42/43/44
Fax:010-68425745
email:gang_hu@soul.com.cn
web:http://www.soul.com.cn
***********************************

[-- Attachment #2: 00_2.4.18-swsusp.gz --]
[-- Type: application/octet-stream, Size: 28697 bytes --]

[-- Attachment #3: uml-suspend.gz --]
[-- Type: application/octet-stream, Size: 2900 bytes --]

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

* Re: [PATH] Port software to UML.
  2002-05-06 15:18     ` Pavel Machek
  2002-05-06 16:17       ` [PATH] Port software suspend " hugang
@ 2002-05-06 17:03       ` Jeff Dike
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Dike @ 2002-05-06 17:03 UTC (permalink / raw)
  To: Pavel Machek; +Cc: hugang, glonnon, seasons, linux-kernel

pavel@suse.cz said:
> PS: Jeff, any chance of uml going to 2.5. soon? 

Any chance of Linus not dropping UML on the floor if I send it to him?

> It would be difficult
> for me to merge swsusp/uml patches when uml is not in the kernel :-(. 

Yeah, I know.  Sorry.

I've been doing 2.4 pretty much exclusively, so the last UML that did 2.5
was 2.5.1-something, so it needs to catch up some.

				Jeff


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

* Re: [PATH] Port software suspend to UML.
  2002-05-06 16:17       ` [PATH] Port software suspend " hugang
@ 2002-05-06 19:05         ` Jeff Dike
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Dike @ 2002-05-06 19:05 UTC (permalink / raw)
  To: hugang; +Cc: Pavel Machek, jdike, glonnon, seasons, linux-kernel

gang_hu@soul.com.cn said:
> -- Now The kernel can read the swap data into memory. possible
> somethinks is lost , the kernel can not switch the register to old.  

At the point at which you're trying to restore the old registers, you need
to have recreated the host processes and their state.  So, if you're going
to get any further, you need to start saving that state.

				Jeff


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

end of thread, other threads:[~2002-05-06 18:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20020505214819.19cb9a86.gang_hu@soul.com.cn>
2002-05-05 19:05 ` [PATH] Port software to UML Pavel Machek
2002-05-06  0:22 ` Jeff Dike
2002-05-06  2:50   ` hugang
2002-05-06 15:18     ` Pavel Machek
2002-05-06 16:17       ` [PATH] Port software suspend " hugang
2002-05-06 19:05         ` Jeff Dike
2002-05-06 17:03       ` [PATH] Port software " Jeff Dike
2002-05-06  0:36 ` Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).