scsi: lpfc: Remove unnecessary lockdep_assert_held calls
In an audit of lockdep calls in the driver, there are multiple lockdep checks in successive calling layers. E.g. a routine checks, and then calls a lower routine that also checks, and so on. Calling sequences result in many redundant checks. Refine the code to remove lower-level lockdep checks. Update comments on the lock, correcting a few places where lock object in comment was incorrect. Link: https://lore.kernel.org/r/20200501214310.91713-7-jsmart2021@gmail.com Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
3048e3e805
commit
88acb4d9ff
@@ -1356,14 +1356,14 @@ lpfc_vlan_id_match(uint16_t curr_vlan_id, uint16_t new_vlan_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lpfc_update_fcf_record - Update driver fcf record
|
|
||||||
* __lpfc_update_fcf_record_pri - update the lpfc_fcf_pri record.
|
* __lpfc_update_fcf_record_pri - update the lpfc_fcf_pri record.
|
||||||
* @phba: pointer to lpfc hba data structure.
|
* @phba: pointer to lpfc hba data structure.
|
||||||
* @fcf_index: Index for the lpfc_fcf_record.
|
* @fcf_index: Index for the lpfc_fcf_record.
|
||||||
* @new_fcf_record: pointer to hba fcf record.
|
* @new_fcf_record: pointer to hba fcf record.
|
||||||
*
|
*
|
||||||
* This routine updates the driver FCF priority record from the new HBA FCF
|
* This routine updates the driver FCF priority record from the new HBA FCF
|
||||||
* record. This routine is called with the host lock held.
|
* record. The hbalock is asserted held in the code path calling this
|
||||||
|
* routine.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
__lpfc_update_fcf_record_pri(struct lpfc_hba *phba, uint16_t fcf_index,
|
__lpfc_update_fcf_record_pri(struct lpfc_hba *phba, uint16_t fcf_index,
|
||||||
@@ -1372,8 +1372,6 @@ __lpfc_update_fcf_record_pri(struct lpfc_hba *phba, uint16_t fcf_index,
|
|||||||
{
|
{
|
||||||
struct lpfc_fcf_pri *fcf_pri;
|
struct lpfc_fcf_pri *fcf_pri;
|
||||||
|
|
||||||
lockdep_assert_held(&phba->hbalock);
|
|
||||||
|
|
||||||
fcf_pri = &phba->fcf.fcf_pri[fcf_index];
|
fcf_pri = &phba->fcf.fcf_pri[fcf_index];
|
||||||
fcf_pri->fcf_rec.fcf_index = fcf_index;
|
fcf_pri->fcf_rec.fcf_index = fcf_index;
|
||||||
/* FCF record priority */
|
/* FCF record priority */
|
||||||
@@ -1451,7 +1449,7 @@ lpfc_copy_fcf_record(struct lpfc_fcf_rec *fcf_rec,
|
|||||||
*
|
*
|
||||||
* This routine updates the driver FCF record from the new HBA FCF record
|
* This routine updates the driver FCF record from the new HBA FCF record
|
||||||
* together with the address mode, vlan_id, and other informations. This
|
* together with the address mode, vlan_id, and other informations. This
|
||||||
* routine is called with the host lock held.
|
* routine is called with the hbalock held.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
__lpfc_update_fcf_record(struct lpfc_hba *phba, struct lpfc_fcf_rec *fcf_rec,
|
__lpfc_update_fcf_record(struct lpfc_hba *phba, struct lpfc_fcf_rec *fcf_rec,
|
||||||
|
|||||||
@@ -1248,8 +1248,8 @@ lpfc_sli_get_iocbq(struct lpfc_hba *phba)
|
|||||||
* @phba: Pointer to HBA context object.
|
* @phba: Pointer to HBA context object.
|
||||||
* @iocbq: Pointer to driver iocb object.
|
* @iocbq: Pointer to driver iocb object.
|
||||||
*
|
*
|
||||||
* This function is called with hbalock held to release driver
|
* This function is called to release the driver iocb object
|
||||||
* iocb object to the iocb pool. The iotag in the iocb object
|
* to the iocb pool. The iotag in the iocb object
|
||||||
* does not change for each use of the iocb object. This function
|
* does not change for each use of the iocb object. This function
|
||||||
* clears all other fields of the iocb object when it is freed.
|
* clears all other fields of the iocb object when it is freed.
|
||||||
* The sqlq structure that holds the xritag and phys and virtual
|
* The sqlq structure that holds the xritag and phys and virtual
|
||||||
@@ -1259,7 +1259,8 @@ lpfc_sli_get_iocbq(struct lpfc_hba *phba)
|
|||||||
* this IO was aborted then the sglq entry it put on the
|
* this IO was aborted then the sglq entry it put on the
|
||||||
* lpfc_abts_els_sgl_list until the CQ_ABORTED_XRI is received. If the
|
* lpfc_abts_els_sgl_list until the CQ_ABORTED_XRI is received. If the
|
||||||
* IO has good status or fails for any other reason then the sglq
|
* IO has good status or fails for any other reason then the sglq
|
||||||
* entry is added to the free list (lpfc_els_sgl_list).
|
* entry is added to the free list (lpfc_els_sgl_list). The hbalock is
|
||||||
|
* asserted held in the code path calling this routine.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
__lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
__lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
||||||
@@ -1269,8 +1270,6 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
|||||||
unsigned long iflag = 0;
|
unsigned long iflag = 0;
|
||||||
struct lpfc_sli_ring *pring;
|
struct lpfc_sli_ring *pring;
|
||||||
|
|
||||||
lockdep_assert_held(&phba->hbalock);
|
|
||||||
|
|
||||||
if (iocbq->sli4_xritag == NO_XRI)
|
if (iocbq->sli4_xritag == NO_XRI)
|
||||||
sglq = NULL;
|
sglq = NULL;
|
||||||
else
|
else
|
||||||
@@ -1333,18 +1332,17 @@ out:
|
|||||||
* @phba: Pointer to HBA context object.
|
* @phba: Pointer to HBA context object.
|
||||||
* @iocbq: Pointer to driver iocb object.
|
* @iocbq: Pointer to driver iocb object.
|
||||||
*
|
*
|
||||||
* This function is called with hbalock held to release driver
|
* This function is called to release the driver iocb object to the
|
||||||
* iocb object to the iocb pool. The iotag in the iocb object
|
* iocb pool. The iotag in the iocb object does not change for each
|
||||||
* does not change for each use of the iocb object. This function
|
* use of the iocb object. This function clears all other fields of
|
||||||
* clears all other fields of the iocb object when it is freed.
|
* the iocb object when it is freed. The hbalock is asserted held in
|
||||||
|
* the code path calling this routine.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
__lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
__lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
||||||
{
|
{
|
||||||
size_t start_clean = offsetof(struct lpfc_iocbq, iocb);
|
size_t start_clean = offsetof(struct lpfc_iocbq, iocb);
|
||||||
|
|
||||||
lockdep_assert_held(&phba->hbalock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean all volatile data fields, preserve iotag and node struct.
|
* Clean all volatile data fields, preserve iotag and node struct.
|
||||||
*/
|
*/
|
||||||
@@ -1789,17 +1787,17 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
|||||||
* @nextiocb: Pointer to driver iocb object which need to be
|
* @nextiocb: Pointer to driver iocb object which need to be
|
||||||
* posted to firmware.
|
* posted to firmware.
|
||||||
*
|
*
|
||||||
* This function is called with hbalock held to post a new iocb to
|
* This function is called to post a new iocb to the firmware. This
|
||||||
* the firmware. This function copies the new iocb to ring iocb slot and
|
* function copies the new iocb to ring iocb slot and updates the
|
||||||
* updates the ring pointers. It adds the new iocb to txcmplq if there is
|
* ring pointers. It adds the new iocb to txcmplq if there is
|
||||||
* a completion call back for this iocb else the function will free the
|
* a completion call back for this iocb else the function will free the
|
||||||
* iocb object.
|
* iocb object. The hbalock is asserted held in the code path calling
|
||||||
|
* this routine.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
||||||
IOCB_t *iocb, struct lpfc_iocbq *nextiocb)
|
IOCB_t *iocb, struct lpfc_iocbq *nextiocb)
|
||||||
{
|
{
|
||||||
lockdep_assert_held(&phba->hbalock);
|
|
||||||
/*
|
/*
|
||||||
* Set up an iotag
|
* Set up an iotag
|
||||||
*/
|
*/
|
||||||
@@ -11170,6 +11168,7 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
|
|||||||
* request, this function issues abort out unconditionally. This function is
|
* request, this function issues abort out unconditionally. This function is
|
||||||
* called with hbalock held. The function returns 0 when it fails due to
|
* called with hbalock held. The function returns 0 when it fails due to
|
||||||
* memory allocation failure or when the command iocb is an abort request.
|
* memory allocation failure or when the command iocb is an abort request.
|
||||||
|
* The hbalock is asserted held in the code path calling this routine.
|
||||||
**/
|
**/
|
||||||
static int
|
static int
|
||||||
lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
||||||
@@ -11183,8 +11182,6 @@ lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|||||||
unsigned long iflags;
|
unsigned long iflags;
|
||||||
struct lpfc_nodelist *ndlp;
|
struct lpfc_nodelist *ndlp;
|
||||||
|
|
||||||
lockdep_assert_held(&phba->hbalock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are certain command types we don't want to abort. And we
|
* There are certain command types we don't want to abort. And we
|
||||||
* don't want to abort commands that are already in the process of
|
* don't want to abort commands that are already in the process of
|
||||||
|
|||||||
Reference in New Issue
Block a user