public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Hannes Reinecke <hare@suse.de>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	Boaz Harrosh <bharrosh@panasas.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Douglas Gilbert <dgilbert@interlog.com>
Subject: Re: [RFC-v2 02/12] iscsi-target: Add primary iSCSI request/response state machine logic
Date: Tue, 15 Mar 2011 15:46:10 -0700	[thread overview]
Message-ID: <1300229170.28255.304.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20110315101500.GA23623@lst.de>

On Tue, 2011-03-15 at 11:15 +0100, Christoph Hellwig wrote:
> On Mon, Mar 14, 2011 at 05:17:12PM -0700, Nicholas A. Bellinger wrote:
> > > > +#include <linux/version.h>
> > > > +#include <generated/utsrelease.h>
> > > > +#include <linux/utsname.h>
> > > 
> > > You keep including these headers a lot, and I still don't understand why.  Even
> > > if we need to expose data from it it should be done once in the core and not
> > > all over the code.
> > > 
> > 
> > OK, moved into a single iscsi_target_core.h include.
> 
> That's not what I meant.
> 
>  - for linux/version.h:
> 
> 	neither LINUX_VERSION_CODE nor KERNEL_VERSION is used anywhere in
> 	the target code, so it can't possibly required at all.
> 

OK, dropped.

>  - for linux/utsname.h and <generated/utsrelease.h>:
> 
> 	please either remove the attributes printing this information
> 	into common code.  or better off just remove it all all.  You can
> 	get the kernel version and release from the utsname system call,
> 	there is absolutely no need to duplicate it in a different attribute in
> 	every target frontend.

Ok, sorry, I see what you mean wrt to UTS_RELEASE and dropping this
usage and generated/utsrelease.h include.

> 	Also printing it during initialization is completely pointless, too.
> 

the 'vX.Y.Z on Linux/$ARCH' in the version string has been around for a
looong time, but I don't mind dropping it all together for the handful
of informational cases here.

> > > > +void core_put_tiqn_for_login(struct iscsi_tiqn *tiqn)
> > > > +{
> > > > +	spin_lock(&tiqn->tiqn_state_lock);
> > > > +	atomic_dec(&tiqn->tiqn_access_count);
> > > > +	spin_unlock(&tiqn->tiqn_state_lock);
> > > > +	return;
> > > 
> > > no need for the return here.  Also what's the point of making tiqn_access_count
> > > if you take a spinlock around all it's modifications?
> > > 
> > 
> > Removed the unnecessary return here..  I was behind paranoid here..
> 
> Also please make tiqn_access_count a normal integer type, it is always
> protected by tiqn_state_lock.
> 

Done.

> > Indeed..  Ok, I am going to go ahead an rename everything using core_ to
> > iscsi_
> 
> Looks like none of the initiator code currently uses iscsi_, but I'd still
> feel better about iscsit_ to make sure we're not conflicting with other
> initiator side code.
> 

Ok, will use this for the core_ prefixed bits..

> > > Can't you just use the core idr code for generating indices?
> > > 
> > 
> > Mmmm, not sure what you mean here..
> 
> Take a look at include/linux/idr.h.
> 

Thanks, looking at the code now.

> Note that the uses for np_index, tpg_np_index and conn_index can be
> removed entirely as they are unused.
> 

Done

> > Ok, there are a quite a few struct semaphores that need to be converted
> > into a struct mutex or struct completion..  I will get all of these
> > converted over..
> 
> or sometimes spinlocks.  Or often removed at all, as they just implement weird
> semantics for the threads - no need to have startup/shutdown synchronization
> as the kthread semantics are synchronous, and for a wakeup after queueing
> up work a simple wake_up_process on the task_struct pointer is enough.
> 

Ok, I will get this cleaned up for the NP login thread and TX conn
thread cases first and find+locate the issue mentioned above for the RX
case using kthread_stop()

> If you have question on how to avoid certain uses feel free to ask.
> 

<nod>

> > 
> > Ok, this is where I have previously run into some issues after doing a
> > kthread conversion for the RX/TX pairs using sock_recvmsg() some time a
> > while back.  That said, I will go ahead will get the ulgiest pieces for
> > the NP thread converted first and then have another look where the RX
> > path code was (I think) having an issue to successfully perform iSCSI
> > Logout Request -> Response processing..
> 
> Note that you might get away with less copies using the sk_data_ready,
> sk_state_change callbacks and tcp_read_sock() and totally dropping the
> traditional recvmsg path.  As this remove the blocking behaviour it
> will as a side effect also remove any issues with thread startup/stop.
> 
> Take a look at drivers/scsi/iscsi_tcp.c for an implementation.
> 

<nod>, I am well aware of ->sk_data_ready() for directly accessing
struct sk_buff memory for the RX side case, and currently consider this
a future optimiziation item.

> > > > +#define CONN(cmd)		((struct iscsi_conn *)(cmd)->conn)
> > > > +#define CONN_OPS(conn)		((struct iscsi_conn_ops *)(conn)->conn_ops)
> > > 
> > > There really shouldn't be any need for these macros.
> > > 
> > > 
> > > > +#define SESS(conn)		((struct iscsi_session *)(conn)->sess)
> > > > +#define SESS_OPS(sess)		((struct iscsi_sess_ops *)(sess)->sess_ops)
> > > > +#define SESS_OPS_C(conn)	((struct iscsi_sess_ops *)(conn)->sess->sess_ops)
> > > > +#define SESS_NODE_ACL(sess)	((struct se_node_acl *)(sess)->se_sess->se_node_acl)
> > > 
> > > Same here.
> > > 
> > 
> > Ok, I will drop the unnecessary casts here, and I will look at thinning
> > -> removing these out these handful of macros.
> 
> It's not just the casts - macros just for dereferencing a field just obsfucate
> the code.
> 

Yep, will get them cleaned up as the larger items are addressed.

Thanks Christoph!

--nab


  reply	other threads:[~2011-03-15 22:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 11:56 [RFC-v2 00/12] iSCSI target v4.1.0-rc1 series for .39 Nicholas A. Bellinger
2011-03-14 11:56 ` [RFC-v2 01/12] iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi Nicholas A. Bellinger
2011-03-14 14:59   ` Christoph Hellwig
2011-03-14 21:40     ` Nicholas A. Bellinger
     [not found]       ` <1300138856.28255.133.camel-Y1+j5t8j3WgjMeEPmliV8E/sVC8ogwMJ@public.gmane.org>
2011-03-14 22:13         ` Mike Christie
2011-03-14 23:52           ` Nicholas A. Bellinger
2011-03-14 11:56 ` [RFC-v2 02/12] iscsi-target: Add primary iSCSI request/response state machine logic Nicholas A. Bellinger
2011-03-14 15:33   ` Christoph Hellwig
2011-03-15  0:17     ` Nicholas A. Bellinger
2011-03-15 10:15       ` Christoph Hellwig
2011-03-15 22:46         ` Nicholas A. Bellinger [this message]
2011-03-14 11:57 ` [RFC-v2 03/12] iscsi-target: Add TCM v4 compatiable ConfigFS control plane Nicholas A. Bellinger
2011-03-15  0:54   ` Jesper Juhl
2011-03-15  4:47     ` Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 04/12] iscsi-target: Add configfs fabric dependent statistics Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 05/12] iscsi-target: Add TPG and Device logic Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 06/12] iscsi-target: Add iSCSI Login Negotiation and Parameter logic Nicholas A. Bellinger
2011-03-15 10:21   ` Christoph Hellwig
2011-03-15 22:55     ` Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 07/12] iscsi-target: Add CHAP Authentication support using libcrypto Nicholas A. Bellinger
2011-03-15 10:24   ` Christoph Hellwig
2011-03-15 22:56     ` Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 08/12] iscsi-target: Add Sequence/PDU list + DataIN response logic Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 09/12] iscsi-target: Add iSCSI Error Recovery Hierarchy support Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 10/12] iscsi-target: Add support for task management operations Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 11/12] iscsi-target: Add misc utility and debug logic Nicholas A. Bellinger
2011-03-15 10:27   ` Christoph Hellwig
2011-03-15 22:59     ` Nicholas A. Bellinger
2011-03-14 11:57 ` [RFC-v2 12/12] iscsi-target: Add Makefile/Kconfig and update TCM top level Nicholas A. Bellinger
2011-03-15  1:03   ` Jesper Juhl
2011-03-15  4:52     ` 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=1300229170.28255.304.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bharrosh@panasas.com \
    --cc=dgilbert@interlog.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=sfr@canb.auug.org.au \
    /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