Received: by 10.192.165.148 with SMTP id m20csp3166342imm; Mon, 7 May 2018 07:45:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp2ESPOXBXLJ/sUCV8lghDQB+DyF58qaK4ikHTVDy1dF2MXee0CQXGgxtVGD6LCBvwiAnS6 X-Received: by 2002:aca:31d5:: with SMTP id x204-v6mr22032644oix.85.1525704344821; Mon, 07 May 2018 07:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525704344; cv=none; d=google.com; s=arc-20160816; b=BtSRl8E1ojTA6w51/LJQAAQjieCWSfRLccCdfkpfsUwWq8CJEuDsvzPihzad2V0Jad KruG73XDRdlSj9X1cOFdohg5ONI5ILtIGhHtwNcDu7B/yRWJ709QuUHUiaLCU2nlM7uo H6uMkQy5yI29vjzWbTnP5ImdFGk1lLFd/biTkjadMd0EwsJn/q3p6Tao94wUyuiS+5qd h0oGGQfSWhf4fvqu7zH4yj8DYcA/ftaMHggTZND7zLe9I1m1Go4RVjHn6BR8tfdbz8te 6bkh8V8TymIKlG9Finazidp05ZcIduNnwbZQOWsAM/TZTyzQDrHLSO9b+JRuKq8rBnes sFmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature :arc-authentication-results; bh=/NRwFoJDbIVtyiacnoj01I/eLlSOl4WNbtC77TVieRA=; b=QGJtjdwjUl1KmEeoK1hbNP2/vjlKPqJj6INwR+VQRfbUKs/bVtrGBN451JyYsD+xsm Hhjfh+n9alexs4608dAmEni9FOK3YLtbxg1CiEHTQ5ZVuioAymZC3XUtKuFszXc/zAkm VcVOvXyJQRFZtnC7RRVqtJ0d0XrYRe+DiGin308WsAwHgvNmG9sBNHnzwnX52J4l1N/l eQSbe2SQ6sbwAx+pm1b48evhXBF+AiXISu10NcBmqBTJHesz89jEqPfAO3NTkCq/J8AE tnMrC0iSkot2LkUaYFIc+/kiarqJLzPgi81WnHUS6+KuLYdD/8/djmCp0VGpiWxyW/EW WuPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sARPKS0p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v72-v6si7396712oif.90.2018.05.07.07.45.30; Mon, 07 May 2018 07:45:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sARPKS0p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbeEGOom (ORCPT + 99 others); Mon, 7 May 2018 10:44:42 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40980 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752334AbeEGOoW (ORCPT ); Mon, 7 May 2018 10:44:22 -0400 Received: by mail-wr0-f195.google.com with SMTP id g21-v6so29024362wrb.8; Mon, 07 May 2018 07:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=/NRwFoJDbIVtyiacnoj01I/eLlSOl4WNbtC77TVieRA=; b=sARPKS0pbzOS3uL/WaCHPD6yrHMPSWEP50ece0WdXBrpwYajIWmYt9yzp/GpGxFTx+ IyYz2xOu7FDv/lcA+0EqGvhg++WVmUSr8vboVQQx6hJc++X8c2veL0Ruz5isAp5wf9FW DSU5uUES6TcVLp7cwpGjTSxnfSCZFm4lPdMQoNS49eZeJLmVLn0C/JtNEKq2KynL92FZ wIo44np5nRcAXYwvn2w/RLFqrYOGH6mTTRIG8MDmzLDHvx1Tk0mDNiBfMUprWsi/xZgr kK3n/E0d5SMBjTZ4suVgj5jaAOgHxu29Cqxnlu6CBnssa5P/FSQ83Ho6tSB/LmsWMm7e Q0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=/NRwFoJDbIVtyiacnoj01I/eLlSOl4WNbtC77TVieRA=; b=RMoRKgk5VC19uQyu+BTwUIjLo+9DEMHgASfWKphxAilVEr/kGlr/ytKazN/eRvbAr/ npt3q4z5TIVImCG9WQI4UYZqzOYehgasLDUiXs8J2mPxXQjeId4msK6u2gmRv0rqvywV 0FM944HcHu+2bYN6/w4bRsWjFqHC46nUWdSz04Go83mSvjQfpZhJjITly9ec3Aiwg47V K9zDsoFBoVyWgjl2Ln87og3/Lm8wG58jTdNkOp63cVHH5KHe9oUP+TSQdkUAwXqWdrcD bsbE3DpIETKWkWREdX7NPB62tfVDg6jOL9y5Iu3FMvWImjSBFSMTVcyt+P+6ssipic7w atzA== X-Gm-Message-State: ALQs6tCIJYWMP+uiWW87yqffew8e/EA1RwCwQNcihp9wBdj7ehh/8wZ6 CxlBUyRrw6POoxgWS/gAJaY= X-Received: by 2002:adf:e9c3:: with SMTP id l3-v6mr31980005wrn.195.1525704261203; Mon, 07 May 2018 07:44:21 -0700 (PDT) Received: from gmail.com (51B6778B.dsl.pool.telekom.hu. [81.182.119.139]) by smtp.gmail.com with ESMTPSA id g105-v6sm38563208wrd.45.2018.05.07.07.44.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 07:44:20 -0700 (PDT) Date: Mon, 7 May 2018 16:44:14 +0200 From: Alexandru Moise <00moses.alexander00@gmail.com> To: monis@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] nvmet,rxe: defer ip datagram sending to tasklet Message-ID: <20180507144414.GA11904@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using NVME over Fabrics we may end up sending IP packets in interrupt context, we should defer this work to a tasklet. [ 50.939957] WARNING: CPU: 3 PID: 0 at kernel/softirq.c:161 __local_bh_enable_ip+0x1f/0xa0 [ 50.942602] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Tainted: G W 4.17.0-rc3-ARCH+ #104 [ 50.945466] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014 [ 50.948163] RIP: 0010:__local_bh_enable_ip+0x1f/0xa0 [ 50.949631] RSP: 0018:ffff88009c183900 EFLAGS: 00010006 [ 50.951029] RAX: 0000000080010403 RBX: 0000000000000200 RCX: 0000000000000001 [ 50.952636] RDX: 0000000000000000 RSI: 0000000000000200 RDI: ffffffff817e04ec [ 50.954278] RBP: ffff88009c183910 R08: 0000000000000001 R09: 0000000000000614 [ 50.956000] R10: ffffea00021d5500 R11: 0000000000000001 R12: ffffffff817e04ec [ 50.957779] R13: 0000000000000000 R14: ffff88009566f400 R15: ffff8800956c7000 [ 50.959402] FS: 0000000000000000(0000) GS:ffff88009c180000(0000) knlGS:0000000000000000 [ 50.961552] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 50.963798] CR2: 000055c4ec0ccac0 CR3: 0000000002209001 CR4: 00000000000606e0 [ 50.966121] Call Trace: [ 50.966845] [ 50.967497] __dev_queue_xmit+0x62d/0x690 [ 50.968722] dev_queue_xmit+0x10/0x20 [ 50.969894] neigh_resolve_output+0x173/0x190 [ 50.971244] ip_finish_output2+0x2b8/0x370 [ 50.972527] ip_finish_output+0x1d2/0x220 [ 50.973785] ? ip_finish_output+0x1d2/0x220 [ 50.975010] ip_output+0xd4/0x100 [ 50.975903] ip_local_out+0x3b/0x50 [ 50.976823] rxe_send+0x74/0x120 [ 50.977702] rxe_requester+0xe3b/0x10b0 [ 50.978881] ? ip_local_deliver_finish+0xd1/0xe0 [ 50.980260] rxe_do_task+0x85/0x100 [ 50.981386] rxe_run_task+0x2f/0x40 [ 50.982470] rxe_post_send+0x51a/0x550 [ 50.983591] nvmet_rdma_queue_response+0x10a/0x170 [ 50.985024] __nvmet_req_complete+0x95/0xa0 [ 50.986287] nvmet_req_complete+0x15/0x60 [ 50.987469] nvmet_bio_done+0x2d/0x40 [ 50.988564] bio_endio+0x12c/0x140 [ 50.989654] blk_update_request+0x185/0x2a0 [ 50.990947] blk_mq_end_request+0x1e/0x80 [ 50.991997] nvme_complete_rq+0x1cc/0x1e0 [ 50.993171] nvme_pci_complete_rq+0x117/0x120 [ 50.994355] __blk_mq_complete_request+0x15e/0x180 [ 50.995988] blk_mq_complete_request+0x6f/0xa0 [ 50.997304] nvme_process_cq+0xe0/0x1b0 [ 50.998494] nvme_irq+0x28/0x50 [ 50.999572] __handle_irq_event_percpu+0xa2/0x1c0 [ 51.000986] handle_irq_event_percpu+0x32/0x80 [ 51.002356] handle_irq_event+0x3c/0x60 [ 51.003463] handle_edge_irq+0x1c9/0x200 [ 51.004473] handle_irq+0x23/0x30 [ 51.005363] do_IRQ+0x46/0xd0 [ 51.006182] common_interrupt+0xf/0xf [ 51.007129] Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com> --- v1->v2: added Zhu Yanjun's suggestion on in_irq() check drivers/infiniband/sw/rxe/rxe_verbs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 2cb52fd48cf1..9f1010f39bc3 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -796,7 +796,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, struct ib_send_wr *wr, * and the requester call ip_local_out_sk() that takes spin_lock_bh. */ must_sched = (qp_type(qp) == IB_QPT_GSI) || - (queue_count(qp->sq.queue) > 1); + (queue_count(qp->sq.queue) > 1) || in_irq(); rxe_run_task(&qp->req.task, must_sched); if (unlikely(qp->req.state == QP_STATE_ERROR)) @@ -809,6 +809,7 @@ static int rxe_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, struct ib_send_wr **bad_wr) { struct rxe_qp *qp = to_rqp(ibqp); + int must_sched = 0; if (unlikely(!qp->valid)) { *bad_wr = wr; @@ -821,8 +822,16 @@ static int rxe_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, } if (qp->is_user) { + /* + * NVME over fabrics can enter this path in + * interrupt context, offload datagram + * sending to rxe tasklet. + */ + if (in_irq()) + must_sched = 1; + /* Utilize process context to do protocol processing */ - rxe_run_task(&qp->req.task, 0); + rxe_run_task(&qp->req.task, must_sched); return 0; } else return rxe_post_send_kernel(qp, wr, bad_wr); -- 2.17.0