Re: [PATCH-v2 0/9] target: se_node_acl + se_lun RCU conversions
On 05/22/2015 08:11 AM, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > Hi all, > > Here is -v2 series for converting LIO target se_node_acl + se_lun > mapping tables from fixed size arrays to dynamic RCU hlist_heads. > > This turns fast-path I/O into a lock-less RCU reader using existing > percpu based se_lun->lun_ref logic, and converts the RCU updater > path to allow for an arbitrary number of LUNs for both types of > mappings within target-core. > > This series also squashes a number of previous se_node_acl RCU > related changes into a single commit (#1) for easier review, > and to avoid potential bisect issues. > > There have been a number of changes since -v1, including: > > - Mirror port->sep_rtpi in lun->lun_rtpi for RCU > - Drop unnecessary synchronize_rcu() usage > - Convert call_rcu() to kfree_rcu() usage > - Move hlist_del_rcu head of rcu_assign_pointer in se_dev_entry > - Drop unnecessary lookup deve in target_fabric_mappedlun_unlink() > - Add target_lun_is_rdonly helper > - Acquire lun_entry_mutex during core_disable_device_list_for_node > - Drop TRANSPORT_LUNFLAGS_*_ACCESS usage > - Pass se_dev_entry directly to core_disable_device_list_for_node > - Convert sbp-target se_lun usage to use ->login_lun > - Fix se_session dereference in spc_emulate_report_luns > - Fix testing for NULL instead of IS_ERR in fabric_make_lun() > - Convert BUG_ON to EINVAL for wrong dynamic -> explicit ACL conversion > - Add missing hlist_del_rcu when swapping orig with new > - Add HBA_FLAGS_INTERNAL_USE checks in add/remove lun > > Please review. > Very nice. Reviewed-by: Hannes Reinecke Although it would be _perfect_ if you could move to full 64-bit LUNs; now that the LUN array is gone there is no need to have a limitation on the number of LUNs, and we can trivially support 64-bit LUNs ... But then, I can easily send a patch once this one is in. Cheers, Hannes -- Dr. Hannes ReineckezSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH-v2 0/9] target: se_node_acl + se_lun RCU conversions
From: Nicholas Bellinger Hi all, Here is -v2 series for converting LIO target se_node_acl + se_lun mapping tables from fixed size arrays to dynamic RCU hlist_heads. This turns fast-path I/O into a lock-less RCU reader using existing percpu based se_lun->lun_ref logic, and converts the RCU updater path to allow for an arbitrary number of LUNs for both types of mappings within target-core. This series also squashes a number of previous se_node_acl RCU related changes into a single commit (#1) for easier review, and to avoid potential bisect issues. There have been a number of changes since -v1, including: - Mirror port->sep_rtpi in lun->lun_rtpi for RCU - Drop unnecessary synchronize_rcu() usage - Convert call_rcu() to kfree_rcu() usage - Move hlist_del_rcu head of rcu_assign_pointer in se_dev_entry - Drop unnecessary lookup deve in target_fabric_mappedlun_unlink() - Add target_lun_is_rdonly helper - Acquire lun_entry_mutex during core_disable_device_list_for_node - Drop TRANSPORT_LUNFLAGS_*_ACCESS usage - Pass se_dev_entry directly to core_disable_device_list_for_node - Convert sbp-target se_lun usage to use ->login_lun - Fix se_session dereference in spc_emulate_report_luns - Fix testing for NULL instead of IS_ERR in fabric_make_lun() - Convert BUG_ON to EINVAL for wrong dynamic -> explicit ACL conversion - Add missing hlist_del_rcu when swapping orig with new - Add HBA_FLAGS_INTERNAL_USE checks in add/remove lun Please review. --nab Christoph Hellwig (1): target/pr: cleanup core_scsi3_pr_seq_non_holder Nicholas Bellinger (8): target: Convert se_node_acl->device_list[] to RCU hlist target/pr: Use atomic bitop for se_dev_entry->pr_reg reservation check target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun target: Convert se_portal_group->tpg_lun_list[] to RCU hlist target: Convert se_tpg->acl_node_lock to ->acl_node_mutex target: Convert core_tpg_deregister to use list splice target: Drop unused se_lun->lun_acl_list target: Only reset specific dynamic entries during lun_group creation drivers/target/iscsi/iscsi_target_tpg.c | 2 - drivers/target/sbp/sbp_target.c | 97 +++--- drivers/target/sbp/sbp_target.h | 2 +- drivers/target/target_core_configfs.c| 6 +- drivers/target/target_core_device.c | 452 +++ drivers/target/target_core_fabric_configfs.c | 75 +++-- drivers/target/target_core_internal.h| 17 +- drivers/target/target_core_pr.c | 217 +++-- drivers/target/target_core_pscsi.c | 7 +- drivers/target/target_core_spc.c | 18 +- drivers/target/target_core_stat.c| 180 +-- drivers/target/target_core_tpg.c | 269 drivers/target/target_core_transport.c | 20 +- drivers/target/target_core_ua.c | 51 ++- drivers/target/tcm_fc/tfc_conf.c | 4 +- drivers/xen/xen-scsiback.c | 27 +- include/target/target_core_backend.h | 2 +- include/target/target_core_base.h| 38 +-- include/target/target_core_fabric.h | 1 - 19 files changed, 634 insertions(+), 851 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH-v2 2/9] target/pr: Use atomic bitop for se_dev_entry->pr_reg reservation check
From: Nicholas Bellinger This patch converts the core_scsi3_pr_seq_non_holder() check for non reservation holding registrations to use an atomic bitop. It also includes associated set_bit() in __core_scsi3_add_registration() and clear_bit() __core_scsi3_free_registration() for the updater path. Reported-by: Christoph Hellwig Cc: Hannes Reinecke Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c | 1 + drivers/target/target_core_pr.c | 57 - include/target/target_core_base.h | 4 +-- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index cfe5cd3..6432d26 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -405,6 +405,7 @@ void core_disable_device_list_for_node( core_scsi3_ua_release_all(orig); hlist_del_rcu(&orig->link); + clear_bit(1, &orig->pr_reg); rcu_assign_pointer(orig->se_lun, NULL); rcu_assign_pointer(orig->se_lun_acl, NULL); orig->lun_flags = 0; diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index c0b593a..d29b39c 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -327,9 +327,13 @@ static int core_scsi3_pr_seq_non_holder( int we = 0; /* Write Exclusive */ int legacy = 0; /* Act like a legacy device and return * RESERVATION CONFLICT on some CDBs */ + bool registered = false; rcu_read_lock(); se_deve = target_nacl_find_deve(nacl, cmd->orig_fe_lun); + if (se_deve) + registered = test_bit(1, &se_deve->pr_reg); + rcu_read_unlock(); /* * Determine if the registration should be ignored due to * non-matching ISIDs in target_scsi3_pr_reservation_check(). @@ -346,7 +350,7 @@ static int core_scsi3_pr_seq_non_holder( * Some commands are only allowed for the persistent reservation * holder. */ - if ((se_deve->def_pr_registered) && !(ignore_reg)) + if ((registered) && !(ignore_reg)) registered_nexus = 1; break; case PR_TYPE_WRITE_EXCLUSIVE_REGONLY: @@ -356,7 +360,7 @@ static int core_scsi3_pr_seq_non_holder( * Some commands are only allowed for registered I_T Nexuses. */ reg_only = 1; - if ((se_deve->def_pr_registered) && !(ignore_reg)) + if ((registered) && !(ignore_reg)) registered_nexus = 1; break; case PR_TYPE_WRITE_EXCLUSIVE_ALLREG: @@ -366,14 +370,12 @@ static int core_scsi3_pr_seq_non_holder( * Each registered I_T Nexus is a reservation holder. */ all_reg = 1; - if ((se_deve->def_pr_registered) && !(ignore_reg)) + if ((registered) && !(ignore_reg)) registered_nexus = 1; break; default: - rcu_read_unlock(); return -EINVAL; } - rcu_read_unlock(); /* * Referenced from spc4r17 table 45 for *NON* PR holder access */ @@ -1009,10 +1011,6 @@ static void __core_scsi3_dump_registration( pr_reg->pr_reg_aptpl); } -/* - * this function can be called with struct se_device->dev_reservation_lock - * when register_move = 1 - */ static void __core_scsi3_add_registration( struct se_device *dev, struct se_node_acl *nacl, @@ -1023,6 +1021,7 @@ static void __core_scsi3_add_registration( const struct target_core_fabric_ops *tfo = nacl->se_tpg->se_tpg_tfo; struct t10_pr_registration *pr_reg_tmp, *pr_reg_tmp_safe; struct t10_reservation *pr_tmpl = &dev->t10_pr; + struct se_dev_entry *deve; /* * Increment PRgeneration counter for struct se_device upon a successful @@ -1039,10 +1038,16 @@ static void __core_scsi3_add_registration( spin_lock(&pr_tmpl->registration_lock); list_add_tail(&pr_reg->pr_reg_list, &pr_tmpl->registration_list); - pr_reg->pr_reg_deve->def_pr_registered = 1; __core_scsi3_dump_registration(tfo, dev, nacl, pr_reg, register_type); spin_unlock(&pr_tmpl->registration_lock); + + mutex_lock(&nacl->lun_entry_mutex); + deve = target_nacl_find_deve(nacl, pr_reg->pr_res_mapped_lun); + if (deve) + set_bit(1, &deve->pr_reg); + mutex_unlock(&nacl->lun_entry_mutex); + /* * Skip extra processing for ALL_TG_PT=0 or REGISTER_AND_MOVE. */ @@ -1054,6 +1059,8 @@ static void __core_scsi3_add_registration( */ list_for_each_entry_safe(pr_reg_tmp, pr_reg_tmp_safe, &pr_reg->pr_reg_atp_list, pr_reg_atp_mem_list) { +
[PATCH-v2 5/9] target: Convert se_portal_group->tpg_lun_list[] to RCU hlist
From: Nicholas Bellinger This patch converts the fixed size se_portal_group->tpg_lun_list[] to use modern RCU with hlist_head in order to support an arbitary number of se_lun ports per target endpoint. It includes dropping core_tpg_alloc_lun() from core_dev_add_lun(), and calling it directly from target_fabric_make_lun() to allocate a new se_lun. Also add a new target_fabric_port_release() configfs item callback to invoke kfree_rcu() to release memory during se_lun->lun_group shutdown. Also now that se_node_acl->lun_entry_hlist is using RCU, convert existing tpg_lun_lock to struct mutex so core_tpg_add_node_to_devs() can perform RCU updater logic without releasing ->tpg_lun_mutex. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Paul E. McKenney Cc: Chris Boot Signed-off-by: Nicholas Bellinger --- drivers/target/iscsi/iscsi_target_tpg.c | 2 - drivers/target/sbp/sbp_target.c | 97 +--- drivers/target/sbp/sbp_target.h | 2 +- drivers/target/target_core_device.c | 92 ++- drivers/target/target_core_fabric_configfs.c | 34 --- drivers/target/target_core_internal.h| 6 +- drivers/target/target_core_tpg.c | 132 ++- drivers/xen/xen-scsiback.c | 27 +++--- include/target/target_core_base.h| 6 +- include/target/target_core_fabric.h | 1 - 10 files changed, 122 insertions(+), 277 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 3af76e3..86f888e 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c @@ -281,8 +281,6 @@ int iscsit_tpg_del_portal_group( return -EPERM; } - core_tpg_clear_object_luns(&tpg->tpg_se_tpg); - if (tpg->param_list) { iscsi_release_param_list(tpg->param_list); tpg->param_list = NULL; diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 5d7755e..47fb12f 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -108,13 +108,13 @@ static struct sbp_session *sbp_session_find_by_guid( } static struct sbp_login_descriptor *sbp_login_find_by_lun( - struct sbp_session *session, struct se_lun *lun) + struct sbp_session *session, u32 unpacked_lun) { struct sbp_login_descriptor *login, *found = NULL; spin_lock_bh(&session->lock); list_for_each_entry(login, &session->login_list, link) { - if (login->lun == lun) + if (login->login_lun == unpacked_lun) found = login; } spin_unlock_bh(&session->lock); @@ -124,7 +124,7 @@ static struct sbp_login_descriptor *sbp_login_find_by_lun( static int sbp_login_count_all_by_lun( struct sbp_tpg *tpg, - struct se_lun *lun, + u32 unpacked_lun, int exclusive) { struct se_session *se_sess; @@ -138,7 +138,7 @@ static int sbp_login_count_all_by_lun( spin_lock_bh(&sess->lock); list_for_each_entry(login, &sess->login_list, link) { - if (login->lun != lun) + if (login->login_lun != unpacked_lun) continue; if (!exclusive || login->exclusive) @@ -174,23 +174,23 @@ static struct sbp_login_descriptor *sbp_login_find_by_id( return found; } -static struct se_lun *sbp_get_lun_from_tpg(struct sbp_tpg *tpg, int lun) +static u32 sbp_get_lun_from_tpg(struct sbp_tpg *tpg, u32 login_lun, int *err) { struct se_portal_group *se_tpg = &tpg->se_tpg; struct se_lun *se_lun; - if (lun >= TRANSPORT_MAX_LUNS_PER_TPG) - return ERR_PTR(-EINVAL); - - spin_lock(&se_tpg->tpg_lun_lock); - se_lun = se_tpg->tpg_lun_list[lun]; - - if (se_lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) - se_lun = ERR_PTR(-ENODEV); - - spin_unlock(&se_tpg->tpg_lun_lock); + rcu_read_lock(); + hlist_for_each_entry_rcu(se_lun, &se_tpg->tpg_lun_hlist, link) { + if (se_lun->unpacked_lun == login_lun) { + rcu_read_unlock(); + *err = 0; + return login_lun; + } + } + rcu_read_unlock(); - return se_lun; + *err = -ENODEV; + return login_lun; } static struct sbp_session *sbp_session_create( @@ -294,17 +294,16 @@ static void sbp_management_request_login( { struct sbp_tport *tport = agent->tport; struct sbp_tpg *tpg = tport->tpg; - struct se_lun *se_lun; - int ret; - u64 guid; struct sbp_session *sess; struct sbp_login_descriptor *login; struct sbp_login_response_block *response; - int l
[PATCH-v2 1/9] target: Convert se_node_acl->device_list[] to RCU hlist
From: Nicholas Bellinger This patch converts se_node_acl->device_list[] table for mappedluns to modern RCU hlist_head usage in order to support an arbitrary number of node_acl lun mappings. It converts transport_lookup_*_lun() fast-path code to use RCU read path primitives when looking up se_dev_entry. It adds a new hlist_head at se_node_acl->lun_entry_hlist for this purpose. For transport_lookup_cmd_lun() code, it works with existing per-cpu se_lun->lun_ref when associating se_cmd with se_lun + se_device. Also, go ahead and update core_create_device_list_for_node() + core_free_device_list_for_node() to use ->lun_entry_hlist. It also converts se_dev_entry->pr_ref_count access to use modern struct kref counting, and updates core_disable_device_list_for_node() to kref_put() and block on se_deve->pr_comp waiting for outstanding PR references to drop. So now that se_node_acl->lun_entry_hlist fast path access uses RCU protected pointers, go ahead and convert remaining non-fast path RCU updater code using ->lun_entry_lock to struct mutex to allow callers to block while walking se_node_acl->lun_entry_hlist. Finally drop the left-over core_clear_initiator_node_from_tpg() that originally cleared lun_access during se_node_acl shutdown, as post RCU conversion it now becomes duplicated logic. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Paul E. McKenney Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c | 326 +-- drivers/target/target_core_fabric_configfs.c | 43 ++-- drivers/target/target_core_internal.h| 8 +- drivers/target/target_core_pr.c | 79 --- drivers/target/target_core_pscsi.c | 7 +- drivers/target/target_core_spc.c | 18 +- drivers/target/target_core_stat.c| 180 +++ drivers/target/target_core_tpg.c | 75 +- drivers/target/target_core_ua.c | 51 +++-- include/target/target_core_backend.h | 2 +- include/target/target_core_base.h| 19 +- 11 files changed, 386 insertions(+), 422 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 6e58976..cfe5cd3 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -59,17 +59,16 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) { struct se_lun *se_lun = NULL; struct se_session *se_sess = se_cmd->se_sess; + struct se_node_acl *nacl = se_sess->se_node_acl; struct se_device *dev; - unsigned long flags; + struct se_dev_entry *deve; if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) return TCM_NON_EXISTENT_LUN; - spin_lock_irqsave(&se_sess->se_node_acl->device_list_lock, flags); - se_cmd->se_deve = se_sess->se_node_acl->device_list[unpacked_lun]; - if (se_cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) { - struct se_dev_entry *deve = se_cmd->se_deve; - + rcu_read_lock(); + deve = target_nacl_find_deve(nacl, unpacked_lun); + if (deve) { deve->total_cmds++; if ((se_cmd->data_direction == DMA_TO_DEVICE) && @@ -78,7 +77,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) " Access for 0x%08x\n", se_cmd->se_tfo->get_fabric_name(), unpacked_lun); - spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); + rcu_read_unlock(); return TCM_WRITE_PROTECTED; } @@ -96,7 +95,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) percpu_ref_get(&se_lun->lun_ref); se_cmd->lun_ref_active = true; } - spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); + rcu_read_unlock(); if (!se_lun) { /* @@ -146,24 +145,23 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun) struct se_dev_entry *deve; struct se_lun *se_lun = NULL; struct se_session *se_sess = se_cmd->se_sess; + struct se_node_acl *nacl = se_sess->se_node_acl; struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; unsigned long flags; if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) return -ENODEV; - spin_lock_irqsave(&se_sess->se_node_acl->device_list_lock, flags); - se_cmd->se_deve = se_sess->se_node_acl->device_list[unpacked_lun]; - deve = se_cmd->se_deve; - - if (deve->lun_flags & TRANSPORT_LUNFLAGS_INITIATOR_ACCESS) { + rcu_read_lock(); + deve = target_nacl_find_deve(nacl, unpacked_lun); + if (deve) { se_tmr->tmr_lun = deve->se_lun; se_cmd->se_lun = deve->se_l
[PATCH-v2 7/9] target: Convert core_tpg_deregister to use list splice
From: Nicholas Bellinger This patch converts core_tpg_deregister() to perform a list splice for any remaining dynamically generated se_node_acls attached to se_tpg, before calling kfree(nacl) to free memory. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_tpg.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 229e827..e7745d2 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -547,6 +547,7 @@ int core_tpg_deregister(struct se_portal_group *se_tpg) { const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo; struct se_node_acl *nacl, *nacl_tmp; + LIST_HEAD(node_list); pr_debug("TARGET_CORE[%s]: Deallocating portal_group for endpoint: %s, " "Proto: %d, Portal Tag: %u\n", tfo->get_fabric_name(), @@ -560,25 +561,22 @@ int core_tpg_deregister(struct se_portal_group *se_tpg) while (atomic_read(&se_tpg->tpg_pr_ref_count) != 0) cpu_relax(); + mutex_lock(&se_tpg->acl_node_mutex); + list_splice_init(&se_tpg->acl_node_list, &node_list); + mutex_unlock(&se_tpg->acl_node_mutex); /* * Release any remaining demo-mode generated se_node_acl that have * not been released because of TFO->tpg_check_demo_mode_cache() == 1 * in transport_deregister_session(). */ - mutex_lock(&se_tpg->acl_node_mutex); - list_for_each_entry_safe(nacl, nacl_tmp, &se_tpg->acl_node_list, - acl_list) { + list_for_each_entry_safe(nacl, nacl_tmp, &node_list, acl_list) { list_del(&nacl->acl_list); se_tpg->num_node_acls--; - mutex_unlock(&se_tpg->acl_node_mutex); core_tpg_wait_for_nacl_pr_ref(nacl); core_free_device_list_for_node(nacl, se_tpg); kfree(nacl); - - mutex_lock(&se_tpg->acl_node_mutex); } - mutex_unlock(&se_tpg->acl_node_mutex); if (se_tpg->proto_id >= 0) core_tpg_remove_lun(se_tpg, &se_tpg->tpg_virt_lun0); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH-v2 3/9] target/pr: Change alloc_registration to avoid pr_reg_tg_pt_lun
From: Nicholas Bellinger This patch changes __core_scsi3_do_alloc_registration() code to drop pr_reg->pr_reg_tg_pt_lun pointer usage in favor of a new pr_reg RPTI + existing target_lun. It also includes changes to REGISTER, REGISTER_AND_MOVE and APTPL feature bit codepaths. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_configfs.c | 6 +- drivers/target/target_core_pr.c | 110 +++--- include/target/target_core_base.h | 4 +- 3 files changed, 53 insertions(+), 67 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 2768221..67d6d5f 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -817,7 +817,6 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_holder_tg_port( struct se_device *dev, char *page) { struct se_node_acl *se_nacl; - struct se_lun *lun; struct se_portal_group *se_tpg; struct t10_pr_registration *pr_reg; const struct target_core_fabric_ops *tfo; @@ -832,7 +831,6 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_holder_tg_port( se_nacl = pr_reg->pr_reg_nacl; se_tpg = se_nacl->se_tpg; - lun = pr_reg->pr_reg_tg_pt_lun; tfo = se_tpg->se_tpg_tfo; len += sprintf(page+len, "SPC-3 Reservation: %s" @@ -840,9 +838,9 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_holder_tg_port( tfo->tpg_get_wwn(se_tpg)); len += sprintf(page+len, "SPC-3 Reservation: Relative Port" " Identifier Tag: %hu %s Portal Group Tag: %hu" - " %s Logical Unit: %u\n", lun->lun_sep->sep_rtpi, + " %s Logical Unit: %u\n", pr_reg->tg_pt_sep_rtpi, tfo->get_fabric_name(), tfo->tpg_get_tag(se_tpg), - tfo->get_fabric_name(), lun->unpacked_lun); + tfo->get_fabric_name(), pr_reg->pr_aptpl_target_lun); out_unlock: spin_unlock(&dev->dev_reservation_lock); diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index d29b39c..94a136f 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -44,11 +44,10 @@ * Used for Specify Initiator Ports Capable Bit (SPEC_I_PT) */ struct pr_transport_id_holder { - int dest_local_nexus; struct t10_pr_registration *dest_pr_reg; struct se_portal_group *dest_tpg; struct se_node_acl *dest_node_acl; - struct se_dev_entry __rcu *dest_se_deve; + struct se_dev_entry *dest_se_deve; struct list_head dest_list; }; @@ -625,7 +624,9 @@ static u32 core_scsi3_pr_generation(struct se_device *dev) static struct t10_pr_registration *__core_scsi3_do_alloc_registration( struct se_device *dev, struct se_node_acl *nacl, + struct se_lun *lun, struct se_dev_entry *deve, + u32 mapped_lun, unsigned char *isid, u64 sa_res_key, int all_tg_pt, @@ -647,12 +648,12 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration( atomic_set(&pr_reg->pr_res_holders, 0); pr_reg->pr_reg_nacl = nacl; pr_reg->pr_reg_deve = deve; - pr_reg->pr_res_mapped_lun = deve->mapped_lun; - pr_reg->pr_aptpl_target_lun = deve->se_lun->unpacked_lun; + pr_reg->pr_res_mapped_lun = mapped_lun; + pr_reg->pr_aptpl_target_lun = lun->unpacked_lun; + pr_reg->tg_pt_sep_rtpi = lun->lun_sep->sep_rtpi; pr_reg->pr_res_key = sa_res_key; pr_reg->pr_reg_all_tg_pt = all_tg_pt; pr_reg->pr_reg_aptpl = aptpl; - pr_reg->pr_reg_tg_pt_lun = deve->se_lun; /* * If an ISID value for this SCSI Initiator Port exists, * save it to the registration now. @@ -676,7 +677,9 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *); static struct t10_pr_registration *__core_scsi3_alloc_registration( struct se_device *dev, struct se_node_acl *nacl, + struct se_lun *lun, struct se_dev_entry *deve, + u32 mapped_lun, unsigned char *isid, u64 sa_res_key, int all_tg_pt, @@ -692,8 +695,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration( * Create a registration for the I_T Nexus upon which the * PROUT REGISTER was received. */ - pr_reg = __core_scsi3_do_alloc_registration(dev, nacl, deve, isid, - sa_res_key, all_tg_pt, aptpl); + pr_reg = __core_scsi3_do_alloc_registration(dev, nacl, lun, deve, mapped_lun, + isid, sa_res_key, all_tg_pt, + aptpl); if (!pr_reg) return NULL; /* @@ -765,8 +769,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
[PATCH-v2 6/9] target: Convert se_tpg->acl_node_lock to ->acl_node_mutex
From: Nicholas Bellinger This patch converts se_tpg->acl_node_lock to struct mutex, so that ->acl_node_acl walkers in core_clear_lun_from_tpg() can block when calling core_disable_device_list_for_node(). It also updates core_dev_add_lun() to hold ->acl_node_mutex when calling core_tpg_add_node_to_devs() to build ->lun_entry_hlist for dynamically generated se_node_acl. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c| 14 -- drivers/target/target_core_pr.c| 8 +++--- drivers/target/target_core_tpg.c | 51 +- drivers/target/target_core_transport.c | 20 ++--- drivers/target/tcm_fc/tfc_conf.c | 4 +-- include/target/target_core_base.h | 2 +- 6 files changed, 48 insertions(+), 51 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 5b74c33..99a60e6 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -433,9 +433,8 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg) struct se_node_acl *nacl; struct se_dev_entry *deve; - spin_lock_irq(&tpg->acl_node_lock); + mutex_lock(&tpg->acl_node_mutex); list_for_each_entry(nacl, &tpg->acl_node_list, acl_list) { - spin_unlock_irq(&tpg->acl_node_lock); mutex_lock(&nacl->lun_entry_mutex); hlist_for_each_entry_rcu(deve, &nacl->lun_entry_hlist, link) { @@ -445,10 +444,8 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg) core_disable_device_list_for_node(lun, deve, nacl, tpg); } mutex_unlock(&nacl->lun_entry_mutex); - - spin_lock_irq(&tpg->acl_node_lock); } - spin_unlock_irq(&tpg->acl_node_lock); + mutex_unlock(&tpg->acl_node_mutex); } static struct se_port *core_alloc_port(struct se_device *dev) @@ -1183,17 +1180,16 @@ int core_dev_add_lun( */ if (tpg->se_tpg_tfo->tpg_check_demo_mode(tpg)) { struct se_node_acl *acl; - spin_lock_irq(&tpg->acl_node_lock); + + mutex_lock(&tpg->acl_node_mutex); list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { if (acl->dynamic_node_acl && (!tpg->se_tpg_tfo->tpg_check_demo_mode_login_only || !tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg))) { - spin_unlock_irq(&tpg->acl_node_lock); core_tpg_add_node_to_devs(acl, tpg); - spin_lock_irq(&tpg->acl_node_lock); } } - spin_unlock_irq(&tpg->acl_node_lock); + mutex_unlock(&tpg->acl_node_mutex); } return 0; diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 36bcc60..cee2b31 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -1582,12 +1582,12 @@ core_scsi3_decode_spec_i_port( * from the decoded fabric module specific TransportID * at *i_str. */ - spin_lock_irq(&tmp_tpg->acl_node_lock); + mutex_lock(&tmp_tpg->acl_node_mutex); dest_node_acl = __core_tpg_get_initiator_node_acl( tmp_tpg, i_str); if (dest_node_acl) atomic_inc_mb(&dest_node_acl->acl_pr_ref_count); - spin_unlock_irq(&tmp_tpg->acl_node_lock); + mutex_unlock(&tmp_tpg->acl_node_mutex); if (!dest_node_acl) { core_scsi3_tpg_undepend_item(tmp_tpg); @@ -3298,12 +3298,12 @@ after_iport_check: /* * Locate the destination struct se_node_acl from the received Transport ID */ - spin_lock_irq(&dest_se_tpg->acl_node_lock); + mutex_lock(&dest_se_tpg->acl_node_mutex); dest_node_acl = __core_tpg_get_initiator_node_acl(dest_se_tpg, initiator_str); if (dest_node_acl) atomic_inc_mb(&dest_node_acl->acl_pr_ref_count); - spin_unlock_irq(&dest_se_tpg->acl_node_lock); + mutex_unlock(&dest_se_tpg->acl_node_mutex); if (!dest_node_acl) { pr_err("Unable to locate %s dest_node_acl for" diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 13d34e2..229e827 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -49,7 +49,7 @@ static LIST_HEAD(tpg_list); /* __core_tpg_get_initiator_node_acl(): * - * spin_lock_bh
[PATCH-v2 8/9] target: Drop unused se_lun->lun_acl_list
From: Nicholas Bellinger Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c | 15 --- drivers/target/target_core_tpg.c| 4 include/target/target_core_base.h | 3 --- 3 files changed, 22 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 99a60e6..7674c8f 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -1232,7 +1232,6 @@ struct se_lun_acl *core_dev_init_initiator_node_lun_acl( return NULL; } - INIT_LIST_HEAD(&lacl->lacl_list); lacl->mapped_lun = mapped_lun; lacl->se_lun_nacl = nacl; snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s", @@ -1262,11 +1261,6 @@ int core_dev_add_initiator_node_lun_acl( lun_access, nacl, tpg) < 0) return -EINVAL; - spin_lock(&lun->lun_acl_lock); - list_add_tail(&lacl->lacl_list, &lun->lun_acl_list); - atomic_inc_mb(&lun->lun_acl_count); - spin_unlock(&lun->lun_acl_lock); - pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " " InitiatorNode: %s\n", tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun, lacl->mapped_lun, @@ -1293,19 +1287,12 @@ int core_dev_del_initiator_node_lun_acl( if (!nacl) return -EINVAL; - spin_lock(&lun->lun_acl_lock); - list_del(&lacl->lacl_list); - atomic_dec_mb(&lun->lun_acl_count); - spin_unlock(&lun->lun_acl_lock); - mutex_lock(&nacl->lun_entry_mutex); deve = target_nacl_find_deve(nacl, lacl->mapped_lun); if (deve) core_disable_device_list_for_node(lun, deve, nacl, tpg); mutex_unlock(&nacl->lun_entry_mutex); - lacl->se_lun = NULL; - pr_debug("%s_TPG[%hu]_LUN[%u] - Removed ACL for" " InitiatorNode: %s Mapped LUN: %u\n", tpg->se_tpg_tfo->get_fabric_name(), @@ -1435,8 +1422,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) xcopy_lun = &dev->xcopy_lun; xcopy_lun->lun_se_dev = dev; init_completion(&xcopy_lun->lun_shutdown_comp); - INIT_LIST_HEAD(&xcopy_lun->lun_acl_list); - spin_lock_init(&xcopy_lun->lun_acl_lock); spin_lock_init(&xcopy_lun->lun_sep_lock); init_completion(&xcopy_lun->lun_ref_comp); diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index e7745d2..73c25bd 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -495,8 +495,6 @@ static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg) lun->lun_status = TRANSPORT_LUN_STATUS_FREE; atomic_set(&lun->lun_acl_count, 0); init_completion(&lun->lun_shutdown_comp); - INIT_LIST_HEAD(&lun->lun_acl_list); - spin_lock_init(&lun->lun_acl_lock); spin_lock_init(&lun->lun_sep_lock); init_completion(&lun->lun_ref_comp); @@ -610,8 +608,6 @@ struct se_lun *core_tpg_alloc_lun( lun->lun_status = TRANSPORT_LUN_STATUS_FREE; atomic_set(&lun->lun_acl_count, 0); init_completion(&lun->lun_shutdown_comp); - INIT_LIST_HEAD(&lun->lun_acl_list); - spin_lock_init(&lun->lun_acl_lock); spin_lock_init(&lun->lun_sep_lock); init_completion(&lun->lun_ref_comp); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index f6cf401..25d5ebe 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -632,7 +632,6 @@ struct se_lun_acl { u32 mapped_lun; struct se_node_acl *se_lun_nacl; struct se_lun *se_lun; - struct list_headlacl_list; struct config_group se_lun_group; struct se_ml_stat_grps ml_stat_grps; }; @@ -714,10 +713,8 @@ struct se_lun { u32 lun_flags; u32 unpacked_lun; atomic_tlun_acl_count; - spinlock_t lun_acl_lock; spinlock_t lun_sep_lock; struct completion lun_shutdown_comp; - struct list_headlun_acl_list; struct se_device*lun_se_dev; struct se_port *lun_sep; struct config_group lun_group; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH-v2 4/9] target/pr: cleanup core_scsi3_pr_seq_non_holder
From: Christoph Hellwig Clean up the mess of registered variables, and pass the isid mismatch flag explicitly instead of overloading the registration type. Signed-off-by: Christoph Hellwig Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_pr.c | 43 - 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 94a136f..36bcc60 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -312,34 +312,30 @@ out: * This function is called by those initiator ports who are *NOT* * the active PR reservation holder when a reservation is present. */ -static int core_scsi3_pr_seq_non_holder( - struct se_cmd *cmd, - u32 pr_reg_type) +static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type, + bool isid_mismatch) { unsigned char *cdb = cmd->t_task_cdb; - struct se_dev_entry *se_deve; struct se_session *se_sess = cmd->se_sess; struct se_node_acl *nacl = se_sess->se_node_acl; - int other_cdb = 0, ignore_reg; + int other_cdb = 0; int registered_nexus = 0, ret = 1; /* Conflict by default */ int all_reg = 0, reg_only = 0; /* ALL_REG, REG_ONLY */ int we = 0; /* Write Exclusive */ int legacy = 0; /* Act like a legacy device and return * RESERVATION CONFLICT on some CDBs */ - bool registered = false; - rcu_read_lock(); - se_deve = target_nacl_find_deve(nacl, cmd->orig_fe_lun); - if (se_deve) - registered = test_bit(1, &se_deve->pr_reg); - rcu_read_unlock(); - /* -* Determine if the registration should be ignored due to -* non-matching ISIDs in target_scsi3_pr_reservation_check(). -*/ - ignore_reg = (pr_reg_type & 0x8000); - if (ignore_reg) - pr_reg_type &= ~0x8000; + if (isid_mismatch) { + registered_nexus = 0; + } else { + struct se_dev_entry *se_deve; + + rcu_read_lock(); + se_deve = target_nacl_find_deve(nacl, cmd->orig_fe_lun); + if (se_deve) + registered_nexus = test_bit(1, &se_deve->pr_reg); + rcu_read_unlock(); + } switch (pr_reg_type) { case PR_TYPE_WRITE_EXCLUSIVE: @@ -349,8 +345,6 @@ static int core_scsi3_pr_seq_non_holder( * Some commands are only allowed for the persistent reservation * holder. */ - if ((registered) && !(ignore_reg)) - registered_nexus = 1; break; case PR_TYPE_WRITE_EXCLUSIVE_REGONLY: we = 1; @@ -359,8 +353,6 @@ static int core_scsi3_pr_seq_non_holder( * Some commands are only allowed for registered I_T Nexuses. */ reg_only = 1; - if ((registered) && !(ignore_reg)) - registered_nexus = 1; break; case PR_TYPE_WRITE_EXCLUSIVE_ALLREG: we = 1; @@ -369,8 +361,6 @@ static int core_scsi3_pr_seq_non_holder( * Each registered I_T Nexus is a reservation holder. */ all_reg = 1; - if ((registered) && !(ignore_reg)) - registered_nexus = 1; break; default: return -EINVAL; @@ -576,6 +566,7 @@ target_scsi3_pr_reservation_check(struct se_cmd *cmd) struct se_device *dev = cmd->se_dev; struct se_session *sess = cmd->se_sess; u32 pr_reg_type; + bool isid_mismatch = false; if (!dev->dev_pr_res_holder) return 0; @@ -588,7 +579,7 @@ target_scsi3_pr_reservation_check(struct se_cmd *cmd) if (dev->dev_pr_res_holder->isid_present_at_reg) { if (dev->dev_pr_res_holder->pr_reg_bin_isid != sess->sess_bin_isid) { - pr_reg_type |= 0x8000; + isid_mismatch = true; goto check_nonholder; } } @@ -596,7 +587,7 @@ target_scsi3_pr_reservation_check(struct se_cmd *cmd) return 0; check_nonholder: - if (core_scsi3_pr_seq_non_holder(cmd, pr_reg_type)) + if (core_scsi3_pr_seq_non_holder(cmd, pr_reg_type, isid_mismatch)) return TCM_RESERVATION_CONFLICT; return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH-v2 9/9] target: Only reset specific dynamic entries during lun_group creation
From: Nicholas Bellinger This patch changes core_tpg_add_node_to_devs() to avoid unnecessarly resetting every se_dev_entry in se_node_acl->tpg_lun_hlist when the operation is driven by an explicit configfs se_lun->lun_group creation via core_dev_add_lun() to only update a single se_lun. Otherwise for the second core_tpg_check_initiator_node_acl() case, go ahead and continue to scan the full set of currently active se_lun in se_portal_group->tpg_lun_hlist. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c | 2 +- drivers/target/target_core_internal.h | 3 ++- drivers/target/target_core_tpg.c | 7 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7674c8f..c80a7a8 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -1186,7 +1186,7 @@ int core_dev_add_lun( if (acl->dynamic_node_acl && (!tpg->se_tpg_tfo->tpg_check_demo_mode_login_only || !tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg))) { - core_tpg_add_node_to_devs(acl, tpg); + core_tpg_add_node_to_devs(acl, tpg, lun); } } mutex_unlock(&tpg->acl_node_mutex); diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 2c160ce..ce80ca7 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -64,7 +64,8 @@ extern struct se_device *g_lun0_dev; struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, const char *); -void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *); +void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *, + struct se_lun *); void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); struct se_lun *core_tpg_alloc_lun(struct se_portal_group *, u32); intcore_tpg_add_lun(struct se_portal_group *, struct se_lun *, diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 73c25bd..f66c208 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -89,7 +89,8 @@ EXPORT_SYMBOL(core_tpg_get_initiator_node_acl); */ void core_tpg_add_node_to_devs( struct se_node_acl *acl, - struct se_portal_group *tpg) + struct se_portal_group *tpg, + struct se_lun *lun_orig) { u32 lun_access = 0; struct se_lun *lun; @@ -99,6 +100,8 @@ void core_tpg_add_node_to_devs( hlist_for_each_entry_rcu(lun, &tpg->tpg_lun_hlist, link) { if (lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) continue; + if (lun_orig && lun != lun_orig) + continue; dev = lun->lun_se_dev; /* @@ -238,7 +241,7 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( */ if ((tpg->se_tpg_tfo->tpg_check_demo_mode_login_only == NULL) || (tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg) != 1)) - core_tpg_add_node_to_devs(acl, tpg); + core_tpg_add_node_to_devs(acl, tpg, NULL); target_add_node_acl(acl); return acl; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re
Dear Friend, You might be letter bite apprehensive because you do not know me, I am Mrs. Horniakova Bozena a bank officer with the international bank of Taipei (Taiwan) I need your partnership in reprofilling funds I will need your reply so that I can send you more details as soon as possible. Regards Mrs. Horniakova Bozena -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] cxlflash: Base support for IBM CXL Flash Adapter
> >> +#define CXLFLASH_MAX_CMDS 16 > >> +#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS > >> + > >> +#define NOT_POW2(_x) ((_x) & ((_x) & ((_x) - 1))) > > > > include/linux/log2 has is_power_of_2() > > > > This is used for compile-time enforcement. The items in the log2 header are > runtime > functions. Will add a comment for clarity. OK. > >> +#if NOT_POW2(CXLFLASH_NUM_CMDS) > >> +#error "CXLFLASH_NUM_CMDS is not a power of 2!" > >> +#endif > >> + > >> +#define CMD_BUFSIZE PAGE_SIZE_4K > > > > Does this mean we can't compile with 64K pages? How is this related to > > PAGES? > > > > No, 64K pages are fully supported. We are simply borrowing the 4K page > #define as > the size of the AFU's command buffer is 4096 bytes. Will add a comment for > clarity. OK, I'd just put 4096 there. > >> + > >> +struct cxlflash { > > > > I really don't like this name. What does this struct actually represent? > > Is > > it just some table, info, queue? Calling it just "cxlflash" doesn't give > > the > > reader any idea what it is. Plus it makes it really hard to search for > > since > > "cxlflash" is being used a lot in this driver for other stuff and you often > > do > > struct cxlflash *cxlflash; > > > > If you used something like > > struct cxlflash_desc {}; > > struct cxlflash_desc *desc; > > I could search for desc and find all the uses. > > > > Sounds reasonable. This is our per-device handle. How about the name > struct cxlflash_cfg and we locally call the variable 'cfg'? Sounds good! > > >> > >> + > >> + struct pci_pool *cxlflash_cmd_pool; > >> + struct pci_dev *parent_dev; > >> + > >> + int num_user_contexts; > > > > You init this to 0 but never use it. > > > >> + struct ctx_info *ctx_info[MAX_CONTEXT]; > >> + struct file_operations cxl_fops; > > > > This is unused in this patch. > > > > These are used in other areas of the driver not included in this patch. Will > look > at not including them in the next patch with updates based on feedback. Ideally this next patch would add these. > >> + char *buf; /* per command buffer */ > >> + struct afu *back; > > > > Can we call this parent, rather than back? > > > > Sure. > > >> + int slot; > >> + atomic_t free; > > > > Looks like you're just doing ref counting with this so it should probably > > be a > > struct kref. > > > > We'll leave this as an atomic for now to support our round-robin allocation. > > >> + u8 special:1; > >> + u8 internal:1; > >> + u8 sync:1; > >> + > >> +} __aligned(cache_line_size()); > > > > Why is this cacheline aigned? > > The IOASA and IOARCB sit at the top of this structure. We keep this aligned on > a cacheline so that these two sit in the same cacheline for better > performance. Great... document this here. > >> + while (dec--) { > >> + k = (afu->cmd_couts++ & (CXLFLASH_NUM_CMDS - 1)); > >> + > >> + cmd = &afu->cmd[k]; > >> + > >> + if (!atomic_dec_if_positive(&cmd->free)) { > > > > I guess this is ok with only 32 commands but it's a linear search. I would > > be > > nice to use a standard allocator here instead. I think you could use ida > > for > > this and remove the need for cmd->free. Probably not a bit issue though. > > We're going to continue to use this simple round-robin search. The command > pool > is larger than the hardware queue depth and therefore we should rarely hit a > case > where we're looping more than a time or two here to find a free command. OK. Just looked like you were reinventing something that should already be available. > > >> + > >> + spin_lock_irqsave(&cmd->slock, lock_flags); > >> + cmd->sa.host_use_b[0] |= B_DONE; > >> + spin_unlock_irqrestore(&cmd->slock, lock_flags); > > > > Who else are you locking against here? Just yourself? In other places you > > just stick 0 here. What happens if you race with that? > > > > If you're just racing with yourself, does that mean this code can be called > > simultaneously? If so, is the rest of this code save? cmd->rcb.scp doesn't > > seem to be locked below. > > > > We have removed this locking. It was left over from when we used to have > other writer threads and more bits. Great > > >> > >> + > >> + while (cxlflash->tmf_active) > >> + wait_event(cxlflash->tmf_wait_q, !cxlflash->tmf_active); > > > > This doesn't look right. Why not just wait_event()? > > > > Same in other places. > > > > Fixed. Great > >> > >> + cxlflash->afu = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, > >> + get_order(sizeof(struct afu))); > > > > Any reason not to use kmalloc here? How big is struct afu? > > The AFU is roughly 12K. We allocate on a page to satisfy alignment > requirements > for substructures located at the top of the AFU. We have added a comment to > clarify the size and use. Thanks. > >> > >> + if (afu->room == 0) { > >> + do { > >> +
Re: [PATCH 1/1] cxlflash: Base support for IBM CXL Flash Adapter
Mikey, Thanks for reviewing this patch. Responses are inline below. -matt On May 20, 2015, at 12:51 AM, Michael Neuling wrote: > Does this driver work when compiled big endian? We haven't tested on big endian but agree that the code should support both little and big endian. >> >> +#define CXLFLASH_MAX_CMDS 16 >> +#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS >> + >> +#define NOT_POW2(_x) ((_x) & ((_x) & ((_x) - 1))) > > include/linux/log2 has is_power_of_2() > This is used for compile-time enforcement. The items in the log2 header are runtime functions. Will add a comment for clarity. >> +#if NOT_POW2(CXLFLASH_NUM_CMDS) >> +#error "CXLFLASH_NUM_CMDS is not a power of 2!" >> +#endif >> + >> +#define CMD_BUFSIZE PAGE_SIZE_4K > > Does this mean we can't compile with 64K pages? How is this related to PAGES? > No, 64K pages are fully supported. We are simply borrowing the 4K page #define as the size of the AFU's command buffer is 4096 bytes. Will add a comment for clarity. >> +#define CONFN(_s) "%s: "_s"\n" >> +#define cxlflash_err(_s, ...) pr_err(CONFN(_s), __func__, >> ##__VA_ARGS__) >> +#define cxlflash_warn(_s, ...) pr_warn(CONFN(_s), __func__, >> ##__VA_ARGS__) >> +#define cxlflash_info(_s, ...) pr_info(CONFN(_s), __func__, >> ##__VA_ARGS__) >> +#define cxlflash_dbg(_s, ...) pr_debug(CONFN(_s), __func__, >> ##__VA_ARGS__) > > Please don't redefine these. Just makes it less readable for others. > Okay. >> +#define cxlflash_dev_dbg(_d, _s, ...) \ >> +dev_dbg(_d, CONFN(_s), __func__, ##__VA_ARGS__) >> + > > Same here... Okay. >> >> +u32 padding; >> +struct cxl_context *ctx; >> +struct list_head luns; /* LUNs attached to this context */ >> +}; > > Might be nice to pack these to ensure there is no holes. I'm not sure that's > the case currently. We'll look into this. > >> + >> +struct cxlflash { > > I really don't like this name. What does this struct actually represent? Is > it just some table, info, queue? Calling it just "cxlflash" doesn't give the > reader any idea what it is. Plus it makes it really hard to search for since > "cxlflash" is being used a lot in this driver for other stuff and you often do > struct cxlflash *cxlflash; > > If you used something like > struct cxlflash_desc {}; > struct cxlflash_desc *desc; > I could search for desc and find all the uses. > Sounds reasonable. This is our per-device handle. How about the name struct cxlflash_cfg and we locally call the variable 'cfg'? >> >> + >> +struct pci_pool *cxlflash_cmd_pool; >> +struct pci_dev *parent_dev; >> + >> +int num_user_contexts; > > You init this to 0 but never use it. > >> +struct ctx_info *ctx_info[MAX_CONTEXT]; >> +struct file_operations cxl_fops; > > This is unused in this patch. > These are used in other areas of the driver not included in this patch. Will look at not including them in the next patch with updates based on feedback. >> +char *buf; /* per command buffer */ >> +struct afu *back; > > Can we call this parent, rather than back? > Sure. >> +int slot; >> +atomic_t free; > > Looks like you're just doing ref counting with this so it should probably be a > struct kref. > We'll leave this as an atomic for now to support our round-robin allocation. >> +u8 special:1; >> +u8 internal:1; >> +u8 sync:1; >> + >> +} __aligned(cache_line_size()); > > Why is this cacheline aigned? The IOASA and IOARCB sit at the top of this structure. We keep this aligned on a cacheline so that these two sit in the same cacheline for better performance. >> +/* Housekeeping data */ >> +struct mutex afu_mutex; /* for anything that needs serialization > > This is never used > >> + e. g. to access afu */ >> +struct mutex err_mutex; /* for signalling error thread */ > > This is never used > Will remove these with other unused fields. >> + >> +struct cxlflash *back; /* Pointer back to parent cxlflash */ > > Can we just call this parent? Sure. > >> + >> +} __aligned(PAGE_SIZE_4K); > > Why 4K aligned? What has this got to do with page size? We have removed this. >> +while (dec--) { >> +k = (afu->cmd_couts++ & (CXLFLASH_NUM_CMDS - 1)); >> + >> +cmd = &afu->cmd[k]; >> + >> +if (!atomic_dec_if_positive(&cmd->free)) { > > I guess this is ok with only 32 commands but it's a linear search. I would be > nice to use a standard allocator here instead. I think you could use ida for > this and remove the need for cmd->free. Probably not a bit issue though. We're going to continue to use this simple round-robin search. The command pool is larger than the hardware queue depth and therefore we should rarely hit a case where we're looping more than a time or two here to find a free command. >> + >> +spin_lock_irqsave(&cmd->slock, lock_flags); >> +
[PATCH for-next] scsi: qla2xxx: Hide unavailable firmware
Some qla2xxx devices have firmware stored in flash on the device, however for debugging and triage purposes, Qlogic staff like to be able to load known-good versions of these firmwares through request_firmware(). These firmware files were never distributed and are unlikely to ever be released publically, so to hide these missing firmware files from scripts which check such things, (e.g. Debian's initramfs-tools) put them behind a new EXPERT Kconfig option. Cc: Cc: James E.J. Bottomley Cc: Linux Firmware Maintainers Signed-off-by: Julian Calaby --- drivers/scsi/qla2xxx/Kconfig | 25 + drivers/scsi/qla2xxx/qla_os.c | 40 +++- 2 files changed, 52 insertions(+), 13 deletions(-) This is against linux-next @next-20150520 and has been compile tested only. diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index 33f60c9..31e9db4 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig @@ -31,6 +31,31 @@ config SCSI_QLA_FC They are also included in the linux-firmware tree as well. + This driver also supports some adapters with firmware stored + onboard in flash. + +config SCSI_QLA_FC_TRIAGE + bool "Firmware loading support for flash based adapters" + depends on SCSI_QLA_FC + depends on EXPERT + default n + ---help--- + Add firmware definitions for adapters with firmware stored + onboard in flash. + + This requires the following firmware files which are not + distributed: + + ISP Firmware Filename + --- + 81xx ql8100_fw.bin + 82xx ql8200_fw.bin + + This option should only be enabled by Qlogic support staff + as these firmware files are not available publically. + + If unsure say N. + config TCM_QLA2XXX tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" depends on SCSI_QLA_FC && TARGET_CORE diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7462dd7..da98d83 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5284,11 +5284,14 @@ qla2x00_timer(scsi_qla_host_t *vha) #define FW_ISP2322 3 #define FW_ISP24XX 4 #define FW_ISP25XX 5 -#define FW_ISP81XX 6 -#define FW_ISP82XX 7 -#define FW_ISP2031 8 -#define FW_ISP8031 9 -#define FW_ISP27XX 10 +#define FW_ISP2031 6 +#define FW_ISP8031 7 +#define FW_ISP27XX 8 + +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE +#define FW_ISP81XX 9 +#define FW_ISP82XX 10 +#endif #define FW_FILE_ISP21XX"ql2100_fw.bin" #define FW_FILE_ISP22XX"ql2200_fw.bin" @@ -5296,12 +5299,14 @@ qla2x00_timer(scsi_qla_host_t *vha) #define FW_FILE_ISP2322"ql2322_fw.bin" #define FW_FILE_ISP24XX"ql2400_fw.bin" #define FW_FILE_ISP25XX"ql2500_fw.bin" -#define FW_FILE_ISP81XX"ql8100_fw.bin" -#define FW_FILE_ISP82XX"ql8200_fw.bin" #define FW_FILE_ISP2031"ql2600_fw.bin" #define FW_FILE_ISP8031"ql8300_fw.bin" #define FW_FILE_ISP27XX"ql2700_fw.bin" +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE +#define FW_FILE_ISP81XX"ql8100_fw.bin" +#define FW_FILE_ISP82XX"ql8200_fw.bin" +#endif static DEFINE_MUTEX(qla_fw_lock); @@ -5312,11 +5317,13 @@ static struct fw_blob qla_fw_blobs[FW_BLOBS] = { { .name = FW_FILE_ISP2322, .segs = { 0x800, 0x1c000, 0x1e000, 0 }, }, { .name = FW_FILE_ISP24XX, }, { .name = FW_FILE_ISP25XX, }, - { .name = FW_FILE_ISP81XX, }, - { .name = FW_FILE_ISP82XX, }, { .name = FW_FILE_ISP2031, }, { .name = FW_FILE_ISP8031, }, { .name = FW_FILE_ISP27XX, }, +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE + { .name = FW_FILE_ISP81XX, }, + { .name = FW_FILE_ISP82XX, }, +#endif }; struct fw_blob * @@ -5337,16 +5344,18 @@ qla2x00_request_firmware(scsi_qla_host_t *vha) blob = &qla_fw_blobs[FW_ISP24XX]; } else if (IS_QLA25XX(ha)) { blob = &qla_fw_blobs[FW_ISP25XX]; - } else if (IS_QLA81XX(ha)) { - blob = &qla_fw_blobs[FW_ISP81XX]; - } else if (IS_QLA82XX(ha)) { - blob = &qla_fw_blobs[FW_ISP82XX]; } else if (IS_QLA2031(ha)) { blob = &qla_fw_blobs[FW_ISP2031]; } else if (IS_QLA8031(ha)) { blob = &qla_fw_blobs[FW_ISP8031]; } else if (IS_QLA27XX(ha)) { blob = &qla_fw_blobs[FW_ISP27XX]; +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE + } else if (IS_QLA81XX(ha)) { + blob = &qla_fw_blobs[FW_ISP81XX]; + } else if (IS_QLA82XX(ha)) { + blob = &qla_fw_blobs[FW_ISP82XX]; +#endif } else { return NULL; } @@ -5837,3 +5846,8 @@ MODULE_FIRMWARE(FW_FILE_ISP25XX); MODULE_FIRMWARE(FW_FILE_ISP2031); MODULE_FIRMWARE(FW_FILE_ISP8031);
Re: [PATCH for-next] scsi: qla2xxx: Hide unavailable firmware
Hi Xose, Adding you to CC. On Fri, May 22, 2015 at 10:00 AM, Julian Calaby wrote: > Some qla2xxx devices have firmware stored in flash on the device, > however for debugging and triage purposes, Qlogic staff like to > be able to load known-good versions of these firmwares through > request_firmware(). > > These firmware files were never distributed and are unlikely to ever > be released publically, so to hide these missing firmware files from > scripts which check such things, (e.g. Debian's initramfs-tools) put > them behind a new EXPERT Kconfig option. > > Cc: > Cc: James E.J. Bottomley > Cc: Linux Firmware Maintainers > Signed-off-by: Julian Calaby > --- > drivers/scsi/qla2xxx/Kconfig | 25 + > drivers/scsi/qla2xxx/qla_os.c | 40 +++- > 2 files changed, 52 insertions(+), 13 deletions(-) > > This is against linux-next @next-20150520 and has been compile > tested only. > > diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig > index 33f60c9..31e9db4 100644 > --- a/drivers/scsi/qla2xxx/Kconfig > +++ b/drivers/scsi/qla2xxx/Kconfig > @@ -31,6 +31,31 @@ config SCSI_QLA_FC > > They are also included in the linux-firmware tree as well. > > + This driver also supports some adapters with firmware stored > + onboard in flash. > + > +config SCSI_QLA_FC_TRIAGE > + bool "Firmware loading support for flash based adapters" > + depends on SCSI_QLA_FC > + depends on EXPERT > + default n > + ---help--- > + Add firmware definitions for adapters with firmware stored > + onboard in flash. > + > + This requires the following firmware files which are not > + distributed: > + > + ISP Firmware Filename > + --- > + 81xx ql8100_fw.bin > + 82xx ql8200_fw.bin > + > + This option should only be enabled by Qlogic support staff > + as these firmware files are not available publically. > + > + If unsure say N. > + > config TCM_QLA2XXX > tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target > mode HBAs" > depends on SCSI_QLA_FC && TARGET_CORE > diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c > index 7462dd7..da98d83 100644 > --- a/drivers/scsi/qla2xxx/qla_os.c > +++ b/drivers/scsi/qla2xxx/qla_os.c > @@ -5284,11 +5284,14 @@ qla2x00_timer(scsi_qla_host_t *vha) > #define FW_ISP2322 3 > #define FW_ISP24XX 4 > #define FW_ISP25XX 5 > -#define FW_ISP81XX 6 > -#define FW_ISP82XX 7 > -#define FW_ISP2031 8 > -#define FW_ISP8031 9 > -#define FW_ISP27XX 10 > +#define FW_ISP2031 6 > +#define FW_ISP8031 7 > +#define FW_ISP27XX 8 > + > +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE > +#define FW_ISP81XX 9 > +#define FW_ISP82XX 10 > +#endif > > #define FW_FILE_ISP21XX"ql2100_fw.bin" > #define FW_FILE_ISP22XX"ql2200_fw.bin" > @@ -5296,12 +5299,14 @@ qla2x00_timer(scsi_qla_host_t *vha) > #define FW_FILE_ISP2322"ql2322_fw.bin" > #define FW_FILE_ISP24XX"ql2400_fw.bin" > #define FW_FILE_ISP25XX"ql2500_fw.bin" > -#define FW_FILE_ISP81XX"ql8100_fw.bin" > -#define FW_FILE_ISP82XX"ql8200_fw.bin" > #define FW_FILE_ISP2031"ql2600_fw.bin" > #define FW_FILE_ISP8031"ql8300_fw.bin" > #define FW_FILE_ISP27XX"ql2700_fw.bin" > > +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE > +#define FW_FILE_ISP81XX"ql8100_fw.bin" > +#define FW_FILE_ISP82XX"ql8200_fw.bin" > +#endif > > static DEFINE_MUTEX(qla_fw_lock); > > @@ -5312,11 +5317,13 @@ static struct fw_blob qla_fw_blobs[FW_BLOBS] = { > { .name = FW_FILE_ISP2322, .segs = { 0x800, 0x1c000, 0x1e000, 0 }, }, > { .name = FW_FILE_ISP24XX, }, > { .name = FW_FILE_ISP25XX, }, > - { .name = FW_FILE_ISP81XX, }, > - { .name = FW_FILE_ISP82XX, }, > { .name = FW_FILE_ISP2031, }, > { .name = FW_FILE_ISP8031, }, > { .name = FW_FILE_ISP27XX, }, > +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE > + { .name = FW_FILE_ISP81XX, }, > + { .name = FW_FILE_ISP82XX, }, > +#endif > }; > > struct fw_blob * > @@ -5337,16 +5344,18 @@ qla2x00_request_firmware(scsi_qla_host_t *vha) > blob = &qla_fw_blobs[FW_ISP24XX]; > } else if (IS_QLA25XX(ha)) { > blob = &qla_fw_blobs[FW_ISP25XX]; > - } else if (IS_QLA81XX(ha)) { > - blob = &qla_fw_blobs[FW_ISP81XX]; > - } else if (IS_QLA82XX(ha)) { > - blob = &qla_fw_blobs[FW_ISP82XX]; > } else if (IS_QLA2031(ha)) { > blob = &qla_fw_blobs[FW_ISP2031]; > } else if (IS_QLA8031(ha)) { > blob = &qla_fw_blobs[FW_ISP8031]; > } else if (IS_QLA27XX(ha)) { > blob = &qla_fw_blobs[FW_ISP27XX]; > +#ifdef CONFIG_SCSI_QLA_FC_TRIAGE > + } else if (IS_QLA81XX(ha)
Re: [PATCH for-next] qla2xxx: delete references to unused firmware files
Hi All, On Thu, May 21, 2015 at 8:42 PM, Xose Vazquez Perez wrote: > On 05/19/2015 05:51 PM, Himanshu Madhani wrote: > >> On 5/18/15, 6:50 PM, "Julian Calaby" wrote: > >>> Do the devices these firmware files are for exist and is there any >>> chance of the files being released? >> >> Yes. These devices are available and we read firmware from FLASH on these >> adapters. >> At times when debugging/triaging involves firmware, we use binaries that >> would be useful for quick triaging. > > It looks like newer FW files were released on 4/29/2015 in: > http://ldriver.qlogic.com/firmware/rpms/qlogic-firmware-8.01.00-1.noarch.rpm > > ql2400_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2500_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2600_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2700_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql8300_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > > > Could you please send meaningful files to linux-firmware.git ? > And remove irrelevant code from qla_os.c/Kconfig Assuming that these files are actually sent to linux-firmware.git, the patch I just sent will hide the stuff for the missing firmware files behind a new Kconfig symbol, this way it's there for Qlogic, however hidden from people who don't have access to the files. Thanks, -- Julian Calaby Email: julian.cal...@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
iscsi flashnode bus? Re: [RFC PATCH 2/4] iscsi: sysfs filtering by network namespace
On Wed, May 13, 2015 at 03:12:45PM -0700, Chris Leech wrote: > This makes the iscsi_host, iscsi_session, iscsi_connection, and > iscsi_endpoint transport class devices only visible in sysfs under a > matching network namespace. The network namespace for all of these > objects is tracked in the iscsi_cls_host structure. I noticed that I didn't change iscsi_iface, but it should probably be handled the same was as iscsi_endpoint. I had intentionally skipped over all the flashnode stuff, until I had a chance to go back and take a closer look. Is there any particular reason why the flashnode support was implemented as a bus? Following the pattern of everything else in scsi_transport_iscsi it should probably have been two classes (iscsi_flash_session and iscsi_flash_conn). It's an issue as sysfs tagging only works on a per-class basis right now. I can see a couple of ways forward. 1) Extend sysfs tagging to work with device_type as well as class, and use that for the two types on the flashnode "bus" 2) Change the flashnode code to use classes instead of a bus. Keeping a single iscsi_flashnode class and continuing to use the two device_types for sessions and connections should result in the only visible change being /sys/bus/iscsi_flashnode moving to /sys/class/iscsi_flashnode. I prefer #2, but it looks like the open-iscsi tools would need to be updated (not all code paths follow the recommendations to ignore bus/class differences and check all subsystem locations). And I don't know for sure that there aren't any other tools using this interface (it's only implemented for qla4xxx). - Chris -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 0/4] Make iSCSI network namespace aware
On Wed, May 20, 2015 at 11:45:43AM -0700, Andy Grover wrote: > On 05/13/2015 03:12 PM, Chris Leech wrote: > >This is only about the structures and functionality involved in maintaining > >the > >iSCSI session, the SCSI host along with it's discovered targets and devices > >has > >no association with network namespaces. > > > >These patches are functional, but not complete. There's no isolation > >enforced > >in the kernel just yet, so it relies on well behaved userspace. I plan on > >fixing that, but wanted some feedback on the idea and approach so far. > > Seems like a good direction, to me. > > What would be the extent of the userspace (open-iscsi) changes needed to go > along with this? There's no core changes needed in the open-iscsi tools, it's more a matter of how iscsid is packaged and executed. The control socket between iscsid and iscsiadm binds to an abstract unix domain path, so that works fine as long as you run iscsiadm from within the same net ns as the iscsid instance you want to talk to. The pid file checks clash if /var/run is common between instances. Putting iscsid in a container could provide separate config files and configuration databases, but there may be something that could improve handling there. I've been testing using 'ip netns exec' to run iscsid in a new network namespace (it actually crates a new mount namespace as well, to remount /sys with the new namespace filtered view). My test setup so far has been the following: A VM with two virtio network interfaces on different virtual networks. I have an iSCSI target configured with two portals, one on each virtual network. I create two new network namespaces with 'ip netns add' and then move the nics into them with 'ip link netns ' and bring them online. Using 'ip netns exec' I start up an iscsid instance in each namespace, using the --foreground option to avoid the PID file clash. Form within each namespace I can run iscsiadm to manage sessions through one of the iscsid instances. With this setup they share the persistent configuration database, so I specifically select which records to start/stop. - Chris -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Proposal for annotating _unstable_ pages
On Thu 21-05-15 11:09:55, Kent Overstreet wrote: > On Thu, May 21, 2015 at 06:54:53PM +0200, Jan Kara wrote: > > On Wed 20-05-15 18:04:40, Kent Overstreet wrote: > > > > Yeah. I never figured out a sane way to migrate pages and keep > > > > everything > > > > else happy. Daniel Phillips is having a go at page forking for tux3; > > > > let's > > > > see if the questions about that get resolved. > > > > > > That would be great, we need something. > > > > > > I'd also be really curious what btrfs is doing today - is it just bouncing > > > everything internally, or did they come up with something more clever? > > > > Btrfs is just waiting for IO to complete. > > > > > > > Also, there's probably always going to be situations where we're > > > > > reading or > > > > > writing to pages user space can stomp on (dio) - IMO we need to add a > > > > > bio flag > > > > > to annotate this - "if you need this to be stable you have to bounce > > > > > it". > > > > > Otherwise either filesystems/block drivers are going to be stuck > > > > > bouncing > > > > > everything, or it'll just (continue to be) buggy. > > > > > > > > Well, for now there's BIO_SNAP_STABLE that forces the block layer to > > > > bounce it, > > > > but right now ext3 is the last user of it, and afaict btrfs is the only > > > > other > > > > FS that takes care of stable pages on its own. > > > > > > I have no idea what BIO_SNAP_STABLE was supposed to be for, but I don't > > > see how > > > it's useful for anything sane. > > > > It's for the case where lower layer requests it needs stable pages but > > upper layer isn't able to provide them (as is the case of ext3). Then block > > layer bounces the data for the caller. > > > > > But that's the complete opposite of the problem stable pages are supposed > > > to > > > solve: stable pages are for when the _lower_ layer (be it filesystem, > > > bcache, > > > md, lvm) needs the memory being either read to or written from (both, > > > it's not > > > just writes) to not be diddled over while the IO is in flight. > > > > > > Now, a point that I think has been missed is that stable pages are _not_ a > > > complete solution, at least for consumers in the block layer. > > > > > > The situation today is that if I'm in the block layer, and I get a handed > > > a read > > > or write bio, I _don't know_ if it's from something that's going to > > > diddle over > > > those pages or not. So if I require stable pages - be it for data > > > checksumming > > > or for other things - I've just got to bounce the bio myself. > > > > > > And then the really annoying thing is that if you've got stacked things > > > that all > > > need stable pages (maybe btrfs on top of bcache on top of md) - they > > > _all_ have > > > to assume the pages aren't going to be stable, so if they need them they > > > _all_ > > > have to bounce - even though once the first layer bounced the bio that > > > made it > > > stable for everything underneath it. > > > > The current design is that if you need stable pages for your device, set > > bdi capability BDI_CAP_STABLE_WRITES, fs then takes care of not scribbling > > over your page while it is under writeback or uses BIO_SNAP_STABLE if it > > cannot. > > But if I need stable pages, I still have to bounce because that _does not_ > guarantee stable pages, it only gives me stable pages for some of the IOs and > in > the lower layers you can't tell which is which. > > Do you see the problem? What good is BDI_CAP_STABLE_WRITES if it's not a > guarantee and I can't tell if I need to bounce or not? So fix the upper layers to make it a guarantee? You mentioned direct IO needs fixing. Anything else? Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Proposal for annotating _unstable_ pages
On Thu, May 21, 2015 at 06:54:53PM +0200, Jan Kara wrote: > On Wed 20-05-15 18:04:40, Kent Overstreet wrote: > > > Yeah. I never figured out a sane way to migrate pages and keep everything > > > else happy. Daniel Phillips is having a go at page forking for tux3; > > > let's > > > see if the questions about that get resolved. > > > > That would be great, we need something. > > > > I'd also be really curious what btrfs is doing today - is it just bouncing > > everything internally, or did they come up with something more clever? > > Btrfs is just waiting for IO to complete. > > > > > Also, there's probably always going to be situations where we're > > > > reading or > > > > writing to pages user space can stomp on (dio) - IMO we need to add a > > > > bio flag > > > > to annotate this - "if you need this to be stable you have to bounce > > > > it". > > > > Otherwise either filesystems/block drivers are going to be stuck > > > > bouncing > > > > everything, or it'll just (continue to be) buggy. > > > > > > Well, for now there's BIO_SNAP_STABLE that forces the block layer to > > > bounce it, > > > but right now ext3 is the last user of it, and afaict btrfs is the only > > > other > > > FS that takes care of stable pages on its own. > > > > I have no idea what BIO_SNAP_STABLE was supposed to be for, but I don't see > > how > > it's useful for anything sane. > > It's for the case where lower layer requests it needs stable pages but > upper layer isn't able to provide them (as is the case of ext3). Then block > layer bounces the data for the caller. > > > But that's the complete opposite of the problem stable pages are supposed to > > solve: stable pages are for when the _lower_ layer (be it filesystem, > > bcache, > > md, lvm) needs the memory being either read to or written from (both, it's > > not > > just writes) to not be diddled over while the IO is in flight. > > > > Now, a point that I think has been missed is that stable pages are _not_ a > > complete solution, at least for consumers in the block layer. > > > > The situation today is that if I'm in the block layer, and I get a handed a > > read > > or write bio, I _don't know_ if it's from something that's going to diddle > > over > > those pages or not. So if I require stable pages - be it for data > > checksumming > > or for other things - I've just got to bounce the bio myself. > > > > And then the really annoying thing is that if you've got stacked things > > that all > > need stable pages (maybe btrfs on top of bcache on top of md) - they _all_ > > have > > to assume the pages aren't going to be stable, so if they need them they > > _all_ > > have to bounce - even though once the first layer bounced the bio that made > > it > > stable for everything underneath it. > > The current design is that if you need stable pages for your device, set > bdi capability BDI_CAP_STABLE_WRITES, fs then takes care of not scribbling > over your page while it is under writeback or uses BIO_SNAP_STABLE if it > cannot. But if I need stable pages, I still have to bounce because that _does not_ guarantee stable pages, it only gives me stable pages for some of the IOs and in the lower layers you can't tell which is which. Do you see the problem? What good is BDI_CAP_STABLE_WRITES if it's not a guarantee and I can't tell if I need to bounce or not? -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] target: Convert se_node_acl->device_list[] to RCU hlist
On Thu, 2015-05-21 at 19:03 +0200, Christoph Hellwig wrote: > On Tue, May 19, 2015 at 08:22:31AM +0200, Christoph Hellwig wrote: > > On Mon, May 18, 2015 at 11:05:47PM -0700, Nicholas A. Bellinger wrote: > > > > [ 12.830576] kernel BUG at ../drivers/target/target_core_device.c:337! > > > > > > > > > > How did you hit this..? > > > > tcm_node --block iblock_0/array /dev/sda > > > > line=$(tcm_loop --createnexus=0) > > wwn=$(echo $line | awk '{print $15}') > > tcm_loop --addlun=$wwn 0 0 iblock_0/array > > And here is the fix. Seems like anything using dynamic node ACLs was > broken the same way (I could reproduce it with vhost as well). > > I don't really like how HBA_FLAGS_INTERNAL_USE means this is a virtual > lun0, so I'll send another patch to replace it with a per-device flag > eventually. > > --- > From 9fd0e75cffde876b84b08952cc7f026d4e08d77a Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Thu, 21 May 2015 18:58:21 +0200 > Subject: target: don't add lun0 to tpg_lun_hlist > > We never want to find the virtual lun0 when looking up a lun on the TPG, > otherwise the core code gets really confused. > > Signed-off-by: Christoph Hellwig > --- > drivers/target/target_core_tpg.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/target/target_core_tpg.c > b/drivers/target/target_core_tpg.c > index b8c2a32..ced1dd6 100644 > --- a/drivers/target/target_core_tpg.c > +++ b/drivers/target/target_core_tpg.c > @@ -647,7 +647,8 @@ int core_tpg_add_lun( > > lun->lun_access = lun_access; > lun->lun_status = TRANSPORT_LUN_STATUS_ACTIVE; > - hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); > + if (!(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) > + hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); > > mutex_unlock(&tpg->tpg_lun_mutex); > > @@ -687,7 +688,8 @@ void core_tpg_remove_lun( > } > > lun->lun_status = TRANSPORT_LUN_STATUS_FREE; > - hlist_del_rcu(&lun->link); > + if (!(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) > + hlist_del_rcu(&lun->link); > mutex_unlock(&tpg->tpg_lun_mutex); > > percpu_ref_exit(&lun->lun_ref); Applied to for-next, and will squash into the original series soon. --nab -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 09/15] lpfc: Fix to remove IRQF_SHARED flag for MSI/MSI-X vectors.
Fix to remove IRQF_SHARED flag for MSI/MSI-X vectors. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 15825f6..6ab8312 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -8369,7 +8369,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba) /* vector-0 is associated to slow-path handler */ rc = request_irq(phba->msix_entries[0].vector, -&lpfc_sli_sp_intr_handler, IRQF_SHARED, +&lpfc_sli_sp_intr_handler, 0, LPFC_SP_DRIVER_HANDLER_NAME, phba); if (rc) { lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, @@ -8380,7 +8380,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba) /* vector-1 is associated to fast-path handler */ rc = request_irq(phba->msix_entries[1].vector, -&lpfc_sli_fp_intr_handler, IRQF_SHARED, +&lpfc_sli_fp_intr_handler, 0, LPFC_FP_DRIVER_HANDLER_NAME, phba); if (rc) { @@ -8489,7 +8489,7 @@ lpfc_sli_enable_msi(struct lpfc_hba *phba) } rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, -IRQF_SHARED, LPFC_DRIVER_NAME, phba); +0, LPFC_DRIVER_NAME, phba); if (rc) { pci_disable_msi(phba->pcidev); lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, @@ -8946,13 +8946,13 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) if (phba->cfg_fof && (index == (vectors - 1))) rc = request_irq( phba->sli4_hba.msix_entries[index].vector, -&lpfc_sli4_fof_intr_handler, IRQF_SHARED, +&lpfc_sli4_fof_intr_handler, 0, (char *)&phba->sli4_hba.handler_name[index], &phba->sli4_hba.fcp_eq_hdl[index]); else rc = request_irq( phba->sli4_hba.msix_entries[index].vector, -&lpfc_sli4_hba_intr_handler, IRQF_SHARED, +&lpfc_sli4_hba_intr_handler, 0, (char *)&phba->sli4_hba.handler_name[index], &phba->sli4_hba.fcp_eq_hdl[index]); if (rc) { @@ -9052,7 +9052,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) } rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, -IRQF_SHARED, LPFC_DRIVER_NAME, phba); +0, LPFC_DRIVER_NAME, phba); if (rc) { pci_disable_msi(phba->pcidev); lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 05/15] lpfc: Fix ABORTs WQ selection in terminate_rport_io
Fix ABORTs WQ selection in terminate_rport_io Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_sli.c | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 56f7368..41d3370 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -8792,30 +8792,40 @@ lpfc_sli_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) return 0; } +/** + * lpfc_sli_calc_ring - Calculates which ring to use + * @phba: Pointer to HBA context object. + * @ring_number: Initial ring + * @piocb: Pointer to command iocb. + * + * For SLI4, FCP IO can deferred to one fo many WQs, based on + * fcp_wqidx, thus we need to calculate the corresponding ring. + * Since ABORTS must go on the same WQ of the command they are + * aborting, we use command's fcp_wqidx. + */ int lpfc_sli_calc_ring(struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb) { - uint32_t idx; - if (phba->sli_rev == LPFC_SLI_REV4) { if (piocb->iocb_flag & (LPFC_IO_FCP | LPFC_USE_FCPWQIDX)) { - /* -* fcp_wqidx should already be setup based on what -* completion queue we want to use. -*/ if (!(phba->cfg_fof) || (!(piocb->iocb_flag & LPFC_IO_FOF))) { if (unlikely(!phba->sli4_hba.fcp_wq)) return LPFC_HBA_ERROR; - idx = lpfc_sli4_scmd_to_wqidx_distr(phba); - piocb->fcp_wqidx = idx; - ring_number = MAX_SLI3_CONFIGURED_RINGS + idx; + /* +* for abort iocb fcp_wqidx should already +* be setup based on what work queue we used. +*/ + if (!(piocb->iocb_flag & LPFC_USE_FCPWQIDX)) + piocb->fcp_wqidx = + lpfc_sli4_scmd_to_wqidx_distr(phba); + ring_number = MAX_SLI3_CONFIGURED_RINGS + + piocb->fcp_wqidx; } else { if (unlikely(!phba->sli4_hba.oas_wq)) return LPFC_HBA_ERROR; - idx = 0; - piocb->fcp_wqidx = idx; + piocb->fcp_wqidx = 0; ring_number = LPFC_FCP_OAS_RING; } } -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 04/15] lpfc: Correct reference counting of rport
Correct reference counting of rport Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 72388a6..e93705d 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -161,7 +161,8 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) ndlp->rport = NULL; if (put_node) lpfc_nlp_put(ndlp); - put_device(&rport->dev); + if (put_rport) + put_device(&rport->dev); return; } -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/15] lpfc: Add support for RDP ELS command.
Add support for RDP ELS command. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_els.c | 420 ++ drivers/scsi/lpfc/lpfc_hw.h | 169 + drivers/scsi/lpfc/lpfc_hw4.h | 201 drivers/scsi/lpfc/lpfc_mbox.c | 152 +++ drivers/scsi/lpfc/lpfc_sli4.h | 10 + 7 files changed, 955 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 3246d09..a5a56fa 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -231,6 +231,7 @@ struct lpfc_stats { uint32_t elsRcvRTV; uint32_t elsRcvECHO; uint32_t elsRcvLCB; + uint32_t elsRcvRDP; uint32_t elsXmitFLOGI; uint32_t elsXmitFDISC; uint32_t elsXmitPLOGI; diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 587e3e9..b0e6fe4 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -498,3 +498,5 @@ bool lpfc_disable_oas_lun(struct lpfc_hba *, struct lpfc_name *, bool lpfc_find_next_oas_lun(struct lpfc_hba *, struct lpfc_name *, struct lpfc_name *, uint64_t *, struct lpfc_name *, struct lpfc_name *, uint64_t *, uint32_t *); +int lpfc_sli4_dump_page_a0(struct lpfc_hba *phba, struct lpfcMboxq *mbox); +void lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb); diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 3975276..724b61c 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -4615,6 +4615,422 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) return sentplogi; } +void +lpfc_rdp_res_link_service(struct fc_rdp_link_service_desc *desc, + uint32_t word0) +{ + + desc->tag = cpu_to_be32(RDP_LINK_SERVICE_DESC_TAG); + desc->payload.els_req = word0; + desc->length = cpu_to_be32(sizeof(desc->payload)); +} + +void +lpfc_rdp_res_sfp_desc(struct fc_rdp_sfp_desc *desc, + uint8_t *page_a0, uint8_t *page_a2) +{ + uint16_t wavelength; + uint16_t temperature; + uint16_t rx_power; + uint16_t tx_bias; + uint16_t tx_power; + uint16_t vcc; + uint16_t flag = 0; + struct sff_trasnceiver_codes_byte4 *trasn_code_byte4; + struct sff_trasnceiver_codes_byte5 *trasn_code_byte5; + + desc->tag = cpu_to_be32(RDP_SFP_DESC_TAG); + + trasn_code_byte4 = (struct sff_trasnceiver_codes_byte4 *) + &page_a0[SSF_TRANSCEIVER_CODE_B4]; + trasn_code_byte5 = (struct sff_trasnceiver_codes_byte5 *) + &page_a0[SSF_TRANSCEIVER_CODE_B5]; + + if ((trasn_code_byte4->fc_sw_laser) || + (trasn_code_byte5->fc_sw_laser_sl) || + (trasn_code_byte5->fc_sw_laser_sn)) { /* check if its short WL */ + flag |= (SFP_FLAG_PT_SWLASER << SFP_FLAG_PT_SHIFT); + } else if (trasn_code_byte4->fc_lw_laser) { + wavelength = (page_a0[SSF_WAVELENGTH_B1] << 8) | + page_a0[SSF_WAVELENGTH_B0]; + if (wavelength == SFP_WAVELENGTH_LC1310) + flag |= SFP_FLAG_PT_LWLASER_LC1310 << SFP_FLAG_PT_SHIFT; + if (wavelength == SFP_WAVELENGTH_LL1550) + flag |= SFP_FLAG_PT_LWLASER_LL1550 << SFP_FLAG_PT_SHIFT; + } + /* check if its SFP+ */ + flag |= ((page_a0[SSF_IDENTIFIER] == SFF_PG0_IDENT_SFP) ? + SFP_FLAG_CT_SFP_PLUS : SFP_FLAG_CT_UNKNOWN) + << SFP_FLAG_CT_SHIFT; + + /* check if its OPTICAL */ + flag |= ((page_a0[SSF_CONNECTOR] == SFF_PG0_CONNECTOR_LC) ? + SFP_FLAG_IS_OPTICAL_PORT : 0) + << SFP_FLAG_IS_OPTICAL_SHIFT; + + temperature = (page_a2[SFF_TEMPERATURE_B1] << 8 | + page_a2[SFF_TEMPERATURE_B0]); + vcc = (page_a2[SFF_VCC_B1] << 8 | + page_a2[SFF_VCC_B0]); + tx_power = (page_a2[SFF_TXPOWER_B1] << 8 | + page_a2[SFF_TXPOWER_B0]); + tx_bias = (page_a2[SFF_TX_BIAS_CURRENT_B1] << 8 | + page_a2[SFF_TX_BIAS_CURRENT_B0]); + rx_power = (page_a2[SFF_RXPOWER_B1] << 8 | + page_a2[SFF_RXPOWER_B0]); + desc->sfp_info.temperature = cpu_to_be16(temperature); + desc->sfp_info.rx_power = cpu_to_be16(rx_power); + desc->sfp_info.tx_bias = cpu_to_be16(tx_bias); + desc->sfp_info.tx_power = cpu_to_be16(tx_power); + desc->sfp_info.vcc = cpu_to_be16(vcc); + + desc->sfp_info.flags = cpu_to_be16(flag); + desc->length = cpu_to_be32(sizeof(desc->sfp_info)); +} + +void +lpfc_rdp_res_link_error(struct fc_rdp_link_error_status_desc *desc, + READ_LNK_VAR *stat) +{ + uint32_t type; + + desc->t
[PATCH v2 10/15] lpfc: Fix crash in vport_delete.
Fix crash in vport_delete. We inadvertantly took the path to recreate the vport while in a driver teardown path Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 8 +++- drivers/scsi/lpfc/lpfc_nportdisc.c | 8 +++- drivers/scsi/lpfc/lpfc_vport.c | 9 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 6ab8312..14424e6 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -4483,7 +4483,13 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, lpfc_destroy_vport_work_array(phba, vports); } - if (active_vlink_present) { + /* +* Don't re-instantiate if vport is marked for deletion. +* If we are here first then vport_delete is going to wait +* for discovery to complete. +*/ + if (!(vport->load_flag & FC_UNLOADING) && + active_vlink_present) { /* * If there are other active VLinks present, * re-instantiate the Vlink using FDISC. diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 4cb9882..09de640 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -661,7 +661,13 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_destroy_vport_work_array(phba, vports); } - if (active_vlink_present) { + /* +* Don't re-instantiate if vport is marked for deletion. +* If we are here first then vport_delete is going to wait +* for discovery to complete. +*/ + if (!(vport->load_flag & FC_UNLOADING) && + active_vlink_present) { /* * If there are other active VLinks present, * re-instantiate the Vlink using FDISC. diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index a87ee33..7690126 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c @@ -567,8 +567,8 @@ int lpfc_vport_delete(struct fc_vport *fc_vport) { struct lpfc_nodelist *ndlp = NULL; - struct Scsi_Host *shost = (struct Scsi_Host *) fc_vport->shost; struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; + struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct lpfc_hba *phba = vport->phba; long timeout; bool ns_ndlp_referenced = false; @@ -645,8 +645,8 @@ lpfc_vport_delete(struct fc_vport *fc_vport) } /* Remove FC host and then SCSI host with the vport */ - fc_remove_host(lpfc_shost_from_vport(vport)); - scsi_remove_host(lpfc_shost_from_vport(vport)); + fc_remove_host(shost); + scsi_remove_host(shost); ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); @@ -772,7 +772,8 @@ skip_logo: * Completion of unreg_vpi (lpfc_mbx_cmpl_unreg_vpi) * does the scsi_host_put() to release the vport. */ - if (lpfc_mbx_unreg_vpi(vport)) + if (!(vport->vpi_state & LPFC_VPI_REGISTERED) || + lpfc_mbx_unreg_vpi(vport)) scsi_host_put(shost); } else scsi_host_put(shost); -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 08/15] lpfc: Fix discovery issue when changing from Pt2Pt to Fabric.
Fix discovery issue when changing from Pt2Pt to Fabric. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index e93705d..0dfa566 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -4834,9 +4834,19 @@ lpfc_matchdid(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, if (matchdid.un.b.id == ndlpdid.un.b.id) { if ((mydid.un.b.domain == matchdid.un.b.domain) && (mydid.un.b.area == matchdid.un.b.area)) { + /* This code is supposed to match the ID +* for a private loop device that is +* connect to fl_port. But we need to +* check that the port did not just go +* from pt2pt to fabric or we could end +* up matching ndlp->nlp_DID 01 to +* fabric DID 0x20101 +*/ if ((ndlpdid.un.b.domain == 0) && (ndlpdid.un.b.area == 0)) { - if (ndlpdid.un.b.id) + if (ndlpdid.un.b.id && + vport->phba->fc_topology == + LPFC_TOPOLOGY_LOOP) return 1; } return 0; -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 12/15] lpfc: Fix rport leak.
Fix rport leak. Correct locking and refcounting in tracking our rports Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_disc.h| 4 +- drivers/scsi/lpfc/lpfc_els.c | 12 +++- drivers/scsi/lpfc/lpfc_hbadisc.c | 145 +++ 3 files changed, 79 insertions(+), 82 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 6977027..361f5b3 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h @@ -79,7 +79,6 @@ struct lpfc_nodelist { struct lpfc_name nlp_portname; struct lpfc_name nlp_nodename; uint32_t nlp_flag; /* entry flags */ - uint32_t nlp_add_flag; /* additional flags */ uint32_t nlp_DID; /* FC D_ID of entry */ uint32_t nlp_last_elscmd; /* Last ELS cmd sent */ uint16_t nlp_type; @@ -147,6 +146,7 @@ struct lpfc_node_rrq { #define NLP_LOGO_ACC 0x0010 /* Process LOGO after ACC completes */ #define NLP_TGT_NO_SCSIID 0x0020 /* good PRLI but no binding for scsid */ #define NLP_ISSUE_LOGO 0x0040 /* waiting to issue a LOGO */ +#define NLP_IN_DEV_LOSS0x0080 /* devloss in progress */ #define NLP_ACC_REGLOGIN 0x0100 /* Issue Reg Login after successful ACC */ #define NLP_NPR_ADISC 0x0200 /* Issue ADISC when dq'ed from @@ -158,8 +158,6 @@ struct lpfc_node_rrq { #define NLP_FIRSTBURST 0x4000 /* Target supports FirstBurst */ #define NLP_RPI_REGISTERED 0x8000 /* nlp_rpi is valid */ -/* Defines for nlp_add_flag (uint32) */ -#define NLP_IN_DEV_LOSS 0x0001/* Dev Loss processing in progress */ /* ndlp usage management macros */ #define NLP_CHK_NODE_ACT(ndlp) (((ndlp)->nlp_usg_map \ diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 4d3d931..011c8d8 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1624,8 +1624,9 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, if (rport) { rdata = rport->dd_data; if (rdata->pnode == ndlp) { - lpfc_nlp_put(ndlp); + /* break the link before dropping the ref */ ndlp->rport = NULL; + lpfc_nlp_put(ndlp); rdata->pnode = lpfc_nlp_get(new_ndlp); new_ndlp->rport = rport; } @@ -3674,6 +3675,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, * Remove the ndlp reference if it's a fabric node that has * sent us an unsolicted LOGO. */ + /* FIXME: this one frees ndlp before breaking rport link */ if (ndlp->nlp_type & NLP_FABRIC) lpfc_nlp_put(ndlp); @@ -7351,8 +7353,13 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, * Do not process any unsolicited ELS commands * if the ndlp is in DEV_LOSS */ - if (ndlp->nlp_add_flag & NLP_IN_DEV_LOSS) + shost = lpfc_shost_from_vport(vport); + spin_lock_irq(shost->host_lock); + if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { + spin_unlock_irq(shost->host_lock); goto dropit; + } + spin_unlock_irq(shost->host_lock); elsiocb->context1 = lpfc_nlp_get(ndlp); elsiocb->vport = vport; @@ -7396,7 +7403,6 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, rjt_exp = LSEXP_NOTHING_MORE; break; } - shost = lpfc_shost_from_vport(vport); if (vport->port_state < LPFC_DISC_AUTH) { if (!(phba->pport->fc_flag & FC_PT2PT) || (phba->pport->fc_flag & FC_PT2PT_PLOGI)) { diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 0dfa566..88af258 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -106,6 +106,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) struct lpfc_rport_data *rdata; struct lpfc_nodelist * ndlp; struct lpfc_vport *vport; + struct Scsi_Host *shost; struct lpfc_hba *phba; struct lpfc_work_evt *evtp; int put_node; @@ -146,49 +147,32 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) return; - if (ndlp->nlp_type & NLP_FABRIC) { - - /* If the WWPN of the rport and ndlp don't match, ignore it */ - if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn)) { - lpfc_printf_vlog(vport, KERN_
[PATCH v2 11/15] lpfc: Correct loss of RSCNs during array takeaway/giveback testing.
Correct loss of RSCNs during array takeaway/giveback testing. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index b490ef5..4d3d931 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1514,7 +1514,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, struct fc_rport *rport; struct serv_parm *sp; uint8_t name[sizeof(struct lpfc_name)]; - uint32_t rc, keepDID = 0; + uint32_t rc, keepDID = 0, keep_nlp_flag = 0; int put_node; int put_rport; unsigned long *active_rrqs_xri_bitmap = NULL; @@ -1603,9 +1603,9 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, ndlp->active_rrqs_xri_bitmap, phba->cfg_rrq_xri_bitmap_sz); - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) - new_ndlp->nlp_flag |= NLP_NPR_2B_DISC; - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; + keep_nlp_flag = new_ndlp->nlp_flag; + new_ndlp->nlp_flag = ndlp->nlp_flag; + ndlp->nlp_flag = keep_nlp_flag; /* Set state will put new_ndlp on to node list if not already done */ lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state); @@ -1648,7 +1648,9 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, memcpy(ndlp->active_rrqs_xri_bitmap, active_rrqs_xri_bitmap, phba->cfg_rrq_xri_bitmap_sz); - lpfc_drop_node(vport, ndlp); + + if (!NLP_CHK_NODE_ACT(ndlp)) + lpfc_drop_node(vport, ndlp); } else { lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 03/15] lpfc: Add support for ELS LCB.
Add support for ELS LCB. Also has a little whitespace fixing. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 239 +- drivers/scsi/lpfc/lpfc_hw.h | 32 ++ drivers/scsi/lpfc/lpfc_hw4.h | 27 - drivers/scsi/lpfc/lpfc_init.c | 2 + drivers/scsi/lpfc/lpfc_sli4.h | 11 ++ 6 files changed, 306 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 9b81a34..3246d09 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -230,6 +230,7 @@ struct lpfc_stats { uint32_t elsRcvRRQ; uint32_t elsRcvRTV; uint32_t elsRcvECHO; + uint32_t elsRcvLCB; uint32_t elsXmitFLOGI; uint32_t elsXmitFDISC; uint32_t elsXmitPLOGI; diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 851e8ef..3975276 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -4587,16 +4587,16 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) if (!NLP_CHK_NODE_ACT(ndlp)) continue; if (ndlp->nlp_state == NLP_STE_NPR_NODE && - (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && - (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && - (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) { + (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && + (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && + (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) { ndlp->nlp_prev_state = ndlp->nlp_state; lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); sentplogi++; vport->num_disc_nodes++; if (vport->num_disc_nodes >= - vport->cfg_discovery_threads) { + vport->cfg_discovery_threads) { spin_lock_irq(shost->host_lock); vport->fc_flag |= FC_NLP_MORE; spin_unlock_irq(shost->host_lock); @@ -4615,6 +4615,233 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) return sentplogi; } +static void +lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) +{ + MAILBOX_t *mb; + IOCB_t *icmd; + uint8_t *pcmd; + struct lpfc_iocbq *elsiocb; + struct lpfc_nodelist *ndlp; + struct ls_rjt *stat; + struct lpfc_lcb_context *lcb_context; + struct fc_lcb_res_frame *lcb_res; + uint32_t cmdsize; + int rc; + + mb = &pmb->u.mb; + + lcb_context = (struct lpfc_lcb_context *)pmb->context1; + ndlp = lcb_context->ndlp; + pmb->context1 = NULL; + pmb->context2 = NULL; + + if (mb->mbxStatus) { + mempool_free(pmb, phba->mbox_mem_pool); + goto error; + } + + mempool_free(pmb, phba->mbox_mem_pool); + + cmdsize = sizeof(struct fc_lcb_res_frame); + elsiocb = lpfc_prep_els_iocb(phba->pport, 0, cmdsize, + lpfc_max_els_tries, ndlp, + ndlp->nlp_DID, ELS_CMD_ACC); + + /* Decrement the ndlp reference count from previous mbox command */ + lpfc_nlp_put(ndlp); + + if (!elsiocb) + goto free_lcb_context; + + lcb_res = (struct fc_lcb_res_frame *) + (((struct lpfc_dmabuf *)elsiocb->context2)->virt); + + icmd = &elsiocb->iocb; + icmd->ulpContext = lcb_context->rx_id; + icmd->unsli3.rcvsli3.ox_id = lcb_context->ox_id; + + pcmd = (uint8_t *)(((struct lpfc_dmabuf *)elsiocb->context2)->virt); + *((uint32_t *)(pcmd)) = ELS_CMD_ACC; + lcb_res->lcb_sub_command = lcb_context->sub_command; + lcb_res->lcb_type = lcb_context->type; + lcb_res->lcb_frequency = lcb_context->frequency; + elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; + phba->fc_stat.elsXmitACC++; + rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); + if (rc == IOCB_ERROR) + lpfc_els_free_iocb(phba, elsiocb); + + kfree(lcb_context); + return; + +error: + cmdsize = sizeof(struct fc_lcb_res_frame); + elsiocb = lpfc_prep_els_iocb(phba->pport, 0, cmdsize, + lpfc_max_els_tries, ndlp, + ndlp->nlp_DID, ELS_CMD_LS_RJT); + lpfc_nlp_put(ndlp); + if (!elsiocb) + goto free_lcb_context; + + icmd = &elsiocb->iocb; + icmd->ulpContext = lcb_context->rx_id; + icmd->unsli3.rcvsli3.ox_id = lcb_context->ox_id; + pcmd = (uint8_t *)(((struct lpfc_dmabuf *)elsiocb->context2)->virt); + + *((uint32_t *)(pcmd)) = ELS_CMD_LS_RJT; + stat = (struct ls_rjt *)(pcmd +
[PATCH v2 15/15] lpfc: Update driver version for upstream patch set 10.6.0.1.
Update driver version for upstream patch set 10.6.0.1. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index c37bb9f..8b96d10 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -18,7 +18,7 @@ * included with this package. * ***/ -#define LPFC_DRIVER_VERSION "10.5.0.0." +#define LPFC_DRIVER_VERSION "10.6.0.1." #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 14/15] lpfc: Change buffer pool empty message to miscellaneous category
Change buffer pool empty message to miscellaneous category Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c140f99..116df9c 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4537,7 +4537,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) if (lpfc_cmd == NULL) { lpfc_rampdown_queue_depth(phba); - lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, + lpfc_printf_vlog(vport, KERN_INFO, LOG_MISC, "0707 driver's buffer pool is empty, " "IO busied\n"); goto out_host_busy; -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 07/15] lpfc: Correct reporting of vport state on fdisc command failure.
Correct reporting of vport state on fdisc command failure. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 724b61c..b490ef5 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -8237,7 +8237,8 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, lpfc_do_scr_ns_plogi(phba, vport); goto out; fdisc_failed: - lpfc_vport_set_state(vport, FC_VPORT_FAILED); + if (vport->fc_vport->vport_state != FC_VPORT_NO_FABRIC_RSCS) + lpfc_vport_set_state(vport, FC_VPORT_FAILED); /* Cancel discovery timer */ lpfc_can_disctmo(vport); lpfc_nlp_put(ndlp); -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 13/15] lpfc: Fix incorrect log message reported for empty FCF record.
Fix incorrect log message reported for empty FCF record. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 88af258..72a69d4 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -1777,7 +1777,7 @@ lpfc_sli4_fcf_rec_mbox_parse(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, dma_addr_t phys_addr; struct lpfc_mbx_sge sge; struct lpfc_mbx_read_fcf_tbl *read_fcf; - uint32_t shdr_status, shdr_add_status; + uint32_t shdr_status, shdr_add_status, if_type; union lpfc_sli4_cfg_shdr *shdr; struct fcf_record *new_fcf_record; @@ -1798,9 +1798,11 @@ lpfc_sli4_fcf_rec_mbox_parse(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, lpfc_sli_pcimem_bcopy(shdr, shdr, sizeof(union lpfc_sli4_cfg_shdr)); shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); if (shdr_status || shdr_add_status) { - if (shdr_status == STATUS_FCF_TABLE_EMPTY) + if (shdr_status == STATUS_FCF_TABLE_EMPTY || + if_type == LPFC_SLI_INTF_IF_TYPE_2) lpfc_printf_log(phba, KERN_ERR, LOG_FIP, "2726 READ_FCF_RECORD Indicates empty " "FCF table.\n"); -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 02/15] lpfc: Correct loss of target discovery after cable swap.
Correct loss of target discovery after cable swap. Fix incorrect reference counting Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index f2db89f..72388a6 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -4296,9 +4296,9 @@ lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) if (vport->phba->sli_rev == LPFC_SLI_REV4) { lpfc_cleanup_vports_rrqs(vport, ndlp); lpfc_unreg_rpi(vport, ndlp); - } else { - lpfc_nlp_put(ndlp); } + + lpfc_nlp_put(ndlp); return; } -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 01/15] lpfc: The lpfc driver does not issue RFF_ID and RFT_ID in the correct sequence
The lpfc driver does not issue RFF_ID and RFT_ID in the correct sequence Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 2500f15..f2db89f 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -3868,11 +3868,11 @@ out: if (vport->port_state < LPFC_VPORT_READY) { /* Link up discovery requires Fabric registration. */ - lpfc_ns_cmd(vport, SLI_CTNS_RFF_ID, 0, 0); /* Do this first! */ lpfc_ns_cmd(vport, SLI_CTNS_RNN_ID, 0, 0); lpfc_ns_cmd(vport, SLI_CTNS_RSNN_NN, 0, 0); lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0); lpfc_ns_cmd(vport, SLI_CTNS_RFT_ID, 0, 0); + lpfc_ns_cmd(vport, SLI_CTNS_RFF_ID, 0, 0); /* Issue SCR just before NameServer GID_FT Query */ lpfc_issue_els_scr(vport, SCR_DID, 0); -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 00/15] lpfc: Update to revision 10.6.0.1
This patch set updates the lpfc driver to revision 10.6.0.1 This is version 2. v2 changes: Patch 3: Revised for review comments from Sebastian Herbszt Replaced double spacing with single spacing Patch 6: Revised for review comments from Sebastian Herbszt Replaced double spacing with single spacing Revised LS_RJT codes for lpfc_els_rcv_rdp() The patches were cut against scsi-misc -- james James Smart (15): The lpfc driver does not issue RFF_ID and RFT_ID in the correct sequence Correct loss of target discovery after cable swap. Add support for ELS LCB. Correct reference counting of rport Fix ABORTs WQ selection in terminate_rport_io Add support for RDP ELS command. Correct reporting of vport state on fdisc command failure. Fix discovery issue when changing from Pt2Pt to Fabric. Fix to remove IRQF_SHARED flag for MSI/MSI-X vectors. Fix crash in vport_delete. Correct loss of RSCNs during array takeaway/giveback testing. Fix rport leak. Fix incorrect log message reported for empty FCF record. Change buffer pool empty message to miscellaneous category Update driver version for upstream patch set 10.6.0.1. drivers/scsi/lpfc/lpfc.h | 2 + drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_disc.h | 4 +- drivers/scsi/lpfc/lpfc_els.c | 686 - drivers/scsi/lpfc/lpfc_hbadisc.c | 168 - drivers/scsi/lpfc/lpfc_hw.h| 201 +++ drivers/scsi/lpfc/lpfc_hw4.h | 228 +++- drivers/scsi/lpfc/lpfc_init.c | 22 +- drivers/scsi/lpfc/lpfc_mbox.c | 152 drivers/scsi/lpfc/lpfc_nportdisc.c | 8 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 32 +- drivers/scsi/lpfc/lpfc_sli4.h | 21 ++ drivers/scsi/lpfc/lpfc_version.h | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 9 +- 15 files changed, 1415 insertions(+), 124 deletions(-) -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 3/3] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
> On Thu, 2015-05-21 at 10:09 +, yga...@codeaurora.org wrote: >> > On Wed, 2015-05-20 at 10:22 +0200, Paul Bolle wrote: >> > Am I missing something obvious here? Because ufs-qcom currently looks >> > pointless to me, and I actually see little reason to even have it in >> the >> > mainline tree. >> > >> >> we haven't uploaded yet the patch that binds qcom vops to the driver, >> but >> we will soon. > > Perhaps you could make that patch part of v2 of this series. I see > little point in this series without that patch. Perhaps someone else > still cares about it, but I'm not looking at it anymore. > fair enough. i will upload a V2 series soon. thanks for your inputs. > Thanks, > > > Paul Bolle > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] target: Convert se_node_acl->device_list[] to RCU hlist
On Tue, May 19, 2015 at 08:22:31AM +0200, Christoph Hellwig wrote: > On Mon, May 18, 2015 at 11:05:47PM -0700, Nicholas A. Bellinger wrote: > > > [ 12.830576] kernel BUG at ../drivers/target/target_core_device.c:337! > > > > > > > How did you hit this..? > > tcm_node --block iblock_0/array /dev/sda > > line=$(tcm_loop --createnexus=0) > wwn=$(echo $line | awk '{print $15}') > tcm_loop --addlun=$wwn 0 0 iblock_0/array And here is the fix. Seems like anything using dynamic node ACLs was broken the same way (I could reproduce it with vhost as well). I don't really like how HBA_FLAGS_INTERNAL_USE means this is a virtual lun0, so I'll send another patch to replace it with a per-device flag eventually. --- >From 9fd0e75cffde876b84b08952cc7f026d4e08d77a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 21 May 2015 18:58:21 +0200 Subject: target: don't add lun0 to tpg_lun_hlist We never want to find the virtual lun0 when looking up a lun on the TPG, otherwise the core code gets really confused. Signed-off-by: Christoph Hellwig --- drivers/target/target_core_tpg.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index b8c2a32..ced1dd6 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -647,7 +647,8 @@ int core_tpg_add_lun( lun->lun_access = lun_access; lun->lun_status = TRANSPORT_LUN_STATUS_ACTIVE; - hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); + if (!(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) + hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); mutex_unlock(&tpg->tpg_lun_mutex); @@ -687,7 +688,8 @@ void core_tpg_remove_lun( } lun->lun_status = TRANSPORT_LUN_STATUS_FREE; - hlist_del_rcu(&lun->link); + if (!(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) + hlist_del_rcu(&lun->link); mutex_unlock(&tpg->tpg_lun_mutex); percpu_ref_exit(&lun->lun_ref); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Proposal for annotating _unstable_ pages
On Wed 20-05-15 18:04:40, Kent Overstreet wrote: > > Yeah. I never figured out a sane way to migrate pages and keep everything > > else happy. Daniel Phillips is having a go at page forking for tux3; let's > > see if the questions about that get resolved. > > That would be great, we need something. > > I'd also be really curious what btrfs is doing today - is it just bouncing > everything internally, or did they come up with something more clever? Btrfs is just waiting for IO to complete. > > > Also, there's probably always going to be situations where we're reading > > > or > > > writing to pages user space can stomp on (dio) - IMO we need to add a bio > > > flag > > > to annotate this - "if you need this to be stable you have to bounce it". > > > Otherwise either filesystems/block drivers are going to be stuck bouncing > > > everything, or it'll just (continue to be) buggy. > > > > Well, for now there's BIO_SNAP_STABLE that forces the block layer to bounce > > it, > > but right now ext3 is the last user of it, and afaict btrfs is the only > > other > > FS that takes care of stable pages on its own. > > I have no idea what BIO_SNAP_STABLE was supposed to be for, but I don't see > how > it's useful for anything sane. It's for the case where lower layer requests it needs stable pages but upper layer isn't able to provide them (as is the case of ext3). Then block layer bounces the data for the caller. > But that's the complete opposite of the problem stable pages are supposed to > solve: stable pages are for when the _lower_ layer (be it filesystem, bcache, > md, lvm) needs the memory being either read to or written from (both, it's not > just writes) to not be diddled over while the IO is in flight. > > Now, a point that I think has been missed is that stable pages are _not_ a > complete solution, at least for consumers in the block layer. > > The situation today is that if I'm in the block layer, and I get a handed a > read > or write bio, I _don't know_ if it's from something that's going to diddle > over > those pages or not. So if I require stable pages - be it for data checksumming > or for other things - I've just got to bounce the bio myself. > > And then the really annoying thing is that if you've got stacked things that > all > need stable pages (maybe btrfs on top of bcache on top of md) - they _all_ > have > to assume the pages aren't going to be stable, so if they need them they _all_ > have to bounce - even though once the first layer bounced the bio that made it > stable for everything underneath it. The current design is that if you need stable pages for your device, set bdi capability BDI_CAP_STABLE_WRITES, fs then takes care of not scribbling over your page while it is under writeback or uses BIO_SNAP_STABLE if it cannot. There is no reason why this shouldn't work with device stacking (although I'm not sure it really works currently). You are right that this won't solve the possible issues with direct IO where user scribbles over the buffers while direct IO is in flight. We could make direct IO submit pages with BIO_SNAP_STABLE when underlying device declares they are required but I assume some users would rather like to promise they don't touch them than paying the cost of copy... I have to say I don't quite see the advantage of your proposal over this... > Stable pages for IO to/from the pagecache are _not_ going to solve this > problem, > because the page cache is not the only source of IO to non stable pages > (Direct > IO will always be, even if everything else gets fixed). > > So what I'm proposing is: > > - Add a new bio flag: BIO_PAGES_NOT_STABLE > > - Everything that submits a bio and _doesn't_ guarantee that the pages won't > be >touched while the IO is in flight has to set that flag. This flag will > have >to be preserved when cloning a bio, but not when cloning a bio and its > pages >(i.e. bouncing it). > > This is going to be a lot of not-fun work auditing code, but IMO it really > needs > to be done. As a bonus, once it's done everything that generates IO that must > be > expensively bounced will be nicely annotated. > > To verify that the annotations are correct, for writes we can add some debug > code to the generic IO path that checksums the data before and after the IO > and > complains loudly if the checksums don't match. Dunno what we can do for reads. > > Thoughts? Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH trivial] lpfc: Grammar s/an negative/a negative/
Reviewed-By: James Smart looks fine. Thanks -- james s On 5/21/2015 8:11 AM, Geert Uytterhoeven wrote: Signed-off-by: Geert Uytterhoeven --- drivers/scsi/lpfc/lpfc_debugfs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 513edcb0c2dae379..25aa9b98d53aa345 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -710,7 +710,7 @@ lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -760,7 +760,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -810,7 +810,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -852,7 +852,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -894,7 +894,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -1115,7 +1115,7 @@ lpfc_debugfs_dif_err_release(struct inode *inode, struct file *file) * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH trivial] lpfc: Grammar s/an negative/a negative/
Signed-off-by: Geert Uytterhoeven --- drivers/scsi/lpfc/lpfc_debugfs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 513edcb0c2dae379..25aa9b98d53aa345 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -710,7 +710,7 @@ lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -760,7 +760,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -810,7 +810,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -852,7 +852,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -894,7 +894,7 @@ out: * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int @@ -1115,7 +1115,7 @@ lpfc_debugfs_dif_err_release(struct inode *inode, struct file *file) * returns a pointer to that log in the private_data field in @file. * * Returns: - * This function returns zero if successful. On error it will return an negative + * This function returns zero if successful. On error it will return a negative * error value. **/ static int -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi: debug: fix type mismatch warning for sg_pcopy_from_buffer
On Thursday 21 May 2015 12:09:58 Dave Gordon wrote: > From b304c5a99ea260eac1cf98ced5f3c79c793ad4fd Mon Sep 17 00:00:00 2001 > From: Dave Gordon > Date: Thu, 21 May 2015 12:06:27 +0100 > Subject: [PATCH] scsi: resolve sg buffer const-ness issue > > do_device_access() takes a separate parameter to indicate the direction > of data transfer, which it used to use to select the appropriate function > out of sg_pcopy_{to,from}_buffer(). However these two functions now have > different const-ness in their signatures, leading to compiler warnings. > > So this patch makes it bypass these wrappers and call the underlying > function sg_copy_buffer() directly; this has the same calling style as > do_device_access() i.e. a separate direction-of-transfer parameter and > no pointers-to-const, so skipping the wrappers not only eliminates the > warning, it also make the code simpler > > Signed-off-by: Dave Gordon > --- Acked-by: Arnd Bergmann -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi: debug: fix type mismatch warning for sg_pcopy_from_buffer
On 20/05/15 21:31, Arnd Bergmann wrote: > On Wednesday 20 May 2015 12:53:29 Andrew Morton wrote: >> On Tue, 19 May 2015 23:22:39 +0200 Arnd Bergmann wrote: >>> >>> I can't decide if this is actually a good idea, or if we should rather drop >>> the sg_pcopy_from_buffer() patch. Maybe someone else sees a better solution. >> >> Could make do_device_access() call sg_copy_buffer() directly. >> >> But yes, dropping the sg_pcopy_from/to_buffer changes is reasonable. >> sg_copy_buffer() is bidirectional and that won't be changing, so >> putting constified wrapeprs around it is kinda fake. > > Ok. The part I only saw now is that do_device_access() is the only user > of sg_pcopy_from_buffer(), so if that passes a non-const argument, > there is dropping the patch will be teh best solution. > > Arnd do_device_access() may the only user of sg_pcopy_from_buffer() in the -mm tree at the moment, but the const-patch was created because we were using the sg_pcopy_{to,from}_buffer functions in new code in the i915 driver (published to the intel-gfx mailing list, but not yet folded into the upstream versions). So quite soon it won't be the only user :) The various sg_[p]copy_* wrappers all just supply trailing parameters for the convenience of those who don't need (and don't want to deal with) the full capabilities of the underlying sg_copy_buffer(). In particular, we want the wrappers for the benefit of users that *don't* use this flag-specifies-direction style (which I think is actually quite rare and not really conducive to robust checking). The separate-source-and-destination style seems much more common (cf. memcpy()). And scsi_debug.c itself has functions fill_from_dev_buffer() and fetch_to_dev_buffer() that call the separate sg_copy_{to,from}_buffer() wrappers. But since do_device_access() has the same parameter style as sg_copy_buffer() (i.e. pointer parameters that may be either source or destination, plus a flag to specify direction of transfer, as opposed to one (const *) parameter for the input and a separate one for the (non-const) destination), I think it quite reasonable that do_device_access() should call sg_copy_buffer() directly rather than going through one or other wrapper. In fact it simplifies the code further; we can lose four lines and get rid of the function pointer entirely, just by passing 'do_write' down to sg_copy_buffer(). See attached patch :) .Dave. >From b304c5a99ea260eac1cf98ced5f3c79c793ad4fd Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Thu, 21 May 2015 12:06:27 +0100 Subject: [PATCH] scsi: resolve sg buffer const-ness issue do_device_access() takes a separate parameter to indicate the direction of data transfer, which it used to use to select the appropriate function out of sg_pcopy_{to,from}_buffer(). However these two functions now have different const-ness in their signatures, leading to compiler warnings. So this patch makes it bypass these wrappers and call the underlying function sg_copy_buffer() directly; this has the same calling style as do_device_access() i.e. a separate direction-of-transfer parameter and no pointers-to-const, so skipping the wrappers not only eliminates the warning, it also make the code simpler :) Signed-off-by: Dave Gordon --- drivers/scsi/scsi_debug.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 1f8e2dc..30268bb 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -2363,17 +2363,13 @@ do_device_access(struct scsi_cmnd *scmd, u64 lba, u32 num, bool do_write) u64 block, rest = 0; struct scsi_data_buffer *sdb; enum dma_data_direction dir; - size_t (*func)(struct scatterlist *, unsigned int, void *, size_t, - off_t); if (do_write) { sdb = scsi_out(scmd); dir = DMA_TO_DEVICE; - func = sg_pcopy_to_buffer; } else { sdb = scsi_in(scmd); dir = DMA_FROM_DEVICE; - func = sg_pcopy_from_buffer; } if (!sdb->length) @@ -2385,16 +2381,16 @@ do_device_access(struct scsi_cmnd *scmd, u64 lba, u32 num, bool do_write) if (block + num > sdebug_store_sectors) rest = block + num - sdebug_store_sectors; - ret = func(sdb->table.sgl, sdb->table.nents, + ret = sg_copy_buffer(sdb->table.sgl, sdb->table.nents, fake_storep + (block * scsi_debug_sector_size), - (num - rest) * scsi_debug_sector_size, 0); + (num - rest) * scsi_debug_sector_size, 0, do_write); if (ret != (num - rest) * scsi_debug_sector_size) return ret; if (rest) { - ret += func(sdb->table.sgl, sdb->table.nents, + ret += sg_copy_buffer(sdb->table.sgl, sdb->table.nents, fake_storep, rest * scsi_debug_sector_size, - (num - rest) * scsi_debug_sector_size); + (num - rest) * scsi_debug_sector_size, do_write); } return ret; -- 1.7.9.5
Re: [PATCH for-next] qla2xxx: delete references to unused firmware files
On 05/21/2015 12:42 PM, Xose Vazquez Perez wrote: > ql2400_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2500_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2600_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql2700_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ > ql8300_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware > Version 8.01.00 $ ^^^ wrong Those should be: ql2400_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ ql2500_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP25xx Firmware Version 8.01.00 $ ql2600_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP83xx Firmware Version 8.01.00 $ ql2700_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP27xx Firmware Version 8.01.00 $ ql8300_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP83xx Firmware Version 8.01.00 $ -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH for-next] qla2xxx: delete references to unused firmware files
On 05/19/2015 05:51 PM, Himanshu Madhani wrote: > On 5/18/15, 6:50 PM, "Julian Calaby" wrote: >> Do the devices these firmware files are for exist and is there any >> chance of the files being released? > > Yes. These devices are available and we read firmware from FLASH on these > adapters. > At times when debugging/triaging involves firmware, we use binaries that > would be useful for quick triaging. It looks like newer FW files were released on 4/29/2015 in: http://ldriver.qlogic.com/firmware/rpms/qlogic-firmware-8.01.00-1.noarch.rpm ql2400_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ ql2500_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ ql2600_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ ql2700_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ ql8300_fw.bin: COPYRIGHT 2015 QLOGIC CORPORATION ISP24xx Firmware Version 8.01.00 $ Could you please send meaningful files to linux-firmware.git ? And remove irrelevant code from qla_os.c/Kconfig -thank you- -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 3/3] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
On Thu, 2015-05-21 at 10:09 +, yga...@codeaurora.org wrote: > > On Wed, 2015-05-20 at 10:22 +0200, Paul Bolle wrote: > > Am I missing something obvious here? Because ufs-qcom currently looks > > pointless to me, and I actually see little reason to even have it in the > > mainline tree. > > > > we haven't uploaded yet the patch that binds qcom vops to the driver, but > we will soon. Perhaps you could make that patch part of v2 of this series. I see little point in this series without that patch. Perhaps someone else still cares about it, but I'm not looking at it anymore. Thanks, Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 3/3] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
> On Wed, 2015-05-20 at 10:22 +0200, Paul Bolle wrote: >> By the way, as far as I can see, this (new) module can only be loaded >> manually (or via scripts). Is that what people want? > > This comment wasn't well thought through. So I hand another look at the > code of usf-qcom. > > I noticed that the single thing ufs-qcom exports is "struct > ufs_hba_qcom_vops". But that's unused in next-20150520: > $ git grep -nw ufs_hba_qcom_vops > drivers/scsi/ufs/ufs-qcom.c:999: * struct ufs_hba_qcom_vops - UFS QCOM > specific variant operations > drivers/scsi/ufs/ufs-qcom.c:1004:static const struct > ufs_hba_variant_ops ufs_hba_qcom_vops = { > drivers/scsi/ufs/ufs-qcom.c:1016:EXPORT_SYMBOL(ufs_hba_qcom_vops); > > So it's not used by code outside of ufs-qcom.c. Probably because it > can't actually be used by outside code. It's not mentioned in any public > header and it's even static! > > Am I missing something obvious here? Because ufs-qcom currently looks > pointless to me, and I actually see little reason to even have it in the > mainline tree. > we haven't uploaded yet the patch that binds qcom vops to the driver, but we will soon. > > Paul Bolle > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 0/4] Make iSCSI network namespace aware
On 05/20/2015 08:45 PM, Andy Grover wrote: > On 05/13/2015 03:12 PM, Chris Leech wrote: >> This is only about the structures and functionality involved in >> maintaining the >> iSCSI session, the SCSI host along with it's discovered targets >> and devices has >> no association with network namespaces. >> >> These patches are functional, but not complete. There's no >> isolation enforced >> in the kernel just yet, so it relies on well behaved userspace. I >> plan on >> fixing that, but wanted some feedback on the idea and approach so >> far. > > Seems like a good direction, to me. > > What would be the extent of the userspace (open-iscsi) changes > needed to go along with this? > What I would like to see is to split off iscsid to have one instance/process per session. With that we could trivially run open-iscsi in containers and stufflike; currently it'll be hard as there really is only one iscsid expected to be running in a system. Cheers, Hannes -- Dr. Hannes ReineckezSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] libsas: fix "sysfs group not found" warnings at port teardown time
On Wed, May 20, 2015 at 07:00:53PM -0400, Dan Williams wrote: > Praveen reports: > > After some debugging this is what I have found > > sas_phye_loss_of_signal gets triggered on phy_event from mvsas > sas_phye_loss_of_signal calls sas_deform_port > sas_deform_port posts a DISCE_DESTRUCT event > (sas_unregister_domain_devices-> sas_unregister_dev) > sas_deform_port calls sas_port_delete > sas_port_delete calls sas_port_delete_link > sysfs_remove_group: kobject 'port-X:Y' > sas_port_delete calls device_del > sysfs_remove_group: kobject 'port-X:Y' > > sas_destruct_devices gets triggered for the destruct event > (DISCE_DESTRUCT) > sas_destruct_devices calls sas_rphy_delete > sas_rphy_delete calls scsi_remove_device > scsi_remove_device calls __scsi_remove_device > __scsi_remove_device calls bsg_unregister_queue > bsg_unregister_queue -> device_unregister -> > device_del -> sysfs_remove_group: kobject 'X:0:0:0' > > Since X:0:0:0 falls under port-X:Y (which got deleted during > sas_port_delete), this call results in the warning. All the later > warnings in the dmesg output I sent earlier are trying to delete objects > under port-X:Y. Since port-X:Y got recursively deleted, all these calls > result in warnings. Since, the PHY and DISC events are processed in two > different work queues (and one triggers the other), is there any way > other than checking if the object exists in sysfs (in device_del) before > deleting? > > [ cut here ] > WARNING: CPU: 2 PID: 6 at fs/sysfs/group.c:219 device_del+0x40/0x1c0() > sysfs group 818b97e0 not found for kobject '2:0:4:0' > [..] > CPU: 2 PID: 6 Comm: kworker/u8:0 Tainted: PW O > 3.16.7-ckt9-logicube-ng.3 #1 > Hardware name: To be filled by O.E.M. To be filled by O.E.M./VT6085, BIOS > 4.6.5 01/23/2015 > Workqueue: scsi_wq_2 sas_destruct_devices [libsas] > 0009 8151cd18 88011b35bcd8 810687b7 > 88011a661400 88011b35bd28 8800c6e5e968 88028810 > 8800c89f2c00 8106881c 81733b68 0028 > Call Trace: > [] ? dump_stack+0x41/0x51 > [] ? warn_slowpath_common+0x77/0x90 > [] ? warn_slowpath_fmt+0x4c/0x50 > [] ? device_del+0x40/0x1c0 > [] ? device_unregister+0x1a/0x70 > [] ? bsg_unregister_queue+0x5e/0xb0 > [] ? __scsi_remove_device+0xa9/0xd0 [scsi_mod] > > It appears we've always been double deleting the devices below sas_port, > but recent sysfs changes now exposes this problem. Libsas should delete > all the devices from rphy down before deleting the parent port. > > Cc: > Reported-by: Praveen Murali > Tested-by: Praveen Murali > Signed-off-by: Dan Williams > --- > > v2: drop the "---" separators that will confuse git-am. Thanks Luis! > Awesome, thanks a lot! Cheers, -- Luís > drivers/scsi/libsas/sas_discover.c |6 +++--- > drivers/scsi/libsas/sas_port.c |1 - > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/libsas/sas_discover.c > b/drivers/scsi/libsas/sas_discover.c > index 60de66252fa2..a4db770fe8b0 100644 > --- a/drivers/scsi/libsas/sas_discover.c > +++ b/drivers/scsi/libsas/sas_discover.c > @@ -362,11 +362,14 @@ static void sas_destruct_devices(struct work_struct > *work) > clear_bit(DISCE_DESTRUCT, &port->disc.pending); > > list_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) { > + struct sas_port *sas_port = > dev_to_sas_port(dev->rphy->dev.parent); > + > list_del_init(&dev->disco_list_node); > > sas_remove_children(&dev->rphy->dev); > sas_rphy_delete(dev->rphy); > sas_unregister_common_dev(port, dev); > + sas_port_delete(sas_port); > } > } > > @@ -400,9 +403,6 @@ void sas_unregister_domain_devices(struct asd_sas_port > *port, int gone) > > list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) > sas_unregister_dev(port, dev); > - > - port->port->rphy = NULL; > - > } > > void sas_device_set_phy(struct domain_device *dev, struct sas_port *port) > diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c > index d3c5297c6c89..9a25ae3a52a4 100644 > --- a/drivers/scsi/libsas/sas_port.c > +++ b/drivers/scsi/libsas/sas_port.c > @@ -219,7 +219,6 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) > > if (port->num_phys == 1) { > sas_unregister_domain_devices(port, gone); > - sas_port_delete(port->port); > port->port = NULL; > } else { > sas_port_delete_phy(port->port, phy->phy); > -- To un
Re: [PATCH v1 3/3] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
On Wed, 2015-05-20 at 10:22 +0200, Paul Bolle wrote: > By the way, as far as I can see, this (new) module can only be loaded > manually (or via scripts). Is that what people want? This comment wasn't well thought through. So I hand another look at the code of usf-qcom. I noticed that the single thing ufs-qcom exports is "struct ufs_hba_qcom_vops". But that's unused in next-20150520: $ git grep -nw ufs_hba_qcom_vops drivers/scsi/ufs/ufs-qcom.c:999: * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations drivers/scsi/ufs/ufs-qcom.c:1004:static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { drivers/scsi/ufs/ufs-qcom.c:1016:EXPORT_SYMBOL(ufs_hba_qcom_vops); So it's not used by code outside of ufs-qcom.c. Probably because it can't actually be used by outside code. It's not mentioned in any public header and it's even static! Am I missing something obvious here? Because ufs-qcom currently looks pointless to me, and I actually see little reason to even have it in the mainline tree. Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html