Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5090722rwb; Sun, 22 Jan 2023 03:08:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+5bbWcrSCsqaZnT24tGS2tp9VdI94Ei7sryoapO7PfMKg19e3HCCEFjmy5WE043mP4B/I X-Received: by 2002:a05:6a20:60d5:b0:af:7939:5fed with SMTP id q21-20020a056a2060d500b000af79395fedmr18537639pza.43.1674385736846; Sun, 22 Jan 2023 03:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674385736; cv=none; d=google.com; s=arc-20160816; b=LfgKbpVU449tqqDIVuvf1GfZTDWOIGmAcngH0LF3C59LGlGsubwYFeOJ3YC+2O3/TP Wn6wY/p3fAwdhB0jAe9e/nsxeRRuqvePsFX0NYxkZEcrs+jk1cqDBJsHI2Ioijorol8Q OyITXVvZS4dUEfoftTe6UuDHY6rgSJ/5FcLQP/1FRfCFuTDXsjo1oBqioy7nDgXhw+YP cEm6h7A0uyjS8GP/2MqQ1vUXkzshHo7W4P9xsUdnrorcVb7unlB08Dv5etBnU3/IMMBy c1NmLEZQFYhUairqD4YTD7bai2Kz7elE96wd0XsW4a6UQ1OZmEJisvYUJ/GNvRatjNQg 8J3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Vp4nDruEit5hTFxTjTpKC1ydXnGDFdRa2R0+xR8TkNY=; b=R/l/AUKvY1yDN6JqP5NlLN4R1zpVGG42CMyfx4dTSqd5QKBju0aXy5aJSRs8vaIaRA qoKuLoKQx8ouKf8ZYy4zIw39xfgdYs5UBMgsROf3jNYvZZcV+KXOE+q+V3FNTFjjDc1p Hw30hD0NeEvGXOXH1y5tGO06onooGa0iU3RtyPUItUWrhEVdITP0tZr4yWbud278llrR 7qEfAoB4wlVr74VuBBLGSgi/u/n2PtqPzp6isAkakAABZx6AUWINJY6/QBeU1Ki+M8FW ILd2G8DkW80K7/V4apeS3tY5/fFSCDNHykWjUj6LOTJW5tdvPPz45Bf+2CRqkkblT/42 K9wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+RxrJaG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b004a339f6f89esi5961627pgb.470.2023.01.22.03.08.50; Sun, 22 Jan 2023 03:08:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+RxrJaG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbjAVKYk (ORCPT + 52 others); Sun, 22 Jan 2023 05:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbjAVKYj (ORCPT ); Sun, 22 Jan 2023 05:24:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BAE91C303 for ; Sun, 22 Jan 2023 02:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674383032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Vp4nDruEit5hTFxTjTpKC1ydXnGDFdRa2R0+xR8TkNY=; b=d+RxrJaGACwDWxQevYeg72s5qe1a2KytczAM+FccY1OvjRLtRK640e1w3MpMnHgPgWOEBa sQhDh5OEzBtT/6ZXhdpfehvMtS3gCQaV20n21qL9RbwvA1XBn6MrkMEi5T/0jra4Sw5hPO YLKK9Bs9bUbJuUrXx1daG4WU8Gal54Y= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-440-8jdeQaVzPPukNSTMQ-7fRw-1; Sun, 22 Jan 2023 05:23:50 -0500 X-MC-Unique: 8jdeQaVzPPukNSTMQ-7fRw-1 Received: by mail-ej1-f71.google.com with SMTP id hr22-20020a1709073f9600b0086ffb73ac1cso6130584ejc.23 for ; Sun, 22 Jan 2023 02:23:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Vp4nDruEit5hTFxTjTpKC1ydXnGDFdRa2R0+xR8TkNY=; b=lUeOozDHeYkGRtYJNJtmYb365j0/kvMdUEjT/xFsrpco5RMqHhd+Ydg7YvJfhvUAQT fqfd75XvfPAltyK+hAbtrpkQpUmlKCqzwld30wUc5EmRHpG/vdfBUFMjlL8M6iCE+Zn1 WszqVh5jGx5+qZpX9dGg0n9WqcIGUC5OorKe37UkRFd1n8w7X1wdNuMi6CMXH6FsAy6d J4qhgPLrzzZ3eXGbg1hLX6z70DU7a2Lrz3yl67GjsxRINiUmOiYznzNvAbdSGhADbE9d F114ME/uQ4Jk6r6+YL6utZlbrSKjD1AqqnqX4jFkaBdRKms2lwjlFMJkYYmCae2+ruKQ loVg== X-Gm-Message-State: AFqh2krc54RDA42/hPklhDau1wvR/9BHGEyoCnmBxs1ZmR4aQSeXHmwD 1NZQFtNdSrLykmr4rCPaax2WEDEkPU06qz4kWrkhjq+mql64Sd+21cXURGLKTiVdKVAuj9IHJTL hmgPReefEGSulOZv+vOfU8PtO X-Received: by 2002:a17:906:71a:b0:7c1:6344:84a with SMTP id y26-20020a170906071a00b007c16344084amr22442679ejb.5.1674383029671; Sun, 22 Jan 2023 02:23:49 -0800 (PST) X-Received: by 2002:a17:906:71a:b0:7c1:6344:84a with SMTP id y26-20020a170906071a00b007c16344084amr22442658ejb.5.1674383029366; Sun, 22 Jan 2023 02:23:49 -0800 (PST) Received: from redhat.com ([2.52.149.29]) by smtp.gmail.com with ESMTPSA id y19-20020a1709060a9300b0084debc351b3sm17314670ejf.20.2023.01.22.02.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 02:23:48 -0800 (PST) Date: Sun, 22 Jan 2023 05:23:44 -0500 From: "Michael S. Tsirkin" To: Laurent Vivier Cc: linux-kernel@vger.kernel.org, Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , Eugenio =?iso-8859-1?Q?P=E9rez?= Subject: Re: [PATCH 0/4] virtio_net: vdpa: update MAC address when it is generated by virtio-net Message-ID: <20230122052211-mutt-send-email-mst@kernel.org> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 22, 2023 at 11:05:22AM +0100, Laurent Vivier wrote: > When the MAC address is not provided by the vdpa device virtio_net > driver assigns a random one without notifying the device. > The consequence, in the case of mlx5_vdpa, is the internal routing > tables of the device are not updated and this can block the > communication between two namespaces. > > To fix this problem, use virtnet_send_command(VIRTIO_NET_CTRL_MAC) > to set the address from virtnet_probe() when the MAC address is > randomly assigned from virtio_net. > > While I was testing this change I found 3 other bugs in vdpa_sim_net: > > - vdpa_sim_net sets the VIRTIO_NET_F_MAC even if no MAC address is > provided. So virtio_net doesn't generate a random MAC address and > the MAC address appears to be 00:00:00:00:00:00 > > - vdpa_sim_net never processes the command and virtnet_send_command() > hangs in an infinite loop. To avoid a kernel crash add a timeout > in the loop. > > - To allow vdpa_sim_net to process the command, replace the cpu_relax() > in the loop by a schedule(). vdpa_sim_net uses a workqueue to process > the queue, and if we don't allow the kernel to schedule, the queue > is not processed and the loop is infinite. I'd split these things out as opposed to a series unless there's a dependency I missed. All this reminds me of https://lore.kernel.org/r/20221226074908.8154-5-jasowang%40redhat.com how is this patch different/better? Pls also CC people involved in that original discussion. Thanks! > Laurent Vivier (4): > virtio_net: notify MAC address change on device initialization > virtio_net: add a timeout in virtnet_send_command() > vdpa_sim_net: don't always set VIRTIO_NET_F_MAC > virtio_net: fix virtnet_send_command() with vdpa_sim_net > > drivers/net/virtio_net.c | 21 +++++++++++++++++++-- > drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 6 ++++++ > 2 files changed, 25 insertions(+), 2 deletions(-) > > -- > 2.39.0 >