Netdev List
 help / color / mirror / Atom feed
From: "Rao, Nikhil" <nikhirao@amd.com>
To: netdev-bot+sashiko@kernel.org, nikhil.rao@amd.com
Cc: brett.creeley@amd.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, abhijit.gangurde@amd.com, allen.hubbe@amd.com,
	jgg@ziepe.ca, leon@kernel.org, jiri@resnulli.us,
	horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
	rdunlap@infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-doc@vger.kernel.org, eric.joyner@amd.com,
	ArunKumar.Prakash@amd.com
Subject: Re: [PATCH net-next v2 3/3] ionic: add devlink param for command timeout
Date: Wed, 18 Nov 2026 15:56:31 -0800	[thread overview]
Message-ID: <cd29a3c1-445e-46a9-99fa-131983ce7a72@amd.com> (raw)
In-Reply-To: <179431289941.994134.11663452629837334156@kernel.org>



On 11/10/2026 4:14 AM, netdev-bot+sashiko@kernel.org wrote:
>> +static int ionic_dl_cmd_timeout_get(struct devlink *dl, u32 id,
>> +                                 struct devlink_param_gset_ctx *ctx,
>> +                                 struct netlink_ext_ack *extack)
>> +{
>> +     struct ionic *ionic = devlink_priv(dl);
>> +
>> +     /* devlink fills PARAM_DEL with this on PCI reset; no FW_RESET check */
>> +     return ionic_dev_getattr_cmd_timeout(ionic, &ctx->val.vu8);
> 
> [Severity: Medium]
> Is the comment above accurate for every caller that reaches this getter
> through PARAM_DEL?
> 
> When a devlink monitor is listening, the unregister path calls this getter
> to fill the notification:
> 
> ionic_lif_handle_fw_down()
>    ionic_devlink_params_unregister()
>      devl_params_unregister()
>        devlink_param_unregister()
>          devlink_param_notify(DEVLINK_CMD_PARAM_DEL)
>            devlink_nl_param_fill()
>              devlink_param_get()
>                ionic_dl_cmd_timeout_get()
>                  ionic_dev_getattr_cmd_timeout()
> 
> On the watchdog path, ionic_lif_handle_fw_down() only runs after fw_status
> has lost IONIC_FW_STS_F_RUNNING. ionic_reset_prepare() is also reached from
> ionic_pci_error_detected() for io_frozen, where MMIO reads return 0xff. In
> both cases the firmware cannot answer the GETATTR.
> 
> __ionic_dev_cmd_wait() then prints the warning and returns -ENXIO. do_msg
> does not gate this warning, so the _nomsg variant still prints it:
> 
>          if (!done && !fw_up) {
>                  ionic_dev_cmd_clean(ionic);
>                  dev_warn(ionic->dev, "DEVCMD %s (%d) interrupted - FW is down\n",
>                           ionic_opcode_to_str(opcode), opcode);
>                  return -ENXIO;
>          }
> 
> devlink_param_notify() drops the message on that error:
> 
>          err = devlink_nl_param_fill(msg, devlink, port_index, param_item, cmd,
>                                      0, 0, 0, NULL);
>          if (err) {
>                  nlmsg_free(msg);
>                  return;
>          }
> 
> So no PARAM_DEL is sent, but ionic_restart_lif() sends PARAM_NEW again on
> FW-up. Monitors would see two PARAM_NEW events with no PARAM_DEL between
> them, and a spurious warning is logged on every FW-down.
> 
> There is also the case where FW-down starts while fw_status still reads
> running (a generation change, or IONIC_EVENT_RESET) and the restarted
> firmware does not complete the command. Could the getter then block the
> deferred FW-down work for up to ionic->cmd_timeout? This patch raises that
> limit to as much as 255 seconds.
> 
Fixed in v3: the parameter is registered once at probe and no longer
unregistered on FW-down or PCI reset, so no PARAM_DEL is sent on reset,
and get no longer sends a device command

> [Severity: Medium]
> Can an unprivileged user use this getter to tie up the device command
> mailbox?

Fixed in v3: get returns the value read at the last probe or reset,
or stored by a later set, without a device command.

> [ ... ]
> 
>> +void ionic_devlink_params_unregister(struct ionic *ionic)
>> +{
>> +     struct devlink *dl = priv_to_devlink(ionic);
>> +
>> +     devl_lock(dl);
>> +     if (ionic->dl_params_registered) {
>> +             devl_params_unregister(dl, ionic_dl_params,
>> +                                    ARRAY_SIZE(ionic_dl_params));
>> +             ionic->dl_params_registered = false;
>> +     }
>> +     devl_unlock(dl);
>> +}
> 
> [Severity: Low]
> This adds devl_lock to two paths that did not take it before:
>
Fixed in v3: the reset paths no longer register or unregister the
parameter
> [ ... ]

> [Severity: Low]

> The new documentation only says:
> 
>    The value is stored in device NVM and takes effect on the next driver
>    probe or device reset. Only available when the device firmware supports
>    it.
> 
> The design may be reasonable, since the capability can change after a
> firmware update. Should the commit message and ionic.rst say that the
> parameter is absent while a reset is in progress, and stays absent if
> recovery fails?
> 
In v3, the parameter is registered once at probe and not unregistered on 
reset, so a reset, including one whose recovery fails,
does not remove it. While a reset is in progress or after it failed,
set returns -EBUSY and get reports the last value read.

Nikhil

  reply	other threads:[~2026-11-18 23:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 22:43 [PATCH net-next v2 0/3] ionic: make the device command timeout configurable Nikhil P. Rao
2026-11-05 22:43 ` [PATCH net-next v2 1/3] ionic: make the command timeout per device Nikhil P. Rao
2026-11-05 22:43 ` [PATCH net-next v2 2/3] RDMA/ionic: Use the ionic command timeout for the admin queue Nikhil P. Rao
2026-11-10 12:14   ` netdev-bot+sashiko
2026-11-18 23:37     ` Rao, Nikhil
2026-11-05 22:43 ` [PATCH net-next v2 3/3] ionic: add devlink param for command timeout Nikhil P. Rao
2026-11-10 12:14   ` netdev-bot+sashiko
2026-11-18 23:56     ` Rao, Nikhil [this message]
2026-11-14  0:55 ` [PATCH net-next v2 0/3] ionic: make the device command timeout configurable Jakub Kicinski

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=cd29a3c1-445e-46a9-99fa-131983ce7a72@amd.com \
    --to=nikhirao@amd.com \
    --cc=ArunKumar.Prakash@amd.com \
    --cc=abhijit.gangurde@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eric.joyner@amd.com \
    --cc=horms@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.rao@amd.com \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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