Skip to content

Commit 3ab098d

Browse files
jasowangdavem330
authored andcommitted
virtio-net: don't respond to cpu hotplug notifier if we're not ready
We're trying to re-configure the affinity unconditionally in cpu hotplug callback. This may lead the issue during resuming from s3/s4 since - virt queues haven't been allocated at that time. - it's unnecessary since thaw method will re-configure the affinity. Fix this issue by checking the config_enable and do nothing is we're not ready. The bug were introduced by commit 8de4b2f (virtio-net: reset virtqueue affinity when doing cpu hotplug). Cc: Rusty Russell <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Wanlong Gao <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Wanlong Gao <[email protected]> Signed-off-by: Jason Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 39bb93f commit 3ab098d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/virtio_net.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,11 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
11161116
{
11171117
struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb);
11181118

1119+
mutex_lock(&vi->config_lock);
1120+
1121+
if (!vi->config_enable)
1122+
goto done;
1123+
11191124
switch(action & ~CPU_TASKS_FROZEN) {
11201125
case CPU_ONLINE:
11211126
case CPU_DOWN_FAILED:
@@ -1128,6 +1133,9 @@ static int virtnet_cpu_callback(struct notifier_block *nfb,
11281133
default:
11291134
break;
11301135
}
1136+
1137+
done:
1138+
mutex_unlock(&vi->config_lock);
11311139
return NOTIFY_OK;
11321140
}
11331141

0 commit comments

Comments
 (0)