From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cindy Lu <lulu@redhat.com>
Cc: "Dragos Tatulea" <dtatulea@nvidia.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
si-wei.liu@oracle.com, "Jiri Pirko" <jiri@nvidia.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set
Date: Sun, 1 Sep 2024 14:49:25 -0400 [thread overview]
Message-ID: <20240901144739-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACLfguXM97JAdWcYO17+H6pu7MWLu2QqBgu_PypGxU_Ab+OUOQ@mail.gmail.com>
On Fri, Aug 30, 2024 at 05:29:14PM +0800, Cindy Lu wrote:
> On Fri, 30 Aug 2024 at 03:03, Dragos Tatulea <dtatulea@nvidia.com> wrote:
> >
> >
> >
> > On 29.08.24 12:00, Dragos Tatulea wrote:
> > >
> > >
> > > On 29.08.24 11:05, Cindy Lu wrote:
> > >> On Wed, 28 Aug 2024 at 17:37, Dragos Tatulea <dtatulea@nvidia.com> wrote:
> > >>>
> > >>>
> > >>>
> > >>> On 28.08.24 11:00, Cindy Lu wrote:
> > >>>> On Wed, 28 Aug 2024 at 09:51, Jason Wang <jasowang@redhat.com> wrote:
> > >>>>>
> > >>>>> On Wed, Aug 28, 2024 at 12:03 AM Dragos Tatulea <dtatulea@nvidia.com> wrote:
> > >>>>>>
> > >>>>>> When the vdpa device is configured without a specific MAC
> > >>>>>> address, the vport MAC address is used. However, this
> > >>>>>> address can be 0 which prevents the driver from properly
> > >>>>>> configuring the MPFS and breaks steering.
> > >>>>>>
> > >>>>>> The solution is to simply generate a random MAC address
> > >>>>>> when no MAC is set on the nic vport.
> > >>>>>>
> > >>>>>> Now it's possible to create a vdpa device without a
> > >>>>>> MAC address and run qemu with this device without needing
> > >>>>>> to configure an explicit MAC address.
> > >>>>>>
> > >>>>>> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > >>>>>> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> > >>>>>
> > >>>>> Acked-by: Jason Wang <jasowang@redhat.com>
> > >>>>>
> > >>>>> (Adding Cindy for double checking if it has any side effect on Qemu side)
> > >>>>>
> > >>>>> Thanks
> > >>>>>
> > >>>> But Now there is a bug in QEMU: if the hardware MAC address does not
> > >>>> match the one in the QEMU command line, it will cause traffic loss.
> > >>>>
> > >>> Why is this a new issue in qemu? qemu in it's current state won't work
> > >>> with a different mac address that the one that is set in HW anyway.
> > >>>
> > >> this is not a new bug. We are trying to fix it because it will cause
> > >> traffic lose without any warning.
> > >> in my fix , this setting (different mac in device and Qemu) will fail
> > >> to load the VM.
> > > Which is a good thing, right? Some feedback to the user that there is
> > > a misconfig. I got bitten by this so many times... Thank you for adding it.
> > >
> > >>
> > >>>> So, Just an FYI here: if your patch merged, it may cause traffic loss.
> > >>>> and now I'm working in the fix it in qemu, the link is
> > >>>> https://patchew.org/QEMU/20240716011349.821777-1-lulu@redhat.com/
> > >>>> The idea of this fix is
> > >>>> There are will only two acceptable situations for qemu:
> > >>>> 1. The hardware MAC address is the same as the MAC address specified
> > >>>> in the QEMU command line, and both MAC addresses are not 0.
> > >>>> 2. The hardware MAC address is not 0, and the MAC address in the QEMU
> > >>>> command line is 0. In this situation, the hardware MAC address will
> > >>>> overwrite the QEMU command line address.
> > >>>>
> > >>> Why would this not work with this patch? This patch simply sets a MAC
> > >>> if the vport doesn't have one set. Which allows for more scenarios to
> > >>> work.
> > >>>
> > >> I do not mean your patch will not work, I just want to make some
> > >> clarify here.Your patch + my fix may cause the VM to fail to load in
> > >> some situations, and this is as expected.
> > >> Your patch is good to merge.
> > > Ack. Thank you for the clarification.
> > (Side note)
> > While looking at another issue I discovered that it's possible to
> > configure a random MAC on the mlx5_vdpa device at VM boot time if
> > device MAC configuration is implemented during during .set_config(). So
> > I was able to boot up a VM with a random MAC address coming from qemu
> > and the traffic worked with this new MAC.
> >
> > So now I'm not sure if this is just by luck or if the .set_config()
> > op should be implemented for the MAC part in our device.
> >
> > Thanks,
> > Dragos
> >
> Hi Dragos,
> For qemu part, I think this is not set from set_config()? it should
> be from the CVQ?
You are confusing two things.
Provisioning is not through CVQ.
> Usually, we don't recommend using the set_config() function because
> the configuration space should be read-only for modern devices.
>
> Now there is a bug in this part of qemu, and we plan to remove the
> code to set_config() in virtio_net_device_realize(), here is the patch
> https://lore.kernel.org/all/CACGkMEvCSKfahpBQLAMmSzdFN-QPhg5Zx+UQVrFX0HsWybZZNA@mail.gmail.com/T/
> and this is still under review
>
> thanks
> cindy
next prev parent reply other threads:[~2024-09-01 18:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 16:02 [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set Dragos Tatulea
2024-08-27 20:43 ` Nelson, Shannon
2024-08-28 1:50 ` Jason Wang
2024-08-28 9:00 ` Cindy Lu
2024-08-28 9:37 ` Dragos Tatulea
2024-08-29 9:05 ` Cindy Lu
2024-08-29 10:00 ` Dragos Tatulea
2024-08-29 19:03 ` Dragos Tatulea
2024-08-30 9:29 ` Cindy Lu
2024-08-30 9:43 ` Dragos Tatulea
2024-09-01 18:49 ` Michael S. Tsirkin [this message]
2024-09-02 9:55 ` Cindy Lu
2024-08-30 9:12 ` Cindy Lu
2024-08-30 13:52 ` Dragos Tatulea
2024-08-30 14:46 ` Dragos Tatulea
2024-09-02 8:40 ` Cindy Lu
2024-09-02 8:53 ` Dragos Tatulea
2024-09-02 9:05 ` Cindy Lu
2024-09-02 9:10 ` Dragos Tatulea
2024-08-28 5:54 ` Si-Wei Liu
2024-08-28 7:53 ` Dragos Tatulea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240901144739-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=dtatulea@nvidia.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=jiri@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=si-wei.liu@oracle.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).