From: Lee Duncan <lduncan@suse.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
hare@suse.com, jthumshirn@suse.de, JBottomley@Parallels.com,
Lee Duncan <lduncan@suse.com>
Subject: [PATCH 0/6] Create ida helpers and use them
Date: Sun, 6 Sep 2015 10:59:28 -0700 [thread overview]
Message-ID: <cover.1441416571.git.lduncan@suse.com> (raw)
As pointed out by Christoph Hellwig, many of the users
of the ida index routines call them with the same calling
pattern, so why not make some helper functions to help
clean up and simplify the code a bit.
After looking at all the uses of the ida routines, I
noticed that most of clients of this API used the
same sequence -- but not all of them. So I picked
the most common and seemingly most correct sequence,
and I made inline helper functions for that, creating:
- ida_get_index() -- get an 'ida' index, with proper
locking and retry
- ida_put_index() -- release/return an index allocated
by ida_get_index(), with proper locking
I converted the following drivers to use the new helper
routines, because they matched the calling sequence
used by the helper functions:
scsi/sd.c SCSI disk
base/soc.c sound?
block/mtip32xxx/mtip32xx.c PCI block?
block/nvme-core.c Intel SSD?
block/rsxx/core.c IBM Flash?
Obviously, only one of these is a SCSI driver, so
I hope this is still the right place to post this.
NOTE 1: the soc.c driver actually had normal locking
around it's 'get' call, but it had no locking around
it's 'put' (release) calls, so since the helper routines
have locking, that means the soc.c driver now has
locking when it releases an index.
There were other drivers that used ida in a way
that meant I could not easily modify them:
drivers/iommu/iommu.c:
- uses unlikely(...)
- uses a mutex instead of spinlock
drivers/misc/cb710/core.c:
- calls return from within the 'get' while loop
- uses spin_lock_irq*()
drivers/scsi/osd/osd_uld.c:
- uses no locking at all for indexes [See NOTE 2]
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
- uses 'unlikely()' in 'get' while loop
- uses 'goto's out of 'get' while loop
NOTE 2: Not sure if this is a bug in the osd code, since
I did not look at it very closely.
The only client driver changes I was able to functionally
test where the sd.c changes. I also tested the helper
functions using the hosts.c module, where they worked
fine, but those changes were later reverted in favor of
using idr there instead. (See previous patch series.)
Lee Duncan (6):
Add ida helper routines
SCSI: Update sd driver to use new ida helper functions.
Update soc driver to use new ida helper functions.
Update soc driver to use new ida helper functions.
Update nvme-core driver to use new ida helper functions.
Update rsxx core driver to use new ida helper functions.
drivers/base/soc.c | 17 +++-------------
drivers/block/mtip32xx/mtip32xx.c | 22 ++++----------------
drivers/block/nvme-core.c | 14 ++-----------
drivers/block/rsxx/core.c | 16 ++-------------
drivers/scsi/sd.c | 18 +++--------------
include/linux/idr.h | 42 +++++++++++++++++++++++++++++++++++++++
6 files changed, 56 insertions(+), 73 deletions(-)
--
2.1.4
next reply other threads:[~2015-09-06 17:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-06 17:59 Lee Duncan [this message]
2015-09-06 17:59 ` [PATCH 1/6] Add ida helper routines Lee Duncan
2015-09-06 17:59 ` [PATCH 2/6] SCSI: Update sd driver to use new ida helper functions Lee Duncan
2015-09-06 17:59 ` [PATCH 3/6] Update soc " Lee Duncan
2015-09-08 16:01 ` Lee Duncan
2015-09-06 17:59 ` [PATCH 4/6] " Lee Duncan
2015-09-06 17:59 ` [PATCH 5/6] Update nvme-core " Lee Duncan
2015-09-06 17:59 ` [PATCH 6/6] Update rsxx core " Lee Duncan
2015-09-14 11:11 ` [PATCH 0/6] Create ida helpers and use them Johannes Thumshirn
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=cover.1441416571.git.lduncan@suse.com \
--to=lduncan@suse.com \
--cc=JBottomley@Parallels.com \
--cc=hare@suse.com \
--cc=hch@infradead.org \
--cc=jthumshirn@suse.de \
--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;
as well as URLs for NNTP newsgroup(s).