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 8F95AC38142 for ; Mon, 23 Jan 2023 09:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231597AbjAWJ0i (ORCPT ); Mon, 23 Jan 2023 04:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjAWJ0g (ORCPT ); Mon, 23 Jan 2023 04:26:36 -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 8AFD915549 for ; Mon, 23 Jan 2023 01:25:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674465950; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZMTy6Tq8SNpkRFs2YVhPz9j6sx3/BmqHI5EE4rEjczI=; b=WYlase41I5o1Ru2ApBik6cacV4ezdB9dYjl0tmRyfZFXczKrx2rYcQFv90DJNDnldOISSg bQdBis8Z9edK2gQHXotxnsP8p0/iGPZKoDkhngFy+oxzdkgFkRmFZBscUYx3QBxJmFnl1N tlfGMMvFW/WRuZcwIBgI/54Y+YTZGks= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-582-TAZX67S_NZW6WRLTG8GYsg-1; Mon, 23 Jan 2023 04:25:49 -0500 X-MC-Unique: TAZX67S_NZW6WRLTG8GYsg-1 Received: by mail-qk1-f197.google.com with SMTP id bm30-20020a05620a199e00b007090f3c5ec0so6758212qkb.21 for ; Mon, 23 Jan 2023 01:25:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZMTy6Tq8SNpkRFs2YVhPz9j6sx3/BmqHI5EE4rEjczI=; b=5VhiAxrMCRbF9fGHc1mSPQn0xb6edWUILBmCDS3c5rnXbtzbWTnbYsSvX+9/DuYOLJ 3qpjMM2UaN1rJnVrusX1Vucu/afzhmKwgUzJYofQ9+khorCznngf5RBtgPmiN1jwLeJ1 d891PJ6OCy1V4D7XxPkuaCBeenXEWRs6TLZLvc8gYfnuYdqtU5NA32imACgN/EGnvmER 0bJpvS5FJHYo+arIM7JSzw3gFA9kJpzO79SO6Nkuto/U3BGelVAYgoXx7PCy8pnzlnHE jP74UyJ6NiPAH5iyKoZwvGxk99F/HXhMXO4UF569dD4riENRJEO8ct5F8OPbtNbMUlcL wZew== X-Gm-Message-State: AFqh2kpMIwGZn2vUSvfK9BCW5Y1zA5sTXCtQuTa9eF3PxHuKw7+r2+eP MQdyYTaEw6733nQnHlvfOT5YQTbjCB+yzt923OMoXMrLLRhgsF6lXowtNq91tdlW+PvXQWRD/oL MVqYiXMAj5K1Baur81Jlt9Gjz X-Received: by 2002:ad4:5301:0:b0:535:5ff1:ccb2 with SMTP id y1-20020ad45301000000b005355ff1ccb2mr16731356qvr.4.1674465948714; Mon, 23 Jan 2023 01:25:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtM8WdUzTuf3AICpDNA4CQh1qPmCAD0+RWVCzbet2oH+5JRFCvNifkrbn4tS6j0Ar1yAi0SvQ== X-Received: by 2002:ad4:5301:0:b0:535:5ff1:ccb2 with SMTP id y1-20020ad45301000000b005355ff1ccb2mr16731343qvr.4.1674465948492; Mon, 23 Jan 2023 01:25:48 -0800 (PST) Received: from [192.168.100.30] ([82.142.8.70]) by smtp.gmail.com with ESMTPSA id s10-20020a05620a16aa00b006cfc9846594sm21718471qkj.93.2023.01.23.01.25.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Jan 2023 01:25:47 -0800 (PST) Message-ID: Date: Mon, 23 Jan 2023 10:25:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 0/4] virtio_net: vdpa: update MAC address when it is generated by virtio-net Content-Language: en-US To: "Michael S. Tsirkin" 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" , =?UTF-8?Q?Eugenio_P=c3=a9rez?= References: <20230122100526.2302556-1-lvivier@redhat.com> <20230122052211-mutt-send-email-mst@kernel.org> From: Laurent Vivier In-Reply-To: <20230122052211-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/22/23 11:23, Michael S. Tsirkin wrote: > 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. We needed to fix virtio_net before fixing vdpa_sim_net otherwise the virtnet_send_command() hangs when we define the vdpa device with "vdpa dev" but without a MAC address. > 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. I was not aware of the Jason's series. It seems to address better the problem, except it triggers the ASSERT_RTNL() in virtnet_send_command() when it is called from virtnet_probe(). I will remove patches 2 and 4 from my series. PATCH 3 can be sent on independently too. Thanks, Laurent