Subject: Re: [PATCH net-next 2/2] net: xilinx: axienet: Enable adaptive IRQ coalescing with DIM

From: Sean Anderson <[email-masked]>
Date: Thu, 5 Sep 2024 10:27:41 -0400

On 9/4/24 13:04, Eric Dumazet wrote:
> On Tue, Sep 3, 2024 at 9:25 PM Sean Anderson <[email-masked]> wrote:
>>
> 
>> +
>> +/**
>> + * axienet_rx_dim_work() - Adjust RX DIM settings
>> + * @work: The work struct
>> + */
>> +static void axienet_rx_dim_work(struct work_struct *work)
>> +{
>> +       struct axienet_local *lp =
>> +               container_of(work, struct axienet_local, rx_dim.work);
>> +
>> +       rtnl_lock();
> 
> Why do you need rtnl ?

To protect against concurrent modification in axienet_ethtools_set_coalesce.

> This is very dangerous, because cancel_work_sync(&lp->rx_dim.work)
> might deadlock.

Ah, you're right. So maybe I should add a separate mutex for this.

--Sean

>> +       axienet_dim_coalesce_rx(lp);
>> +       axienet_update_coalesce_rx(lp);
>> +       rtnl_unlock();
>> +
>> +       lp->rx_dim.state = DIM_START_MEASURE;
>> +}
>>