From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Robert Malz <robert.malz@canonical.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
"Jacob Keller" <jacob.e.keller@intel.com>,
Jesse Brandeburg <jbrandeb@kernel.org>,
<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH iwl] ice: acquire NVM lock around each flash read
Date: Wed, 15 Jul 2026 10:04:19 -0700 [thread overview]
Message-ID: <e8a4e549-c67f-4d20-8d33-fb50b4c44de9@intel.com> (raw)
In-Reply-To: <CADcc-bxLMg1NujF+jE2rOXGc38quv_XqZfv5K+yGQFfhc03avA@mail.gmail.com>
On 7/15/2026 3:22 AM, Robert Malz wrote:
...
>>> - if (status)
>>> + if (status) {
>>> + /* ice_release_nvm() issues an AQ command that would
>>> + * overwrite sq_last_status, which some callers
>>> + * inspect after a failed read. Preserve the read's
>>> + * AQ error across the release.
>>> + */
>>> + aq_err = hw->adminq.sq_last_status;
>>> +
>>> + ice_release_nvm(hw);
>>> + hw->adminq.sq_last_status = aq_err;
>>
>> Does restoring hw->adminq.sq_last_status here without holding the Admin
>> Queue
>> lock risk overwriting the status of a concurrent AdminQ command?
>> If another thread acquires the lock and sends a command immediately after
>> ice_release_nvm(hw), this lockless write could corrupt its error status.
>>
>> [TN] I don't believe the AQ lock will work as desired we can't guarantee
>> that we will have the lock directly following the release in order to
>> restore the AQ error. Similar to the NVM lock issue, I think this is a
>> small window but wanted to bring this here in case others had
>> thoughts/comments on this.
>
> [RM] Agree, this can cause issues. We can't drop sq_last_status as
> ice_discover_flash_size depends on it.
> Proposed fix: drop the save/restore sq_last_status and propagate the
> read AQ error through a real return path instead of the shared global.
> I could add optional enum libie_aq_err *read_aq_err out param to
> ice_read_flat_nvm(), capture sq_last_status before the
> ice_release_nvm, and have ice_discover_flash_size() test that instead.
> The log-only callers (devlink/ethtool) don't care about it.
> Let me know what you think about it.
This sounds good to me.
Thanks,
Tony
next prev parent reply other threads:[~2026-07-15 17:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 10:32 [PATCH iwl] ice: acquire NVM lock around each flash read Robert Malz
2026-07-03 13:34 ` Przemek Kitszel
2026-07-06 20:56 ` Jacob Keller
2026-07-14 23:47 ` Tony Nguyen
2026-07-15 10:22 ` Robert Malz
2026-07-15 17:04 ` Tony Nguyen [this message]
2026-07-15 18:22 ` Jacob Keller
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=e8a4e549-c67f-4d20-8d33-fb50b4c44de9@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jbrandeb@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=robert.malz@canonical.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