[PATCH vhost] vdpa/mlx5: Fix release of uninitialized resources on error path

2025-07-08 Thread Dragos Tatulea
x104/0x140 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f0c25b0feca [...] ---[ end trace ]--- Signed-off-by: Dragos Tatulea Fixes: 83e445e64f48 ("vdpa/mlx5: Fix error path during device add") Reported-by: Wenli Quan Closes: https://lore.kerne

[PATCH vhost] vdpa/mlx5: Fix needs_teardown flag calculation

2025-06-04 Thread Dragos Tatulea
evious value of the needs_teardown flag when re-calculating it during VQ size configuration. Fixes: 0fe963d6fc16 ("vdpa/mlx5: Re-create HW VQs under certain conditions") Signed-off-by: Dragos Tatulea Reviewed-by: Shahar Shitrit Reviewed-by: Si-Wei Liu Tested-by: Si-Wei Liu --- drive

[PATCH vhost v2] vdpa/mlx5: Fix oversized null mkey longer than 32bit

2025-02-20 Thread Dragos Tatulea
are correctly populated. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Cc: sta...@vger.kernel.org Reported-by: Cong Meng Signed-off-by: Si-Wei Liu Signed-off-by: Dragos Tatulea Acked-by: Eugenio Pérez --- Changes in v2: - Added Reported-by tag. - Fixed typo fo

Re: [PATCH vhost] vdpa/mlx5: Fix oversized null mkey longer than 32bit

2025-02-18 Thread Dragos Tatulea
On 02/18, Eugenio Perez Martin wrote: > On Mon, Feb 17, 2025 at 8:45 PM Dragos Tatulea wrote: > > > > From: Si-Wei Liu > > > > create_user_mr() has correct code to count the number of null keys > > used to fill in a hole for the memory map. However, fill_indir(

[PATCH vhost] vdpa/mlx5: Fix oversized null mkey longer than 32bit

2025-02-17 Thread Dragos Tatulea
correctly populated. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Cc: sta...@vger.kernel.org Signed-off-by: Si-Wei Liu Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mr.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dr

Re: [PATCH v2] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines

2025-02-04 Thread Dragos Tatulea
gt;actual_features = > + (device_features & BIT_ULL(VIRTIO_F_VERSION_1)); > > ndev->vqs = kcalloc(max_vqs, sizeof(*ndev->vqs), GFP_KERNEL); > ndev->event_cbs = kcalloc(max_vqs + 1, sizeof(*ndev->event_cbs), > GFP_KERNEL); > -- > 2.34.1 > The patch looks good now. Thanks! Reviewed-by: Dragos Tatulea

Re: [PATCH] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines.

2025-01-30 Thread Dragos Tatulea
On 01/30, Konstantin Shkolnyy wrote: > mlx5_vdpa_dev_add() doesn’t initialize mvdev->actual_features. It’s > initialized later by mlx5_vdpa_set_driver_features(). However, > mlx5_vdpa_get_config() depends on the VIRTIO_F_VERSION_1 flag in > actual_features to return data with correct endianness. Wh

Re: [PATCH vhost 2/2] vdpa/mlx5: Fix suboptimal range on iotlb iteration

2024-11-13 Thread Dragos Tatulea
On 13.11.24 15:49, Michael S. Tsirkin wrote: > On Wed, Nov 13, 2024 at 03:33:35PM +0100, Dragos Tatulea wrote: >> >> >> On 13.11.24 07:32, Michael S. Tsirkin wrote: >>> On Mon, Oct 21, 2024 at 04:40:40PM +0300, Dragos Tatulea wrote: >>>> From: Si-Wei L

Re: [PATCH vhost 2/2] vdpa/mlx5: Fix suboptimal range on iotlb iteration

2024-11-13 Thread Dragos Tatulea
On 13.11.24 07:32, Michael S. Tsirkin wrote: > On Mon, Oct 21, 2024 at 04:40:40PM +0300, Dragos Tatulea wrote: >> From: Si-Wei Liu >> >> The starting iova address to iterate iotlb map entry within a range >> was set to an irrelevant value when passing to the itree_n

Re: [PATCH vhost 0/2] vdpa/mlx5: Iova mapping related fixes

2024-11-11 Thread Dragos Tatulea
On 21.10.24 15:40, Dragos Tatulea wrote: > Here are 2 fixes from Si-Wei: > - The first one is an important fix that has to be applied as far > back as possible (hence CC'ing linux-stable). > - The second is more of an improvement. That's why it doesn't have the >

Re: [PATCH v3 1/2] vdpa/mlx5: Set speed and duplex of vDPA devices to UNKNOWN

2024-11-08 Thread Dragos Tatulea
t endianness of speed. >> >> Signed-off-by: Carlos Bilbao >> Reviewed-by: Dragos Tatulea >> --- >> drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 >> 1 file changed, 12 insertions(+) >> >> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c >>

[PATCH] vdpa/mlx5: Fix error path during device add

2024-11-05 Thread Dragos Tatulea
ffeace233f3 Modules linked in: ... CR2: 00b8 Fixes: 62111654481d ("vdpa/mlx5: Postpone MR deletion") Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 21 + 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/vdpa/ml

[PATCH vhost 0/2] vdpa/mlx5: Iova mapping related fixes

2024-10-21 Thread Dragos Tatulea
Here are 2 fixes from Si-Wei: - The first one is an important fix that has to be applied as far back as possible (hence CC'ing linux-stable). - The second is more of an improvement. That's why it doesn't have the Fixes tag. I'd like to thank Si-Wei for the effort of finding and fixing these is

[PATCH vhost 2/2] vdpa/mlx5: Fix suboptimal range on iotlb iteration

2024-10-21 Thread Dragos Tatulea
ke it consistent with the following for-loop. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Si-Wei Liu Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/vdpa/m

[PATCH vhost 1/2] vdpa/mlx5: Fix PA offset with unaligned starting iotlb map

2024-10-21 Thread Dragos Tatulea
code is already correct: the range in [mr->start, map->start) was handled by a different iteration. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Cc: sta...@vger.kernel.org Signed-off-by: Si-Wei Liu Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5

Re: [PATCH vhost v2 0/7] vdpa/mlx5: Optimze MKEY operations

2024-09-11 Thread Dragos Tatulea
On 11.09.24 10:02, Eugenio Perez Martin wrote: > On Mon, Sep 9, 2024 at 11:30 AM Dragos Tatulea wrote: >> >> >> >> On 30.08.24 12:58, Dragos Tatulea wrote: >>> This series improves the time of .set_map() operations by parallelizing >>> the MKEY cr

Re: [PATCH mlx5-vhost v2 01/10] net/mlx5: Support throttled commands from async API

2024-09-11 Thread Dragos Tatulea
On 11.09.24 10:00, Eugenio Perez Martin wrote: > On Mon, Sep 9, 2024 at 11:33 AM Dragos Tatulea wrote: >> >> >> >> On 16.08.24 11:01, Dragos Tatulea wrote: >>> Currently, commands that qualify as throttled can't be used via the >>> async API.

Re: [PATCH mlx5-vhost v2 01/10] net/mlx5: Support throttled commands from async API

2024-09-09 Thread Dragos Tatulea
On 16.08.24 11:01, Dragos Tatulea wrote: > Currently, commands that qualify as throttled can't be used via the > async API. That's due to the fact that the throttle semaphore can sleep > but the async API can't. > > This patch allows throttling in the async API by

Re: [PATCH vhost v2 0/7] vdpa/mlx5: Optimze MKEY operations

2024-09-09 Thread Dragos Tatulea
On 30.08.24 12:58, Dragos Tatulea wrote: > This series improves the time of .set_map() operations by parallelizing > the MKEY creation and deletion for direct MKEYs. Looking at the top > level MKEY creation/deletion functions, the following improvement can

Re: [PATCH v2 2/2] vdpa: Remove ioctl VHOST_VDPA_SET_CONFIG per spec compliance

2024-09-04 Thread Dragos Tatulea
On 04.09.24 08:34, Jason Wang wrote: > On Wed, Sep 4, 2024 at 1:59 PM Dragos Tatulea wrote: >> >> >> >> On 04.09.24 05:38, Jason Wang wrote: >>> On Wed, Sep 4, 2024 at 1:15 AM Carlos Bilbao >>> wrote: >>>> >>>> From: Carlos

Re: [PATCH v2 2/2] vdpa: Remove ioctl VHOST_VDPA_SET_CONFIG per spec compliance

2024-09-03 Thread Dragos Tatulea
On 04.09.24 05:38, Jason Wang wrote: > On Wed, Sep 4, 2024 at 1:15 AM Carlos Bilbao > wrote: >> >> From: Carlos Bilbao >> >> Remove invalid ioctl VHOST_VDPA_SET_CONFIG and all its implementations >> with vdpa_config_ops->set_config(). This is needed per virtio spec >> requirements; virtio-spec

Re: [PATCH vhost v2 00/10] vdpa/mlx5: Parallelize device suspend/resume

2024-09-03 Thread Dragos Tatulea
On 03.09.24 10:10, Eugenio Perez Martin wrote: > On Tue, Sep 3, 2024 at 9:48 AM Dragos Tatulea wrote: >> >> >> >> On 03.09.24 09:40, Lei Yang wrote: >>> On Mon, Sep 2, 2024 at 7:05 PM Dragos Tatulea wrote: >>>> >>>> Hi Lei,

Re: [PATCH vhost v2 00/10] vdpa/mlx5: Parallelize device suspend/resume

2024-09-03 Thread Dragos Tatulea
On 03.09.24 09:40, Lei Yang wrote: > On Mon, Sep 2, 2024 at 7:05 PM Dragos Tatulea wrote: >> >> Hi Lei, >> >> On 02.09.24 12:03, Lei Yang wrote: >>> Hi Dragos >>> >>> QE tested this series with mellanox nic, it failed with [1] when >>

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-30 Thread Dragos Tatulea
Hi Cindy, On 30.08.24 15:52, Dragos Tatulea wrote: > > > On 30.08.24 11:12, Cindy Lu wrote: >> On Thu, 29 Aug 2024 at 18:00, Dragos Tatulea wrote: >>> >>> >>> >>> On 29.08.24 11:05, Cindy Lu wrote: >>>> On Wed, 28 Aug 2024 at 17:37

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-30 Thread Dragos Tatulea
On 30.08.24 11:12, Cindy Lu wrote: > On Thu, 29 Aug 2024 at 18:00, Dragos Tatulea wrote: >> >> >> >> On 29.08.24 11:05, Cindy Lu wrote: >>> On Wed, 28 Aug 2024 at 17:37, Dragos Tatulea wrote: >>>> >>>> >>>> >>>&g

Re: [PATCH vhost 1/7] vdpa/mlx5: Create direct MKEYs in parallel

2024-08-30 Thread Dragos Tatulea
On 29.08.24 17:15, Eugenio Perez Martin wrote: > On Thu, Aug 29, 2024 at 3:54 PM Dragos Tatulea wrote: >> >> >> >> On 29.08.24 15:10, Eugenio Perez Martin wrote: >>> On Wed, Aug 21, 2024 at 1:41 PM Dragos Tatulea wrote: >>>> >>>> Us

[PATCH vhost v2 5/7] vdpa/mlx5: Rename mr_mtx -> lock

2024-08-30 Thread Dragos Tatulea
Now that the mr resources have their own namespace in the struct, give the lock a clearer name. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 +- drivers/vdpa/mlx5/core/mr.c| 20 ++-- drivers

[PATCH vhost v2 7/7] vdpa/mlx5: Postpone MR deletion

2024-08-30 Thread Dragos Tatulea
lock taken, this operation it will have to wait for the handler to finish. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 10 ++ drivers/vdpa/mlx5/core/mr.c| 55 -- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4

[PATCH vhost v2 3/7] vdpa/mlx5: Rename function

2024-08-30 Thread Dragos Tatulea
A followup patch will use this name for something else. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 +- drivers/vdpa/mlx5/core/mr.c| 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 3 files changed, 6 insertions(+), 6

[PATCH vhost v2 6/7] vdpa/mlx5: Introduce init/destroy for MR resources

2024-08-30 Thread Dragos Tatulea
urces() / mlx5_vdpa_free_resources() into these new functions. However, the lifetime at the outer scope remains the same: mlx5_vdpa_dev_add() / mlx5_vdpa_dev_free() Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 ++ drivers/vdpa/mlx5/core/mr.c

[PATCH vhost v2 4/7] vdpa/mlx5: Extract mr members in own resource struct

2024-08-30 Thread Dragos Tatulea
Group all mapping related resources into their own structure. Upcoming patches will add more members in this new structure. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 13 ++- drivers/vdpa/mlx5/core/mr.c

[PATCH vhost v2 2/7] vdpa/mlx5: Delete direct MKEYs in parallel

2024-08-30 Thread Dragos Tatulea
Use the async interface to issue MTT MKEY deletion. This makes destroy_user_mr() on average 8x times faster. This number is also dependent on the size of the MR being deleted. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/core/mr.c | 64

[PATCH vhost v2 1/7] vdpa/mlx5: Create direct MKEYs in parallel

2024-08-30 Thread Dragos Tatulea
create_user_mr() 3-5x faster, depending on the size of the MR. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mr.c | 120 +--- 1 file changed, 98 insertions(+), 22 deletions(-) diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5

[PATCH vhost v2 0/7] vdpa/mlx5: Optimze MKEY operations

2024-08-30 Thread Dragos Tatulea
where appropriate (only second patch). - Added macro define for MTT alignment in first patch. - Improved commit messages/comments based on review comments. - Removed extra newlines. --- Dragos Tatulea (7): vdpa/mlx5: Create direct MKEYs in parallel vdpa/mlx5: Delete direct MKEYs in parallel

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-30 Thread Dragos Tatulea
Hi Cindy, On 30.08.24 11:29, Cindy Lu wrote: > On Fri, 30 Aug 2024 at 03:03, Dragos Tatulea 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

Re: [PATCH 2/2] vdpa: Add support to update speed/duplex in vDPA/mlx5_vnet

2024-08-29 Thread Dragos Tatulea
(resending as I accidentally replied only to Carlos) On 29.08.24 18:16, Carlos Bilbao wrote: > From: Carlos Bilbao > > Include support to update the vDPA configuration fields of speed and > duplex (as needed by VHOST_VDPA_SET_CONFIG). This includes function > mlx5_vdpa_set_config() as well as ch

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-29 Thread Dragos Tatulea
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 wrote: >>> >>> >>> >>> On 28.08.24 11:00, Cindy Lu wrote: >>>> On Wed, 28 Aug 2024 at 09:51,

Re: [PATCH 1/2] mlx5_vnet: Set speed and duplex of vDPA devices to UNKNOWN

2024-08-29 Thread Dragos Tatulea
and duplex. Add > needed helper cpu_to_mlx5vdpa32() to convert endianness of speed. > > Signed-off-by: Carlos Bilbao Nit: prefix is vdpa/mlx5. Once that is fixed, for this patch: Reviewed-by: Dragos Tatulea > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 > 1 file ch

Re: [PATCH vhost 6/7] vdpa/mlx5: Introduce init/destroy for MR resources

2024-08-29 Thread Dragos Tatulea
On 29.08.24 16:37, Eugenio Perez Martin wrote: > On Wed, Aug 21, 2024 at 1:42 PM Dragos Tatulea wrote: >> >> There's currently not a lot of action happening during >> the init/destroy of MR resources. But more will be added >> in the upcoming patches. >

Re: [PATCH vhost 7/7] vdpa/mlx5: Postpone MR deletion

2024-08-29 Thread Dragos Tatulea
On 29.08.24 17:07, Eugenio Perez Martin wrote: > On Wed, Aug 21, 2024 at 1:42 PM Dragos Tatulea wrote: >> >> Currently, when a new MR is set up, the old MR is deleted. MR deletion >> is about 30-40% the time of MR creation. As deleting the old MR is not >> important

Re: [PATCH] vdpa: Set speed and duplex of mlx5_vnet to UNKNOWN

2024-08-29 Thread Dragos Tatulea
On 28.08.24 20:16, Carlos Bilbao wrote: > From: Carlos Bilbao > > mlx5_vdpa vDPA devices currently don't support reporting or setting the > speed and duplex and hence should be UNKNOWN instead of zero. > > Signed-off-by: Carlos Bilbao > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 +++ >

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-29 Thread Dragos Tatulea
On 29.08.24 11:05, Cindy Lu wrote: > On Wed, 28 Aug 2024 at 17:37, Dragos Tatulea wrote: >> >> >> >> On 28.08.24 11:00, Cindy Lu wrote: >>> On Wed, 28 Aug 2024 at 09:51, Jason Wang wrote: >>>> >>>> On Wed, Aug 28, 2024 at 12:03 AM D

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-28 Thread Dragos Tatulea
On 28.08.24 11:00, Cindy Lu wrote: > On Wed, 28 Aug 2024 at 09:51, Jason Wang wrote: >> >> On Wed, Aug 28, 2024 at 12:03 AM Dragos Tatulea wrote: >>> >>> When the vdpa device is configured without a specific MAC >>> address, the vport MAC address i

Re: [PATCH] vdpa/mlx5: Fix invalid mr resource destroy

2024-08-28 Thread Dragos Tatulea
On 28.08.24 08:22, Si-Wei Liu wrote: > > > On 8/27/2024 9:08 AM, Dragos Tatulea wrote: >> Certain error paths from mlx5_vdpa_dev_add() can end up releasing mr >> resources which never got initialized in the first place. >> >> This patch adds the missing check

Re: [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-28 Thread Dragos Tatulea
On 28.08.24 07:54, Si-Wei Liu wrote: > > > On 8/27/2024 9:02 AM, Dragos Tatulea 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

Re: [RFC] Why is set_config not supported in mlx5_vnet?

2024-08-27 Thread Dragos Tatulea
On 27.08.24 04:03, Jason Wang wrote: > On Tue, Aug 27, 2024 at 12:11 AM Dragos Tatulea wrote: >> >> >> On 26.08.24 16:24, Andrew Lunn wrote: >>> On Mon, Aug 26, 2024 at 11:06:09AM +0200, Dragos Tatulea wrote: >>>> >>>> >>>> On

[PATCH] vdpa/mlx5: Fix invalid mr resource destroy

2024-08-27 Thread Dragos Tatulea
? clear_bhb_loop+0x25/0x80 ? clear_bhb_loop+0x25/0x80 ? clear_bhb_loop+0x25/0x80 ? clear_bhb_loop+0x25/0x80 entry_SYSCALL_64_after_hwframe+0x78/0x80 Fixes: 512c0cdd80c1 ("vdpa/mlx5: Decouple cvq iotlb handling from hw mapping code") Signed-off-by: Dragos Tatulea Reviewed-by: Co

[PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set

2024-08-27 Thread Dragos Tatulea
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 Reviewed-by: Jiri Pirko --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+)

Re: [RFC] Why is set_config not supported in mlx5_vnet?

2024-08-26 Thread Dragos Tatulea
On 26.08.24 16:24, Andrew Lunn wrote: > On Mon, Aug 26, 2024 at 11:06:09AM +0200, Dragos Tatulea wrote: >> >> >> On 23.08.24 18:54, Carlos Bilbao wrote: >>> Hello, >>> >>> I'm debugging my vDPA setup, and when using ioctl to retrieve the &

Re: [RFC] Why is set_config not supported in mlx5_vnet?

2024-08-26 Thread Dragos Tatulea
On 26.08.24 16:26, Carlos Bilbao wrote: > Hello Dragos, > > On 8/26/24 4:06 AM, Dragos Tatulea wrote: >> >> On 23.08.24 18:54, Carlos Bilbao wrote: >>> Hello, >>> >>> I'm debugging my vDPA setup, and when using ioctl to retrieve the >>

Re: [RFC] Why is set_config not supported in mlx5_vnet?

2024-08-26 Thread Dragos Tatulea
On 23.08.24 18:54, Carlos Bilbao wrote: > Hello, > > I'm debugging my vDPA setup, and when using ioctl to retrieve the > configuration, I noticed that it's running in half duplex mode: > > Configuration data (24 bytes): > MAC address: (Mac address) > Status: 0x0001 > Max virtqueue pairs:

[PATCH vhost 7/7] vdpa/mlx5: Postpone MR deletion

2024-08-21 Thread Dragos Tatulea
lock taken, this operation it will have to wait for the handler to finish. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 10 ++ drivers/vdpa/mlx5/core/mr.c| 51 -- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3

[PATCH vhost 5/7] vdpa/mlx5: Rename mr_mtx -> lock

2024-08-21 Thread Dragos Tatulea
Now that the mr resources have their own namespace in the struct, give the lock a clearer name. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 +- drivers/vdpa/mlx5/core/mr.c| 20 ++-- drivers/vdpa/mlx5/core

[PATCH vhost 0/7] vdpa/mlx5: Optimze MKEY operations

2024-08-21 Thread Dragos Tatulea
VQPs) This series must be applied on top of the parallel VQ suspend/resume series [0]. [0] https://lore.kernel.org/all/20240816090159.1967650-1-dtatu...@nvidia.com/ Dragos Tatulea (7): vdpa/mlx5: Create direct MKEYs in parallel vdpa/mlx5: Delete direct MKEYs in parallel vdpa/mlx5: Rename

[PATCH vhost 6/7] vdpa/mlx5: Introduce init/destroy for MR resources

2024-08-21 Thread Dragos Tatulea
There's currently not a lot of action happening during the init/destroy of MR resources. But more will be added in the upcoming patches. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 ++ drivers/vdpa/mlx5/core/mr.c

[PATCH vhost 4/7] vdpa/mlx5: Extract mr members in own resource struct

2024-08-21 Thread Dragos Tatulea
Group all mapping related resources into their own structure. Upcoming patches will add more members in this new structure. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 13 ++- drivers/vdpa/mlx5/core/mr.c| 30

[PATCH vhost 2/7] vdpa/mlx5: Delete direct MKEYs in parallel

2024-08-21 Thread Dragos Tatulea
Use the async interface to issue MTT MKEY deletion. This makes destroy_user_mr() on average 8x times faster. This number is also dependent on the size of the MR being deleted. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mr.c | 66

[PATCH vhost 3/7] vdpa/mlx5: Rename function

2024-08-21 Thread Dragos Tatulea
A followup patch will use this name for something else. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 +- drivers/vdpa/mlx5/core/mr.c| 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 3 files changed, 6 insertions(+), 6

[PATCH vhost 1/7] vdpa/mlx5: Create direct MKEYs in parallel

2024-08-21 Thread Dragos Tatulea
create_user_mr() 3-5x faster, depending on the size of the MR. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/core/mr.c | 118 +--- 1 file changed, 96 insertions(+), 22 deletions(-) diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5

Re: [PATCH vhost 0/7] vdpa/mlx5: Parallelize device suspend/resume

2024-08-16 Thread Dragos Tatulea
On 02.08.24 15:14, Michael S. Tsirkin wrote: > On Fri, Aug 02, 2024 at 10:20:17AM +0300, Dragos Tatulea wrote: >> This series parallelizes the mlx5_vdpa device suspend and resume >> operations through the firmware async API. The purpose is to reduce live >> migration downt

[PATCH vhost v2 10/10] vdpa/mlx5: Parallelize VQ suspend/resume for CVQ MQ command

2024-08-16 Thread Dragos Tatulea
() will exit early. If the VQ is not initialized, setup_vq() will create it and resume_vqs() will resume it. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a

[PATCH vhost v2 09/10] vdpa/mlx5: Small improvement for change_num_qps()

2024-08-16 Thread Dragos Tatulea
change_num_qps() has a lot of multiplications by 2 to convert the number of VQ pairs to number of VQs. This patch simplifies the code by doing the VQP -> VQ count conversion at the beginning in a variable. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/

[PATCH vhost v2 08/10] vdpa/mlx5: Keep notifiers during suspend but ignore

2024-08-16 Thread Dragos Tatulea
changes. For 1 vDPA device x 32 VQs (16 VQPs) attached to a large VM (256 GB RAM, 32 CPUs x 2 threads per core), the device suspend time is reduced from ~13 ms to ~2.5 ms. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6

[PATCH vhost v2 07/10] vdpa/mlx5: Parallelize device resume

2024-08-16 Thread Dragos Tatulea
is reduced from ~16 ms to ~4.5 ms. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 40 +++ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b

[PATCH vhost v2 06/10] vdpa/mlx5: Parallelize device suspend

2024-08-16 Thread Dragos Tatulea
large VM (256 GB RAM, 32 CPUs x 2 threads per core), the device suspend time is reduced from ~37 ms to ~13 ms. A later patch will remove the link unregister operation which will make it even faster. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan Acked-by: Eugenio Pérez --- drivers/vdpa

[PATCH vhost v2 05/10] vdpa/mlx5: Use async API for vq modify commands

2024-08-16 Thread Dragos Tatulea
modifying multiple vqs in parallel. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 154 -- 1 file changed, 106 insertions(+), 48 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c

[PATCH vhost v2 04/10] vdpa/mlx5: Use async API for vq query command

2024-08-16 Thread Dragos Tatulea
issuing more commands at a time. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 2 + drivers/vdpa/mlx5/net/mlx5_vnet.c | 101 ++--- 2 files changed, 78 insertions(+), 25 deletions(-) diff --git a/drivers/vdpa/mlx5

[PATCH vhost v2 03/10] vdpa/mlx5: Introduce async fw command wrapper

2024-08-16 Thread Dragos Tatulea
-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 15 ++ drivers/vdpa/mlx5/core/resources.c | 73 ++ 2 files changed, 88 insertions(+) diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h

[PATCH mlx5-vhost v2 01/10] net/mlx5: Support throttled commands from async API

2024-08-16 Thread Dragos Tatulea
(semaphore at 0) returns EBUSY to signal to the caller that they need to wait for the completion of previously issued commands. Furthermore, make sure that the semaphore is released in the callback. Signed-off-by: Dragos Tatulea Cc: Leon Romanovsky Reviewed-by: Tariq Toukan --- drivers/net/etherne

[PATCH vhost v2 02/10] vdpa/mlx5: Introduce error logging function

2024-08-16 Thread Dragos Tatulea
mlx5_vdpa_err() was missing. This patch adds it and uses it in the necessary places. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 5 + drivers/vdpa/mlx5/net/mlx5_vnet.c | 24 2 files

[PATCH vhost v2 00/10] vdpa/mlx5: Parallelize device suspend/resume

2024-08-16 Thread Dragos Tatulea
in completely in the vhost tree [0]. The mlx5_core patch was reviewed by Tariq who is also a maintainer for mlx5_core. [0] - https://lore.kernel.org/virtualization/6582792d-8db2-4bc0-bf3a-248fe5c8f...@nvidia.com/T/#maefabb2fde5adfb322d16ca16ae64d540f75b7d2 Dragos Tatulea (10): net/mlx5: Supp

Re: [RFC PATCH] vhost_vdpa: assign irq bypass producer token correctly

2024-08-14 Thread Dragos Tatulea
On 14.08.24 07:29, Jason Wang wrote: > On Tue, Aug 13, 2024 at 8:53 PM Dragos Tatulea wrote: >> >> >> >> On 13.08.24 08:26, Jason Wang wrote: >>> On Mon, Aug 12, 2024 at 7:22 PM Dragos Tatulea wrote: >>>> >>>> >>>> &

Re: [RFC PATCH] vhost_vdpa: assign irq bypass producer token correctly

2024-08-13 Thread Dragos Tatulea
On 13.08.24 08:26, Jason Wang wrote: > On Mon, Aug 12, 2024 at 7:22 PM Dragos Tatulea wrote: >> >> >> >> On 12.08.24 08:49, Jason Wang wrote: >>> On Mon, Aug 12, 2024 at 1:47 PM Jason Wang wrote: >>>> >>>> On Fri, Aug 9, 2024

Re: [RFC PATCH] vhost_vdpa: assign irq bypass producer token correctly

2024-08-12 Thread Dragos Tatulea
On 12.08.24 08:49, Jason Wang wrote: > On Mon, Aug 12, 2024 at 1:47 PM Jason Wang wrote: >> >> On Fri, Aug 9, 2024 at 2:04 AM Dragos Tatulea wrote: >>> >>> >>> >>> On 08.08.24 10:20, Jason Wang wrote: >>>> We used to call i

Re: [RFC PATCH] vhost_vdpa: assign irq bypass producer token correctly

2024-08-08 Thread Dragos Tatulea
On 08.08.24 10:20, Jason Wang wrote: > We used to call irq_bypass_unregister_producer() in > vhost_vdpa_setup_vq_irq() which is problematic as we don't know if the > token pointer is still valid or not. > > Actually, we use the eventfd_ctx as the token so the life cycle of the > token should be

Re: [PATCH vhost 0/7] vdpa/mlx5: Parallelize device suspend/resume

2024-08-07 Thread Dragos Tatulea
On 07.08.24 15:25, Eugenio Perez Martin wrote: > On Fri, Aug 2, 2024 at 9:24 AM Dragos Tatulea wrote: >> >> This series parallelizes the mlx5_vdpa device suspend and resume >> operations through the firmware async API. The purpose is to reduce live >> migration

Re: [RFC PATCH vhost] vhost-vdpa: Fix invalid irq bypass unregister

2024-08-06 Thread Dragos Tatulea
On 06.08.24 10:18, Dragos Tatulea wrote: > (Re-sending. I messed up the previous message, sorry about that.) > > On 06.08.24 04:57, Jason Wang wrote: >> On Mon, Aug 5, 2024 at 11:59 PM Dragos Tatulea wrote: >>> >>> On 05.08.24 05:17, Jason Wang wrote: &g

Re: [RFC PATCH vhost] vhost-vdpa: Fix invalid irq bypass unregister

2024-08-06 Thread Dragos Tatulea
(Re-sending. I messed up the previous message, sorry about that.) On 06.08.24 04:57, Jason Wang wrote: > On Mon, Aug 5, 2024 at 11:59 PM Dragos Tatulea wrote: >> >> On 05.08.24 05:17, Jason Wang wrote: >>> On Fri, Aug 2, 2024 at 2:51 PM Dragos Tatulea wrote: >>&g

Re: [RFC PATCH vhost] vhost-vdpa: Fix invalid irq bypass unregister

2024-08-05 Thread Dragos Tatulea
On 05.08.24 05:17, Jason Wang wrote: > On Fri, Aug 2, 2024 at 2:51 PM Dragos Tatulea wrote: >> >> On Fri, 2024-08-02 at 11:29 +0800, Jason Wang wrote: >>> On Thu, Aug 1, 2024 at 11:38 PM Dragos Tatulea wrote: >>>> >>>> The following workflow

[PATCH vhost 7/7] vdpa/mlx5: Keep notifiers during suspend but ignore

2024-08-02 Thread Dragos Tatulea
changes. For 1 vDPA device x 32 VQs (16 VQPs) attached to a large VM (256 GB RAM, 32 CPUs x 2 threads per core), the device suspend time is reduced from ~13 ms to ~2.5 ms. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 -- 1 file changed, 4

[PATCH vhost 6/7] vdpa/mlx5: Parallelize device resume

2024-08-02 Thread Dragos Tatulea
is reduced from ~16 ms to ~4.5 ms. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 40 +++ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net

[PATCH vhost 5/7] vdpa/mlx5: Parallelize device suspend

2024-08-02 Thread Dragos Tatulea
large VM (256 GB RAM, 32 CPUs x 2 threads per core), the device suspend time is reduced from ~37 ms to ~13 ms. A later patch will remove the link unregister operation which will make it even faster. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 56

[PATCH vhost 4/7] vdpa/mlx5: Use async API for vq modify commands

2024-08-02 Thread Dragos Tatulea
modifying multiple vqs in parallel. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 150 -- 1 file changed, 103 insertions(+), 47 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c

[PATCH vhost 3/7] vdpa/mlx5: Use async API for vq query command

2024-08-02 Thread Dragos Tatulea
but the infrastructure is there to issue commands in parallel, including ratelimiting the number of issued async commands to firmware. A later patch will switch to issuing more commands at a time. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/core/mlx5_vdpa.h

[PATCH vhost 2/7] vdpa/mlx5: Introduce error logging function

2024-08-02 Thread Dragos Tatulea
mlx5_vdpa_err() was missing. This patch adds it and uses it in the necessary places. Signed-off-by: Dragos Tatulea Reviewed-by: Tariq Toukan --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 5 + drivers/vdpa/mlx5/net/mlx5_vnet.c | 24 2 files changed, 17 insertions

[PATCH vhost 0/7] vdpa/mlx5: Parallelize device suspend/resume

2024-08-02 Thread Dragos Tatulea
the vhost tree and only then the remaining patches can be applied. [0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost Dragos Tatulea (7): net/mlx5: Support throttled commands from async API vdpa/mlx5: Introduce error logging function vdpa/mlx5: Use async

Re: [RFC PATCH vhost] vhost-vdpa: Fix invalid irq bypass unregister

2024-08-01 Thread Dragos Tatulea
On Fri, 2024-08-02 at 11:29 +0800, Jason Wang wrote: > On Thu, Aug 1, 2024 at 11:38 PM Dragos Tatulea wrote: > > > > The following workflow triggers the crash referenced below: > > > > 1) vhost_vdpa_unsetup_vq_irq() unregisters the irq bypass producer > >

[RFC PATCH vhost] vhost-vdpa: Fix invalid irq bypass unregister

2024-08-01 Thread Dragos Tatulea
0 R10: R11: 0246 R12: 562dfe134360 R13: 562dfe134d20 R14: R15: 7f9df801e190 Signed-off-by: Dragos Tatulea --- drivers/vhost/vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index

Re: [PATH v5 3/3] vdpa/mlx5: Add the support of set mac address

2024-07-23 Thread Dragos Tatulea
> + if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) { > + pfmdev = pci_get_drvdata(pci_physfn(mdev->pdev)); > + err = mlx5_mpfs_add_mac(pfmdev, config->mac); > + if (0 == err) if (!err) would be nicer. Not a deal bre

Re: [PATH v4 3/3] vdpa/mlx5: Add the support of set mac address

2024-07-22 Thread Dragos Tatulea
On Mon, 2024-07-22 at 15:48 +0800, Jason Wang wrote: > On Mon, Jul 22, 2024 at 9:06 AM Cindy Lu wrote: > > > > Add the function to support setting the MAC address. > > For vdpa/mlx5, the function will use mlx5_mpfs_add_mac > > to set the mac address > > > > Tested in ConnectX-6 Dx device > > >

Re: [PATCH vhost 20/23] vdpa/mlx5: Pre-create hardware VQs at vdpa .dev_add time

2024-07-08 Thread Dragos Tatulea
Hi Zhu Yanjun, On Mon, 2024-07-08 at 18:22 +0200, Zhu Yanjun wrote: > 在 2024/6/17 17:07, Dragos Tatulea 写道: > > Currently, hardware VQs are created right when the vdpa device gets into > > DRIVER_OK state. That is easier because most of the VQ state is known by > > then

[PATCH vhost v3 23/24] vdpa/mlx5: Don't reset VQs more than necessary

2024-07-08 Thread Dragos Tatulea
resources. To solve this problem, avoid resetting hardware VQs if the VQs are still in a blank state. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 30 +++--- 1 file changed, 27 insertions(+), 3

[PATCH vhost v3 20/24] vdpa/mlx5: Use suspend/resume during VQP change

2024-07-08 Thread Dragos Tatulea
a VQ instead of tearing it down when the number of VQ pairs decreases. But only if the resume operation is supported. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 14 +++--- 1 file changed, 11 insertions(+), 3

[PATCH vhost v3 24/24] vdpa/mlx5: Don't enable non-active VQs in .set_vq_ready()

2024-07-08 Thread Dragos Tatulea
VQ indices in the range [cur_num_qps, max_vqs) represent queues that have not yet been activated. .set_vq_ready should not activate these VQs. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3

[PATCH vhost v3 19/24] vdpa/mlx5: Forward error in suspend/resume device

2024-07-08 Thread Dragos Tatulea
Start using the suspend/resume_vq() error return codes previously added. Reviewed-by: Cosmin Ratiu Reviewed-by: Zhu Yanjun Reviewed-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff

[PATCH vhost v3 22/24] vdpa/mlx5: Re-create HW VQs under certain conditions

2024-07-08 Thread Dragos Tatulea
these cases, the TIR and RQT need to be re-created. Add a needs_teardown configuration variable and set it when detecting the above scenarios. On next DRIVER_OK, the resources will be torn down first. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers

[PATCH vhost v3 18/24] vdpa/mlx5: Consolidate all VQ modify to Ready to use resume_vq()

2024-07-08 Thread Dragos Tatulea
er in setup_vq() so that resume_vq() doesn't return early. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5

[PATCH vhost v3 21/24] vdpa/mlx5: Pre-create hardware VQs at vdpa .dev_add time

2024-07-08 Thread Dragos Tatulea
DRIVER_OK. On a 64 CPU, 256 GB VM with 1 vDPA device of 16 VQps, the full VQ resource creation + resume time was ~370ms. Now it's down to 60 ms (only VQ config and resume). The measurements were done on a ConnectX6DX based vDPA device. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin

[PATCH vhost v3 16/24] vdpa/mlx5: Accept Init -> Ready VQ transition in resume_vq()

2024-07-08 Thread Dragos Tatulea
Until now resume_vq() was used only for the suspend/resume scenario. This change also allows calling resume_vq() to bring it from Init to Ready state (VQ initialization). Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 24

[PATCH vhost v3 17/24] vdpa/mlx5: Add error code for suspend/resume VQ

2024-07-08 Thread Dragos Tatulea
-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 77 +++ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index adcc4d63cf83..8ab5cf1bbc43 100644 --- a/drivers

  1   2   3   4   >