* Several Misc SCSI updates...
@ 2002-11-17 20:28 Doug Ledford
2002-11-17 20:29 ` Linus Torvalds
0 siblings, 1 reply; 6+ messages in thread
From: Doug Ledford @ 2002-11-17 20:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Linux Scsi Mailing List
These bring the scsi subsys up to the new module loader semantics. There
is more work to be done on inter-module locking here, but we need to solve
the whole module->live is 0 during init problem first or else it's a waste
of time.
bk://linux-scsi.bkbits.net/scsi-dledford
ChangeSet@1.866, 2002-11-17 15:02:31-05:00, dledford@flossy.devel.redhat.com
Merge bk://linux.bkbits.net/linux-2.5
into flossy.devel.redhat.com:/usr/local/home/dledford/bk/linus-2.5
ChangeSet@1.810.1.5, 2002-11-16 21:31:05-05:00, dledford@aladin.rdu.redhat.com
Christoph Hellwig posted a patch that conflicted with a lot of my own
changes, so this is the merge of his work into my own.
ChangeSet@1.810.1.4, 2002-11-16 21:22:06-05:00, dledford@aladin.rdu.redhat.com
aic7xxx_old: fix check_region/request_region usage so that the module
may be loaded/unloaded/reloaded
ChangeSet@1.810.1.3, 2002-11-16 20:59:23-05:00, dledford@aladin.rdu.redhat.com
Update high level scsi drivers to use struct list_head in templates
Update scsi.c for struct list_head in upper layer templates
Update scsi.c for new module loader semantics
ChangeSet@1.810.1.2, 2002-11-16 14:51:42-05:00, dledford@aladin.rdu.redhat.com
scsi.c:
- Comment out GET_USE_COUNT, it's a bogus test anyway
- Don't panic on failure to allocate sg table slab slots, fail gracefully
- init_scsi() leaks all sorts of crap on failed module load
ChangeSet@1.805.6.1, 2002-11-11 18:02:55-05:00, dledford@aladin.rdu.redhat.com
mptscsih.h: compile fix
--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Several Misc SCSI updates...
2002-11-17 20:28 Several Misc SCSI updates Doug Ledford
@ 2002-11-17 20:29 ` Linus Torvalds
2002-11-17 20:38 ` Doug Ledford
0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2002-11-17 20:29 UTC (permalink / raw)
To: Doug Ledford; +Cc: Linux Kernel Mailing List, Linux Scsi Mailing List
On Sun, 17 Nov 2002, Doug Ledford wrote:
>
> These bring the scsi subsys up to the new module loader semantics. There
> is more work to be done on inter-module locking here, but we need to solve
> the whole module->live is 0 during init problem first or else it's a waste
> of time.
Hey, just remove the "live" test, I think it's over-eager and likely to
just cause extra code to work around it rather than fix anything.
Linus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Several Misc SCSI updates...
2002-11-17 20:29 ` Linus Torvalds
@ 2002-11-17 20:38 ` Doug Ledford
2002-11-17 21:40 ` Linus Torvalds
0 siblings, 1 reply; 6+ messages in thread
From: Doug Ledford @ 2002-11-17 20:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Linux Scsi Mailing List
On Sun, Nov 17, 2002 at 12:29:25PM -0800, Linus Torvalds wrote:
>
> On Sun, 17 Nov 2002, Doug Ledford wrote:
> >
> > These bring the scsi subsys up to the new module loader semantics. There
> > is more work to be done on inter-module locking here, but we need to solve
> > the whole module->live is 0 during init problem first or else it's a waste
> > of time.
>
> Hey, just remove the "live" test, I think it's over-eager and likely to
> just cause extra code to work around it rather than fix anything.
Won't work. module->live is what Rusty uses to indicate that the module
is in the process of unloading, which is when we *do* want the attempt to
module_get() to fail. I think the process out to basically be:
load module into mem
set module->live = 1
call module_init
export module syms
done loading module
on module exit:
unexport module syms
set module->live 0
call module_exit
free module memory
done unloading.
That *should* solve all the races Rusty is trying to solve without the
problems we've had so far, but this is only after a few minutes of
thinking....
--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Several Misc SCSI updates...
2002-11-17 20:38 ` Doug Ledford
@ 2002-11-17 21:40 ` Linus Torvalds
2002-11-17 21:55 ` Alexander Viro
0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2002-11-17 21:40 UTC (permalink / raw)
To: Doug Ledford; +Cc: Linux Kernel Mailing List, Linux Scsi Mailing List
On Sun, 17 Nov 2002, Doug Ledford wrote:
>
> Won't work. module->live is what Rusty uses to indicate that the module
> is in the process of unloading, which is when we *do* want the attempt to
> module_get() to fail.
That's fine, as long as "module_get()" is the only thing that cares. Just
make it go "live" early as you indicate, and everybody should be happy. I
certainly agree that it should be illegal to do more module_get()'s once
we've already started unloading..
Linus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Several Misc SCSI updates...
2002-11-17 21:40 ` Linus Torvalds
@ 2002-11-17 21:55 ` Alexander Viro
2002-11-17 22:04 ` Doug Ledford
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Viro @ 2002-11-17 21:55 UTC (permalink / raw)
To: Linus Torvalds
Cc: Doug Ledford, Linux Kernel Mailing List, Linux Scsi Mailing List
On Sun, 17 Nov 2002, Linus Torvalds wrote:
>
> On Sun, 17 Nov 2002, Doug Ledford wrote:
> >
> > Won't work. module->live is what Rusty uses to indicate that the module
> > is in the process of unloading, which is when we *do* want the attempt to
> > module_get() to fail.
>
> That's fine, as long as "module_get()" is the only thing that cares. Just
> make it go "live" early as you indicate, and everybody should be happy. I
> certainly agree that it should be illegal to do more module_get()'s once
> we've already started unloading..
On the unload side it's OK. module_get() also breaks during _init_ and that's
the problem. IOW, you'll need to make every block device driver to set ->live
manually. Smells like a wrong API...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Several Misc SCSI updates...
2002-11-17 21:55 ` Alexander Viro
@ 2002-11-17 22:04 ` Doug Ledford
0 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2002-11-17 22:04 UTC (permalink / raw)
To: Alexander Viro
Cc: Linus Torvalds, Linux Kernel Mailing List,
Linux Scsi Mailing List
On Sun, Nov 17, 2002 at 04:55:26PM -0500, Alexander Viro wrote:
>
>
> On Sun, 17 Nov 2002, Linus Torvalds wrote:
>
> >
> > On Sun, 17 Nov 2002, Doug Ledford wrote:
> > >
> > > Won't work. module->live is what Rusty uses to indicate that the module
> > > is in the process of unloading, which is when we *do* want the attempt to
> > > module_get() to fail.
> >
> > That's fine, as long as "module_get()" is the only thing that cares. Just
> > make it go "live" early as you indicate, and everybody should be happy. I
> > certainly agree that it should be illegal to do more module_get()'s once
> > we've already started unloading..
>
> On the unload side it's OK. module_get() also breaks during _init_ and that's
> the problem. IOW, you'll need to make every block device driver to set ->live
> manually. Smells like a wrong API...
This is the patch I just put into my tree (beware cut-n-paste breakage is
in effect, but Linus should have the change in his tree momentarily
anyway):
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c Sun Nov 17 17:02:48 2002
+++ b/kernel/module.c Sun Nov 17 17:02:48 2002
@@ -1058,6 +1058,15 @@
list_add(&mod->extable.list, &extables);
spin_unlock_irq(&modlist_lock);
+ /* Note, setting the mod->live to 1 here is safe because we haven't
+ * linked the module into the system's kernel symbol table yet,
+ * which means that the only way any other kernel code can call
+ * into this module right now is if this module hands out entry
+ * pointers to the other code. We assume that no module hands out
+ * entry pointers to the rest of the kernel unless it is ready to
+ * have them used.
+ */
+ mod->live = 1;
/* Start the module */
ret = mod->init ? mod->init() : 0;
if (ret < 0) {
@@ -1070,9 +1079,10 @@
/* Mark it "live" so that they can force
deletion later, and we don't keep getting
woken on every decrement. */
- mod->live = 1;
- } else
+ } else {
+ mod->live = 0;
free_module(mod);
+ }
up(&module_mutex);
return ret;
}
@@ -1087,7 +1097,6 @@
mod->module_init = NULL;
/* All ok! */
- mod->live = 1;
up(&module_mutex);
return 0;
}
--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-11-17 21:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-17 20:28 Several Misc SCSI updates Doug Ledford
2002-11-17 20:29 ` Linus Torvalds
2002-11-17 20:38 ` Doug Ledford
2002-11-17 21:40 ` Linus Torvalds
2002-11-17 21:55 ` Alexander Viro
2002-11-17 22:04 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox