Skip to content

Commit 7d4aaca

Browse files
alexestrgregkh
authored andcommitted
IB/isert: Fix for lib/dma_debug check_sync warning
commit 763b696 upstream. The following error message occurs on a target host in a debug build during session login: [ 3524.411874] WARNING: CPU: 5 PID: 12063 at lib/dma-debug.c:1207 check_sync+0x4ec/0x5b0 [ 3524.421057] infiniband hfi1_0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x0000000000000000] [size=76 bytes] ......snip ..... [ 3524.535846] CPU: 5 PID: 12063 Comm: iscsi_np Kdump: loaded Not tainted 3.10.0-862.el7.x86_64.debug #1 [ 3524.546764] Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.2.6 06/08/2015 [ 3524.555740] Call Trace: [ 3524.559102] [<ffffffffa5fe915b>] dump_stack+0x19/0x1b [ 3524.565477] [<ffffffffa58a2f58>] __warn+0xd8/0x100 [ 3524.571557] [<ffffffffa58a2fdf>] warn_slowpath_fmt+0x5f/0x80 [ 3524.578610] [<ffffffffa5bf5b8c>] check_sync+0x4ec/0x5b0 [ 3524.585177] [<ffffffffa58efc3f>] ? set_cpus_allowed_ptr+0x5f/0x1c0 [ 3524.592812] [<ffffffffa5bf5cd0>] debug_dma_sync_single_for_cpu+0x80/0x90 [ 3524.601029] [<ffffffffa586add3>] ? x2apic_send_IPI_mask+0x13/0x20 [ 3524.608574] [<ffffffffa585ee1b>] ? native_smp_send_reschedule+0x5b/0x80 [ 3524.616699] [<ffffffffa58e9b76>] ? resched_curr+0xf6/0x140 [ 3524.623567] [<ffffffffc0879af0>] isert_create_send_desc.isra.26+0xe0/0x110 [ib_isert] [ 3524.633060] [<ffffffffc087af95>] isert_put_login_tx+0x55/0x8b0 [ib_isert] [ 3524.641383] [<ffffffffa58ef114>] ? try_to_wake_up+0x1a4/0x430 [ 3524.648561] [<ffffffffc098cfed>] iscsi_target_do_tx_login_io+0xdd/0x230 [iscsi_target_mod] [ 3524.658557] [<ffffffffc098d827>] iscsi_target_do_login+0x1a7/0x600 [iscsi_target_mod] [ 3524.668084] [<ffffffffa59f9bc9>] ? kstrdup+0x49/0x60 [ 3524.674420] [<ffffffffc098e976>] iscsi_target_start_negotiation+0x56/0xc0 [iscsi_target_mod] [ 3524.684656] [<ffffffffc098c2ee>] __iscsi_target_login_thread+0x90e/0x1070 [iscsi_target_mod] [ 3524.694901] [<ffffffffc098ca50>] ? __iscsi_target_login_thread+0x1070/0x1070 [iscsi_target_mod] [ 3524.705446] [<ffffffffc098ca50>] ? __iscsi_target_login_thread+0x1070/0x1070 [iscsi_target_mod] [ 3524.715976] [<ffffffffc098ca78>] iscsi_target_login_thread+0x28/0x60 [iscsi_target_mod] [ 3524.725739] [<ffffffffa58d60ff>] kthread+0xef/0x100 [ 3524.732007] [<ffffffffa58d6010>] ? insert_kthread_work+0x80/0x80 [ 3524.739540] [<ffffffffa5fff1b7>] ret_from_fork_nospec_begin+0x21/0x21 [ 3524.747558] [<ffffffffa58d6010>] ? insert_kthread_work+0x80/0x80 [ 3524.755088] ---[ end trace 23f8bf9238bd1ed8 ]--- [ 3595.510822] iSCSI/iqn.1994-05.com.redhat:537fa56299: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. The code calls dma_sync on login_tx_desc->dma_addr prior to initializing it with dma-mapped address. login_tx_desc is a part of iser_conn structure and is used only once during login negotiation, so the issue is fixed by eliminating dma_sync call for this buffer using a special case routine. Cc: <[email protected]> Reviewed-by: Mike Marciniszyn <[email protected]> Reviewed-by: Don Dutile <[email protected]> Signed-off-by: Alex Estrin <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c06f8c2 commit 7d4aaca

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,9 @@ isert_login_post_send(struct isert_conn *isert_conn, struct iser_tx_desc *tx_des
885885
}
886886

887887
static void
888-
isert_create_send_desc(struct isert_conn *isert_conn,
889-
struct isert_cmd *isert_cmd,
890-
struct iser_tx_desc *tx_desc)
888+
__isert_create_send_desc(struct isert_device *device,
889+
struct iser_tx_desc *tx_desc)
891890
{
892-
struct isert_device *device = isert_conn->device;
893-
struct ib_device *ib_dev = device->ib_device;
894-
895-
ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr,
896-
ISER_HEADERS_LEN, DMA_TO_DEVICE);
897891

898892
memset(&tx_desc->iser_header, 0, sizeof(struct iser_ctrl));
899893
tx_desc->iser_header.flags = ISCSI_CTRL;
@@ -906,6 +900,20 @@ isert_create_send_desc(struct isert_conn *isert_conn,
906900
}
907901
}
908902

903+
static void
904+
isert_create_send_desc(struct isert_conn *isert_conn,
905+
struct isert_cmd *isert_cmd,
906+
struct iser_tx_desc *tx_desc)
907+
{
908+
struct isert_device *device = isert_conn->device;
909+
struct ib_device *ib_dev = device->ib_device;
910+
911+
ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr,
912+
ISER_HEADERS_LEN, DMA_TO_DEVICE);
913+
914+
__isert_create_send_desc(device, tx_desc);
915+
}
916+
909917
static int
910918
isert_init_tx_hdrs(struct isert_conn *isert_conn,
911919
struct iser_tx_desc *tx_desc)
@@ -993,7 +1001,7 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login,
9931001
struct iser_tx_desc *tx_desc = &isert_conn->login_tx_desc;
9941002
int ret;
9951003

996-
isert_create_send_desc(isert_conn, NULL, tx_desc);
1004+
__isert_create_send_desc(device, tx_desc);
9971005

9981006
memcpy(&tx_desc->iscsi_header, &login->rsp[0],
9991007
sizeof(struct iscsi_hdr));

0 commit comments

Comments
 (0)