[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b2247bc-605e-3aca-3bcb-c06477cd2f2e@huawei.com>
Date: Sat, 5 Jun 2021 17:54:45 +0800
From: "huangguangbin (A)" <huangguangbin2@...wei.com>
To: Richard Cochran <richardcochran@...il.com>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <salil.mehta@...wei.com>,
<lipeng321@...wei.com>, <tanhuazhong@...wei.com>
Subject: Re: [RESEND net-next 1/2] net: hns3: add support for PTP
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
> .
>
Powered by blists - more mailing lists