From: "Nelson, Shannon" <shannon.nelson@amd.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: andrew+netdev@lunn.ch, brett.creeley@amd.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
michal.swiatkowski@linux.intel.com, horms@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v3 net 4/4] pds_core: make wait_context part of q_info
Date: Fri, 18 Apr 2025 15:31:25 -0700 [thread overview]
Message-ID: <917a9476-b499-48da-8702-8b2415bae00a@amd.com> (raw)
In-Reply-To: <20250417082156.5eac67e8@kernel.org>
On 4/17/2025 8:21 AM, Jakub Kicinski wrote:
>
> On Tue, 15 Apr 2025 16:29:31 -0700 Shannon Nelson wrote:
>> Make the wait_context a full part of the q_info struct rather
>> than a stack variable that goes away after pdsc_adminq_post()
>> is done so that the context is still available after the wait
>> loop has given up.
>>
>> There was a case where a slow development firmware caused
>> the adminq request to time out, but then later the FW finally
>> finished the request and sent the interrupt. The handler tried
>> to complete_all() the completion context that had been created
>> on the stack in pdsc_adminq_post() but no longer existed.
>> This caused bad pointer usage, kernel crashes, and much wailing
>> and gnashing of teeth.
>
> The patch will certainly redirect the access from the stack.
> But since you're already processing the completions under a spin
> lock, is it not possible to safely invalidate the completion
> under the same lock on timeout?
>
> Perhaps not I haven't looked very closely.
We have another patch under consideration that does something like this,
but we're not sure we're happy with that patch yet, so haven't pushed it
out yet.
>
>> + wc = &pdsc->adminqcq.q.info[index].wc;
>> + wc->wait_completion = COMPLETION_INITIALIZER_ONSTACK(wc->wait_completion);
>
> _ONSTACK you say? I don't think it's on the stack any more.
This worked, but digging a little further through other examples I see
how we can more correctly use init_completion() and reinit_completion().
sln
prev parent reply other threads:[~2025-04-18 22:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 23:29 [PATCH v3 net 0/4] pds_core: updates and fixes Shannon Nelson
2025-04-15 23:29 ` [PATCH v3 net 1/4] pds_core: Prevent possible adminq overflow/stuck condition Shannon Nelson
2025-04-16 20:13 ` Jacob Keller
2025-04-16 20:49 ` Nelson, Shannon
2025-04-16 23:34 ` Jacob Keller
2025-04-15 23:29 ` [PATCH v3 net 2/4] pds_core: handle unsupported PDS_CORE_CMD_FW_CONTROL result Shannon Nelson
2025-04-16 20:14 ` Jacob Keller
2025-04-15 23:29 ` [PATCH v3 net 3/4] pds_core: Remove unnecessary check in pds_client_adminq_cmd() Shannon Nelson
2025-04-16 20:15 ` Jacob Keller
2025-04-15 23:29 ` [PATCH v3 net 4/4] pds_core: make wait_context part of q_info Shannon Nelson
2025-04-16 20:16 ` Jacob Keller
2025-04-17 15:21 ` Jakub Kicinski
2025-04-18 22:31 ` Nelson, Shannon [this message]
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=917a9476-b499-48da-8702-8b2415bae00a@amd.com \
--to=shannon.nelson@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®