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 79BD5C38142 for ; Sun, 22 Jan 2023 10:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbjAVKYk (ORCPT ); Sun, 22 Jan 2023 05:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjAVKYj (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.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C671DB83 for ; Sun, 22 Jan 2023 02:23:53 -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-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-251-iERXAxyuNeauP3jGBDClSg-1; Sun, 22 Jan 2023 05:23:50 -0500 X-MC-Unique: iERXAxyuNeauP3jGBDClSg-1 Received: by mail-ej1-f69.google.com with SMTP id sa32-20020a1709076d2000b0084d4593797eso6099884ejc.16 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=W0Uu0EuNY6XCq9w1DTlDskrsLJqUj+CUNQlNwXGj52ixepAnRACQuYBxuWvyg3h5AX wcaY1zQtD2gjUAjNcBB6NEURhWKeyo+AZYHQncgjXjfHqOxPg4YGu4Gprye9ZHcuqTcH fsXPvmAB34kAES6h2YIaaaeifENRjvVc+M40NYDL3AMUqpNi9Xg/xG7Tfg0v2xskWCZA iOFllczd84yS4/98+HyeMhz00qWf7PEc+ufwc+pFF8cODW2orLsBoqydod1QkugWdDBB QYRa6XA1FUk99Qa4FJUBUecHSdQ3D+4/AbIto2ExPxMd+TX7HqFbqBKJb81tRhaKHMPt F1EQ== X-Gm-Message-State: AFqh2kqAFkvTgr9E8R1ReLx99g89/WHSvgeDyr2WEVRzfH+1B9pBTOg5 1Hh/2ljAYY3wT+QqtInZ5UWyyN/pizHEg6cHCT4uaDy7e5Xs4YyMJxurN+BUNTN6s0iLd/Kv4JC 3Ufqz/Q9UMpN601wr X-Received: by 2002:a17:906:71a:b0:7c1:6344:84a with SMTP id y26-20020a170906071a00b007c16344084amr22442681ejb.5.1674383029675; 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: netdev@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 >