From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796050002; b=t36BPc9AlEHxkuU5t1nWKgf3UdqbnD+fCgoIr0gacJQU6nkQcbdJRfqCpzDI1JRcCcoy IzKpklsgWOw6xSOrBRbpznFnvoNH8H1D1/9Cbzgpx44p+QS4K1VHP5wEUKnM4SEu7UKza W7hdouC+n5YfHiSMYW6Vb7gienghsBik42H1OxwXtvtEcJpgBWJihT4TiVdStU87MD/hs BjpStEMw1jNMCYjI8RU0GuYj1FTPeTeMmiEar74gdCwcpBEYP39HBfHBCHNBf2EedjT7V IuY3ZgmvKjhOol9rX9tucbHXup9ev3anTiH6w4Ime5XysQTSYqbVXw6t3aQrI5pWKMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796050002; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ytWVXETT2J6xFXLGYGG2jwB5xyWus+Q4nOjm5DqTWCA=; b=bjkv7ePB+oTyYsbC/O9lKA0RKdJrey65+DVulrCvoI3BCgDBkNmfUKRJAYMmLng9A5Fh PsXK7P0hPWkXVBKccCI6k6bi0aJ7nadX0XsQ/XMHGuyRBePuYQ+XdwgamSwvXsNTEMVVv k5jRsPCNxzLnelkbsY8OuQaerXR8w0mj2HTU6LzUL0QCST1TPTDOUBbOyHYoSM7eyxxY0 oNfo/YWn9VhOj3wmPnGeC7zJ8/2PcdxWwY0mLyDN8FVDxF9r+mMca68OMs7nXoHwbuVzF S4CtbFr9awK11IWio5N3uyMAP/A8YsS+95C0/Srwr0c6QzJfT3ZnXNARMFW03gf9Rzg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=U2EK6oe7; arc=none smtp.remote-ip=209.85.210.172 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0DAA606A320 for ; Mon, 30 Nov 2026 14:46:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B0DAA606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=U2EK6oe7 Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-8b67f25e6e1so5217606b3a.0 for ; Mon, 30 Nov 2026 06:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796049996; x=1796654796; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ytWVXETT2J6xFXLGYGG2jwB5xyWus+Q4nOjm5DqTWCA=; b=U2EK6oe7w9RYZMTQ1aCs+OBqO3iFc2Y9alBxZZ5FWRMObX5vvlA4Cc59Xi6t5RIoen 4lN0522no920hDWtB2g03+KxbFBgLQswUiUoLM7VDGq9DLR2iPcGysLtF4CCZ6XrH6ge HJ3yoaCh44LdwttgSACcioJ1JPqZP6UDg+f5wJ7xh8HFo8poRxBeNExPV6jUSm9w37IW zP8GgWMdnSZoiPuXdH0tTtkeIeA+QUj6p1jII7YPjm4+yiketpcBXrArBOkfE8onMAoY 3aeFhTonsqcl4sdxfA0ujDo3LjRzXdIdw8Cn/xpSRPJ51LYxlT3QZ1i6RePZ7bQ0+1rA 8cCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796049996; x=1796654796; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=ytWVXETT2J6xFXLGYGG2jwB5xyWus+Q4nOjm5DqTWCA=; b=VoXZCcth5+p8Uux1xeltg14jgigITUwTz75Tur0BWOfeW/sGN2IrU8jWfqZmUN+8+9 /CLQSUm6XJYF3QCXKgfus/WvlGzhrZIqKOqMJ6xHmc3CrJGNRLuhTM5lzUnOKKKkX8l9 1R/qxZ+lkpmSaE2RTnmGKVLpUOneGl7ijuIZCOpCtqY2a5+j/vuzigTqiNjk8TFHGJP+ EaMI0Yn7FxEYBUie8wmAGmUzrJ4ECR++krrdNtXgV9tdUckfXUaj/dL4F7/8vICzXM2q KyjLA9y3z9oDiEpJQdgbldwMkuGmWxVbPetvxMwDvh2HX76BI0+Os3BHYgQkJUSCJCOG VOGg== X-Forwarded-Encrypted: i=1; AL+hErFaDzsP7zqGe7WeIO92GSKkWLhkxCiuFYdb6IEyzpMhOwHMBlNmfl6BqmZk5njewpkR8srzCn8=@vger.kernel.org X-Gm-Message-State: APuU4Z+aqXN9Z89ge7I+n9OrQblzn/bhLbVc48wv631DbePI2hGpRuWi YTth/5WP8FREDBgBsa1CbR56ZlEEpBWcse45XU5GtiEM1+tcHMgaSz6brCgbMB/dTyY= X-Gm-Gg: AZFdTZe6FcA17QE2fpB/ZzChClxg5W7QKY5v3IsToUeJ2Rt9w9k/GEI3VqMqQHBhyvu n3TyWipaNzMTiNNGhDphSwAyr3fVBl67MGJkKS8cW5jZHfkyWV46mKquDxMGUflRYMEakEeAvWv w9FX80dl4sgPmx1VsCf6as0svNkd84hf7QoghSmOjlVWmpH1p8B2t+YKiCwqrw8iv3R/C7vtgeR cLtbuSl5StKe60velLbpBoyg6xv51e4m7oRVeib5FH6t1MxKL949I3F0ZzUB646maMESKhtgxwS u9KBaof/OsC0/r3gy292L6qQpGld9yZE/lzFuFNCQV6JFpbwVFXMl0zUPn3iqumNjZ5HxXyBTN2 ZGUrwURq8M3SRdzluMphW/4qoS03PxrmEQf0yadxoBHSD1QNlTU4fSdAXd3hw13EcdcqECylx4K kI7mkpQKOWoq7gm1z2Nx7GPDDWNqvprMqGoALJmzXjptHnUcel97NnhD0O0vJ9BnJLZuBV8mN8y EzaTNPDp7HAEWipUieYXSMsdOxEudb7JoBS7so7IaqURaoz2rboXr32ZUoIaaKspgjnZ+Eis5FL 02yipVDEqepBGrMRBS1TJkx3Ghtl3ov2/4s7YLPpIA== X-Received: by 2002:a05:6a00:610f:b0:886:a737:e0fe with SMTP id d2e1a72fcca58-8cd9fe59529mr18515561b3a.23.1796049995929; Mon, 30 Nov 2026 06:46:35 -0800 (PST) Received: from localhost ([2a03:2880:2ff:3::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87344184fsm18369678b3a.35.2026.11.30.06.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 06:46:35 -0800 (PST) Date: Mon, 30 Nov 2026 06:46:34 -0800 From: Joe Damato To: Paolo Abeni Cc: michael.chan@broadcom.com, prashant@broadcom.com, horms@kernel.org, selvin.xavier@broadcom.com, kalesh-anakkur.purayil@broadcom.com, pavan.chebbi@broadcom.com, netdev-bot+sashiko@kernel.org, edumazet@google.com, netdev@vger.kernel.org, edumazet@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v6 2/5] bnxt_en: check HWRM response if completion never arrives Message-ID: Mail-Followup-To: Joe Damato , Paolo Abeni , michael.chan@broadcom.com, prashant@broadcom.com, horms@kernel.org, selvin.xavier@broadcom.com, kalesh-anakkur.purayil@broadcom.com, pavan.chebbi@broadcom.com, netdev-bot+sashiko@kernel.org, edumazet@google.com, netdev@vger.kernel.org, edumazet@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org References: <20261120152830.699712-3-joe@dama.to> <179545865940.3135.4199576162321798829@kernel.org> <3598861f-f441-46ea-a5c8-574372a34370@redhat.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3598861f-f441-46ea-a5c8-574372a34370@redhat.com> On Thu, Nov 26, 2026 at 12:18:14PM +0100, Paolo Abeni wrote: > On 11/23/26 23:43, Joe Damato wrote: > > On Mon, Nov 23, 2026 at 06:30:59PM +0000, netdev-bot+sashiko@kernel.org wrote: > > > Thank you for your contribution! Sashiko AI review found 1 potential > > > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c > > > > index de02d1baa7514..53667c0c38aaf 100644 > > > > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c > > > > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c > > > > @@ -582,11 +582,50 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) > > > > > > [ ... ] > > > > > > > + /* The completion was not delivered, but the firmware > > > > + * may still have freed the ring. Check the response > > > > + * before giving up and log the state. > > > > + */ > > > > + resp_seq_id = READ_ONCE(ctx->resp->seq_id); > > > > + len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len)); > > > > + if (len && resp_seq_id == ctx->req->seq_id) > > > > + valid_byte = READ_ONCE(*((u8 *)ctx->resp + len - 1)); > > > > + > > > > + if (!valid_byte) { > > > > + hwrm_err(bp, ctx, > > > > + "Resp cmpl intr err msg: 0x%x len:%d seq:0x%x/0x%x\n", > > > > + req_type, len, > > > > + le16_to_cpu(resp_seq_id), > > > > + le16_to_cpu(ctx->req->seq_id)); > > > > + goto exit; > > > > + } > > > > + > > > > + /* Read the rest of the response after the valid byte */ > > > > + dma_rmb(); > > > > + if (!(ctx->flags & BNXT_HWRM_CTX_SILENT)) > > > > + netdev_warn(bp->dev, > > > > + "Resp cmpl intr not delivered, msg: 0x%x completed anyway (len:%d valid:0x%x err:0x%x)\n", > > > > + req_type, len, valid_byte, > > > > + le16_to_cpu(ctx->resp->error_code)); > > > > + } else { > > > > + len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len)); > > > > } > > > > - len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len)); > > > > valid = ((u8 *)ctx->resp) + len - 1; > > > > > > [Severity: Medium] > > > Is a set valid byte in ctx->resp enough to show that the ring is safe to > > > free? > > > > > > The commit message calls this case one where "only the notification was > > > lost". But the commit in the Fixes: tag, 74608fc98d28, sent the > > > RING_FREE response to the completion ring so that the completion entry > > > itself would act as the fence: > > > > > > "The response will be the last entry in the ring and we can free the > > > ring after getting the response. This will guarantee no spurious DMA > > > to freed memory." > > > > > > The response buffer and the HWRM_DONE completion entry are two separate > > > device writes. Once token->state is BNXT_HWRM_COMPLETE, the existing > > > success path reads resp_len without waiting for the valid byte. That > > > suggests the response buffer is written before the completion entry. > > > > > > So a set valid byte may not mean that the HWRM_DONE entry has landed. It > > > also may not mean that the TX/RX completions queued ahead of it on the > > > same ring have landed. > > > > Agreed. The valid byte shows that the firmware finished HWRM_RING_FREE for > > the TX/RX/AGG ring. It does not show that HWRM_DONE was posted to the > > completion ring. > > > > Michael, can you confirm that the firmware has stopped DMA for the ring > > (other than completions to the completion ring) by the time it writes > > the RING_FREE response? > > > > If the response is written before the ring is quiesced, then this patch is > > wrong. > @Pavan, @Michael: there are pending question for you here and elsewhere > in this series, please have a look. > > If nobody answer in a few days we will have to toss the series. Just to clarify: did you mean this version of this code or this series in general? I just want to make sure because I don't want to resubmit if you meant that I should not resubmit. > @Joe: could the issues be caused by a broken firmware? in such a case > nothing would stop it from doing DMA at the bad time, right? Yea, I suspect there is a firmware issue of some kind (IIRC Broadcom mentioned there might be an issue with the RING FREE FW command with large ring sizes in the last version). The point of the series though was to try to harden the path in the driver to avoid freeing memory that might still be in use by the firmware. So, while I agree in principle that nothing can stop FW from doing a bad DMA I think it's probably a good idea to make the driver check return values and avoid freeing memory if it thinks FW is stuck. I think the trouble with this series in particular is that Sashiko is finding a lot of random stuff that is also potentially buggy, so I've been trying to summarize the addressable points in a reply to the cover letter to help focus Broadcom's feedback. FWIW, the first several revisions of this series were RFCs and I just continued with the version increment when it got "promoted" from RFC to a "real" submission. I don't plan on submitting this endlessly; if I can't get something workable that Broadcom agrees with in the next revision or two then I will drop this (unless you meant above that I should stop submitting this). I've been trying to have conversations in the thread for each submission to limit the number of revisions maintainers need to read, but unfortunately Sashiko is smarter than me and finds stuff I didn't know was there.