vdpa/mlx5: Add support for resumable vqs
Subsystems (5)
Dragos Tatulea
maintainercover vdpa/mlx5: Add support for resumable vqs
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.
The first patch exposes the relevant bits in mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first. Once applied there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].
To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/
Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_map
drivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)
Signature · 1 line
2.42.0
Dragos Tatulea
maintainerPATCH 1/7 vdpa/mlx5: Expose resumable vq capability
Necessary for checking if resumable vqs are supported by the hardware. Actual support will be added in a downstream patch.
--- include/linux/mlx5/mlx5_ifc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/mlx5/mlx5_ifc.h +2 -1
@@ -1235,7 +1235,8 @@ struct mlx5_ifc_virtio_emulation_cap_bits {u8 reserved_at_c0[0x13 ];u8 desc_group_mkey_supported[0x1 ]; -u8 reserved_at_d4[0xc ]; +u8 freeze_to_rdy_supported[0x1 ]; +u8 reserved_at_d5[0xb ];u8 reserved_at_e0[0x20 ];
Signature · 1 line
2.42.0
Dragos Tatulea
maintainerPATCH 2/7 vdpa/mlx5: Split function into locked and unlocked variants
In reply to Dragos Tatuleamlx5_vdpa_destroy_mr contains more logic than _mlx5_vdpa_destroy_mr. There is no reason for this to be the case. All the logic can go into the unlocked variant.
Using the unlocked version is needed in a follow-up patch. And it also makes it more consistent with mlx5_vdpa_create_mr.
--- drivers/vdpa/mlx5/core/mr.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/vdpa/mlx5/core/mr.c +16 -15
@@ -498,32 +498,32 @@ static void destroy_user_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_mr *mrstatic void _mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev *mvdev,struct mlx5_vdpa_mr *mr) { +if (!mr) +return ; +if (mr->user_mr)destroy_user_mr (mvdev, mr);else destroy_dma_mr (mvdev, mr); +for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) { +if (mvdev->mr[i] == mr) + mvdev->mr[i] =NULL ; + } +vhost_iotlb_free (mr->iotlb); + +kfree (mr); }void mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev *mvdev,struct mlx5_vdpa_mr *mr) { -if (!mr) -return ; -mutex_lock (&mvdev->mr_mtx);_mlx5_vdpa_destroy_mr (mvdev, mr); -for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) { -if (mvdev->mr[i] == mr) - mvdev->mr[i] =NULL ; - } -mutex_unlock (&mvdev->mr_mtx); - -kfree (mr); } void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,
@@ -535,10 +535,7 @@ void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,mutex_lock (&mvdev->mr_mtx); mvdev->mr[asid] = new_mr; -if (old_mr) { -_mlx5_vdpa_destroy_mr (mvdev, old_mr); -kfree (old_mr); - } +_mlx5_vdpa_destroy_mr (mvdev, old_mr);mutex_unlock (&mvdev->mr_mtx);
@@ -546,8 +543,12 @@ void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,void mlx5_vdpa_destroy_mr_resources (struct mlx5_vdpa_dev *mvdev) { +mutex_lock (&mvdev->mr_mtx); +for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) -mlx5_vdpa_destroy_mr (mvdev, mvdev->mr[i]); +_mlx5_vdpa_destroy_mr (mvdev, mvdev->mr[i]); + +mutex_unlock (&mvdev->mr_mtx);prune_iotlb (mvdev->cvq.iotlb); }
Signature · 1 line
2.42.0
Re: [PATCH vhost 2/7] vdpa/mlx5: Split function into locked and unlocked variants
Quoted 9 lines · Dragos Tatulea
mlx5_vdpa_destroy_mrcontains more logic than_mlx5_vdpa_destroy_mr. There is no reason for this to be the case. All the logic can go into the unlocked variant.Using the unlocked version is needed in a follow-up patch. And it also makes it more consistent with
mlx5_vdpa_create_mr.Signed-off-by Dragos Tatulea <[email protected]>
Quoted 80 lines
--- drivers/vdpa/mlx5/core/mr.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)drivers/vdpa/mlx5/core/mr.c +16
-16@@ -498,32 +498,32 @@ static void destroy_user_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_mr *mrstatic void _mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev *mvdev,struct mlx5_vdpa_mr *mr) { +if (!mr) +return ; +if (mr->user_mr)destroy_user_mr (mvdev, mr);else destroy_dma_mr (mvdev, mr); +for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) { +if (mvdev->mr[i] == mr) + mvdev->mr[i] =NULL ; + } +vhost_iotlb_free (mr->iotlb); + +kfree (mr); }void mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev *mvdev,struct mlx5_vdpa_mr *mr) { -if (!mr) -return ; -mutex_lock (&mvdev->mr_mtx);_mlx5_vdpa_destroy_mr (mvdev, mr); -for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) { -if (mvdev->mr[i] == mr) - mvdev->mr[i] =NULL ; - } -mutex_unlock (&mvdev->mr_mtx); - -kfree (mr); } void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,@@ -535,10 +535,7 @@ void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,mutex_lock (&mvdev->mr_mtx); mvdev->mr[asid] = new_mr; -if (old_mr) { -_mlx5_vdpa_destroy_mr (mvdev, old_mr); -kfree (old_mr); - } +_mlx5_vdpa_destroy_mr (mvdev, old_mr);mutex_unlock (&mvdev->mr_mtx);@@ -546,8 +543,12 @@ void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,void mlx5_vdpa_destroy_mr_resources (struct mlx5_vdpa_dev *mvdev) { +mutex_lock (&mvdev->mr_mtx); +for (int i =0 ; i <MLX5_VDPA_NUM_AS ; i++) -mlx5_vdpa_destroy_mr (mvdev, mvdev->mr[i]); +_mlx5_vdpa_destroy_mr (mvdev, mvdev->mr[i]); + +mutex_unlock (&mvdev->mr_mtx);prune_iotlb (mvdev->cvq.iotlb); } --2.42.0
Dragos Tatulea
maintainerPATCH 3/7 vdpa/mlx5: Allow modifying multiple vq fields in one modify command
In reply to Dragos TatuleaAdd a bitmask variable that tracks hw vq field changes that are supposed to be modified on next hw vq change command.
This will be useful to set multiple vq fields when resuming the vq.
The state needs to remain as a parameter as it doesn't make sense to make it part of the vq struct: fw_state is updated only after a successful command.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 48 +++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +40 -8
@@ -120,6 +120,9 @@ struct mlx5_vdpa_virtqueue {u16 avail_idx;u16 used_idx;int fw_state; + +u64 modified_fields; +struct msi_map map;/* keep last in the struct */
@@ -1181,7 +1184,19 @@ static bool is_valid_state_change(int oldstate, int newstate) } } -static int modify_virtqueue (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq,int state) +static bool modifiable_virtqueue_fields (struct mlx5_vdpa_virtqueue *mvq) +{ +/* Only state is always modifiable */ +if (mvq->modified_fields & ~MLX5_VIRTQ_MODIFY_MASK_STATE ) +return mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT || + mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ; + +return true; +} + +static int modify_virtqueue (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +int state) {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {};
@@ -1193,6 +1208,9 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueif (mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_NONE )return 0 ; +if (!modifiable_virtqueue_fields (mvq)) +return -EINVAL ; +if (!is_valid_state_change (mvq->fw_state, state))return -EINVAL ;
@@ -1208,17 +1226,28 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueMLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); -MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, -MLX5_VIRTQ_MODIFY_MASK_STATE ); -MLX5_SET (virtio_net_q_object, obj_context, state, state); +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) +MLX5_SET (virtio_net_q_object, obj_context, state, state); + +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));kfree (in);if (!err) mvq->fw_state = state; + mvq->modified_fields =0 ; +return err; } +static int modify_virtqueue_state (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +unsigned int state) +{ + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_STATE ; +return modify_virtqueue (ndev, mvq, state); +} +static int counter_set_alloc (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) {u32 in[MLX5_ST_SZ_DW (create_virtio_q_counters_in)] = {};
@@ -1347,7 +1376,7 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) goto err_vq;if (mvq->ready) { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (&ndev->mvdev,"failed to modify to ready vq idx %d(%d)\n" , idx, err);
@@ -1382,7 +1411,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mif (mvq->fw_state !=MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY )return ; -if (modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND )) +if (modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ))mlx5_vdpa_warn (&ndev->mvdev,"modify to suspend failed\n" );if (query_virtqueue (ndev, mvq, &attr)) {
@@ -1407,6 +1436,7 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *return ;suspend_vq (ndev, mvq); + mvq->modified_fields =0 ;destroy_virtqueue (ndev, mvq);dealloc_vector (ndev, mvq);counter_set_dealloc (ndev, mvq);
@@ -2207,7 +2237,7 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool readyif (!ready) {suspend_vq (ndev, mvq); }else { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (mvdev,"modify VQ %d to ready failed (%d)\n" , idx, err); ready = false;
@@ -2804,8 +2834,10 @@ static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) {int i; -for (i =0 ; i < ndev->mvdev.max_vqs; i++) +for (i =0 ; i < ndev->mvdev.max_vqs; i++) { ndev->vqs[i].ready = false; + ndev->vqs[i].modified_fields =0 ; + } ndev->mvdev.cvq.ready = false; }
Signature · 1 line
2.42.0
Eugenio Perez Martin
maintainerRe: [PATCH vhost 3/7] vdpa/mlx5: Allow modifying multiple vq fields in one modify command
Quoted 10 lines · Dragos Tatulea
Add a bitmask variable that tracks hw vq field changes that are supposed to be modified on next hw vq change command.
This will be useful to set multiple vq fields when resuming the vq.
The state needs to remain as a parameter as it doesn't make sense to make it part of the vq struct:
fw_stateis updated only after a successful command.
I don't get this paragraph, "modified_fields" is a member of "mlx5_vdpa_virtqueue". Am I missing something?
Quoted 41 lines
Signed-off-by Dragos Tatulea <[email protected]>--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 48 +++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-)drivers/vdpa/mlx5/net/mlx5_vnet.c +16
-1@@ -120,6 +120,9 @@ struct mlx5_vdpa_virtqueue {u16 avail_idx;u16 used_idx;int fw_state; + +u64 modified_fields; +struct msi_map map;/* keep last in the struct */ @@ -1181,7 +1184,19 @@ static bool is_valid_state_change(int oldstate, int newstate) } } -static int modify_virtqueue (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq,int state) +static bool modifiable_virtqueue_fields (struct mlx5_vdpa_virtqueue *mvq) +{ +/* Only state is always modifiable */ +if (mvq->modified_fields & ~MLX5_VIRTQ_MODIFY_MASK_STATE ) +return mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT || + mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ; + +return true; +} + +static int modify_virtqueue (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +int state) {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {};
drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque · line 1213
Quoted 6 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +3
-0@@ -1193,6 +1208,9 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueif (mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_NONE )return 0 ; +if (!modifiable_virtqueue_fields (mvq)) +return -EINVAL ; +
I'm ok with this change, but since modified_fields is (or will be) a bitmap tracking changes to state, addresses, mkey, etc, doesn't have more sense to check it like:
if (modified_fields & 1<<change_1_flag)
// perform change 1
if (modified_fields & 1<<change_2_flag)
// perform change 2
if (modified_fields & 1<<change_3_flag)
// perform change 13
---
Instead of:
if (!modified_fields)
return
if (modified_fields & 1<<change_1_flag)
// perform change 1
if (modified_fields & 1<<change_2_flag)
// perform change 2
// perform change 3, no checking, as it is the only possible value of modified_fields
---
Or am I missing something?
The rest looks good to me.
Quoted 85 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +21
-8if (!is_valid_state_change (mvq->fw_state, state))return -EINVAL ;@@ -1208,17 +1226,28 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueMLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); -MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, -MLX5_VIRTQ_MODIFY_MASK_STATE ); -MLX5_SET (virtio_net_q_object, obj_context, state, state); +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) +MLX5_SET (virtio_net_q_object, obj_context, state, state); + +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));kfree (in);if (!err) mvq->fw_state = state; + mvq->modified_fields =0 ; +return err; } +static int modify_virtqueue_state (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +unsigned int state) +{ + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_STATE ; +return modify_virtqueue (ndev, mvq, state); +} +static int counter_set_alloc (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) {u32 in[MLX5_ST_SZ_DW (create_virtio_q_counters_in)] = {};@@ -1347,7 +1376,7 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) goto err_vq;if (mvq->ready) { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (&ndev->mvdev,"failed to modify to ready vq idx %d(%d)\n" , idx, err);@@ -1382,7 +1411,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mif (mvq->fw_state !=MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY )return ; -if (modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND )) +if (modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ))mlx5_vdpa_warn (&ndev->mvdev,"modify to suspend failed\n" );if (query_virtqueue (ndev, mvq, &attr)) {@@ -1407,6 +1436,7 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *return ;suspend_vq (ndev, mvq); + mvq->modified_fields =0 ;destroy_virtqueue (ndev, mvq);dealloc_vector (ndev, mvq);counter_set_dealloc (ndev, mvq);@@ -2207,7 +2237,7 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool readyif (!ready) {suspend_vq (ndev, mvq); }else { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (mvdev,"modify VQ %d to ready failed (%d)\n" , idx, err); ready = false;@@ -2804,8 +2834,10 @@ static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) {int i; -for (i =0 ; i < ndev->mvdev.max_vqs; i++) +for (i =0 ; i < ndev->mvdev.max_vqs; i++) { ndev->vqs[i].ready = false; + ndev->vqs[i].modified_fields =0 ; + } ndev->mvdev.cvq.ready = false; } --2.42.0
Dragos Tatulea
maintainerRe: [PATCH vhost 3/7] vdpa/mlx5: Allow modifying multiple vq fields in one modify command
Quoted 7 lines · Eugenio Perez Martin
Quoted 6 lines · Dragos Tatulea
Add a bitmask variable that tracks hw vq field changes that are supposed to be modified on next hw vq change command.
This will be useful to set multiple vq fields when resuming the vq.
Quoted 8 lines
Quoted 4 lines
The state needs to remain as a parameter as it doesn't make sense to make it part of the vq struct:
fw_stateis updated only after a successful command.I don't get this paragraph, "
modified_fields" is a member of "mlx5_vdpa_virtqueue". Am I missing something?
I think this paragraph adds more confusion than clarification. I meant to say that the state argument from modified_virtqueue needs to remain there, as opposed to integrating it into the mlx5_vdpa_virtqueue struct.
Quoted 70 lines
Quoted 42 lines
Signed-off-by Dragos Tatulea <[email protected]>--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 48 +++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-)drivers/vdpa/mlx5/net/mlx5_vnet.c +16
-1@@ -120,6 +120,9 @@ struct mlx5_vdpa_virtqueue {u16 avail_idx;u16 used_idx;int fw_state; + +u64 modified_fields; +struct msi_map map;/* keep last in the struct */ @@ -1181,7 +1184,19 @@ static bool is_valid_state_change(int oldstate, int newstate) } } -static int modify_virtqueue (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq,int state) +static bool modifiable_virtqueue_fields (struct mlx5_vdpa_virtqueue *mvq) +{ +/* Only state is always modifiable */ +if (mvq->modified_fields & ~MLX5_VIRTQ_MODIFY_MASK_STATE ) +return mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT || + mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ; + +return true; +} + +static int modify_virtqueue (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +int state) {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {};drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque · line 1213
Quoted 6 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +3
-0@@ -1193,6 +1208,9 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueif (mvq->fw_state ==MLX5_VIRTIO_NET_Q_OBJECT_NONE )return 0 ; +if (!modifiable_virtqueue_fields (mvq)) +return -EINVAL ; +I'm ok with this change, but since
modified_fieldsis (or will be) a bitmap tracking changes to state, addresses, mkey, etc, doesn't have more sense to check it like:if (
modified_fields& 1<<change_1_flag)
// perform change 1
if (modified_fields& 1<<change_2_flag)
// perform change 2
if (modified_fields& 1<<change_3_flag)
// perform change 13
---Instead of:
if (!modified_fields)
returnif (
modified_fields& 1<<change_1_flag)
// perform change 1
if (modified_fields& 1<<change_2_flag)
// perform change 2
Quoted 6 lines
// perform change 3, no checking, as it is the only possible value of
modified_fields
---Or am I missing something?
modifiable_virtqueue_fields() is meant to check that the modification is done only in the INIT or SUSPEND state of the queue. Or did I misunderstand your question?
Quoted 2 lines
The rest looks good to me.
Thanks for reviewing my patches Eugenio!
Quoted 86 lines
Quoted 85 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +21
-8if (!is_valid_state_change (mvq->fw_state, state))return -EINVAL ;@@ -1208,17 +1226,28 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueMLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); -MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, -MLX5_VIRTQ_MODIFY_MASK_STATE ); -MLX5_SET (virtio_net_q_object, obj_context, state, state); +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) +MLX5_SET (virtio_net_q_object, obj_context, state, state); + +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));kfree (in);if (!err) mvq->fw_state = state; + mvq->modified_fields =0 ; +return err; } +static int modify_virtqueue_state (struct mlx5_vdpa_net *ndev, +struct mlx5_vdpa_virtqueue *mvq, +unsigned int state) +{ + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_STATE ; +return modify_virtqueue (ndev, mvq, state); +} +static int counter_set_alloc (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) {u32 in[MLX5_ST_SZ_DW (create_virtio_q_counters_in)] = {};@@ -1347,7 +1376,7 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) goto err_vq;if (mvq->ready) { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (&ndev->mvdev,"failed to modify to ready vq idx %d(%d)\n" , idx, err);@@ -1382,7 +1411,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mif (mvq->fw_state !=MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY )return ; -if (modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND )) +if (modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ))mlx5_vdpa_warn (&ndev->mvdev,"modify to suspend failed\n" );if (query_virtqueue (ndev, mvq, &attr)) {@@ -1407,6 +1436,7 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *return ;suspend_vq (ndev, mvq); + mvq->modified_fields =0 ;destroy_virtqueue (ndev, mvq);dealloc_vector (ndev, mvq);counter_set_dealloc (ndev, mvq);@@ -2207,7 +2237,7 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool readyif (!ready) {suspend_vq (ndev, mvq); }else { - err =modify_virtqueue (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY ); + err =modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY );if (err) {mlx5_vdpa_warn (mvdev,"modify VQ %d to ready failed (%d)\n" , idx, err); ready = false;@@ -2804,8 +2834,10 @@ static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) {int i; -for (i =0 ; i < ndev->mvdev.max_vqs; i++) +for (i =0 ; i < ndev->mvdev.max_vqs; i++) { ndev->vqs[i].ready = false; + ndev->vqs[i].modified_fields =0 ; + } ndev->mvdev.cvq.ready = false; } --2.42.0
Dragos Tatulea
maintainerPATCH 4/7 vdpa/mlx5: Introduce per vq and device resume
In reply to Dragos TatuleaImplement vdpa vq and device resume if capability detected. Add support for suspend -> ready state change.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 67 +++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +60 -7
@@ -1170,7 +1170,12 @@ static int query_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueureturn err; } -static bool is_valid_state_change (int oldstate,int newstate) +static bool is_resumable (struct mlx5_vdpa_net *ndev) +{ +return ndev->mvdev.vdev.config->resume; +} + +static bool is_valid_state_change (int oldstate,int newstate,bool resumable) {switch (oldstate) {case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT :
@@ -1178,6 +1183,7 @@ static bool is_valid_state_change(int oldstate, int newstate)case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY :return newstate ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ;case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND : +return resumable ? newstate ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY : false;case MLX5_VIRTIO_NET_Q_OBJECT_STATE_ERR :default :return false;
@@ -1200,6 +1206,7 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {}; +bool state_change = false;void *obj_context;void *cmd_hdr;void *in;
@@ -1211,9 +1218,6 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,if (!modifiable_virtqueue_fields (mvq))return -EINVAL ; -if (!is_valid_state_change (mvq->fw_state, state)) -return -EINVAL ; - in =kzalloc (inlen,GFP_KERNEL );if (!in)return -ENOMEM ;
@@ -1226,17 +1230,29 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,MLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); -if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) + +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) { +if (!is_valid_state_change (mvq->fw_state, state,is_resumable (ndev))) { + err = -EINVAL ; + goto done; + } +MLX5_SET (virtio_net_q_object, obj_context, state, state); + state_change = true; + }MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out)); -kfree (in); -if (!err) +if (err) + goto done; + +if (state_change) mvq->fw_state = state; mvq->modified_fields =0 ; +done: +kfree (in);return err; }
@@ -1430,6 +1446,24 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev)suspend_vq (ndev, &ndev->vqs[i]); } +static void resume_vq (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) +{ +if (!mvq->initialized || !is_resumable (ndev)) +return ; + +if (mvq->fw_state !=MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ) +return ; + +if (modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY )) +mlx5_vdpa_warn (&ndev->mvdev,"modify to resume failed\n" ); +} + +static void resume_vqs (struct mlx5_vdpa_net *ndev) +{ +for (int i =0 ; i < ndev->mvdev.max_vqs; i++) +resume_vq (ndev, &ndev->vqs[i]); +} +static void teardown_vq (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) {if (!mvq->initialized)
@@ -3256,6 +3290,21 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev)return 0 ; } +static int mlx5_vdpa_resume (struct vdpa_device *vdev) +{ +struct mlx5_vdpa_dev *mvdev =to_mvdev (vdev); +struct mlx5_vdpa_net *ndev =to_mlx5_vdpa_ndev (mvdev); + +mlx5_vdpa_info (mvdev,"resuming device\n" ); + +down_write (&ndev->reslock); + mvdev->suspended = false; +resume_vqs (ndev); +register_link_notifier (ndev); +up_write (&ndev->reslock); +return 0 ; +} +static int mlx5_set_group_asid (struct vdpa_device *vdev,u32 group,unsigned int asid) {
@@ -3312,6 +3361,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { .get_vq_dma_dev = mlx5_get_vq_dma_dev, .free = mlx5_vdpa_free, .suspend = mlx5_vdpa_suspend, + .resume = mlx5_vdpa_resume, /* Op disabled if not supported. */ };static int query_mtu (struct mlx5_core_dev *mdev,u16 *mtu)
@@ -3683,6 +3733,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,if (!MLX5_CAP_DEV_VDPA_EMULATION (mdev, desc_group_mkey_supported)) mgtdev->vdpa_ops.get_vq_desc_group =NULL ; +if (!MLX5_CAP_DEV_VDPA_EMULATION (mdev, freeze_to_rdy_supported)) + mgtdev->vdpa_ops.resume =NULL ; + err =vdpa_mgmtdev_register (&mgtdev->mgtdev);if (err) goto reg_err;
Signature · 1 line
2.42.0
Re: [PATCH vhost 4/7] vdpa/mlx5: Introduce per vq and device resume
Quoted 5 lines · Dragos Tatulea
Implement vdpa vq and device resume if capability detected. Add support for suspend -> ready state change.
Signed-off-by Dragos Tatulea <[email protected]>
Quoted 149 lines
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 67 +++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-)drivers/vdpa/mlx5/net/mlx5_vnet.c +60
-8@@ -1170,7 +1170,12 @@ static int query_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueureturn err; } -static bool is_valid_state_change (int oldstate,int newstate) +static bool is_resumable (struct mlx5_vdpa_net *ndev) +{ +return ndev->mvdev.vdev.config->resume; +} + +static bool is_valid_state_change (int oldstate,int newstate,bool resumable) {switch (oldstate) {case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT :@@ -1178,6 +1183,7 @@ static bool is_valid_state_change(int oldstate, int newstate)case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY :return newstate ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ;case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND : +return resumable ? newstate ==MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY : false;case MLX5_VIRTIO_NET_Q_OBJECT_STATE_ERR :default :return false;@@ -1200,6 +1206,7 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {}; +bool state_change = false;void *obj_context;void *cmd_hdr;void *in;@@ -1211,9 +1218,6 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,if (!modifiable_virtqueue_fields (mvq))return -EINVAL ; -if (!is_valid_state_change (mvq->fw_state, state)) -return -EINVAL ; - in =kzalloc (inlen,GFP_KERNEL );if (!in)return -ENOMEM ;@@ -1226,17 +1230,29 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,MLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); -if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) + +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) { +if (!is_valid_state_change (mvq->fw_state, state,is_resumable (ndev))) { + err = -EINVAL ; + goto done; + } +MLX5_SET (virtio_net_q_object, obj_context, state, state); + state_change = true; + }MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out)); -kfree (in); -if (!err) +if (err) + goto done; + +if (state_change) mvq->fw_state = state; mvq->modified_fields =0 ; +done: +kfree (in);return err; }@@ -1430,6 +1446,24 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev)suspend_vq (ndev, &ndev->vqs[i]); } +static void resume_vq (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) +{ +if (!mvq->initialized || !is_resumable (ndev)) +return ; + +if (mvq->fw_state !=MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND ) +return ; + +if (modify_virtqueue_state (ndev, mvq,MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY )) +mlx5_vdpa_warn (&ndev->mvdev,"modify to resume failed\n" ); +} + +static void resume_vqs (struct mlx5_vdpa_net *ndev) +{ +for (int i =0 ; i < ndev->mvdev.max_vqs; i++) +resume_vq (ndev, &ndev->vqs[i]); +} +static void teardown_vq (struct mlx5_vdpa_net *ndev,struct mlx5_vdpa_virtqueue *mvq) {if (!mvq->initialized)@@ -3256,6 +3290,21 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev)return 0 ; } +static int mlx5_vdpa_resume (struct vdpa_device *vdev) +{ +struct mlx5_vdpa_dev *mvdev =to_mvdev (vdev); +struct mlx5_vdpa_net *ndev =to_mlx5_vdpa_ndev (mvdev); + +mlx5_vdpa_info (mvdev,"resuming device\n" ); + +down_write (&ndev->reslock); + mvdev->suspended = false; +resume_vqs (ndev); +register_link_notifier (ndev); +up_write (&ndev->reslock); +return 0 ; +} +static int mlx5_set_group_asid (struct vdpa_device *vdev,u32 group,unsigned int asid) {@@ -3312,6 +3361,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { .get_vq_dma_dev = mlx5_get_vq_dma_dev, .free = mlx5_vdpa_free, .suspend = mlx5_vdpa_suspend, + .resume = mlx5_vdpa_resume, /* Op disabled if not supported. */ };static int query_mtu (struct mlx5_core_dev *mdev,u16 *mtu)@@ -3683,6 +3733,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,if (!MLX5_CAP_DEV_VDPA_EMULATION (mdev, desc_group_mkey_supported)) mgtdev->vdpa_ops.get_vq_desc_group =NULL ; +if (!MLX5_CAP_DEV_VDPA_EMULATION (mdev, freeze_to_rdy_supported)) + mgtdev->vdpa_ops.resume =NULL ; + err =vdpa_mgmtdev_register (&mgtdev->mgtdev);if (err) goto reg_err; --2.42.0
Dragos Tatulea
maintainerPATCH 5/7 vdpa/mlx5: Mark vq addrs for modification in hw vq
In reply to Dragos TatuleaAddresses get set by .set_vq_address. hw vq addresses will be updated on next modify_virtqueue.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 9 +++++++++ include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 10 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +9 -0
@@ -1209,6 +1209,7 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,bool state_change = false;void *obj_context;void *cmd_hdr; +void *vq_ctx;void *in;int err;
@@ -1230,6 +1231,7 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,MLX5_SET (general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context =MLX5_ADDR_OF (modify_virtio_net_q_in, in, obj_context); + vq_ctx =MLX5_ADDR_OF (virtio_net_q_object, obj_context, virtio_q_context);if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_STATE ) {if (!is_valid_state_change (mvq->fw_state, state,is_resumable (ndev))) {
@@ -1241,6 +1243,12 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, state_change = true; } +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS ) { +MLX5_SET64 (virtio_q, vq_ctx, desc_addr, mvq->desc_addr); +MLX5_SET64 (virtio_q, vq_ctx, used_addr, mvq->device_addr); +MLX5_SET64 (virtio_q, vq_ctx, available_addr, mvq->driver_addr); + } +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)
@@ -2202,6 +2210,7 @@ static int mlx5_vdpa_set_vq_address(struct vdpa_device *vdev, u16 idx, u64 desc_ mvq->desc_addr = desc_area; mvq->device_addr = device_area; mvq->driver_addr = driver_area; + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS ;return 0 ; }
include/linux/mlx5/mlx5_ifc_vdpa.h +1 -0
@@ -145,6 +145,7 @@ enum {MLX5_VIRTQ_MODIFY_MASK_STATE = (u64 )1 <<0 ,MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_PARAMS = (u64 )1 <<3 ,MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_DUMP_ENABLE = (u64 )1 <<4 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64 )1 <<6 , MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, };
Signature · 1 line
2.42.0
Dragos Tatulea
maintainerPATCH 6/7 vdpa/mlx5: Mark vq state for modification in hw vq
In reply to Dragos Tatulea.set_vq_state will set the indices and mark the fields to be modified in the hw vq.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 ++++++++ include/linux/mlx5/mlx5_ifc_vdpa.h | 2 ++ 2 files changed, 10 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +8 -0
@@ -1249,6 +1249,12 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,MLX5_SET64 (virtio_q, vq_ctx, available_addr, mvq->driver_addr); } +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX ) +MLX5_SET (virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); + +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX ) +MLX5_SET (virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)
@@ -2328,6 +2334,8 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, mvq->used_idx = state->split.avail_index; mvq->avail_idx = state->split.avail_index; + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX | +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX ;return 0 ; }
include/linux/mlx5/mlx5_ifc_vdpa.h +2 -0
@@ -146,6 +146,8 @@ enum {MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_PARAMS = (u64 )1 <<3 ,MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_DUMP_ENABLE = (u64 )1 <<4 ,MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64 )1 <<6 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX = (u64 )1 <<7 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64 )1 <<8 , MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, };
Signature · 1 line
2.42.0
Re: [PATCH vhost 6/7] vdpa/mlx5: Mark vq state for modification in hw vq
Quoted 5 lines · Dragos Tatulea
.set_vq_state will set the indices and mark the fields to be modified in the hw vq.
Signed-off-by Dragos Tatulea <[email protected]>
Quoted 47 lines
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 ++++++++ include/linux/mlx5/mlx5_ifc_vdpa.h | 2 ++ 2 files changed, 10 insertions(+)drivers/vdpa/mlx5/net/mlx5_vnet.c +8
-0@@ -1249,6 +1249,12 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,MLX5_SET64 (virtio_q, vq_ctx, available_addr, mvq->driver_addr); } +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX ) +MLX5_SET (virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); + +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX ) +MLX5_SET (virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)@@ -2328,6 +2334,8 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, mvq->used_idx = state->split.avail_index; mvq->avail_idx = state->split.avail_index; + mvq->modified_fields |=MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX | +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX ;return 0 ; }include/linux/mlx5/mlx5_ifc_vdpa.h +2
-1@@ -146,6 +146,8 @@ enum {MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_PARAMS = (u64 )1 <<3 ,MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_DUMP_ENABLE = (u64 )1 <<4 ,MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64 )1 <<6 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX = (u64 )1 <<7 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64 )1 <<8 , MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, }; --2.42.0
Dragos Tatulea
maintainerPATCH 7/7 vdpa/mlx5: Use vq suspend/resume during .set_map
In reply to Dragos TatuleaInstead of tearing down and setting up vq resources, use vq suspend/resume during .set_map to speed things up a bit.
The vq mr is updated with the new mapping while the vqs are suspended.
If the device doesn't support resumable vqs, do the old teardown and setup dance.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 46 ++++++++++++++++++++++++------ include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 39 insertions(+), 8 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +38 -8
@@ -1206,6 +1206,7 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, {int inlen =MLX5_ST_SZ_BYTES (modify_virtio_net_q_in);u32 out[MLX5_ST_SZ_DW (modify_virtio_net_q_out)] = {}; +struct mlx5_vdpa_dev *mvdev = &ndev->mvdev;bool state_change = false;void *obj_context;void *cmd_hdr;
@@ -1255,6 +1256,24 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev,if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX )MLX5_SET (virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY ) { +struct mlx5_vdpa_mr *mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP ]]; + +if (mr) +MLX5_SET (virtio_q, vq_ctx, virtio_q_mkey, mr->mkey); +else + mvq->modified_fields &= ~MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY ; + } + +if (mvq->modified_fields &MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY ) { +struct mlx5_vdpa_mr *mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP ]]; + +if (mr &&MLX5_CAP_DEV_VDPA_EMULATION (mvdev->mdev, desc_group_mkey_supported)) +MLX5_SET (virtio_q, vq_ctx, desc_group_mkey, mr->mkey); +else + mvq->modified_fields &= ~MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY ; + } +MLX5_SET64 (virtio_net_q_object, obj_context, modify_field_select, mvq->modified_fields); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)
@@ -2784,24 +2803,35 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, unsigned int asid) {struct mlx5_vdpa_net *ndev =to_mlx5_vdpa_ndev (mvdev); +bool teardown = !is_resumable (ndev);int err;suspend_vqs (ndev); - err =save_channels_info (ndev); -if (err) -return err; +if (teardown) { + err =save_channels_info (ndev); +if (err) +return err; -teardown_driver (ndev); +teardown_driver (ndev); + }mlx5_vdpa_update_mr (mvdev, new_mr, asid); +for (int i =0 ; i < ndev->cur_num_vqs; i++) + ndev->vqs[i].modified_fields |=MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY | +MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY ; +if (!(mvdev->status &VIRTIO_CONFIG_S_DRIVER_OK ) || mvdev->suspended)return 0 ; -restore_channels_info (ndev); - err =setup_driver (mvdev); -if (err) -return err; +if (teardown) { +restore_channels_info (ndev); + err =setup_driver (mvdev); +if (err) +return err; + } + +resume_vqs (ndev);return 0 ; }
include/linux/mlx5/mlx5_ifc_vdpa.h +1 -0
@@ -148,6 +148,7 @@ enum {MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64 )1 <<6 ,MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX = (u64 )1 <<7 ,MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64 )1 <<8 , +MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64 )1 <<11 , MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, };
Signature · 1 line
2.42.0
Michael S. Tsirkin
maintainerQuoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.
I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
Quoted 29 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Dragos Tatulea
maintainerQuoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.
Quoted 6 lines
Quoted 2 lines
The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].
Thanks,
Dragos
Quoted 30 lines
Quoted 29 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Michael S. Tsirkin
maintainerQuoted 12 lines · Dragos Tatulea
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.
Quoted 8 lines
Quoted 3 lines
I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
Dragos
Are there other changes in that area that will cause non-trivial merge conflicts?
Quoted 31 lines
Quoted 30 lines
Quoted 29 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Dragos Tatulea
maintainerQuoted 16 lines · Michael S. Tsirkin
Quoted 15 lines · Dragos Tatulea
Quoted 14 lines · Michael S. Tsirkin
Quoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
Quoted 9 lines
Quoted 5 lines
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
DragosAre there other changes in that area that will cause non-trivial merge conflicts?
There are pending changes in mlx5_ifc.h for net-next. I haven't seen any changes around the touched structure but I would prefer not to take any risk.
Thanks,
Dragos
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
Quoted 29 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Michael S. Tsirkin
maintainerQuoted 23 lines · Dragos Tatulea
Quoted 22 lines · Michael S. Tsirkin
Quoted 20 lines · Dragos Tatulea
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.Quoted 6 lines
Quoted 2 lines
The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
Dragos
Quoted 8 lines
Quoted 3 lines
Are there other changes in that area that will cause non-trivial merge conflicts?
There are pending changes in
mlx5_ifc.hfor net-next. I haven't seen any changes around the touched structure but I would prefer not to take any risk.Thanks,
Dragos
This is exactly what linux-next is for.
Quoted 33 lines
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
Quoted 29 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Dragos Tatulea
maintainerQuoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Dragos Tatulea
Quoted 25 lines · Michael S. Tsirkin
Quoted 12 lines · Dragos Tatulea
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.Quoted 8 lines
Quoted 3 lines
I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
DragosAre there other changes in that area that will cause non-trivial merge conflicts?
Quoted 8 lines
Quoted 5 lines
There are pending changes in
mlx5_ifc.hfor net-next. I haven't seen any changes around the touched structure but I would prefer not to take any risk.Thanks,
DragosThis is exactly what linux-next is for.
Not sure what the suggestion is here. Is it:
1) To post patch 1/7 to net-next? Then we'd have to wait for a few weeks to make sure that it gets into the next tree.
or
2) To apply it into the vhost tree directly? Then we run the risk of having merge issues.
The "pull from branch" approach for cross subsystem changes was suggested by Linus this merge issue.
[0]
https://lore.kernel.org/all/CA+55aFxxoO=i7neGBRGW_afHsSZ7K-x6fMO8v-8po3Ls_Ew0Rg@mail.gmail.com/
Thanks,
Dragos
Quoted 35 lines
Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
Once applied
there, the change has to be pulled from mlx5-vhost into the vhost tree and only then the remaining patches can be applied. Same flow as the vq descriptor mappings patchset [1].To be able to use resumable vqs properly, support for selectively modifying vq parameters was needed. This is what the middle part of the series consists of.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/log/?h=mlx5-vhost
[1] https://lore.kernel.org/virtualization/[email protected]/Dragos Tatulea (7):
vdpa/mlx5: Expose resumable vq capability
vdpa/mlx5: Split function into locked and unlocked variants vdpa/mlx5: Allow modifying multiple vq fields in one modify command vdpa/mlx5: Introduce per vq and device resume
vdpa/mlx5: Mark vq addrs for modification in hw vq vdpa/mlx5: Mark vq state for modification in hw vq vdpa/mlx5: Use vq suspend/resume during .set_mapdrivers/vdpa/mlx5/core/mr.c | 31 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 172 +++++++++++++++++++++++++---- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/mlx5/mlx5_ifc_vdpa.h | 4 + 4 files changed, 174 insertions(+), 36 deletions(-)Signature · 1 line
2.42.0
Michael S. Tsirkin
maintainerQuoted 46 lines · Dragos Tatulea
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Dragos Tatulea
Quoted 25 lines · Michael S. Tsirkin
Quoted 12 lines · Dragos Tatulea
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.Quoted 8 lines
Quoted 3 lines
I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
DragosAre there other changes in that area that will cause non-trivial merge conflicts?
Quoted 8 lines
Quoted 5 lines
There are pending changes in
mlx5_ifc.hfor net-next. I haven't seen any changes around the touched structure but I would prefer not to take any risk.Thanks,
DragosThis is exactly what linux-next is for.
Not sure what the suggestion is here. Is it:
1) To post patch 1/7 to net-next? Then we'd have to wait for a few weeks to make sure that it gets into the next tree.
or
2) To apply it into the vhost tree directly? Then we run the risk of having merge issues.
Quoted 8 lines
The "pull from branch" approach for cross subsystem changes was suggested by Linus this merge issue.
[0]
https://lore.kernel.org/all/CA+55aFxxoO=i7neGBRGW_afHsSZ7K-x6fMO8v-8po3Ls_Ew0Rg@mail.gmail.com/Thanks,
Dragos
I will park this in my tree for now so it can get testing in linux next. When it's available in some other tree as well, let me know and I'll figure it out.
Signature · 1 line
MST
Dragos Tatulea
maintainerQuoted 53 lines · Michael S. Tsirkin
Quoted 52 lines · Dragos Tatulea
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Dragos Tatulea
Quoted 25 lines · Michael S. Tsirkin
Quoted 12 lines · Dragos Tatulea
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.The first patch exposes the relevant bits in
mlx5_ifc.h. That means it needs to be applied to the mlx5-vhost tree [0] first.Quoted 8 lines
Quoted 3 lines
I didn't get this. Why does this need to go through that tree? Is there a dependency on some other commit from that tree?
To avoid merge issues in Linus's tree in
mlx5_ifc.h. The idea is the same as for the "vq descriptor mappings" patchset [1].Thanks,
DragosAre there other changes in that area that will cause non-trivial merge conflicts?
Quoted 8 lines
Quoted 5 lines
There are pending changes in
mlx5_ifc.hfor net-next. I haven't seen any changes around the touched structure but I would prefer not to take any risk.Thanks,
DragosThis is exactly what linux-next is for.
Not sure what the suggestion is here. Is it:
1) To post patch 1/7 to net-next? Then we'd have to wait for a few weeks to make sure that it gets into the next tree.
or
2) To apply it into the vhost tree directly? Then we run the risk of having merge issues.
The "pull from branch" approach for cross subsystem changes was suggested by Linus this merge issue.
[0]
https://lore.kernel.org/all/CA+55aFxxoO=i7neGBRGW_afHsSZ7K-x6fMO8v-8po3Ls_Ew0Rg@mail.gmail.com/
Quoted 7 lines
Quoted 2 lines
Thanks,
DragosI will park this in my tree for now so it can get testing in linux next. When it's available in some other tree as well, let me know and I'll figure it out.
Thanks! But don't park it just yet. I would like to send a v2 in the next few days that contains 2 more patches on top. I've sent the v1 early to get reviews for the bulk of the work. Forgot to mention that in the cover letter. My bad, sorry.
Thanks,
Dragos
Leon Romanovsky
AppliedRe: (subset) [PATCH vhost 0/7] vdpa/mlx5: Add support for resumable vqs
In reply to Dragos TatuleaQuoted 8 lines · Dragos Tatulea
Add support for resumable vqs in the driver. This is a firmware feature that can be used for the following benefits:
- Full device .suspend/.resume.
- .set_map doesn't need to destroy and create new vqs anymore just to update the map. When resumable vqs are supported it is enough to suspend the vqs, set the new maps, and then resume the vqs.[...]
Applied, thanks!
[1/7] vdpa/mlx5: Expose resumable vq capability
https://git.kernel.org/rdma/rdma/c/b24910e1be0e76
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>