Skip to contentSkip to conversation

Properly stop kernel threads on aic7xxx

PATCH Pavel Machek 3 participants 4 messages Apr 1, 2004 – Apr 2, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi!

This is totally untested patch that should make aic7xxx one step closer to working with software suspend... Plus it kills ugly #if in the process.
Pavel

drivers/scsi/aic7xxx/aic79xx_osm.c renamed from linux/drivers/scsi/aic7xxx/aic79xx_osm.c +1 -10
@@ -2581,17 +2581,8 @@
 	 * Complete thread creation.
 	 */
 	lock_kernel();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
-	/*
-	 * Don't care about any signals.
-	 */
-	siginitsetinv(&current->blocked, 0);
-
-	daemonize();
-	sprintf(current->comm, "ahd_dv_%d", ahd->unit);
-#else
 	daemonize("ahd_dv_%d", ahd->unit);
-#endif
+	current->flags |= PF_IOTHREAD;
 	unlock_kernel();
 
 	while (1) {
drivers/scsi/aic7xxx/aic7xxx_osm.c renamed from linux/drivers/scsi/aic7xxx/aic7xxx_osm.c +1 -10
@@ -2286,17 +2286,8 @@
 	 * Complete thread creation.
 	 */
 	lock_kernel();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	/*
-	 * Don't care about any signals.
-	 */
-	siginitsetinv(&current->blocked, 0);
-
-	daemonize();
-	sprintf(current->comm, "ahc_dv_%d", ahc->unit);
-#else
 	daemonize("ahc_dv_%d", ahc->unit);
-#endif
+	current->flags |= PF_IOTHREAD;
 	unlock_kernel();
 
 	while (1) {
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw
Quoted 39 lines · Pavel Machek

Hi!

This is totally untested patch that should make aic7xxx one step closer to working with software suspend... Plus it kills ugly #if in the process.
Pavel

drivers/scsi/aic7xxx/aic79xx_osm.c renamed from linux/drivers/scsi/aic7xxx/aic79xx_osm.c +1 -10
@@ -2581,17 +2581,8 @@
 	 * Complete thread creation.
 	 */
 	lock_kernel();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
-	/*
-	 * Don't care about any signals.
-	 */
-	siginitsetinv(&current->blocked, 0);
-
-	daemonize();
-	sprintf(current->comm, "ahd_dv_%d", ahd->unit);
-#else
 	daemonize("ahd_dv_%d", ahd->unit);
-#endif
+	current->flags |= PF_IOTHREAD;
 	unlock_kernel();
 
 	while (1) {
drivers/scsi/aic7xxx/aic7xxx_osm.c renamed from linux/drivers/scsi/aic7xxx/aic7xxx_osm.c +0 -5
@@ -2286,17 +2286,8 @@
 	 * Complete thread creation.
 	 */
 	lock_kernel();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	/*
-	 * Don't care about any signals.
-	 */
-	siginitsetinv(&current->blocked, 0);

drivers/scsi/aic7xxx/aic7xxx_osm.c line 2293

Quoted 10 lines
drivers/scsi/aic7xxx/aic7xxx_osm.c renamed from linux/drivers/scsi/aic7xxx/aic7xxx_osm.c +1 -5
-
-	daemonize();
-	sprintf(current->comm, "ahc_dv_%d", ahc->unit);
-#else
 	daemonize("ahc_dv_%d", ahc->unit);
-#endif
+	current->flags |= PF_IOTHREAD;
 	unlock_kernel();
 
 	while (1) {

This fixed the hang, I can reproduce the oops now.

Pavel the current CVS would work fine if only you wouldn't try to do I/O on compound pages via rw_page_swap_sync. That thing now collides with anon-vma (though it should work fine if you would backout anon-vma since the rw_page_swap_sync wouldn't touch page->private anymore).

I'm not exactly sure how to fix this collision right now. there are various ways, probably something that will work perfectly is to just clear PG_compound in rw_swap_page_sync and to set it back before returning (if it was set at the entry point), though I'd take it as last resort... thinking about it. Comments welcome.

I'm also unsure why _all_ multipage allocations really need this compound thing setup and why can't the owner of the page take care of the refcounting itself by always using the head page. I may actually add a GFP bitflag asking for a multipage but w/o a compound setup. There are million ways to fix this, none of which is obvious.

#2 lore raw
Quoted 6 lines · Andrea Arcangeli

I'm also unsure why _all_ multipage allocations really need this compound thing setup and why can't the owner of the page take care of the refcounting itself by always using the head page. I may actually add a GFP bitflag asking for a multipage but w/o a compound setup. There are million ways to fix this, none of which is obvious.

For direct-io into higher-order pages. When doing direct-io into a hugetlb page we need to make sure that get_user_pages() pins the correct pageframe.

Possibly we need to turn it on regardless of CONFIG_HUGETLBPAGE for people who want to do direct-io or PEEKTEXT/POKETEXT into mmapped soundcard buffers, for example. Perhaps there's a race which could permit direct-io to write to a freed page via this route..

Davem had some reason why he might want to turn on the compound logic permanently - related to TCP access to/from higher-order pages, I think.

#3 lore raw
Quoted 10 lines · Andrew Morton
Quoted 6 lines · Andrea Arcangeli

I'm also unsure why _all_ multipage allocations really need this compound thing setup and why can't the owner of the page take care of the refcounting itself by always using the head page. I may actually add a GFP bitflag asking for a multipage but w/o a compound setup. There are million ways to fix this, none of which is obvious.

For direct-io into higher-order pages. When doing direct-io into a hugetlb page we need to make sure that get_user_pages() pins the correct pageframe.

we do the same in bigpages 2.4 just fine with a basic math on the page_t knowing it's 2M naturally aligned, very easy to find the head page on vmas with VM_HUGETLBFS.

Quoted 7 lines

Possibly we need to turn it on regardless of CONFIG_HUGETLBPAGE for people who want to do direct-io or PEEKTEXT/POKETEXT into mmapped soundcard buffers, for example. Perhaps there's a race which could permit direct-io to write to a freed page via this route..

Davem had some reason why he might want to turn on the compound logic permanently - related to TCP access to/from higher-order pages, I think.

currently it's turned on only with HUGTLBFS=y though.