diff mbox series

[net-next,2/3] virtio_net: fix possible dim status unrecoverable

Message ID 20240425125855.87025-3-hengqi@linux.alibaba.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series virtio_net: enable the irq for ctrlq | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next-1

Commit Message

Heng Qi April 25, 2024, 12:58 p.m. UTC
When the dim worker is scheduled, if it no longer needs to issue
commands, dim may not be able to return to the working state later.

For example, the following single queue scenario:
  1. The dim worker of rxq0 is scheduled, and the dim status is
     changed to DIM_APPLY_NEW_PROFILE;
  2. dim is disabled or parameters have not been modified;
  3. virtnet_rx_dim_work exits directly;

Then, even if net_dim is invoked again, it cannot work because the
state is not restored to DIM_START_MEASURE.

Fixes: 6208799553a8 ("virtio-net: support rx netdim")
Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski April 26, 2024, 2:21 a.m. UTC | #1
On Thu, 25 Apr 2024 20:58:54 +0800 Heng Qi wrote:
> When the dim worker is scheduled, if it no longer needs to issue
> commands, dim may not be able to return to the working state later.
> 
> For example, the following single queue scenario:
>   1. The dim worker of rxq0 is scheduled, and the dim status is
>      changed to DIM_APPLY_NEW_PROFILE;
>   2. dim is disabled or parameters have not been modified;
>   3. virtnet_rx_dim_work exits directly;
> 
> Then, even if net_dim is invoked again, it cannot work because the
> state is not restored to DIM_START_MEASURE.
> 
> Fixes: 6208799553a8 ("virtio-net: support rx netdim")
> Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>

This sounds like a legitimate bug fix so it needs to be sent separately
to the net tree (subject tagged with [PATCH net]) and then you'll have
to wait until the following Thursday for the net tree to get merged
into net-next. At which point you can send the improvements.
(Without the wait there would be a conflict between the trees).

Right now the series does not apply to net-next anyway.
Heng Qi April 26, 2024, 2:55 a.m. UTC | #2
在 2024/4/26 上午10:21, Jakub Kicinski 写道:
> On Thu, 25 Apr 2024 20:58:54 +0800 Heng Qi wrote:
>> When the dim worker is scheduled, if it no longer needs to issue
>> commands, dim may not be able to return to the working state later.
>>
>> For example, the following single queue scenario:
>>    1. The dim worker of rxq0 is scheduled, and the dim status is
>>       changed to DIM_APPLY_NEW_PROFILE;
>>    2. dim is disabled or parameters have not been modified;
>>    3. virtnet_rx_dim_work exits directly;
>>
>> Then, even if net_dim is invoked again, it cannot work because the
>> state is not restored to DIM_START_MEASURE.
>>
>> Fixes: 6208799553a8 ("virtio-net: support rx netdim")
>> Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
> This sounds like a legitimate bug fix so it needs to be sent separately
> to the net tree (subject tagged with [PATCH net]) and then you'll have
> to wait until the following Thursday for the net tree to get merged
> into net-next. At which point you can send the improvements.
> (Without the wait there would be a conflict between the trees).


Yes, you are right, since this set is on top of the one DanJ is working on

(which I mentioned in the commit log and patchwork will warn about),

I merged the fix patch into this series. I'll wait for his set to be merged and push it again.

Thanks a lot!


>
> Right now the series does not apply to net-next anyway.
diff mbox series

Patch

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 79a1b30c173c..8f05bcf1d37d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3650,9 +3650,9 @@  static void virtnet_rx_dim_work(struct work_struct *work)
 		if (err)
 			pr_debug("%s: Failed to send dim parameters on rxq%d\n",
 				 dev->name, qnum);
-		dim->state = DIM_START_MEASURE;
 	}
 out:
+	dim->state = DIM_START_MEASURE;
 	mutex_unlock(&rq->dim_lock);
 }