public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* khubd zombie
@ 2002-02-18 13:33 Patrik Weiskircher
  2002-02-18 18:14 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Patrik Weiskircher @ 2002-02-18 13:33 UTC (permalink / raw)
  To: linux-kernel

killall khubd results to:
10 ?        Z      0:00 [khubd <defunct>]

is this ok?
if not, how can i solve this?

Best Regards,
Patrik Weiskircher




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

* Re: khubd zombie
  2002-02-18 13:33 khubd zombie Patrik Weiskircher
@ 2002-02-18 18:14 ` Greg KH
  2002-02-18 19:56   ` Patrik Weiskircher
  2002-02-18 18:21 ` John Levon
  2002-02-22  1:19 ` Andrew Rodland
  2 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2002-02-18 18:14 UTC (permalink / raw)
  To: Patrik Weiskircher; +Cc: linux-kernel

On Mon, Feb 18, 2002 at 02:33:13PM +0100, Patrik Weiskircher wrote:
> killall khubd results to:
> 10 ?        Z      0:00 [khubd <defunct>]
> 
> is this ok?
> if not, how can i solve this?

What kernel version is this?
And why are you trying to kill khubd from userspace?  Unloading the
usbcore module will do the same thing.

thanks,

greg k-h

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

* Re: khubd zombie
  2002-02-18 13:33 khubd zombie Patrik Weiskircher
  2002-02-18 18:14 ` Greg KH
@ 2002-02-18 18:21 ` John Levon
  2002-02-22  1:19 ` Andrew Rodland
  2 siblings, 0 replies; 9+ messages in thread
From: John Levon @ 2002-02-18 18:21 UTC (permalink / raw)
  To: linux-kernel

On Mon, Feb 18, 2002 at 02:33:13PM +0100, Patrik Weiskircher wrote:

> killall khubd results to:
> 10 ?        Z      0:00 [khubd <defunct>]
> 
> is this ok?
> if not, how can i solve this?

add reparent_to_init() in drivers/usb/hub.c (by the daemonize()).

I imagine the fix is sitting in some USB changes somewhere ...

john

-- 
"They eat cold meat for breakfast and make jokes about gzip."
	- Rik Hemsley on KDE developers

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

* Re: khubd zombie
  2002-02-18 18:14 ` Greg KH
@ 2002-02-18 19:56   ` Patrik Weiskircher
  2002-02-18 20:00     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Patrik Weiskircher @ 2002-02-18 19:56 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

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

On Mon, 2002-02-18 at 19:14, Greg KH wrote:
> On Mon, Feb 18, 2002 at 02:33:13PM +0100, Patrik Weiskircher wrote:
> > killall khubd results to:
> > 10 ?        Z      0:00 [khubd <defunct>]
> > 
> > is this ok?
> > if not, how can i solve this?
> 
> What kernel version is this?
> And why are you trying to kill khubd from userspace?  Unloading the
> usbcore module will do the same thing.
> 
> thanks,
> 
> greg k-h

I tried it with 2.4.5, 2.4.12, 2.4.17.
And I have to kill everything except init.
I need a "clean" system.

Anyway, I don't think that it should behave like that.
Killing something from userspace should not affect the kernel, or did I
miss something?

I fixed it, it works, patch file attached.

Best Regards,
Patrik


[-- Attachment #2: hub.c.patch --]
[-- Type: text/x-patch, Size: 826 bytes --]

diff -Naur linux-2.4.17/drivers/usb/hub.c linux/drivers/usb/hub.c
--- linux-2.4.17/drivers/usb/hub.c	Mon Feb 18 20:43:48 2002
+++ linux/drivers/usb/hub.c	Mon Feb 18 20:38:50 2002
@@ -826,6 +826,8 @@
 
 static int usb_hub_thread(void *__hub)
 {
+	struct task_struct *tsk = current;
+
 	lock_kernel();
 
 	/*
@@ -835,6 +837,13 @@
 
 	daemonize();
 
+	/* avoid getting signals */
+	spin_lock_irq(&tsk->sigmask_lock);
+	flush_signals(tsk);
+	sigfillset(&tsk->blocked);
+	recalc_sigpending(tsk);
+	spin_unlock_irq(&tsk->sigmask_lock);
+
 	/* Setup a nice name */
 	strcpy(current->comm, "khubd");
 
@@ -879,7 +888,7 @@
 	}
 
 	pid = kernel_thread(usb_hub_thread, NULL,
-		CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+		CLONE_FS | CLONE_FILES | CLONE_SIGNAL);
 	if (pid >= 0) {
 		khubd_pid = pid;
 

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

* Re: khubd zombie
  2002-02-18 19:56   ` Patrik Weiskircher
@ 2002-02-18 20:00     ` Greg KH
  2002-02-18 20:16       ` Patrik Weiskircher
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2002-02-18 20:00 UTC (permalink / raw)
  To: Patrik Weiskircher; +Cc: linux-kernel

On Mon, Feb 18, 2002 at 08:56:22PM +0100, Patrik Weiskircher wrote:
> 
> I tried it with 2.4.5, 2.4.12, 2.4.17.
> And I have to kill everything except init.
> I need a "clean" system.

What?  You want to also get rid of keventd, ksoftirqd_CPUX, kswapd, and
others and expect your machine to still work properly?

> Anyway, I don't think that it should behave like that.
> Killing something from userspace should not affect the kernel, or did I
> miss something?

This is a _kernel_ thread, not a userspace program running.

> I fixed it, it works, patch file attached.

And what happened to your USB devices when you kill khubd after applying
your patch?

The reparent_to_init() seems like the better thing to do.

thanks,

greg k-h

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

* Re: khubd zombie
  2002-02-18 20:00     ` Greg KH
@ 2002-02-18 20:16       ` Patrik Weiskircher
  2002-02-18 20:43         ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Patrik Weiskircher @ 2002-02-18 20:16 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

On Mon, 2002-02-18 at 21:00, Greg KH wrote:
> On Mon, Feb 18, 2002 at 08:56:22PM +0100, Patrik Weiskircher wrote:
> > 
> > I tried it with 2.4.5, 2.4.12, 2.4.17.
> > And I have to kill everything except init.
> > I need a "clean" system.
> 
> What?  You want to also get rid of keventd, ksoftirqd_CPUX, kswapd, and
> others and expect your machine to still work properly?

I just do a kill(-1,15);
It doesn't affect keventd, ksoftirqd_CPUX, etc. as far as i know.
Except the khubd, it keeps getting a zombie.

> 
> > Anyway, I don't think that it should behave like that.
> > Killing something from userspace should not affect the kernel, or did I
> > miss something?
> 
> This is a _kernel_ thread, not a userspace program running.

khubd is a kernel thread, yes.
But if I issue a 'killall khubd' it shouldn't become a zombie.

> 
> > I fixed it, it works, patch file attached.
> 
> And what happened to your USB devices when you kill khubd after applying
> your patch?

They work as always.

> 
> The reparent_to_init() seems like the better thing to do.
> 

I have to admit, I'm really new to the kernel sources.
There's still _very_ much I don't know about the kernel.
These are the first steps in kernel programming. 
Sorry if it's the wrong way to do, I just try my best.

> thanks,
> 
> greg k-h

Best Regards,
Patrik Weiskircher


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

* Re: khubd zombie
  2002-02-18 20:16       ` Patrik Weiskircher
@ 2002-02-18 20:43         ` Greg KH
  2002-02-18 21:05           ` Patrik Weiskircher
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2002-02-18 20:43 UTC (permalink / raw)
  To: Patrik Weiskircher; +Cc: linux-kernel

On Mon, Feb 18, 2002 at 09:16:30PM +0100, Patrik Weiskircher wrote:
> 
> khubd is a kernel thread, yes.
> But if I issue a 'killall khubd' it shouldn't become a zombie.

Agreed.  I'll look into this.

> > And what happened to your USB devices when you kill khubd after applying
> > your patch?
> 
> They work as always.

Try removing a device, or plugging a new one in :)

greg k-h

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

* Re: khubd zombie
  2002-02-18 20:43         ` Greg KH
@ 2002-02-18 21:05           ` Patrik Weiskircher
  0 siblings, 0 replies; 9+ messages in thread
From: Patrik Weiskircher @ 2002-02-18 21:05 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

On Mon, 2002-02-18 at 21:43, Greg KH wrote:

> > > And what happened to your USB devices when you kill khubd after applying
> > > your patch?
> > 
> > They work as always.
> 
> Try removing a device, or plugging a new one in :)
> 

Without my patch, plugging a new one in doesn't work, after a killall
khubd. with my patch it worked without a single problem. (with ohci,
don't know if that matters.)

I'll do some more tests tomorrow morning. ;)

Thanks for your help so far,
Patrik


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

* Re: khubd zombie
  2002-02-18 13:33 khubd zombie Patrik Weiskircher
  2002-02-18 18:14 ` Greg KH
  2002-02-18 18:21 ` John Levon
@ 2002-02-22  1:19 ` Andrew Rodland
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Rodland @ 2002-02-22  1:19 UTC (permalink / raw)
  To: linux-kernel

I read this as "Kobold Zombie". >:)

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

end of thread, other threads:[~2002-02-22  1:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-18 13:33 khubd zombie Patrik Weiskircher
2002-02-18 18:14 ` Greg KH
2002-02-18 19:56   ` Patrik Weiskircher
2002-02-18 20:00     ` Greg KH
2002-02-18 20:16       ` Patrik Weiskircher
2002-02-18 20:43         ` Greg KH
2002-02-18 21:05           ` Patrik Weiskircher
2002-02-18 18:21 ` John Levon
2002-02-22  1:19 ` Andrew Rodland

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