From: "huangguangbin (A)" <huangguangbin2@huawei.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<salil.mehta@huawei.com>, <lipeng321@huawei.com>,
<tanhuazhong@huawei.com>
Subject: Re: [RESEND net-next 1/2] net: hns3: add support for PTP
Date: Sat, 5 Jun 2021 17:54:45 +0800 [thread overview]
Message-ID: <4b2247bc-605e-3aca-3bcb-c06477cd2f2e@huawei.com> (raw)
In-Reply-To: <20210603131452.GA6216@hoboy.vegasvil.org>
On 2021/6/3 21:14, Richard Cochran wrote:
> On Wed, Jun 02, 2021 at 10:57:43AM +0800, Guangbin Huang wrote:
>
>> @@ -4342,12 +4352,34 @@ static void hclge_periodic_service_task(struct hclge_dev *hdev)
>> hclge_task_schedule(hdev, delta);
>> }
>>
>> +static void hclge_ptp_service_task(struct hclge_dev *hdev)
>> +{
>> + if (!test_bit(HCLGE_STATE_PTP_EN, &hdev->state) ||
>> + !test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state) ||
>> + !time_is_before_jiffies(hdev->ptp->tx_start + HZ))
>> + return;
>> +
>> + /* to prevent concurrence with the irq handler, disable vector0
>> + * before handling ptp service task.
>> + */
>> + disable_irq(hdev->misc_vector.vector_irq);
>
> This won't work. After all, the ISR thread might already be running.
> Use a proper spinlock instead.
>
Thanks for review. Using spinlock in irq_handler looks heavy, what about
adding a new flag HCLGE_STATE_PTP_CLEANING_TX_HWTS for hclge_ptp_clean_tx_hwts()?
Function hclge_ptp_clean_tx_hwts() test and set this flag at the beginning
and clean it in the end. Do you think it is Ok?
Thanks,
Guangbin
.
>> + /* check HCLGE_STATE_PTP_TX_HANDLING here again, since the irq
>> + * handler may handle it just before disable_irq().
>> + */
>> + if (test_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state))
>> + hclge_ptp_clean_tx_hwts(hdev);
>> +
>> + enable_irq(hdev->misc_vector.vector_irq);
>> +}
>
> Thanks,
> Richard
> .
>
next prev parent reply other threads:[~2021-06-05 9:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 2:57 [RESEND net-next 0/2] net: hns3: add support for PTP Guangbin Huang
2021-06-02 2:57 ` [RESEND net-next 1/2] " Guangbin Huang
2021-06-03 13:14 ` Richard Cochran
2021-06-05 9:54 ` huangguangbin (A) [this message]
2021-06-05 15:51 ` Richard Cochran
2021-06-07 2:20 ` huangguangbin (A)
2021-06-03 13:18 ` Richard Cochran
2021-06-05 9:57 ` huangguangbin (A)
2021-06-03 13:22 ` Richard Cochran
2021-06-05 10:37 ` huangguangbin (A)
2021-06-05 15:53 ` Richard Cochran
2021-06-07 2:44 ` huangguangbin (A)
2021-06-02 2:57 ` [RESEND net-next 2/2] net: hns3: add debugfs support for ptp info Guangbin Huang
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=4b2247bc-605e-3aca-3bcb-c06477cd2f2e@huawei.com \
--to=huangguangbin2@huawei.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@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