From: Mike Anderson <andmike@us.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] scsi_host sysfs updates scsi-misc-2.5 [0/2]
Date: Thu, 8 May 2003 23:33:21 -0700 [thread overview]
Message-ID: <20030509063321.GA3259@beaverton.ibm.com> (raw)
This series of patches is an update to the scsi_host sysfs / ref
counting patches previously merged into the scsi-misc-2.5 tree.
insmod / rmmod Testing:
Legacy registration:
aic7xxx_old, qlogicisp
qla2xxx v8.00.00b1 - Driver oops system with garbled
messages on rmmod. Does not seem related to this patch.
New registration:
scsi_debug
aic7xxx has an issue with holding lock while calling
scsi_remove_host. I created a test patch to not hold the
lock and the scsi mid layer illegal context messages
stopped. Justin will need to address a real fix.
I am booted on the ips driver, but have done no insmod / rmmod
testing.
Attached is the current Reference Counting Rules and a small future
TODO cleanup list.
Post feedback I will work to roll this into the scsi documentation.
-andmike
--
Michael Anderson
andmike@us.ibm.com
<Referemnce Counting Rules>
1.) Reference counting for scsi_host
scsi_register (scsi_alloc_host):
(A) kmalloc Scsi_Host + xtr_bytes
(B) Call device_initialize, class_device_initialize
refcount is 1 on host_gendev.
refcount is 1 on class_dev.
scsi_get_host:
(A) Call get_device on host_gendev
refcount +1 on host_gendev
(B) Call class_device_get on class_dev
refcount +1 on class_dev
scsi_host_put:
(A) Call put_device on host_gendev
refcount -1 on host_gendev
(B) Call class_device_put on class_dev
refcount -1 on class_dev
scsi_add_host:
(A) Call scsi_sysfs_add_host
(1) Call device_add
refcount +1 on parent struct device
host_gendev now visible in sysfs tree.
(2) Call class_device_add
refcount +1 on scsi_host class
refcount +1 on parent struct device
class_dev now visible in sysfs tree
(C) Call scsi_proc_host_add
Scsi_Host now visible in proc.
(D) Call scsi_scan_host
refcount +1 on host_gendev for each scsi_device
discovered
(E) Call scsi_attach_device.
scsi_remove_host:
(A) "scsi_offline_host" see note above.
(B) Call scsi_proc_host_rm
(C) Call scsi_forget_host
refcount -1 on host_gendev for each scsi_device
unregistered
(D) Call scsi_sysfs_remove_host
(1) Call class_device_del
(2) Call device_del
scsi_unregister:
(A) Call scsi_put_host
scsi_host_release:
(A) Call scsi_free_shost
(1) Remove Scsi_Host from scsi_host_list list.
(2) Kill error recovery thread.
(3) Call scsi_destroy_command_freelist
(4) kfree(shost)
scsi_register_host:
(A) Call template detect
(1) Call scsi_register for each instance
(B) Call scsi_add_host for each instance
scsi_unregister_host:
(A) Call scsi_remove_host, hostt->release for all
Scsi_Host instances.
2.) Reference counting for scsi_device
scsi_add_lun:
(A) Call scsi_device_register
refcount 1 on sdev_driverfs_dev
refcount +1 on parent struct device (i.e host_gendev)
scsi_add_device:
(A) Call scsi_probe_and_add_lun
scsi_remove_device:
(A) Call scsi_detach_device
(B) Call scsi_device_unregister
refcount -1 on sdev_driverfs_dev
refcount -1 on parent struct device (i.e host_gendev)
scsi_device_get:
(A) try_module_get
(B) access_count +1
scsi_device_put:
(A) access_count -1
(B) module_put on host module
TODO:
- scsi_set_host_offline needs work on sync between LLDD and mid on
surprise remove.
- Move upper level attaches to driver model so scsi_add_host does
not need to loop over my_devices. Post the cleanups that have
happen on the upper level driver we really close to matching the
model already this should be doable. (Christoph has old patch
that needs refreshed to handle this)
- Remove scsi_host_get_next.
- Should move scsi_device device_register to (initialize, add)
pair. (Low priority)
- Evaluate the need for scsi_host_list as this is duplicated in
the scsi_host class structure. (Low priority)
next reply other threads:[~2003-05-09 6:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-09 6:33 Mike Anderson [this message]
2003-05-09 6:34 ` [PATCH] scsi_host sysfs updates scsi-misc-2.5 [1/2] Mike Anderson
2003-05-09 6:35 ` [PATCH] scsi_host sysfs updates scsi-misc-2.5 [2/2] Mike Anderson
2003-05-09 6:59 ` Christoph Hellwig
2003-05-09 7:50 ` Mike Anderson
2003-05-09 8:21 ` Mike Anderson
2003-05-12 3:57 ` [PATCH] scsi_host sysfs updates scsi-misc-2.5 [0/2] James Bottomley
2003-05-12 6:38 ` Mike Anderson
2003-05-12 17:50 ` James Bottomley
2003-05-12 17:59 ` James Bottomley
2003-05-12 18:41 ` Mike Anderson
2003-05-12 20:10 ` James Bottomley
2003-05-12 20:35 ` Mike Anderson
2003-05-12 20:42 ` James Bottomley
2003-05-12 20:53 ` James Bottomley
2003-05-12 21:49 ` Mike Anderson
2003-05-12 21:50 ` James Bottomley
2003-05-12 22:15 ` Mike Anderson
2003-05-14 0:00 ` Patrick Mochel
2003-05-12 18:18 ` Mike Anderson
2003-05-12 15:15 ` Andrew Vasquez
2003-05-13 18:51 ` Mike Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030509063321.GA3259@beaverton.ibm.com \
--to=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox