From patchwork Tue Mar 26 17:43:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604787 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E837A95B for ; Tue, 26 Mar 2024 17:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475075; cv=none; b=H1vOUNA3kFbOOcNzj2OEgbrzxgLY9TZt+OZym3Vcngp771xmg3+MAGYa8cRuLQQqYu4Z/w5w+LkXbxinSfuGVkYMawv09ykoqfEiMQ4JtAf/OVYnqsHHu0toBDiFevA8TwxstaMqEySY5BmIEUM3R4M4V1ka8nLUt3a35/nXPlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475075; c=relaxed/simple; bh=hu+sSbFLIXAKlrWao5wVCYP2Ee0hJ4jSnfY4fHwka+A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LoGkSJwy8Xve6ktiQAUIkyZwku4KgSaTgbfQ+VsvsnCA9xFnbh0zZABlnduprF8NGBjvFzaIYt7pqbmG65hPNy2b36eVlYqhEoGBPM24094spa2IuscRyhJspkntIZDB/0kjOBLjL0lDvB9ONN3VScPVp4tue9w+ZS8LKFoGTVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DaDsNrxz; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DaDsNrxz" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5a550ce1a41so1298874eaf.0 for ; Tue, 26 Mar 2024 10:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475073; x=1712079873; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GhL5vLaHOFdZg37ZOMVXMEp5PFqWRWgRRVOZKVIqNG0=; b=DaDsNrxzhsOT/5mbOgbmUJtmkQJMZMRSLIFoczN2UQ6VsSfCwAk+6spb0Rw/6De/6H uExZR4LJsvcvv9bmM2VjKkHvbtNZheT554nPYff4FnBGVXJ9hUONHA8Vs8rQIwXrAre0 QMG6LhtXl61sCCcqceeXi+eJWrMBQslmvEOQ3Vjd67hVG0re6nEVjnPkct0HsPiOWsTn uBMnUWgWf59nkc7WXkAYdX9rCU7cM4jnalEhO6IGG1xP9TO36l1LvpP66evVc6+coAp/ iLfhIvRHe/Nn7ED5BVvxt6qhQs9R0SF5jcBvA61NKKI/LlX+46Jw4jt4e+fc9/HgqdDc 3KiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475073; x=1712079873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GhL5vLaHOFdZg37ZOMVXMEp5PFqWRWgRRVOZKVIqNG0=; b=MieXfU/u0qDWrgGfIByCCXZWYco2aCbM64wHDdYEo5PeDBpqaa4Ngtbk4DbNbCgvDx J5DzqRq8C2xdGxOAfRvpRjTFRFNmGQvmn1fLaVPW5ulH7W1tn5pNsFSj+Zt/poiyeP/p 5ED6rPr+ziUHIFECXglJeT4IPX9teDaRBLt8+xUk4yXZhd37x7M6i0otynh8dRabLb7b +nlvB2vcfYX3tUSAYGoUyUZneIBeQ4jWvhxmK67OToty/D3VOjepnCN+Sh9KoplFNsv/ PXcth72y2EiftFgS4SbLXA+o7xMxpO/MuBN/oSCpBT7eTLkS1FoB2gKl250TY3wTqhcH uhcw== X-Forwarded-Encrypted: i=1; AJvYcCWgwNklaZMvnQXjaxM76zMtisFX48QxapxfO7trTCLnMJxhDOIiXtPs0gVcx3BJ9/7b8P/X8G0VoB0rXWg5epgsfcKeaVRxO6MOmw== X-Gm-Message-State: AOJu0YySJcn11lW1LcKIuWl2hxFm48Pm8UAdobBWAmNXvQxnQEoaAanG ch8l/ui42HnPLDkRz2Q6TKNlebYbs6bqbsCFtD+/sAPDPoein6aX X-Google-Smtp-Source: AGHT+IFi0gtl1AFuLLl2FrF715P3WXrNf58O+sk6a+R67N1NjDvqrcsq8GXppPZyVAQZPIL26Qdy+w== X-Received: by 2002:a05:6820:3083:b0:5a5:639a:2faa with SMTP id eu3-20020a056820308300b005a5639a2faamr2004027oob.2.1711475073400; Tue, 26 Mar 2024 10:44:33 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:32 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 01/11] RDMA/rxe: Fix seg fault in rxe_comp_queue_pkt Date: Tue, 26 Mar 2024 12:43:16 -0500 Message-ID: <20240326174325.300849-3-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In rxe_comp_queue_pkt() an incoming response packet skb is enqueued to the resp_pkts queue and then a decision is made whether to run the completer task inline or schedule it. Finally the skb is dereferenced to bump a 'hw' performance counter. This is wrong because if the completer task is already running in a separate thread it may have already processed the skb and freed it which can cause a seg fault. This has been observed infrequently in testing at high scale. This patch fixes this by changing the order of enqueuing the packet until after the counter is accessed. Signed-off-by: Bob Pearson Fixes: 0b1e5b99a48b ("IB/rxe: Add port protocol stats") --- drivers/infiniband/sw/rxe/rxe_comp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index b78b8c0856ab..c997b7cbf2a9 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -131,12 +131,12 @@ void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) { int must_sched; - skb_queue_tail(&qp->resp_pkts, skb); - - must_sched = skb_queue_len(&qp->resp_pkts) > 1; + must_sched = skb_queue_len(&qp->resp_pkts) > 0; if (must_sched != 0) rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_COMPLETER_SCHED); + skb_queue_tail(&qp->resp_pkts, skb); + if (must_sched) rxe_sched_task(&qp->comp.task); else From patchwork Tue Mar 26 17:43:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604788 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 836A01CD2E for ; Tue, 26 Mar 2024 17:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475076; cv=none; b=IE7AMASOo4aQuTmvUSJTEaF6oe1TRYcLjUug8plZjd9Wr7za3qv9p3HCs03rN9LPz3Kd9KWL7tHz8DBz4WwFmkkNG0tN7QaGyIoSysg1pWeZfcx1X+2mdffRybUFzJa4VOKAFHCGoU3SBo+Nwp5toNIq9YHtP6Neiyo48XIU5SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475076; c=relaxed/simple; bh=5x9PCYW59Lr3fJH9xBveiwjcOtBI4BdYwuPrh/imGdI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oq0BSZv5w3zf9TG/9Kd9d1a8/Db34l0NEj+KSeY/Xj3Vp2PIQmm8/vf8pIJXwlaK58XXOM5lLfTfMXip8/8W4TQKBMNRvtMQVICxPjguqm9BMx63dgv07W5oOk41mew7ajG0nwRWKrYG5O2+Iej7sxcJkI8xWac31cMqljVhrrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fkKWrMAi; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fkKWrMAi" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5a128e202b6so2052657eaf.2 for ; Tue, 26 Mar 2024 10:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475074; x=1712079874; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vPi8VLl2TsTWkZrmNx2iayh53nzskgRKcijh4znhtwc=; b=fkKWrMAistxCLWFZ3XjBMxZzghQxuPco7F08jrwUdP+G5L7SpsNaB/iL4/jqYFyj1X u/VBSxVBq555Sl5XalYZb+tw0K5nYz+2RGJGhCjaT1qtHdPDwfSckWcUlSh04GlPYtgM FQllIujfr/Pt4OooLPdkk5A67Yry1cL2WTTg6iF69sOceTZRe/3f5CWsa2a+Z9/PIF1a ypiEa2mWEQ2urfJBKDOH5CbcCcU3OkSj+5Te4JtauVHjNUYonF//Y/i3f5qXxI9dQ6gt dUcN1nNHQ9wOLxq0lPxwgTAo9G5r0Ifi1osJ0Bsq3KeaNLL/VzC40V9xJpZa5kLlE31E K1wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475074; x=1712079874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vPi8VLl2TsTWkZrmNx2iayh53nzskgRKcijh4znhtwc=; b=lPcNQAho654VzCxYXeIg093wwv2ZbvrrsM3KkVgm9IPbZp6N8Unmy+7Bu21daWkpRc 8OvVr7EmQZ0rYmRtqbTKmjcx7mxRi3SBXSqd3LSR6eHduRqrZs/PNuxPz9mlHlG9dVgt zh5X+kG5wKvvFCFi6BHkGSaSwyBk9JPO4/8MGrqOlTb7la1lze/CI6lBmH4dWYYyE5Zg Xp4veHkT9JvfhRyfOE3Lq03DRkyLPd4zxyJVakV/qti6U1ywylnP0QPX1O9mLwOG0rWv WvxjySYXbZ8nZVgiHEcVPptCW3htpFY4J5jdKttNNgw/IQAcxaRNhuQtLZc4QZ3g2Re9 fgCw== X-Forwarded-Encrypted: i=1; AJvYcCVntkrVq1dFaoC4jdrN6SJrrABb+GAquMw7ip0kUNEJZVmgb3CSlzL1jFFYPSHb0PzVqKphBW84peA0+1p2n096r+IdBKUbo4iexg== X-Gm-Message-State: AOJu0YxLJySRqmc2Q0QkKAvp+emcejSsRB2gCxwFAerQeO5vt6X0k2mc 4j2bpoMn9ZWXQ7BPyaI+A5sLySJSlnZ6v6DaJFvCtofuekZwP2fhlbqQHq/GBOQ= X-Google-Smtp-Source: AGHT+IH6x415UVrQ6VmRk+2sZoNXCgmcZKg1GIKV5pkOJHui312GfEUiiTM5Woz2ozkZdgxBRWznJg== X-Received: by 2002:a05:6820:20e:b0:5a5:23fb:4493 with SMTP id bw14-20020a056820020e00b005a523fb4493mr10770179oob.4.1711475074469; Tue, 26 Mar 2024 10:44:34 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:33 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 02/11] RDMA/rxe: Allow good work requests to be executed Date: Tue, 26 Mar 2024 12:43:17 -0500 Message-ID: <20240326174325.300849-4-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A previous commit incorrectly added an 'if(!err)' before scheduling the requester task in rxe_post_send_kernel(). But if there were send wqes successfully added to the send queue before a bad wr they might never get executed. This commit fixes this by scheduling the requester task if any wqes were successfully posted in rxe_post_send_kernel() in rxe_verbs.c. Signed-off-by: Bob Pearson Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") --- drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 614581989b38..a49784e5156c 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -888,6 +888,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, { int err = 0; unsigned long flags; + int good = 0; spin_lock_irqsave(&qp->sq.sq_lock, flags); while (ibwr) { @@ -895,12 +896,15 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, if (err) { *bad_wr = ibwr; break; + } else { + good++; } ibwr = ibwr->next; } spin_unlock_irqrestore(&qp->sq.sq_lock, flags); - if (!err) + /* kickoff processing of any posted wqes */ + if (good) rxe_sched_task(&qp->req.task); spin_lock_irqsave(&qp->state_lock, flags); From patchwork Tue Mar 26 17:43:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604789 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB6F7A95B for ; Tue, 26 Mar 2024 17:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475078; cv=none; b=P5GAuYNgd3vvCtCh4HIy01+XtwPVDo11jfomy8v+sjS3XKn2crYJ8FrNSVHJwth+DCS3sralC5rXNDlrESGGGmYonKpS7nmTQnVnmMNpN6kNvUGnEi7BwQt99tJOQrHwdVpQgXd9iOnMXgQ6aXI1V8/LOaNm5s6MuLHJZtWdUeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475078; c=relaxed/simple; bh=8iWHOP99IJh3x4cD8IHColiMPVTQtiJHUSlhmwoFscQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=agQVEhodJn0E52juVdnRhfe/tmcq6h5BgN1i77lC8KWzpOqebw3YWuh96dAQ3rfkIpPMmRJozXqqmtynLZdPsD/qQD/WOoTYDdg1BjGUi6evIXq2E++JajJwxfQId45GqDQRHzTu23DP/cxMv4ovL4KEvqXThDVAWExZV/ks9yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mIiFILYR; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mIiFILYR" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5a4f9f94e77so3295213eaf.3 for ; Tue, 26 Mar 2024 10:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475075; x=1712079875; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+5LQvpPsIQNq+n9+JoELgdiMziRukkOmYY3wjmCQ26g=; b=mIiFILYRuxgEVZJVSB5EFpOqRrxU8qfVWTVZVaIHhC8kSo/2aegbQrUqZymZxpgfhz QOVMlK0FQvylEQDwEZCkCxCANt7NmOALO8AoLTprPLpumOw/V6kPwHueTe8gZpHrHX7C TmEglGiuSQfiNX6X0v1zPXMJLD5rTqkJo5N041gHO6XkoL2DscXgJ7A3xAagjC4G/1Tt 8tyGrjUDQ+DoihvwunG2MiksBke1d4WeFCT7H3ADs5juUPxwYv5DMRWx43TZTovLDmiY PYRegzG7U43zbPXY5aZ7maXEHmzHzD1D2H1rTRXcu4wfaCn96DTgOgqbZ85sEepaNIpA ad4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475075; x=1712079875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+5LQvpPsIQNq+n9+JoELgdiMziRukkOmYY3wjmCQ26g=; b=O47ag+BBZ9SS7/PSsZzIxv8C5/LjhoxU7wF7kFUS6TxllLkg9QDsFJk9RnUg7aBL/A 2UzgAQcHcZudRiQjZiNpUI7lrHyo+cNHSHrCgMeK6s7PV4KkZ93PCj3aHbKm61lvXdxu +NB4N70YF3AFmEglawqTuSwmtzLeZwQfiieBAcbkVgKqeG1sVjFJTLibb/mLCNygKebC Up7BigeNJT9bBlMfC8P6QPcU7O0hyzYNcJl1YZxsJRUZaTsUFCv20Kl3HyCZn3wRaOgO 9QwriXXanu2707W5SmIC33XhsGapiL42oxjcIJkuZ9O2GgwVnb/ZjPlVBf4NHVCjRDkK 0uxA== X-Forwarded-Encrypted: i=1; AJvYcCVm9WtykcmhFNTQS91Qszaao+bgUhZa9/NZ1q5/CKTo2DjV8R1h6h/3a3dy9ZwBRDyyg+RILbyXHuq7C3isXxJP4Gm/GJTwsiqIbA== X-Gm-Message-State: AOJu0Yw5tYKHaGTulmOEc1MSzumMGYE6a9aXTh97NUSXn1v8QIhvaV2r eQB5SCgHrI43MA6hH03BhxS8HHHouqO4C4ce51s+eptuOMFKy3SK X-Google-Smtp-Source: AGHT+IF6/g7/u4xLrUCxs7B3zJZJMKcjlprVrK6CVaBDblVN8bxCpgmuBnC5N7J9NG5qeq0No2tLJg== X-Received: by 2002:a05:6820:c91:b0:5a5:25b9:dec5 with SMTP id ei17-20020a0568200c9100b005a525b9dec5mr13899545oob.2.1711475075659; Tue, 26 Mar 2024 10:44:35 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:34 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 03/11] RDMA/rxe: Remove redundant scheduling of rxe_completer Date: Tue, 26 Mar 2024 12:43:18 -0500 Message-ID: <20240326174325.300849-5-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In rxe_post_send_kernel() if the qp is in the error state after posting the work requests the rxe_completer() task is scheduled. But, the only way to move the qp into the error state is to call rxe_qp_error() which also schedules the rxe_completer() task to drain the queues. Calling it a second time has no effect. This commit removes the redundant call. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index a49784e5156c..71b0f834030f 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -907,11 +907,6 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, if (good) rxe_sched_task(&qp->req.task); - spin_lock_irqsave(&qp->state_lock, flags); - if (qp_state(qp) == IB_QPS_ERR) - rxe_sched_task(&qp->comp.task); - spin_unlock_irqrestore(&qp->state_lock, flags); - return err; } From patchwork Tue Mar 26 17:43:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604791 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEEB4A95B for ; Tue, 26 Mar 2024 17:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475081; cv=none; b=BJtHiB/rHhko6mGuNtYQr4gEcBnZJvXFoHOEmyNskE/wSpZiPrrXKF+S6q/cYI7vJe+Un7w19291jd/te8cPAWANHUs7zptEBeykS044yAVGuhHmv/N1JhIXxFJXDV+paJ8YnO1HdXIGnmUdH530AtgjTVHA1Bck5D41qsNzRJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475081; c=relaxed/simple; bh=t50X/6Tszd41e46zl3EW21Kgj0HeSS3Z6HC8xX/f1eY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iMRveeCKnHETcZtPPO/xlPDdETNfqXnUKFIwRwfEuNT9CypzPZZVdqz2u4zpZz6d+8VznM7B1Covmxi8MNkXj41k2eOaq8D9WKzhV5WyJD6s2PAVFt3cfAaGTRiYhbUJxKrdsIUZTNzpisAexEwzMemV2TMgpbGYMdjTXKu2Qm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MzwCGOPt; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MzwCGOPt" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a4789684abso3275469eaf.0 for ; Tue, 26 Mar 2024 10:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475077; x=1712079877; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0BiPmDBurHeOCjGjOgWR1zSxn97Z8ryeitoC4oy0wck=; b=MzwCGOPtK6nJCnVMY57dqpkeZKCY8oSr8dsLlql8c/8P7I37T0Mc5SwEqJDg3ZYYAV hZ2L/9NR9Ced3nIiBT8I7EFPt8MFUpbUpPuMphsuQEgYLc8uKKpgPa/zHHkoMo8w8/K1 EHpXPLHeOovXNanVUbkjU/nbFvgp0hwR+YlpQ6vUXxFWHHn9D2O3Ba6QxWSL27dZG1XN 7zAnt7etecqq5p0BS+FKsav4jud086RAYQXBQHQqx7hqCCdX48GVGE5mbZrCZHlT6OuJ Vbqa96hwlpZsH7PZqqkCoEBV/nrdItfpMkON6gYJrvRtZPDMgmCdUjqWgeYZt6WbB/UF KDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475077; x=1712079877; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0BiPmDBurHeOCjGjOgWR1zSxn97Z8ryeitoC4oy0wck=; b=dJyT42x7jlFFV7fOYxVyJoyGyN7zXOlEJ7DlIyzluj8KQYoMFeSBgfoT8ZLwrnDs4s itX61nVejFw3zbgoezZVHJR2k3HO7YXrCUe4gug1f2qTr8iM1dnwqiDzg3qWcZ0id1S9 Vre2g0JL+JIqRz2ifAZ020+SiJ6GbJMjQrj+VBLnPm0RM4QQeXR90jLrmT5+xk/FHYAA zmXucIF5+mRFsr0vo3AwQdssHQIinqg2vI8TJQiu9b1J9pGMIQelj7FUxgX+aMNcI0Pb sgG/9pU2c6++5ANfo/XPMPfHQXGGaX3w1uzV0hBJRam8alacZTF8dXSzmfN6sO6gtrCD KtgA== X-Forwarded-Encrypted: i=1; AJvYcCXo5nbZANZrsVRx2Im+HgpRbf60lWj83bVVQ/nvOz/X6kF1eVbWGuHX5mp5oPVOrVOwXxP+3/0vfrDhAcvWWw8TwoLS0672AGhLwA== X-Gm-Message-State: AOJu0Yxm5FyFp1kiff0eMuRzswS8BAPC/i5Z8gnm/c3zSFv79Iz60XfO kaGEmYAMcNMJh0pu3KSSijx/k+Dx+o5dkWn/UFBH83dnkzVpme/A X-Google-Smtp-Source: AGHT+IF4wEKmY29Fh78KCliB0sblldk6ECalrtqNYRlEyfZBb/Bbfv12IoIi+vCyXC+5ncalycNxog== X-Received: by 2002:a05:6820:c91:b0:5a5:25b9:dec5 with SMTP id ei17-20020a0568200c9100b005a525b9dec5mr13899617oob.2.1711475076710; Tue, 26 Mar 2024 10:44:36 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:36 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 04/11] RDMA/rxe: Merge request and complete tasks Date: Tue, 26 Mar 2024 12:43:19 -0500 Message-ID: <20240326174325.300849-6-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently the rxe driver has three work queue tasks per qp. These are the req.task, comp.task and resp.task which call rxe_requester(), rxe_completer() and rxe_responder() respectively directly or on work queues. Each of these subroutines checks to see if there is work to be performed on the send queue or on the response packet queue or the request packet queue and will run until there is no work remaining or yield the cpu and reschedule itself until there is no work remaining. This commit combines the req.task and comp.task into a single send.task and renames the resp.task to the recv.task. The combined send.task calls rxe_requester() and rxe_completer() serially and continues until all work on both the send queue and the response packet queue are done. In various benchmarks the performance is either improved or left the same. At high scale there is a significant reduction in the load on the cpu. This is the first step in combining these two tasks. Once they are serialized cross rescheduling of req.task and comp.task can be more efficiently handled by just letting the send.task continue to run. This will be done in the next several patches. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_comp.c | 20 +++++----- drivers/infiniband/sw/rxe/rxe_hw_counters.c | 2 +- drivers/infiniband/sw/rxe/rxe_hw_counters.h | 2 +- drivers/infiniband/sw/rxe/rxe_loc.h | 3 +- drivers/infiniband/sw/rxe/rxe_net.c | 4 +- drivers/infiniband/sw/rxe/rxe_qp.c | 44 ++++++++------------- drivers/infiniband/sw/rxe/rxe_req.c | 25 ++++++++++-- drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-- drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +-- drivers/infiniband/sw/rxe/rxe_verbs.h | 6 +-- 10 files changed, 63 insertions(+), 55 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index c997b7cbf2a9..ea64a25fe876 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -122,7 +122,7 @@ void retransmit_timer(struct timer_list *t) spin_lock_irqsave(&qp->state_lock, flags); if (qp->valid) { qp->comp.timeout = 1; - rxe_sched_task(&qp->comp.task); + rxe_sched_task(&qp->send_task); } spin_unlock_irqrestore(&qp->state_lock, flags); } @@ -133,14 +133,14 @@ void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) must_sched = skb_queue_len(&qp->resp_pkts) > 0; if (must_sched != 0) - rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_COMPLETER_SCHED); + rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_SENDER_SCHED); skb_queue_tail(&qp->resp_pkts, skb); if (must_sched) - rxe_sched_task(&qp->comp.task); + rxe_sched_task(&qp->send_task); else - rxe_run_task(&qp->comp.task); + rxe_run_task(&qp->send_task); } static inline enum comp_state get_wqe(struct rxe_qp *qp, @@ -325,7 +325,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, qp->comp.psn = pkt->psn; if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } } return COMPST_ERROR_RETRY; @@ -476,7 +476,7 @@ static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe) */ if (qp->req.wait_fence) { qp->req.wait_fence = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } } @@ -515,7 +515,7 @@ static inline enum comp_state complete_ack(struct rxe_qp *qp, if (qp->req.need_rd_atomic) { qp->comp.timeout_retry = 0; qp->req.need_rd_atomic = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } } @@ -541,7 +541,7 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp, if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } } @@ -737,7 +737,7 @@ int rxe_completer(struct rxe_qp *qp) if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } state = COMPST_DONE; @@ -792,7 +792,7 @@ int rxe_completer(struct rxe_qp *qp) RXE_CNT_COMP_RETRY); qp->req.need_retry = 1; qp->comp.started_retry = 1; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } goto done; diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c index a012522b577a..437917a7d8f2 100644 --- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c +++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c @@ -14,7 +14,7 @@ static const struct rdma_stat_desc rxe_counter_descs[] = { [RXE_CNT_RCV_RNR].name = "rcvd_rnr_err", [RXE_CNT_SND_RNR].name = "send_rnr_err", [RXE_CNT_RCV_SEQ_ERR].name = "rcvd_seq_err", - [RXE_CNT_COMPLETER_SCHED].name = "ack_deferred", + [RXE_CNT_SENDER_SCHED].name = "ack_deferred", [RXE_CNT_RETRY_EXCEEDED].name = "retry_exceeded_err", [RXE_CNT_RNR_RETRY_EXCEEDED].name = "retry_rnr_exceeded_err", [RXE_CNT_COMP_RETRY].name = "completer_retry_err", diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.h b/drivers/infiniband/sw/rxe/rxe_hw_counters.h index 71f4d4fa9dc8..051f9e1c3852 100644 --- a/drivers/infiniband/sw/rxe/rxe_hw_counters.h +++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.h @@ -18,7 +18,7 @@ enum rxe_counters { RXE_CNT_RCV_RNR, RXE_CNT_SND_RNR, RXE_CNT_RCV_SEQ_ERR, - RXE_CNT_COMPLETER_SCHED, + RXE_CNT_SENDER_SCHED, RXE_CNT_RETRY_EXCEEDED, RXE_CNT_RNR_RETRY_EXCEEDED, RXE_CNT_COMP_RETRY, diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h index 746110898a0e..ded46119151b 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -164,7 +164,8 @@ void rxe_dealloc(struct ib_device *ib_dev); int rxe_completer(struct rxe_qp *qp); int rxe_requester(struct rxe_qp *qp); -int rxe_responder(struct rxe_qp *qp); +int rxe_sender(struct rxe_qp *qp); +int rxe_receiver(struct rxe_qp *qp); /* rxe_icrc.c */ int rxe_icrc_init(struct rxe_dev *rxe); diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index cd59666158b1..928508558df4 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -351,7 +351,7 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb) if (unlikely(qp->need_req_skb && skb_out < RXE_INFLIGHT_SKBS_PER_QP_LOW)) - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); rxe_put(qp); } @@ -443,7 +443,7 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, if ((qp_type(qp) != IB_QPT_RC) && (pkt->mask & RXE_END_MASK)) { pkt->wqe->state = wqe_state_done; - rxe_sched_task(&qp->comp.task); + rxe_sched_task(&qp->send_task); } rxe_counter_inc(rxe, RXE_CNT_SENT_PKTS); diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index e3589c02013e..c7d99063594b 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -265,8 +265,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, qp->req.opcode = -1; qp->comp.opcode = -1; - rxe_init_task(&qp->req.task, qp, rxe_requester); - rxe_init_task(&qp->comp.task, qp, rxe_completer); + rxe_init_task(&qp->send_task, qp, rxe_sender); qp->qp_timeout_jiffies = 0; /* Can't be set for UD/UC in modify_qp */ if (init->qp_type == IB_QPT_RC) { @@ -337,7 +336,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, return err; } - rxe_init_task(&qp->resp.task, qp, rxe_responder); + rxe_init_task(&qp->recv_task, qp, rxe_receiver); qp->resp.opcode = OPCODE_NONE; qp->resp.msn = 0; @@ -514,14 +513,12 @@ int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp, static void rxe_qp_reset(struct rxe_qp *qp) { /* stop tasks from running */ - rxe_disable_task(&qp->resp.task); - rxe_disable_task(&qp->comp.task); - rxe_disable_task(&qp->req.task); + rxe_disable_task(&qp->recv_task); + rxe_disable_task(&qp->send_task); /* drain work and packet queuesc */ - rxe_requester(qp); - rxe_completer(qp); - rxe_responder(qp); + rxe_sender(qp); + rxe_receiver(qp); if (qp->rq.queue) rxe_queue_reset(qp->rq.queue); @@ -548,9 +545,8 @@ static void rxe_qp_reset(struct rxe_qp *qp) cleanup_rd_atomic_resources(qp); /* reenable tasks */ - rxe_enable_task(&qp->resp.task); - rxe_enable_task(&qp->comp.task); - rxe_enable_task(&qp->req.task); + rxe_enable_task(&qp->recv_task); + rxe_enable_task(&qp->send_task); } /* move the qp to the error state */ @@ -562,9 +558,8 @@ void rxe_qp_error(struct rxe_qp *qp) qp->attr.qp_state = IB_QPS_ERR; /* drain work and packet queues */ - rxe_sched_task(&qp->resp.task); - rxe_sched_task(&qp->comp.task); - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->recv_task); + rxe_sched_task(&qp->send_task); spin_unlock_irqrestore(&qp->state_lock, flags); } @@ -575,8 +570,7 @@ static void rxe_qp_sqd(struct rxe_qp *qp, struct ib_qp_attr *attr, spin_lock_irqsave(&qp->state_lock, flags); qp->attr.sq_draining = 1; - rxe_sched_task(&qp->comp.task); - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); spin_unlock_irqrestore(&qp->state_lock, flags); } @@ -821,19 +815,15 @@ static void rxe_qp_do_cleanup(struct work_struct *work) del_timer_sync(&qp->rnr_nak_timer); } - if (qp->resp.task.func) - rxe_cleanup_task(&qp->resp.task); + if (qp->recv_task.func) + rxe_cleanup_task(&qp->recv_task); - if (qp->req.task.func) - rxe_cleanup_task(&qp->req.task); - - if (qp->comp.task.func) - rxe_cleanup_task(&qp->comp.task); + if (qp->send_task.func) + rxe_cleanup_task(&qp->send_task); /* flush out any receive wr's or pending requests */ - rxe_requester(qp); - rxe_completer(qp); - rxe_responder(qp); + rxe_sender(qp); + rxe_receiver(qp); if (qp->sq.queue) rxe_queue_cleanup(qp->sq.queue); diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index d8c41fd626a9..31a611ced3c5 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -108,7 +108,7 @@ void rnr_nak_timer(struct timer_list *t) /* request a send queue retry */ qp->req.need_retry = 1; qp->req.wait_for_rnr_timer = 0; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); } spin_unlock_irqrestore(&qp->state_lock, flags); } @@ -659,7 +659,7 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe) * which can lead to a deadlock. So go ahead and complete * it now. */ - rxe_sched_task(&qp->comp.task); + rxe_sched_task(&qp->send_task); return 0; } @@ -786,7 +786,7 @@ int rxe_requester(struct rxe_qp *qp) qp->req.wqe_index); wqe->state = wqe_state_done; wqe->status = IB_WC_SUCCESS; - rxe_sched_task(&qp->comp.task); + rxe_sched_task(&qp->send_task); goto done; } payload = mtu; @@ -855,7 +855,7 @@ int rxe_requester(struct rxe_qp *qp) */ qp->need_req_skb = 1; - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); goto exit; } @@ -878,3 +878,20 @@ int rxe_requester(struct rxe_qp *qp) out: return ret; } + +int rxe_sender(struct rxe_qp *qp) +{ + int req_ret; + int comp_ret; + + /* process the send queue */ + req_ret = rxe_requester(qp); + + /* process the response queue */ + comp_ret = rxe_completer(qp); + + /* exit the task loop if both requester and completer + * are ready + */ + return (req_ret && comp_ret) ? -EAGAIN : 0; +} diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index 963382f625d7..3ce7a32b5dcf 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -58,9 +58,9 @@ void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) (skb_queue_len(&qp->req_pkts) > 1); if (must_sched) - rxe_sched_task(&qp->resp.task); + rxe_sched_task(&qp->recv_task); else - rxe_run_task(&qp->resp.task); + rxe_run_task(&qp->recv_task); } static inline enum resp_states get_req(struct rxe_qp *qp, @@ -1485,7 +1485,7 @@ static void flush_recv_queue(struct rxe_qp *qp, bool notify) qp->resp.wqe = NULL; } -int rxe_responder(struct rxe_qp *qp) +int rxe_receiver(struct rxe_qp *qp) { struct rxe_dev *rxe = to_rdev(qp->ibqp.device); enum resp_states state; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 71b0f834030f..d07f7bd3b2ae 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -905,7 +905,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, /* kickoff processing of any posted wqes */ if (good) - rxe_sched_task(&qp->req.task); + rxe_sched_task(&qp->send_task); return err; } @@ -935,7 +935,7 @@ static int rxe_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, if (qp->is_user) { /* Utilize process context to do protocol processing */ - rxe_run_task(&qp->req.task); + rxe_run_task(&qp->send_task); } else { err = rxe_post_send_kernel(qp, wr, bad_wr); if (err) @@ -1045,7 +1045,7 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, spin_lock_irqsave(&qp->state_lock, flags); if (qp_state(qp) == IB_QPS_ERR) - rxe_sched_task(&qp->resp.task); + rxe_sched_task(&qp->recv_task); spin_unlock_irqrestore(&qp->state_lock, flags); return err; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h index ccb9d19ffe8a..af8939b8c7a1 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -113,7 +113,6 @@ struct rxe_req_info { int need_retry; int wait_for_rnr_timer; int noack_pkts; - struct rxe_task task; }; struct rxe_comp_info { @@ -124,7 +123,6 @@ struct rxe_comp_info { int started_retry; u32 retry_cnt; u32 rnr_retry; - struct rxe_task task; }; enum rdatm_res_state { @@ -196,7 +194,6 @@ struct rxe_resp_info { unsigned int res_head; unsigned int res_tail; struct resp_res *res; - struct rxe_task task; }; struct rxe_qp { @@ -229,6 +226,9 @@ struct rxe_qp { struct sk_buff_head req_pkts; struct sk_buff_head resp_pkts; + struct rxe_task send_task; + struct rxe_task recv_task; + struct rxe_req_info req; struct rxe_comp_info comp; struct rxe_resp_info resp; From patchwork Tue Mar 26 17:43:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604790 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A7841F944 for ; Tue, 26 Mar 2024 17:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475080; cv=none; b=YpmHb0lUoqoT3phBKYrAxq1h5JFNp0FcQQu+ljgUy5JnWf48Q+UaujteNjeMUC1ZyKLKsXCO1IyHu9W+l1YxLj8mEi/zgmJyD0GwIsG8OdWvQXU+2qKs8ma6XNLM4Wg9MXDo3BRQ+uOjYf/7pGzn/Zz+wFm8sbOxlP7cgEAmLFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475080; c=relaxed/simple; bh=XIImzMuwSkGxY8LRL32oWi/vfkg7DtdUs916utrYrLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bllZ8Ai91dt5ScD07jbxXJS6teSgLZ7cFQefQakw04oRdG2n28mqn+g0150DHATQxeDqCQ16NGWcHFW2EsJ6MVL2ZbDovEDMucBfzRc5v1Gvw0wsTA7nZ3e2Nn6ULTm7m/mk6f0VgCAg4beRXWLCkIyHMNuvOr3JgBbXGSUA4UE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V75IM9Q+; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V75IM9Q+" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5a51c063f99so1777711eaf.0 for ; Tue, 26 Mar 2024 10:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475077; x=1712079877; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vs13IV4o1jDjBU3SuR7/cEsZjlsaAJ4yfEzh55jmKHc=; b=V75IM9Q+kJZhp0W/sTkGAufOFWAhhE/QCksRYf/SZjAmPnx3XOhl0IdRkHQFGDkC5D xND3Bt+XGKPwwCwWp2oZH3tCmP3CAczS/kLTwBp7AxoR+KF22SrvZpT7WOeS8qx0RFSR r7rhZG0s5HjwsxOxdJOPRcI2hhRBG2YmoS+mwc0aCbsgIeX7Rs9rTa6NVgAgwvHba1c6 AKxdPjN/tgIgrzguGDY7sEb1CJYfKGrHPc/GHjRGNzPSXJ98aFzR8boCbRHIbFMTT8GA 1rCQnWXdmPmHyE9EwRRTsKaxpm+RxUHZ9orZQbFeWPiaP2/5+ODssLO2Ignr08nAVYOO JbHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475077; x=1712079877; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vs13IV4o1jDjBU3SuR7/cEsZjlsaAJ4yfEzh55jmKHc=; b=LPDczKEl3VS2eIawFG0QjeAI/7spJJDnas5WRu98SfBWMrFMWP3zbBG/R6sHHusR0w OxyLwQ5QfwI37ce4SSe8Zzof6jUNixJGo3kVJ6zc4zfXmGyzOw6jn+B2uC/Tj+hbAkvk 2b+qLtUVirgmDA7cWFd+kyEEmVTS5CjBUvsdFuNRWBlHDMVUvpjQHJyDfN9N32sYmFFM bgGvDOX/24YKEqP29J4xaOjPmkuFh9JLX6+j3QzADC1/efdTpq3VRnDU1YkvdPcUw8XW 0KUWVdstLlgzj9wlBwgHyoxv5sL+nT00MqMXGRHlCThU5msEVPUTXKy0IW3SWn7xNmsJ WeMQ== X-Forwarded-Encrypted: i=1; AJvYcCVNUK64pTfCzr6a1UDTPii7mhv19XxCaLaOJ6+U5HnTCllePxGetqgXmaAIKxgaoOsbiu8iwmek7QSQu+RjkUI2OCS+gbRgF0k/wg== X-Gm-Message-State: AOJu0Yx9IWQ/YSPsXRrjJTdqcHO5nV0HIwUQBY5TQMa5Jp/499SyjYKK VRslQ4UxE4HESt4nKaL7dDnBzGyXt360i5BAmnqNbHIWQg9tqekv X-Google-Smtp-Source: AGHT+IEr2DF0Z0sMKysZRWzPaY+qSNqLNUz/8hxSJ9ZPWB5j+Fjf+nxMrJ8RhxmPMHHDMddRGDzyYA== X-Received: by 2002:a05:6820:1e01:b0:5a4:95e6:f15c with SMTP id dh1-20020a0568201e0100b005a495e6f15cmr621581oob.5.1711475077718; Tue, 26 Mar 2024 10:44:37 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:37 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 05/11] RDMA/rxe: Remove save/rollback_state in rxe_requester Date: Tue, 26 Mar 2024 12:43:20 -0500 Message-ID: <20240326174325.300849-7-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that req.task and comp.task are merged it is no longer necessary to call save_state() before calling rxe_xmit_pkt() and rollback_state() if rxe_xmit_pkt() fails. This was done originally to prevent races between rxe_completer() and rxe_requester() which now cannot happen. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_req.c | 40 ++--------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 31a611ced3c5..e20462c3040d 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -573,30 +573,6 @@ static void update_wqe_psn(struct rxe_qp *qp, qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; } -static void save_state(struct rxe_send_wqe *wqe, - struct rxe_qp *qp, - struct rxe_send_wqe *rollback_wqe, - u32 *rollback_psn) -{ - rollback_wqe->state = wqe->state; - rollback_wqe->first_psn = wqe->first_psn; - rollback_wqe->last_psn = wqe->last_psn; - rollback_wqe->dma = wqe->dma; - *rollback_psn = qp->req.psn; -} - -static void rollback_state(struct rxe_send_wqe *wqe, - struct rxe_qp *qp, - struct rxe_send_wqe *rollback_wqe, - u32 rollback_psn) -{ - wqe->state = rollback_wqe->state; - wqe->first_psn = rollback_wqe->first_psn; - wqe->last_psn = rollback_wqe->last_psn; - wqe->dma = rollback_wqe->dma; - qp->req.psn = rollback_psn; -} - static void update_state(struct rxe_qp *qp, struct rxe_pkt_info *pkt) { qp->req.opcode = pkt->opcode; @@ -676,8 +652,6 @@ int rxe_requester(struct rxe_qp *qp) int opcode; int err; int ret; - struct rxe_send_wqe rollback_wqe; - u32 rollback_psn; struct rxe_queue *q = qp->sq.queue; struct rxe_ah *ah; struct rxe_av *av; @@ -799,9 +773,6 @@ int rxe_requester(struct rxe_qp *qp) pkt.mask = rxe_opcode[opcode].mask; pkt.wqe = wqe; - /* save wqe state before we build and send packet */ - save_state(wqe, qp, &rollback_wqe, &rollback_psn); - av = rxe_get_av(&pkt, &ah); if (unlikely(!av)) { rxe_dbg_qp(qp, "Failed no address vector\n"); @@ -834,10 +805,6 @@ int rxe_requester(struct rxe_qp *qp) if (ah) rxe_put(ah); - /* update wqe state as though we had sent it */ - update_wqe_state(qp, wqe, &pkt); - update_wqe_psn(qp, wqe, &pkt, payload); - err = rxe_xmit_packet(qp, &pkt, skb); if (err) { if (err != -EAGAIN) { @@ -845,11 +812,6 @@ int rxe_requester(struct rxe_qp *qp) goto err; } - /* the packet was dropped so reset wqe to the state - * before we sent it so we can try to resend - */ - rollback_state(wqe, qp, &rollback_wqe, rollback_psn); - /* force a delay until the dropped packet is freed and * the send queue is drained below the low water mark */ @@ -859,6 +821,8 @@ int rxe_requester(struct rxe_qp *qp) goto exit; } + update_wqe_state(qp, wqe, &pkt); + update_wqe_psn(qp, wqe, &pkt, payload); update_state(qp, &pkt); /* A non-zero return value will cause rxe_do_task to From patchwork Tue Mar 26 17:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604792 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8927D1F947 for ; Tue, 26 Mar 2024 17:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475081; cv=none; b=RdrqnOdQb4cPU+XVclgzxJbW0F0kZGbwatifEzuXc/3rzmmfbnaKJp7OuDoVCPjZZXlz8s4mdX4E2D0qI507CYLwyNX0ibgAArn3fi5OfLrYOWJjWere4LlHnN2sGfhHLltSRlcAnoSQOqKs5DG+Y4hUdMWjMw+GtQZwZvk5mBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475081; c=relaxed/simple; bh=zg0NyeYEpLuB4fyjuE3MvfLeRVPQSd4yd1s54JV6GWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QzAzXsPJbZniq3XacvE2RjbE8thHNjv9fL5jrL86VCxnggS60FLqoGmKKkJAgHjUfUe/DgmToQBHSOW7zK4VzlhQbC4y138qsuAGV4fQoirDOJlWpBqruQYQtBZLVLSR5RDXIGNgYzfh4540pQ6u8UNn6hY8LWoz2LnJFlXQNN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FhfKESeF; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FhfKESeF" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5a492093073so26367eaf.0 for ; Tue, 26 Mar 2024 10:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475078; x=1712079878; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dXh7V81ZGQZDnKxGumMU/gHX+tc03N1++sgZn0l9RzY=; b=FhfKESeF9k5QOE6I+DxCE4kVItTt9jlsjrFclBtWN+yasmkeG/U9bWPo3XeY3ae69q V8M8EsVUi2zyzPiuxoiNxYRNhfRuWJrRmroFzXk6dJoTuYGyVDaK6fZPVWzV/0qRed9v TyWYIT9BXh4IYJ7CzTu/C63eIVFpU7RQWn/69FniREhXPlABolViTuiAr/53dMgutUSS kQjp91DROdq0gSfAqCJ3K7lGlSj82WuPFc/HjKLAgQVK7KI6eEGtSLHNkIXec2QhNmR7 CgDUT+zT58w0ZaKfypm9CSlttZs/4RKzv0SdSBc5e+9mgnE27ETwoWk+ozJBcQccNH5n /IDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475078; x=1712079878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dXh7V81ZGQZDnKxGumMU/gHX+tc03N1++sgZn0l9RzY=; b=uakNwfrlb5bFCXkUXk/+3pinyYnA0PZk7pLFiz3dLBXT4VcdpQz1mrsf3Ia5OIrfqG S+vBlcx3gx2MiPQfsQxKPDaxxFEsYbj0SVmd2K8kbB4YZ8qleaN+oiaqFbtZrc702XQe OPbItXp5MxSECHlFjMUmrmRVrNmw/kuUFwEzrlNfHOvyJWXngSeqxCFaU/H6RC7lVS27 YDqrNeO4WLbb2kmgr6k4MZJdFw4PeqPnnhyDAKrrU7oQVWnutEuqrjBFJWqVRlNQA3Ix 3672f3dF9lqXwvTLXwXytmNxYpPtiQxVQVG2S9oNFLVOBM8mkqIPAfPqy8IejOCTiuAI cj5g== X-Forwarded-Encrypted: i=1; AJvYcCUq7NJ4AHDx2FgqgR2km/GFlbjY6yjtWPp38p8p6Hr+Z8k63zSYY9xy6D9qdB+bV3L/GPoTA9wGZIL1XVt4gh2XAxGfaK1VfTdJqg== X-Gm-Message-State: AOJu0YwkcicXh+96TB5ZbP0JkEZ0eVlgVhfExA6Ahp/c+kl7ZGykutzS qXwzb551IkcvlqsJ09j3ATi8XFiQucHs3VsVvDa69xAu1OAjVOC5Bj0efRmO2tI= X-Google-Smtp-Source: AGHT+IHEupCyYgn6WDzELXPYMlX685NvELXg8zFN8d4+eYiOZ6BpyVfKesaYVWVDkChk+aA4UhwX/w== X-Received: by 2002:a05:6820:986:b0:5a4:5526:1740 with SMTP id cg6-20020a056820098600b005a455261740mr972890oob.2.1711475078670; Tue, 26 Mar 2024 10:44:38 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:38 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 06/11] RDMA/rxe: Don't schedule rxe_completer() in rxe_requester() Date: Tue, 26 Mar 2024 12:43:21 -0500 Message-ID: <20240326174325.300849-8-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that rxe_completer() is always called serially after rxe_requester() there is no reason to schedule rxe_completer() in rxe_requester(). Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_req.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index e20462c3040d..b217fa94ff03 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -631,12 +631,6 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe) wqe->status = IB_WC_SUCCESS; qp->req.wqe_index = queue_next_index(qp->sq.queue, qp->req.wqe_index); - /* There is no ack coming for local work requests - * which can lead to a deadlock. So go ahead and complete - * it now. - */ - rxe_sched_task(&qp->send_task); - return 0; } @@ -760,7 +754,6 @@ int rxe_requester(struct rxe_qp *qp) qp->req.wqe_index); wqe->state = wqe_state_done; wqe->status = IB_WC_SUCCESS; - rxe_sched_task(&qp->send_task); goto done; } payload = mtu; From patchwork Tue Mar 26 17:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604793 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81185200D1 for ; Tue, 26 Mar 2024 17:44:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475082; cv=none; b=T637/gM76mnGk0DMh9JigbneiPicAnbMk3w0TEw6gKWyFeCyRYqtdg6Hxj+GmGv85YH4tNqRdL19q6i/wPFjgafkNOwPFo85bbUrI5SqTXOoc0pGU90eYuv0DVBZM0o361Yy81zjoOiEr4BfEVxpkHQm75DN9ZDV56KJSRWC0RQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475082; c=relaxed/simple; bh=x5SWuSvv3SMTKBKxaAPrs628VcfWHAdoZKcjlwv9V7g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XN3/j89KO4O4vPOtzKzNYKCRkVTmJlg4afTwJdcExb4VORP9wPPcKRFWMHJIuLdVvuzhNbCz2b3BcAZGREvDpgP6nUoIySYwubLZkfs7f8yEMFpCSG7ox0aJvFMIzm0JicafcHkDX+i0CoKrLESdAR0FB9A2wKEXZPKVglnzDNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZlFq7YbS; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZlFq7YbS" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5a53d5aaaa4so1447313eaf.2 for ; Tue, 26 Mar 2024 10:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475079; x=1712079879; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xCjztQYodtMXHgbrSSmzgM11j2HWm+7GDAVbEYgFieI=; b=ZlFq7YbSfFTQoHnVRMC2JvpkSYbH6TmGZWvw/K+8C2i/1BOXw+3qiYuDIQibXBZ+wz hX/UvattUZ/nwHaQSk0xbkcl6o52/STbl/dNv1yS1wtqvXR/UTlIDiOxJyzjGpwrvXou 1B4+zO5icuJbToXbRJ6JVRDPc9iG7OS+zsXLPdl3hIX1kgCCs3fP5GdM6wQSjsnUXR3u 2sXHD6JWSBrIXsQDMZ/7FVxJJPXc4SrUiyT/YWxVchfQkLTLpngzR1k9JS+dWkeYttfC CbNATdyVJk4DSdsXF8OkR2Wbda7pW5Mdq42Rjla7PC+b3wu03YDsWysI8M4P8verQvGn 3NhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475079; x=1712079879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xCjztQYodtMXHgbrSSmzgM11j2HWm+7GDAVbEYgFieI=; b=VN6DA8PD9I2hm9W0qVsGtAHs9nW6vg0bkYoQBPbxUDN7YwX9EThYLLGyFu61Vxx5kH 8xRHmeqoHrPdKGOjAYDc5UHYMlQIfNh5qhleCHaRmsV9w9xrRgK7Yi5cFPCP7usPS5cb W1U4Fihua7KcHOrAEY59kTgwGdLy0Msz/L/Dg1VRBddpEixoeaAKg3rOYwMFLK/ckrft HBU0IwaDcoEe6kbhM4HJfLVdzU+O0z8q5gGskAAkbaKyY77b9NFsHUwu6KvRxdmuhBEQ hz+45ayRd45ZTERaW/YJBlPHdZeF6pBDBqZI64ISGpV5Xt7IR/+i2K+r00CJGNqoFL18 DmYg== X-Forwarded-Encrypted: i=1; AJvYcCXet+q365fwwNMx0kBQ/M1DY1LEQBW+oSbyzBk+0w+jd/fJeEvAWvo3OKUpFwDo9eA8k/9CtkQo2B3jrS/Bugcx+KDl7aQ+girMhQ== X-Gm-Message-State: AOJu0Yyr8e+3cpo8aZzcjsC4TlDMDYqCb25egXyK8DdeywVaV9CW9xcW 7pc/1HhCFOXvrphZPXwpaSiE6di2e3fBVIIVbWRQd4iLVzdFD6xN X-Google-Smtp-Source: AGHT+IHO528N7GUUMdImdoYZM/P2IPpmLrk/QbDTlSQFezayWxq/XIHy//6on8C3/2VpRW2R3wsGlQ== X-Received: by 2002:a05:6820:2111:b0:5a5:639a:2fa0 with SMTP id cd17-20020a056820211100b005a5639a2fa0mr4623581oob.0.1711475079494; Tue, 26 Mar 2024 10:44:39 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:39 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 07/11] RDMA/rxe: Don't call rxe_requester from rxe_completer Date: Tue, 26 Mar 2024 12:43:22 -0500 Message-ID: <20240326174325.300849-9-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of rescheduling rxe_requester from rxe_completer() just extend the duration of rxe_sender() by one pass. Setting run_requester_again forces rxe_completer() to return 0 which will cause rxe_sender() to be called at least one more time. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_comp.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index ea64a25fe876..c41743fbd5f1 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -82,6 +82,8 @@ static unsigned long rnrnak_usec[32] = { [IB_RNR_TIMER_491_52] = 491520, }; +static int run_requester_again; + static inline unsigned long rnrnak_jiffies(u8 timeout) { return max_t(unsigned long, @@ -325,7 +327,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, qp->comp.psn = pkt->psn; if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } } return COMPST_ERROR_RETRY; @@ -476,7 +478,7 @@ static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe) */ if (qp->req.wait_fence) { qp->req.wait_fence = 0; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } } @@ -515,7 +517,7 @@ static inline enum comp_state complete_ack(struct rxe_qp *qp, if (qp->req.need_rd_atomic) { qp->comp.timeout_retry = 0; qp->req.need_rd_atomic = 0; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } } @@ -541,7 +543,7 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp, if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } } @@ -654,6 +656,8 @@ int rxe_completer(struct rxe_qp *qp) int ret; unsigned long flags; + run_requester_again = 0; + spin_lock_irqsave(&qp->state_lock, flags); if (!qp->valid || qp_state(qp) == IB_QPS_ERR || qp_state(qp) == IB_QPS_RESET) { @@ -737,7 +741,7 @@ int rxe_completer(struct rxe_qp *qp) if (qp->req.wait_psn) { qp->req.wait_psn = 0; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } state = COMPST_DONE; @@ -792,7 +796,7 @@ int rxe_completer(struct rxe_qp *qp) RXE_CNT_COMP_RETRY); qp->req.need_retry = 1; qp->comp.started_retry = 1; - rxe_sched_task(&qp->send_task); + run_requester_again = 1; } goto done; @@ -843,8 +847,9 @@ int rxe_completer(struct rxe_qp *qp) ret = 0; goto out; exit: - ret = -EAGAIN; + ret = (run_requester_again) ? 0 : -EAGAIN; out: + run_requester_again = 0; if (pkt) free_pkt(pkt); return ret; From patchwork Tue Mar 26 17:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604795 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69F6721344 for ; Tue, 26 Mar 2024 17:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475083; cv=none; b=ut+xPvN4cLiVIisERq5zbDqDb4LhngL6wCbJsOOAhOixoN8cW6CCPua10ALdS9+dOhTFiHseyV2zIVsojb7TEDSZ49kTG8o81gBIfPxTYPtsVRc6SPoqx+TYmoLb/5AxGj8UnxDd46bJEPatA7peEBnr6qsgoNj8bh6BVIONnfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475083; c=relaxed/simple; bh=aVaT9oEgjB+t+ktYasHRoGdnbMAnICSWwDtQfMlVfwM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n4nimgDk3W1KeK/43Q9jpkx9ctQMkeQLti0MHtMPUut0+zaXrW7diX9Rrxx3XcipPfaADNPPfe5XqAD2/3DZDUvO3WlgjsfdJY8OYAKuYB5uxvE5wVn3cu2C54kYdyfw4riAN2SuwZ6Vz7X5OmhF/dJpEHv70k/zR+f93Z6aNRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HYiuDcWj; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HYiuDcWj" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5a558d9c33aso1092143eaf.1 for ; Tue, 26 Mar 2024 10:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475080; x=1712079880; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JzZlBTHvySRsZ3KRMvxE7Z6XgjpPewuA3TvQlMhf1s0=; b=HYiuDcWjjFWRcMb6gXj1J2t1dPC/TQ7PLEGUo5vLT1OUpkXgV5B4AlcpoD1r3ocUCI l6PrbdaqTqRoXyBhrDwShS8XnwfI5pgjbP3vbDBH69hvvUhKHWxRVJ4p1iB20ytGOStI zECZSvXnmREclsu6ZGJQhGOrb9Mfj+PFtwmdXggWKf1RxrPIyjlRbtWTFPoI4LVtPLL7 s0u1/eNORgmdK9m6qEWa/oXrl09h9fWPkkCBAZURe+p3m4QfdZnkjrw+OTWqR2jF6Lar Wvit920UmflAtKS/HHaZgsJN6GWksR3Juc7QoInkyMvmPrkZJERUMA+KMr2AslvSXE7b I5Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475080; x=1712079880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JzZlBTHvySRsZ3KRMvxE7Z6XgjpPewuA3TvQlMhf1s0=; b=c4yl6BjlwPVDIlYzRu6UCB4mQjz7FSfYskKrpq97TxcIidMO25vRHsMnPuoLcj+sXr vbBd9pxjfYi8F5YHLXLlmsdlT2a2ZhwTyOTphFzemfgYBokv9k4A3j0cdehI8yk5DGIL 4DpFTBFYP9rVeiqltHyqWx9N0QM3edQoAZBuRFA5desek5Yi81jfluwW28plSPY+03ko 5J0CfIEWdzRv9EC1P47AuNJdQ7CPwVJSin1hswm87hUMaj9NXONsdflfQpBfROWXCLJQ pt+w9gMD09Y6FxI9HEZNJiaG6y7sWE9RUqWvb9g3FKPbJerxmvZtcb02H21BW2T9tNWD 86og== X-Forwarded-Encrypted: i=1; AJvYcCUO3kEn/qhqEX8fgxj2oMkGl5WIYq4LuH4r18rh2DDagiQFvpbV6hrdSaf+AI4HbKxpvBW+Kw2hkQZEVm6+XjgBbk3eaJP7gGENQw== X-Gm-Message-State: AOJu0YxjIEVhckwaVo/VbcZx2ytE9FWeJLZ0QKB5qfy8pb+wDishCoFX DqpmTFIl7zwDDk7iUL0FMoypE9GPzmp5oQ2S6rMce+hU8o12sD91 X-Google-Smtp-Source: AGHT+IGLO74eWsp4oSRFRlPbCbr6IPsDWcU6VFN1AwKp7QKLCP0cRW+J0ftLOfCJEizFmLXK1Oq2bg== X-Received: by 2002:a4a:ee86:0:b0:5a5:639a:2fa4 with SMTP id dk6-20020a4aee86000000b005a5639a2fa4mr4546112oob.0.1711475080512; Tue, 26 Mar 2024 10:44:40 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:39 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 08/11] RDMA/rxe: Don't call direct between tasks Date: Tue, 26 Mar 2024 12:43:23 -0500 Message-ID: <20240326174325.300849-10-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace calls to rxe_run_task() with rxe_sched_task(). This prevents the tasks from all running on the same cpu. This change slightly reduces performance for single qp send and write benchmarks in loopback mode but greatly improves the performance with multiple qps because if run task is used all the work tends to be performed on one cpu. For actual on the wire benchmarks there is no noticeable performance change. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_comp.c | 13 ++----------- drivers/infiniband/sw/rxe/rxe_resp.c | 12 +----------- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index c41743fbd5f1..26c06f840184 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -131,18 +131,9 @@ void retransmit_timer(struct timer_list *t) void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) { - int must_sched; - - must_sched = skb_queue_len(&qp->resp_pkts) > 0; - if (must_sched != 0) - rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_SENDER_SCHED); - + rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_SENDER_SCHED); skb_queue_tail(&qp->resp_pkts, skb); - - if (must_sched) - rxe_sched_task(&qp->send_task); - else - rxe_run_task(&qp->send_task); + rxe_sched_task(&qp->send_task); } static inline enum comp_state get_wqe(struct rxe_qp *qp, diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index 3ce7a32b5dcf..c6a7fa3054fa 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -49,18 +49,8 @@ static char *resp_state_name[] = { /* rxe_recv calls here to add a request packet to the input queue */ void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) { - int must_sched; - struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); - skb_queue_tail(&qp->req_pkts, skb); - - must_sched = (pkt->opcode == IB_OPCODE_RC_RDMA_READ_REQUEST) || - (skb_queue_len(&qp->req_pkts) > 1); - - if (must_sched) - rxe_sched_task(&qp->recv_task); - else - rxe_run_task(&qp->recv_task); + rxe_sched_task(&qp->recv_task); } static inline enum resp_states get_req(struct rxe_qp *qp, diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index d07f7bd3b2ae..c7d4d8ab5a09 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -935,7 +935,7 @@ static int rxe_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, if (qp->is_user) { /* Utilize process context to do protocol processing */ - rxe_run_task(&qp->send_task); + rxe_sched_task(&qp->send_task); } else { err = rxe_post_send_kernel(qp, wr, bad_wr); if (err) From patchwork Tue Mar 26 17:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604794 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41829210E4 for ; Tue, 26 Mar 2024 17:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475083; cv=none; b=paW1FEqUHE2SgKe6cczFW+5ullx6TJVzVEXxjsXUjfvKwXB0MZN2aepKnFI7Spu/9j196g/sAprKTeMLifeapQMNQylRmLWCktBapqUfStgS3d/BulC35BwSBKi2gZNbYfLsL+FhjiTtvs3VzhHU/ZDSUnE2M1UsTuPwBmECq1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475083; c=relaxed/simple; bh=P7tOOgeY0L2CvvM2QtJqeSL/YwkPxpl3T6DkGN+oUBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oj1b5sYAi1HlqBN1iDIiGattdOD0kcjC307Tk4rluLyA82PgiXOjCwLQ64xkpJwLgmpALl7yqDKDjTyk403N+wSjkNxIxnvlm1SHhwnKhb0nrVhuCVrqP81zn886OfJSiuMdaFp0SLLUhqOFF9CEb0Tqr7Z9uej5oVws/LIvbjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JDPrb/5P; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JDPrb/5P" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5a5508007fcso1157881eaf.2 for ; Tue, 26 Mar 2024 10:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475081; x=1712079881; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ofF1b+zvHAVjiqjOdcrJdzZ1L5D5MRm+IjXlS0QMc+8=; b=JDPrb/5Pcx96pJDa7ZJ8OwEXSKWb4te9qi67NtUQFqpOuuIDO9jku4oSEpFZK7cBye Cec1OitnatvGcb1VzlOiTeiH4JGEJRPJzULFlEEcwbYtADgBp3DMFr1mvMx0f3COPyrr H8/dQaF+70zM7piw0Kp/SE/vTkBAkF7nr4kKGZUDQBR4IBX8+Rw5+SF35FnH51TKkzjK mDywDNK+yHlpfJSV+YgzByl8A/lQBlroHX4IYGUYMMjT0CWXNeWbvjsxHBual/u+cNsv R3D8y5Dc8fC7B1NPST4cJC+Q+zYK4IIc1XHDeKzzyFkDbuEKkUxf28izAhQfs0IQDG6E OslA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475081; x=1712079881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ofF1b+zvHAVjiqjOdcrJdzZ1L5D5MRm+IjXlS0QMc+8=; b=GBKj+/vgOrHSmBHmSQDXT0pgZmo0XUXIyGkmHwA/Ee9xqCodg69ZvVKn66Dzsfu78l B9k9qL1CbIY18MiqpmQbKKx+kDTBKP07WhYI+DpQuYyJGfEDOwrJsYHe0Q79mglneBio VKLayoXiEor6auXKt8hJwgEWBitxyTf2z4hz+vNK1B5EQWgPDHCSk6Ms2w6w9adMxErx F1UdcCsiSYQ5XS0E52vKgTk9zJM3oDSLKCR6I/64Pfoqi9dfDIE97IKdAcRBjanqHmwT QchcePAuSwedmv1MyBF/1Mb4enS9hoMYzZRccoyBEptXBCEI+PkcIkLm/RB0BptpQeaQ UQTw== X-Forwarded-Encrypted: i=1; AJvYcCUnQ2oplhFhbp3G95HtlmWrEVI4NNTDGGI2GQiYian1sPnXzk9hZlLp0RCghv+ZQUvTocZRGK6j2DUhFZY8oqv7UmvX1G3tZRX/Xg== X-Gm-Message-State: AOJu0YysvUd31wWwJJnWc7ZH/akeiL0Rpj8cHXtsxcCVwc1SWaqfkkSd ZohdzSYHzlNWaORjUEki637wy6TrON0x5qSn3+9Qp3Fa7o5V935f1roWL6Ok+kA= X-Google-Smtp-Source: AGHT+IFHxDOKjZsXWsyb1UkXdg8X/1kkT0Q5iAS0Kkp6smZ9Hdk++fIlCjlkjdBEqsl3BHzXMzhLag== X-Received: by 2002:a05:6820:20d:b0:5a1:a7b3:3d0 with SMTP id bw13-20020a056820020d00b005a1a7b303d0mr625767oob.4.1711475081321; Tue, 26 Mar 2024 10:44:41 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:40 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 09/11] RDMA/rxe: Fix incorrect rxe_put in error path Date: Tue, 26 Mar 2024 12:43:24 -0500 Message-ID: <20240326174325.300849-11-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In rxe_send() a ref is taken on the qp to keep it alive until the kfree_skb() has a chance to call the skb destructor rxe_skb_tx_dtor() which drops the reference. If the packet has an incorrect protocol the error path just calls kfree_skb() which will call the destructor which will drop the ref. Currently the driver also calls rxe_put() which is incorrect. Additionally since the packets sent to rxe_send() are under the control of the driver and it only ever produces IPV4 or IPV6 packets the simplest fix is to remove all the code in this block. Signed-off-by: Bob Pearson Fixes: 9eb7f8e44d13 ("IB/rxe: Move refcounting earlier in rxe_send()") --- drivers/infiniband/sw/rxe/rxe_net.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 928508558df4..d1dd440b1e4f 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -366,18 +366,10 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt) rxe_get(pkt->qp); atomic_inc(&pkt->qp->skb_out); - if (skb->protocol == htons(ETH_P_IP)) { + if (skb->protocol == htons(ETH_P_IP)) err = ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb); - } else if (skb->protocol == htons(ETH_P_IPV6)) { + else err = ip6_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb); - } else { - rxe_dbg_qp(pkt->qp, "Unknown layer 3 protocol: %d\n", - skb->protocol); - atomic_dec(&pkt->qp->skb_out); - rxe_put(pkt->qp); - kfree_skb(skb); - return -EINVAL; - } if (unlikely(net_xmit_eval(err))) { rxe_dbg_qp(pkt->qp, "error sending packet: %d\n", err); From patchwork Tue Mar 26 17:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604796 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D3E1D54D for ; Tue, 26 Mar 2024 17:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475084; cv=none; b=AcsIv+OFj3Su0bx+YTuCmDO8as3Z4anBiu59EmCgDBvbBoa8Lp6o+jzRxJgfPVe+mZrAFv91D4/y7WAssh2Bq6IluNGjfYaWuPkKOs1r0+aDMTvbsEwZZgIhySZVMf3DINZUgYyu3SehF+QvqTUvpiKhWWwYfTPbA85QMPkAHNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475084; c=relaxed/simple; bh=DTnf6HEfg54WcZlJbM0UnOUOfT1SyJb8ehxXzVRsjls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9JOHpgJqZqa3COQ02YoGASqD8dkIUHDl0AxHnExQpSF+XkMDGPTewNnXkeiJYPB3s1tBhuJ4IbchvIqbIR3W3/jpQ2n/pcOR/nwnOS2auZkHRWlB0fI05hrxpICmBUAY50PgdWClgsKuEZyCilevDYEGi213Xcd8NAW6Wy0SBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f7omdsts; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f7omdsts" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6e696ee8fa3so19085a34.1 for ; Tue, 26 Mar 2024 10:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475082; x=1712079882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x0Gn+52B+bX6FQ71fiFjhV1CrL3vIObKr40YlCDrQRk=; b=f7omdstsEGr2NOD09EyGlZyVcCbjDU479kI0GK/xPJxk0zVLT+WU4shk+2tZLsgV2R b3olzJn3/naP3tp5WMf/FD/3rTtWNB7dUuOUCiGYW90Bj5HegxTD0Sem8y6pJMwMUV0F /AEKVKjeBSGxMgyPRR70+PtMDFB/q1AP+eN6ZRVkLQip1MUSb4QFhgwgrhK2OCAAdUfA 7PPiGycSQudAfxQ6U74nbnH+/IKC1Q5mlel4ENCxip4N+yXEfhzI+vVO+LU90rDecaGB VWfmeOjFWpDw97FATJnH4VnJwSRVqVUsJy79qt6E7N5XYTMgvzFcQZfWmUWj8YzBLVXH zTjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475082; x=1712079882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x0Gn+52B+bX6FQ71fiFjhV1CrL3vIObKr40YlCDrQRk=; b=hIodgiIZxWt357zu8sf6XYfiehyusdZCxKGCEZ3Np4e/7XxvYmGRdA90TlK9CcGM6N c/T+MEsmQXudnvMpopMJbNc1giKIpcSd2qNAMTf2TPCnSilGwMv6O62eXW9BewUZjXaA WEYNMYJC4QrCHMjZPpsHDl1MwM2jb3CUjuYp550skzvChnbTpE3oOQ3DjxGnhxWtWXqj pneCvoMXubmH99j5upkVstMWl1/2g+zIca0y/6F8Y4MCv1GK43Xld9pskT1fwKSMJZzb CrWb9EwdeeWJ/nTWBX3KPf4tlhks01VJQxclpn/AhU1sOWlNgSTfVhom3b2BY1aBCO0Y f6WQ== X-Forwarded-Encrypted: i=1; AJvYcCXeC3mQKbRAT5bNJWfg/9ndiK/mept4PDWS5uPrb83pPwd0MaiAP7l4s+7Gcff8Koo6fAQp8F7lzQGlfbZWNgCp3JMYRNDKO3Ff0g== X-Gm-Message-State: AOJu0YxrDPawPOgCt6F8h9/3lJBJh8TfyxhJWL/Rxu3Hw7FQaHAoTWn5 nfqSbAhBY1N84MC2JNs4q6E8WO+NkUBKQImD3zXY3LQLb14wrH+r X-Google-Smtp-Source: AGHT+IEyUIIZitmjkrtCgwdI37NynphbtszWDZlV6Ns7hcCgLrGfsgDBMWp7e/tVErkU4wXc0/g9pA== X-Received: by 2002:a9d:7743:0:b0:6e6:8d2f:4013 with SMTP id t3-20020a9d7743000000b006e68d2f4013mr926119otl.8.1711475082087; Tue, 26 Mar 2024 10:44:42 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:41 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 10/11] RDMA/rxe: Make rxe_loopback match rxe_send behavior Date: Tue, 26 Mar 2024 12:43:25 -0500 Message-ID: <20240326174325.300849-12-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The rxe send path currently counts the number of skbs outstanding between the rxe driver and the ethernet driver to prevent too many packets to accumulate waiting to send. This patch makes the local loopback path behave the same way. The loopback path forwards the packets to the receive path which will eventually call kfree_skb on all packets and drop the qp references. This makes the loopback path more useful for software testing. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index d1dd440b1e4f..5b88ae29b509 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -386,6 +386,12 @@ static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt) { memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt)); + skb->destructor = rxe_skb_tx_dtor; + skb->sk = pkt->qp->sk->sk; + + rxe_get(pkt->qp); + atomic_inc(&pkt->qp->skb_out); + if (skb->protocol == htons(ETH_P_IP)) skb_pull(skb, sizeof(struct iphdr)); else From patchwork Tue Mar 26 17:43:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 13604797 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4BC0200D1 for ; Tue, 26 Mar 2024 17:44:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475085; cv=none; b=UhkfdKx/VOxmkOMi7fX6qxwfNNUfE4CajCswbA6VfJfqdxoY8a7xT1ePAPlX4Vda9w1aBgYLzyKTxSdAZLWHLdZser8jNzN12CIbmOHs15VnZYWtjyfrPi7kXdMobr1QJGDTLsA38lWOtBZC8X9VD59bXYQtsQcTBO6Cv19nSqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711475085; c=relaxed/simple; bh=SoU3uetKGqIojlNPGwhfWHAZhxbc+tHc2KJgZrh2Nd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dxT16A4239qF0kUlvQl2Z24algijSb/Rav/Wyhzm11s2g8+QSPZGKfKM9RZsjJ/EB3TCDu8bePNiR9j+i17dMNXDJ0y1pbZWraupsX5i6zV0zfmPKFz+prteVkA0gfU7jRHRyMBVDbqj7I3JdFCjVig/WTl042UNW6GQhMAHQao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YHhz09vb; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YHhz09vb" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a50880ce2aso2906486eaf.0 for ; Tue, 26 Mar 2024 10:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711475083; x=1712079883; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s1POE8I9KwEedXg0bNWgQbP3KFGe4zNce0lmHwN/JY0=; b=YHhz09vbP2Nq1xj9w4DBhTZJ+QnCmptaLIX1EPAQs0/1NdOT6y1ZfNTxG69ZEquTrT wMog5W/+4k+K0YDrNDKvJqN/DLw2OQpuYGJBdrinGIKqjHSoQypaFHu5fecpSxsLjqCq 79Mn3czo7BIQEKLm12GISib0x4hqrXmMliF4ymF1hXiai8fycM6rKSh/IHyRXcEZXuLN GSNKuoLKVef+o7gj1dueYCKY6PJE6rH10sUiocZ9RmA1dgXRPd72Vaf3V/VL3PHBTzEQ a+GyBsxpA7Cgc6C05b/jYxEhIfuAIPdtk00+sitKRQFjoZD7sEVb12ktDMETTC9++AMb oD1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711475083; x=1712079883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s1POE8I9KwEedXg0bNWgQbP3KFGe4zNce0lmHwN/JY0=; b=VTh2qGHXUFph0SwYgha7xBQVpKmZIfxDbjTCYxx4RtxUNGwpQox+VrJSgLCf7mwWB9 RG7r5+/2ZgZck0NcAYm5TiA/6jROM5ene88k4z0sDNOk4IIdaMzM3MMD1+SarXhQCO// cPL72/vinFDvu9egOA3IeflsN6q2hfhCU7YF1+hHURiundQCZe8adlMRhzuXT7E9iHOT AYn125d9Psz/HYkkF5FS9M4/kuBvrqrRo7XPNWPRxipQJ1xN1SiJ5OBGy7DIf/FnVGZP qtoKUS5Acznlp/K/ulDjHwLMZIyPlYTKIpraxDXl77kCdXZ6Nek7ZJbiFmw8a2XnY+gF Y4dg== X-Forwarded-Encrypted: i=1; AJvYcCW2GmVwT8A7QI0wwxJCncQXfUrdPDjz+Z43ug6be+n50nZbDKva+7kA3sY7Oc/B5dy7asPT7wGUbJrWfvsX7Fvo+MEpeQZtUoCUFg== X-Gm-Message-State: AOJu0YwysGwl5HfFjAW1pIXUKTLH8HhjKuNn51xFmX9h94hQz01Y9TFc gNoyFSDVLUcnesWcENAHDk05Sczobq+8UStce3SHnS8i4uWeJrIg X-Google-Smtp-Source: AGHT+IHqkAhUGgT5WsWGXYpH+xssnmR8QZxRntIQLKSXjHIPNmav6NyjyqjC1DLLfmovpr6WA1zwBA== X-Received: by 2002:a4a:e910:0:b0:5a5:46e:d0f with SMTP id bx16-20020a4ae910000000b005a5046e0d0fmr2123906oob.1.1711475083043; Tue, 26 Mar 2024 10:44:43 -0700 (PDT) Received: from bob-pearson-dev.lan (2603-8081-1405-679b-b62e-99ff-fef9-fa2e.res6.spectrum.com. [2603:8081:1405:679b:b62e:99ff:fef9:fa2e]) by smtp.gmail.com with ESMTPSA id i10-20020a056820138a00b005a53e935171sm1399860oow.35.2024.03.26.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 10:44:42 -0700 (PDT) From: Bob Pearson To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, jhack@hpe.com Cc: Bob Pearson Subject: [PATCH for-next 11/11] RDMA/rxe: Get rid of pkt resend on err Date: Tue, 26 Mar 2024 12:43:26 -0500 Message-ID: <20240326174325.300849-13-rpearsonhpe@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240326174325.300849-2-rpearsonhpe@gmail.com> References: <20240326174325.300849-2-rpearsonhpe@gmail.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently the rxe_driver detects packet drops by ip_local_out() which occur before the packet is sent on the wire and attempts to resend them. This is redundant with the usual retry mechanism which covers packets that get dropped in transit to or from the remote node. The way this is implemented is not robust since it sets need_req_skb and waits for the number of local skbs outstanding for this qp to drop below a low water mark. This is racy since the skb may be sent to the destructor before the requester can set the need_req_skb flag. This will cause a deadlock in the send path for that qp. This patch removes this mechanism since the normal retry path will correct the error and resend the packet and it makes no difference if the packet is dropped locally or later. Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe_req.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index b217fa94ff03..445650b73b19 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -800,18 +800,8 @@ int rxe_requester(struct rxe_qp *qp) err = rxe_xmit_packet(qp, &pkt, skb); if (err) { - if (err != -EAGAIN) { - wqe->status = IB_WC_LOC_QP_OP_ERR; - goto err; - } - - /* force a delay until the dropped packet is freed and - * the send queue is drained below the low water mark - */ - qp->need_req_skb = 1; - - rxe_sched_task(&qp->send_task); - goto exit; + wqe->status = IB_WC_LOC_QP_OP_ERR; + goto err; } update_wqe_state(qp, wqe, &pkt);