public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Moshe Shemesh <moshe@nvidia.com>
To: Jinpu Wang <jinpu.wang@ionos.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	netdev <netdev@vger.kernel.org>,
	"RDMA mailing list" <linux-rdma@vger.kernel.org>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Maor Gottlieb <maorg@nvidia.com>, Shay Drory <shayd@nvidia.com>
Subject: Re: [BUG] mlx5_core general protection fault in mlx5_cmd_comp_handler
Date: Tue, 15 Nov 2022 18:41:04 +0200	[thread overview]
Message-ID: <54c10b62-5d53-a3a5-48bb-74552e976067@nvidia.com> (raw)
In-Reply-To: <CAMGffEkaZUDLfXQXK239Nt-DSxqkZpbC=8zUeubv0pxLuoMcZw@mail.gmail.com>


On 11/15/2022 5:08 PM, Jinpu Wang wrote:
> On Tue, Nov 15, 2022 at 6:46 AM Jinpu Wang <jinpu.wang@ionos.com> wrote:
>> On Tue, Nov 15, 2022 at 6:15 AM Moshe Shemesh <moshe@nvidia.com> wrote:
>>>
>>> On 11/9/2022 11:51 AM, Jinpu Wang wrote:
>>>> On Mon, Oct 17, 2022 at 7:54 AM Jinpu Wang <jinpu.wang@ionos.com> wrote:
>>>>> On Thu, Oct 13, 2022 at 12:27 PM Leon Romanovsky <leon@kernel.org> wrote:
>>>>>> On Thu, Oct 13, 2022 at 10:32:55AM +0200, Jinpu Wang wrote:
>>>>>>> On Thu, Oct 13, 2022 at 10:18 AM Leon Romanovsky <leon@kernel.org> wrote:
>>>>>>>> On Wed, Oct 12, 2022 at 01:55:55PM +0200, Jinpu Wang wrote:
>>>>>>>>> Hi Leon, hi Saeed,
>>>>>>>>>
>>>>>>>>> We have seen crashes during server shutdown on both kernel 5.10 and
>>>>>>>>> kernel 5.15 with GPF in mlx5 mlx5_cmd_comp_handler function.
>>>>>>>>>
>>>>>>>>> All of the crashes point to
>>>>>>>>>
>>>>>>>>> 1606                         memcpy(ent->out->first.data,
>>>>>>>>> ent->lay->out, sizeof(ent->lay->out));
>>>>>>>>>
>>>>>>>>> I guess, it's kind of use after free for ent buffer. I tried to reprod
>>>>>>>>> by repeatedly reboot the testing servers, but no success  so far.
>>>>>>>> My guess is that command interface is not flushed, but Moshe and me
>>>>>>>> didn't see how it can happen.
>>>>>>>>
>>>>>>>>     1206         INIT_DELAYED_WORK(&ent->cb_timeout_work, cb_timeout_handler);
>>>>>>>>     1207         INIT_WORK(&ent->work, cmd_work_handler);
>>>>>>>>     1208         if (page_queue) {
>>>>>>>>     1209                 cmd_work_handler(&ent->work);
>>>>>>>>     1210         } else if (!queue_work(cmd->wq, &ent->work)) {
>>>>>>>>                             ^^^^^^^ this is what is causing to the splat
>>>>>>>>     1211                 mlx5_core_warn(dev, "failed to queue work\n");
>>>>>>>>     1212                 err = -EALREADY;
>>>>>>>>     1213                 goto out_free;
>>>>>>>>     1214         }
>>>>>>>>
>>>>>>>> <...>
>>>>>>>>> Is this problem known, maybe already fixed?
>>>>>>>> I don't see any missing Fixes that exist in 6.0 and don't exist in 5.5.32.
>>>>>> Sorry it is 5.15.32
>>>>>>
>>>>>>>> Is it possible to reproduce this on latest upstream code?
>>>>>>> I haven't been able to reproduce it, as mentioned above, I tried to
>>>>>>> reproduce by simply reboot in loop, no luck yet.
>>>>>>> do you have suggestions to speedup the reproduction?
>>>>>> Maybe try to shutdown during filling command interface.
>>>>>> I think that any query command will do the trick.
>>>>> Just an update.
>>>>> I tried to run "saquery" in a loop in one session and do "modproble -r
>>>>> mlx5_ib && modprobe mlx5_ib" in loop in another session during last
>>>>> days , but still no luck. --c
>>>>>>> Once I can reproduce, I can also try with kernel 6.0.
>>>>>> It will be great.
>>>>>>
>>>>>> Thanks
>>>>> Thanks!
>>>> Just want to mention, we see more crash during reboot, all the crash
>>>> we saw are all
>>>> Intel  Intel(R) Xeon(R) Gold 6338 CPU. We use the same HCA on
>>>> different servers. So I suspect the bug is related to Ice Lake server.
>>>>
>>>> In case it matters, here is lspci attached.
>>>
>>> Please try the following change on 5.15.32, let me know if it solves the
>>> failure :
>> Thank you Moshe, I will test it on affected servers and report back the result.
> Hi Moshe,
>
> I've been running the reboot tests on 4 affected machines in parallel
> for more than 6 hours,  in total did 300+ reboot, I can no longer
> reproduce the crash. without the fix, I was able to reproduce 2 times
> in 20 reboots.
> So I think the bug is fixed.


Great !

> I also did some basic functional test via RNBD/IPOIB, all look good.
> Tested-by: Jack Wang <jinpu.wang@ionos.com>
> Please provide a formal fix.


Will do.

Thanks!

>
> Thx!
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
>>> b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
>>> index e06a6104e91f..d45ca9c52a21 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
>>> @@ -971,6 +971,7 @@ static void cmd_work_handler(struct work_struct *work)
>>>                   cmd_ent_get(ent);
>>>           set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
>>>
>>> +       cmd_ent_get(ent); /* for the _real_ FW event on completion */
>>>           /* Skip sending command to fw if internal error */
>>>           if (mlx5_cmd_is_down(dev) || !opcode_allowed(&dev->cmd, ent->op)) {
>>>                   u8 status = 0;
>>> @@ -984,7 +985,6 @@ static void cmd_work_handler(struct work_struct *work)
>>>                   return;
>>>           }
>>>
>>> -       cmd_ent_get(ent); /* for the _real_ FW event on completion */
>>>           /* ring doorbell after the descriptor is valid */
>>>           mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 <<
>>> ent->idx);
>>>           wmb();
>>> @@ -1598,8 +1598,8 @@ static void mlx5_cmd_comp_handler(struct
>>> mlx5_core_dev *dev, u64 vec, bool force
>>>                                   cmd_ent_put(ent); /* timeout work was
>>> canceled */
>>>
>>>                           if (!forced || /* Real FW completion */
>>> -                           pci_channel_offline(dev->pdev) || /* FW is
>>> inaccessible */
>>> -                           dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
>>> +                            mlx5_cmd_is_down(dev) || /* No real FW
>>> completion is expected */
>>> +                            !opcode_allowed(cmd, ent->op))
>>>                                   cmd_ent_put(ent);
>>>
>>>                           ent->ts2 = ktime_get_ns();
>>>
>>>> Thx!

  reply	other threads:[~2022-11-15 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 11:55 [BUG] mlx5_core general protection fault in mlx5_cmd_comp_handler Jinpu Wang
2022-10-13  8:18 ` Leon Romanovsky
2022-10-13  8:32   ` Jinpu Wang
2022-10-13 10:27     ` Leon Romanovsky
2022-10-17  5:54       ` Jinpu Wang
2022-11-09  9:51         ` Jinpu Wang
2022-11-15  5:14           ` Moshe Shemesh
2022-11-15  5:46             ` Jinpu Wang
2022-11-15 15:08               ` Jinpu Wang
2022-11-15 16:41                 ` Moshe Shemesh [this message]
2022-11-21  9:11                   ` Jinpu Wang
2022-11-22  4:31                     ` Moshe Shemesh
2022-11-22  6:08                       ` Jinpu Wang

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=54c10b62-5d53-a3a5-48bb-74552e976067@nvidia.com \
    --to=moshe@nvidia.com \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.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