linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: "Nicholas A. Bellinger" <nab@daterainc.com>,
	target-devel <target-devel@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	Sagi Grimberg <sagig@mellanox.com>,
	Andy Grover <agrover@redhat.com>
Subject: Re: [RFC 00/22] target: se_node_acl LUN list RCU conversion
Date: Thu, 2 Apr 2015 01:56:07 -0700	[thread overview]
Message-ID: <20150402085607.GA31017@infradead.org> (raw)
In-Reply-To: <1427953047.9176.292.camel@haakon3.risingtidesystems.com>

On Wed, Apr 01, 2015 at 10:37:27PM -0700, Nicholas A. Bellinger wrote:
> On Wed, 2015-04-01 at 00:04 -0700, Christoph Hellwig wrote:
> > On Tue, Mar 31, 2015 at 11:51:56PM -0700, Nicholas A. Bellinger wrote:
> > > Since last week, enable/disable device_list code has been converted to
> > > use mempool + call_rcu() and performs the RCU pointer swap in
> > > se_node_acl->lun_entry_hlist[] under se_node_acl->lun_entry_mutex.
> > 
> > Why use a mempool there?
> 
> Would be nice to guarantee a certain number of new se_dev_entry
> allocations always succeed as existing code expects.

mempools are for I/O path that make guaranteed progress.  While the
callers of core_enable_device_list_for_node are in the control path,
and not in a very deep callstack, fairly shallow below the configfs
interface.  This is not a use case for mempools, as there is no need
to guarantee progress in deep I/O callstacks.

> The use of t10_pr_registration->pr_reg_deve is still wrong though, as
> it's held for the lifetime of the pr_reg, and not just while
> pr_ref_count is non zero for REGISTER w/ I_PORT + REGISTER_AND_MOVE
> special cases.

Seems like we should just take the reference properly.

> I've already fixed this for v2 by using se_dev_entry->pr_reg for
> signaling when a PR registration is active.

At least in the version you posted ->pr_reg is just used as a boolean
flag, in which case we might want to keep the real def_pr_registered
flag.

> > The refcount is still there in the good old atomic_t-based version,
> > which is perfectl fine for the PRIN and PROUT subcommands which aren't
> > the I/O fast path.
> 
> Agreed the percpu_ref is overkill and percpu_ref_init() is problematic
> because it can still -ENOMEM during se_dev_entry creation..
> 
> Switching to a normal kref with a blocking completion probably makes the
> most sense, in order to avoid potentially spinning on atomic_read() if
> APTPL metadata write-out ends up blocking during the two special PR
> cases.

The nice part about using the dynamically allocated dev entry is that
the shutdown path doesn't need to be sync.  You can just use a normal
kref and don't care when it actually gets freed.  One thing I didn't
do in my branch but which would e useful is to rename -> pr_ref
to just ->ref as it's a generic refcount - for now it's only used by
the PR code, but there is nothing specific to it in there.

  reply	other threads:[~2015-04-02  8:56 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  8:04 [RFC 00/22] target: se_node_acl LUN list RCU conversion Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 01/22] target: Convert transport_lookup_*_lun to RCU reader Nicholas A. Bellinger
2015-03-29  6:38   ` Sagi Grimberg
2015-03-27  8:04 ` [RFC 02/22] target: Convert enable/disable ->device_list to RCU updater Nicholas A. Bellinger
2015-03-29  6:51   ` Sagi Grimberg
2015-03-27  8:04 ` [RFC 03/22] target/device: Convert se_node_acl->device_list access to RCU reader Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 04/22] target/configfs: Convert mappedlun link/unlink " Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 05/22] target/configfs: Convert SCSI MIB attrs " Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 06/22] target/spc: Convert REPORT_LUN + MODE_SENSE " Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 07/22] target/pscsi: Convert MODE_SENSE special case " Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 08/22] target/pr: Convert se_dev_entry to percpu-refcount for RCU Nicholas A. Bellinger
2015-03-27  8:04 ` [RFC 09/22] target/pr: Convert registration check to RCU pointer Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 10/22] target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 11/22] target: Convert UNIT_ATTENTION logic to RCU reader Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 12/22] target: Convert se_tpg->tpg_lun_lock to ->tpg_lun_mutex Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 13/22] target: Convert se_tpg->acl_node_lock to ->acl_node_mutex Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 14/22] target: Convert se_node_acl->lun_entry_lock to ->lun_entry_mutex Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 15/22] target: Convert core_tpg_deregister to use list splice Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 16/22] target: Drop se_lun->lun_acl_list Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 17/22] target: Drop core_tpg_clear_object_luns Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 18/22] target: Rename TPG initiator_node_acl to target_* prefix Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 19/22] target: Rename TPG register/deregister " Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 20/22] target: Rename LUN lookup/add/remove " Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 21/22] target: Rename se_node_acl->lun_entry_hlist " Nicholas A. Bellinger
2015-03-27  8:05 ` [RFC 22/22] target: Rename se_port/se_device export " Nicholas A. Bellinger
2015-03-30 12:08 ` [RFC 00/22] target: se_node_acl LUN list RCU conversion Christoph Hellwig
2015-03-30 19:16   ` Andy Grover
2015-03-30 19:21     ` Christoph Hellwig
2015-03-30 19:35       ` Andy Grover
2015-03-31  9:23         ` Christoph Hellwig
2015-04-01  6:51   ` Nicholas A. Bellinger
2015-04-01  7:04     ` Christoph Hellwig
2015-04-02  5:37       ` Nicholas A. Bellinger
2015-04-02  8:56         ` Christoph Hellwig [this message]
2015-04-02 20:57           ` Nicholas A. Bellinger
2015-04-07  6:17             ` Christoph Hellwig
2015-04-08  6:31               ` Nicholas A. Bellinger

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=20150402085607.GA31017@infradead.org \
    --to=hch@infradead.org \
    --cc=agrover@redhat.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@daterainc.com \
    --cc=nab@linux-iscsi.org \
    --cc=sagig@mellanox.com \
    --cc=target-devel@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).