From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796050002; b=wkjJhlmnITe5JIqzA66IhjB+ysfVIKLtrsQwSQhQp/wXjhHbtEFYKU8sTM48Qqb8hLkz jPiPseFy4wZkr+l7vhUNwDYKm3YV0Zt71zuv+RmSPMWyJ850Wr8T72NZVtIviI4GJHBuB je/WQf1B4CNk1FrpMVmqzYbYfRckgLhC+/oqaZBYyZcuLC50olfRSZ93Lrew5/3K1lXdA 1wI2QQxF04QHTsyLZetPfSK0y2xiyuc6yLlouU23n67m6CjNc8jXOMfqP6KI97/q0R/AN GaaB3IRldPTNgAhZH2Z2xnKXnCCEPEp7a1aw4n5OZQP+FGZfI1O47rFjgYIoq/kTiyw== 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=fwNueuoumljG1/mpfqVaOINf5ZsDoxksWiSutRk/6TqGsNq/5HE6Q5bDBo/RipBG/dcv qWMPbWcfvGTey/VPCfgxekIvqM8N77KWKcZS1kRJUL3G/e2wfoADTZZmY9OLY1KXdHOIu wEN6zOrr71VZLKj9gFakghpeMdImY9QFi7/Jz182jiPnAkNIWiys1yY6a35QlHcMThUu4 l2ChHWh+RCaQoxiLfgN2MR7hV/U3Fr7Qw5q3NyBvpE0ieiUoDpMuwRc/xg+DGjdqJ2msj 716Cz1V/ym98uzN9XisMcqsGmAotOTlyDT66+Ynl/hr1sBhSQiVTF3JIiuYXiJ6zq8Q== 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.170 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 ABFF8606A31C for ; Mon, 30 Nov 2026 14:46:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ABFF8606A31C 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-f170.google.com with SMTP id d2e1a72fcca58-8b67f25e6e1so5217605b3a.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=Wt3r56o4swzYpdPUQhmcYhWA91oiJzRm8Mm56YpdeU4OmDyCKqbawQ9CCDtBKy5RoU 4mMrQG8LBHlG9+xiTdia7Ig+TZwMw87W/oP1Xw5GC4M4kzik7P0YlIEaN6CyJ9s6jxQa obvpKlYoEfMcfGCqqfUm0XWrB3wEMTm0Z8Ka4nomswSZAYwBDozzKttq6XHy1VFXSt7L WKPo58q9GtJFeekBMpFSHv0tLbqn7HbYMXH6Ml0AkfLX4NPv6P3d59Bu1hXHsNswLZXy JObjhHpw33+AWTkUQPnNQg47do6CbZG1hojxDZZvgY1CO8gk0UEwS4fbkEqbpUfuYHzV 3aTQ== X-Forwarded-Encrypted: i=1; AL+hErFx1hpr1vk6+iBFTyCuemQaWXyGJBO205iKuUHuiOgkJX1DTraAJQRtpGKDyTFmdRDR96g1Bs33Ggb+DfY=@vger.kernel.org X-Gm-Message-State: APuU4Z96Q0PxSMPU9gG/jPJFcojrIgV0Lckv3Al7cKzjLeZ2lX3nuMd1 f+a/HUA1HqiDU+D4oWe5RMAZnp2xiX8jo5GGJT97PBWG447s/uL4H0UlIR7HKyUJbg0= X-Gm-Gg: AZFdTZeWIimV/EU40vpaV1VtsgAv1AKKy4ztJylPTVyKinQZDkVGiRR1bWQkxx3m6ec 3d7LUsB3OW8lJvCJ2R3Ns8Io5uSwBhunXZJWetwfY6DGeXuxbmX02tVi7b8zcld3xoIxsYzn/1Y Bc1xRLmSET2XWguyxj6HIueZZCC4di5bEQk/4Q0hW97e+KJu6FTC5nMPMWHYaRK2+u0Czkh4/b5 Zyk8hnTQLOrVOuzzkq5SRGcsLDjcbWvBk2nhEQZ4FPoep48uzRiBpoDo2VQc+RvqWshpBHCDuc0 RBQPasbcLWmYgQ33rjSTalXUKlca1X5c/c3+hGOaYz0caSFSU8vTELE2IAG4dLlJ08JXF7jovHB C7EF4E5k+Ulx0Nv8w4pPKUOZRlsXQvzVRS3w+rgZrfcl6NoPIDj8wgZOIZuq5MMw0ssBQsKXDps gjsKV4MZwDOVhD0B8EhWwi/58MNHZiiBADyRGD584dusE+LodS3WBNOsPq8mIK8lM6jsQMGtmN2 K+3pSHbMzfz0/FIaTln75fE/4gj4E/bg1PrIiZrd17nA0g9RsLZ7k2cVyBTTqQ4IVE/bOwRRaMr LXafTt6y9LKuY77b8TTiD6OLEaC+jNsw+Z+IgK7+5A== 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: linux-kernel@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.