From: David Miller <davem@davemloft.net>
To: tanhuazhong@huawei.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
salil.mehta@huawei.com, yisen.zhuang@huawei.com,
linuxarm@huawei.com, jakub.kicinski@netronome.com
Subject: Re: [PATCH net] net: hns3: fix a wrong reset interrupt status mask
Date: Tue, 19 Nov 2019 15:36:03 -0800 (PST) [thread overview]
Message-ID: <20191119.153603.2158592594523337284.davem@davemloft.net> (raw)
In-Reply-To: <1574130708-30767-1-git-send-email-tanhuazhong@huawei.com>
From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Tue, 19 Nov 2019 10:31:48 +0800
> According to hardware user manual, bits5~7 in register
> HCLGE_MISC_VECTOR_INT_STS means reset interrupts status,
> but HCLGE_RESET_INT_M is defined as bits0~2 now. So it
> will make hclge_reset_err_handle() read the wrong reset
> interrupt status.
>
> This patch fixes it and prints out the register value.
>
> Fixes: 2336f19d7892 ("net: hns3: check reset interrupt status when reset fails")
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Fix exactly _one_ thing or else you make your patch hard to review.
The bug is that the bits are wrong, just fix the bits!
>
> + u32 msix_sts_reg;
> +
> + msix_sts_reg = hclge_read_dev(&hdev->hw, HCLGE_MISC_VECTOR_INT_STS);
> +
> if (hdev->reset_pending) {
Now you are reading a register, and potentially clearing status bits and
causing other side effects, that would not happen in this code path
where hdev->reset_pending is true.
Don't do stuff like this!
If you want to add code to print out the register value, that is a
separate patch, for net-next, and it must be done properly. In that
you should only read the register in the same code paths you do
previously. Otherwise you must _clearly_ explain why reading the
register value in new code paths is OK, and the side effects will
not potentially cause problems for the pending reset operation. It
is still going to be a net-next improvement only.
Thank you.
next prev parent reply other threads:[~2019-11-19 23:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 2:31 Huazhong Tan
2019-11-19 23:36 ` David Miller [this message]
2019-11-20 1:36 ` tanhuazhong
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=20191119.153603.2158592594523337284.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@huawei.com \
--cc=yisen.zhuang@huawei.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®