public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Cc: <przemyslaw.kitszel@intel.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
	<aleksander.lobakin@intel.com>, <horms@kernel.org>,
	<michal.swiatkowski@linux.intel.com>,
	<jedrzej.jagielski@intel.com>, <aleksandr.loktionov@intel.com>,
	<grzegorz.nitka@intel.com>, <ivecera@redhat.com>,
	<arkadiusz.kubalewski@intel.com>, <anthony.l.nguyen@intel.com>,
	<stefan.wegrzyn@intel.com>, <piotr.kwapulinski@intel.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<pmenzel@molgen.mpg.de>, <sunithax.d.mekala@intel.com>
Subject: Re: [PATCH net-next 07/15] ixgbe: E610: add ACI dynamic debug
Date: Mon, 4 May 2026 15:33:25 -0700	[thread overview]
Message-ID: <7505d7e3-4686-457e-a79e-776c634e9edb@intel.com> (raw)
In-Reply-To: <20260503020636.4114758-1-kuba@kernel.org>

On 5/2/2026 7:06 PM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> ixgbe: E610: add ACI dynamic debug
> 
> This commit enables dynamic debugging of the Admin Command Interface (ACI)
> for the e610 adapter, allowing ACI commands and descriptor details to be
> printed into the kernel log.
> 
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
> 
> [ ... ]
> 
>> @@ -106,8 +185,12 @@ static int ixgbe_aci_send_cmd_execute(struct ixgbe_hw *hw,
>>  		if (desc->flags & cpu_to_le16(LIBIE_AQ_FLAG_RD)) {
>>  			for (i = 0; i < buf_size / 4; i++)
>>  				IXGBE_WRITE_REG(hw, IXGBE_PF_HIBA(i), ((u32 *)buf)[i]);
>> -			if (buf_tail_size)
>> +			ixgbe_aci_debug(hw, desc, buf, buf_size);
>> +			if (buf_tail_size) {
>>  				IXGBE_WRITE_REG(hw, IXGBE_PF_HIBA(i), buf_tail);
>> +				ixgbe_aci_debug(hw, desc, &buf_tail,
>> +						buf_tail_size);
>> +			}
>>  		}
>>  	}
> 
> Does this result in redundant output being printed to the kernel log?
> 
> When buf_tail_size is non-zero, ixgbe_aci_debug() is called twice: once for
> the full buffer, and a second time for just the tail. Since ixgbe_aci_debug()
> prints the full CQ CMD descriptor details each time, this appears to print the
> descriptor headers twice and fragment the buffer output.
> 
> [ ... ]
> 
>> @@ -183,10 +278,13 @@ static int ixgbe_aci_send_cmd_execute(struct ixgbe_hw *hw,
>>  	if (valid_buf) {
>>  		for (i = 0; i < buf_size / 4; i++)
>>  			((u32 *)buf)[i] = IXGBE_READ_REG(hw, IXGBE_PF_HIBA(i));
>> +		ixgbe_aci_debug(hw, raw_desc, buf, buf_size);
>>  		if (buf_tail_size) {
>>  			buf_tail = IXGBE_READ_REG(hw, IXGBE_PF_HIBA(i));
>>  			memcpy(buf + buf_size - buf_tail_size, &buf_tail,
>>  			       buf_tail_size);
>> +			ixgbe_aci_debug(hw, raw_desc, &buf_tail,
>> +					buf_tail_size);
>>  		}
>>  	}
> 
> Can this read uninitialized memory from the buffer?
> 
> At the point ixgbe_aci_debug(..., buf, buf_size) is called, the loop has only
> populated the 4-byte aligned chunks of the buffer. The trailing bytes at the
> end of the buffer are not populated until the memcpy() occurs later in the
> block. Because ixgbe_aci_debug() consumes buf_size bytes, it looks like it
> will read and log uninitialized trailing memory (potentially from the kernel
> stack).
> 
> Also, similar to the transmit path, this calls ixgbe_aci_debug() a second
> time on &buf_tail, which will print the descriptor headers again.
> 
> Could we move a single ixgbe_aci_debug(..., buf, buf_size) call to the end of
> the block, after the entire buffer including the tail has been fully written?

Piotr,

Please review this report and submit a new version of this patch to
Intel Wired LAN.

While you are at it, please review the following report from a run of
sashiko I did myself using claude:

> commit 198ec0389c757125d9079647a6c8aba34ba29048
> Author: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
> ixgbe: E610: add ACI dynamic debug
> This patch enables dynamic debug of the Admin Command Interface (ACI)
> for the E610 adapter, adding descriptor and buffer hex dumps via the
> standard dyndbg infrastructure, plus hw_dbg() calls on error paths.
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
>> index 665a9813e251..b686636beb93 100644
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
> [ ... ]
>> @@ -147,6 +230,7 @@ static int ixgbe_aci_send_cmd_execute(struct ixgbe_hw *hw,
>> 			raw_desc[i] = IXGBE_READ_REG(hw, IXGBE_PF_HIDA(i));
>> 			raw_desc[i] = raw_desc[i];
>> 		}
>>+		ixgbe_aci_debug(hw, raw_desc, NULL, 0);
>> 	}
> [ ... ]
>> 	/* Handle timeout and invalid state of HICR register */
>>-	if (hicr & IXGBE_PF_HICR_C)
>>+	if (hicr & IXGBE_PF_HICR_C) {
>>+		hw_dbg(hw, "error: Admin Command 0x%X command timeout\n",
>>+		       le16_to_cpu(desc->opcode));
>> 		return -ETIME;
>>+	}
> Since raw_desc is declared as a cast of desc:
>     u32 *raw_desc = (u32 *)desc;
> and the sync response read loop overwrites raw_desc[] (and thus desc)
> with firmware response data, could le16_to_cpu(desc->opcode) here
> print the response opcode rather than the original command opcode?
> The local variable opcode already holds the original value saved
> earlier via:
>     opcode = le16_to_cpu(desc->opcode);
> Would it be more correct to use opcode directly in this hw_dbg() call
> (and the one in the invalid-state check below)?
>> @@ -183,10 +278,13 @@ static int ixgbe_aci_send_cmd_execute(struct ixgbe_hw *hw,
>> 	if (valid_buf) {
>> 		for (i = 0; i < buf_size / 4; i++)
>> 			((u32 *)buf)[i] = IXGBE_READ_REG(hw, IXGBE_PF_HIBA(i));
>>+		ixgbe_aci_debug(hw, raw_desc, buf, buf_size);
>> 		if (buf_tail_size) {
>> 			buf_tail = IXGBE_READ_REG(hw, IXGBE_PF_HIBA(i));
>> 			memcpy(buf + buf_size - buf_tail_size, &buf_tail,
>> 			       buf_tail_size);
>>+			ixgbe_aci_debug(hw, raw_desc, &buf_tail,
>>+					buf_tail_size);
>> 		}
>> 	}
> When buf_size is not 4-byte aligned, ixgbe_aci_debug() is called
> with the full buf_size before the tail bytes have been read from
> hardware and memcpy'd into buf. The hex dump will show stale content
> for the last 1-3 bytes of the buffer.
> Should the ixgbe_aci_debug() call be moved after the tail memcpy so
> that it dumps the complete response?




  reply	other threads:[~2026-05-04 22:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  6:37 [PATCH net-next 00/15] Intel Wired LAN Updates 2024-04-30 (ixgbe, i40e, ice) Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 01/15] ixgbe: E610: add discovering EEE capability Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 02/15] ixgbe: E610: update EEE supported speeds Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 03/15] ixgbe: E610: use new version of 0x601 ACI command buffer Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 04/15] ixgbe: E610: update ACI command structs with EEE fields Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 05/15] ixgbe: move EEE config validation out of ixgbe_set_eee() Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 06/15] ixgbe: E610: add EEE support Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 07/15] ixgbe: E610: add ACI dynamic debug Jacob Keller
2026-05-03  2:06   ` Jakub Kicinski
2026-05-04 22:33     ` Jacob Keller [this message]
2026-05-05  6:11       ` Kwapulinski, Piotr
2026-05-01  6:37 ` [PATCH net-next 08/15] ixgbe: E610: remove redundant assignment Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 09/15] ixgbe: fix unaligned u32 access in ixgbe_update_flash_X550() Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 10/15] i40e: only timestamp PTP event packets Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 11/15] ice: mention fw_activate action along with devlink reload Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 12/15] ice: access @pp through netmem_desc instead of page Jacob Keller
2026-05-04  9:48   ` Loktionov, Aleksandr
2026-05-01  6:37 ` [PATCH net-next 13/15] ice: dpll: Fix compilation warning Jacob Keller
2026-05-01  6:37 ` [PATCH net-next 14/15] ice: dpll: fix rclk pin state get and misplaced header macros Jacob Keller
2026-05-03  2:09   ` Jakub Kicinski
2026-05-04 18:38     ` Keller, Jacob E
2026-05-05  8:33       ` Ivan Vecera
2026-05-05 22:38         ` Jacob Keller
2026-05-04 22:39   ` Jacob Keller
2026-05-05  8:35     ` Ivan Vecera
2026-05-01  6:37 ` [PATCH net-next 15/15] ice: add support for unmanaged DPLL on E830 NIC Jacob Keller
2026-05-03  2:09   ` Jakub Kicinski
2026-05-03  2:20 ` [PATCH net-next 00/15] Intel Wired LAN Updates 2024-04-30 (ixgbe, i40e, ice) patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7505d7e3-4686-457e-a79e-776c634e9edb@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=grzegorz.nitka@intel.com \
    --cc=horms@kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jedrzej.jagielski@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=piotr.kwapulinski@intel.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stefan.wegrzyn@intel.com \
    --cc=sunithax.d.mekala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox