From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E77C54EAA for ; Sun, 22 Jan 2023 10:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbjAVKYl (ORCPT ); Sun, 22 Jan 2023 05:24:41 -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-Google-Smtp-Source: AMrXdXsJYsSlxdKNdkV3k0zZFAQEWMBIP57WsNsog63A1Utnn4PhgD2R94CsSnVpUciaRFnFvrZD5Q== 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> 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 >