* [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create
@ 2021-05-30 6:31 Eli Cohen
2021-05-30 8:05 ` Michael S. Tsirkin
0 siblings, 1 reply; 7+ messages in thread
From: Eli Cohen @ 2021-05-30 6:31 UTC (permalink / raw)
To: mst, jasowang, virtualization, linux-kernel; +Cc: elic
Fix copy paste bug assigning umem1 size to umem2 and umem3.
Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Eli Cohen <elic@nvidia.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 189e4385df40..53312f0460ad 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque
MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id);
MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size);
MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id);
- MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size);
+ MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size);
MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id);
- MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size);
+ MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size);
MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn);
if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type))
MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1);
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 6:31 [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create Eli Cohen @ 2021-05-30 8:05 ` Michael S. Tsirkin 2021-05-30 8:15 ` Eli Cohen 0 siblings, 1 reply; 7+ messages in thread From: Michael S. Tsirkin @ 2021-05-30 8:05 UTC (permalink / raw) To: Eli Cohen; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > Signed-off-by: Eli Cohen <elic@nvidia.com> could you clarify the impact of the bug please? > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index 189e4385df40..53312f0460ad 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > -- > 2.31.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 8:05 ` Michael S. Tsirkin @ 2021-05-30 8:15 ` Eli Cohen 2021-05-30 8:19 ` Michael S. Tsirkin 0 siblings, 1 reply; 7+ messages in thread From: Eli Cohen @ 2021-05-30 8:15 UTC (permalink / raw) To: Michael S. Tsirkin; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 04:05:16AM -0400, Michael S. Tsirkin wrote: > On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > could you clarify the impact of the bug please? > I leads to firmware failure to create the virtqueue resource when you try to use a 1:1 mapping MR. This kind of usage is presented in the virtio_vdpa support I sent earlier. > > --- > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > index 189e4385df40..53312f0460ad 100644 > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > > -- > > 2.31.1 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 8:15 ` Eli Cohen @ 2021-05-30 8:19 ` Michael S. Tsirkin 2021-05-30 8:26 ` Eli Cohen 0 siblings, 1 reply; 7+ messages in thread From: Michael S. Tsirkin @ 2021-05-30 8:19 UTC (permalink / raw) To: Eli Cohen; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 11:15:36AM +0300, Eli Cohen wrote: > On Sun, May 30, 2021 at 04:05:16AM -0400, Michael S. Tsirkin wrote: > > On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > > > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > > > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > > > could you clarify the impact of the bug please? > > > > I leads to firmware failure to create the virtqueue resource when you > try to use a 1:1 mapping MR. This kind of usage is presented in the > virtio_vdpa support I sent earlier. OK pls include this info in the commit log. And is 1:1 the only case where sizes differ? Is it true that in other cases sizes are all the same? > > > --- > > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > index 189e4385df40..53312f0460ad 100644 > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > > > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > > > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > > > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > > > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > > > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > > > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > > > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > > > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > > > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > > > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > > > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > > > -- > > > 2.31.1 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 8:19 ` Michael S. Tsirkin @ 2021-05-30 8:26 ` Eli Cohen 2021-05-30 8:36 ` Michael S. Tsirkin 0 siblings, 1 reply; 7+ messages in thread From: Eli Cohen @ 2021-05-30 8:26 UTC (permalink / raw) To: Michael S. Tsirkin; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 04:19:01AM -0400, Michael S. Tsirkin wrote: > On Sun, May 30, 2021 at 11:15:36AM +0300, Eli Cohen wrote: > > On Sun, May 30, 2021 at 04:05:16AM -0400, Michael S. Tsirkin wrote: > > > On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > > > > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > > > > > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > > > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > > > > > could you clarify the impact of the bug please? > > > > > > > I leads to firmware failure to create the virtqueue resource when you > > try to use a 1:1 mapping MR. This kind of usage is presented in the > > virtio_vdpa support I sent earlier. > > OK pls include this info in the commit log. OK > And is 1:1 the only case where > sizes differ? Is it true that in other cases sizes are all the same? > The sizes are calculated based on firmware published paramters and a formula provided by the spec. They do differ but it so happened that size1 was larger than size2 and size3 so we did not see failures till now. > > > > --- > > > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > index 189e4385df40..53312f0460ad 100644 > > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > > > > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > > > > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > > > > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > > > > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > > > > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > > > > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > > > > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > > > > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > > > > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > > > > -- > > > > 2.31.1 > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 8:26 ` Eli Cohen @ 2021-05-30 8:36 ` Michael S. Tsirkin 2021-05-30 8:52 ` Eli Cohen 0 siblings, 1 reply; 7+ messages in thread From: Michael S. Tsirkin @ 2021-05-30 8:36 UTC (permalink / raw) To: Eli Cohen; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 11:26:46AM +0300, Eli Cohen wrote: > On Sun, May 30, 2021 at 04:19:01AM -0400, Michael S. Tsirkin wrote: > > On Sun, May 30, 2021 at 11:15:36AM +0300, Eli Cohen wrote: > > > On Sun, May 30, 2021 at 04:05:16AM -0400, Michael S. Tsirkin wrote: > > > > On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > > > > > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > > > > > > > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > > > > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > > > > > > > could you clarify the impact of the bug please? > > > > > > > > > > I leads to firmware failure to create the virtqueue resource when you > > > try to use a 1:1 mapping MR. This kind of usage is presented in the > > > virtio_vdpa support I sent earlier. > > > > OK pls include this info in the commit log. > OK > > > And is 1:1 the only case where > > sizes differ? Is it true that in other cases sizes are all the same? > > > The sizes are calculated based on firmware published paramters and a > formula provided by the spec. They do differ but it so happened that > size1 was larger than size2 and size3 so we did not see failures till > now. can this have a security impact? e.g. can guest access addresses outside of it's memory with this? > > > > > --- > > > > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > index 189e4385df40..53312f0460ad 100644 > > > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > > > > > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > > > > > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > > > > > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > > > > > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > > > > > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > > > > > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > > > > > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > > > > > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > > > > > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > > > > > -- > > > > > 2.31.1 > > > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create 2021-05-30 8:36 ` Michael S. Tsirkin @ 2021-05-30 8:52 ` Eli Cohen 0 siblings, 0 replies; 7+ messages in thread From: Eli Cohen @ 2021-05-30 8:52 UTC (permalink / raw) To: Michael S. Tsirkin; +Cc: jasowang, virtualization, linux-kernel On Sun, May 30, 2021 at 04:36:17AM -0400, Michael S. Tsirkin wrote: > On Sun, May 30, 2021 at 11:26:46AM +0300, Eli Cohen wrote: > > On Sun, May 30, 2021 at 04:19:01AM -0400, Michael S. Tsirkin wrote: > > > On Sun, May 30, 2021 at 11:15:36AM +0300, Eli Cohen wrote: > > > > On Sun, May 30, 2021 at 04:05:16AM -0400, Michael S. Tsirkin wrote: > > > > > On Sun, May 30, 2021 at 09:31:28AM +0300, Eli Cohen wrote: > > > > > > Fix copy paste bug assigning umem1 size to umem2 and umem3. > > > > > > > > > > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > > > > > > Signed-off-by: Eli Cohen <elic@nvidia.com> > > > > > > > > > > could you clarify the impact of the bug please? > > > > > > > > > > > > > I leads to firmware failure to create the virtqueue resource when you > > > > try to use a 1:1 mapping MR. This kind of usage is presented in the > > > > virtio_vdpa support I sent earlier. > > > > > > OK pls include this info in the commit log. > > OK > > > > > And is 1:1 the only case where > > > sizes differ? Is it true that in other cases sizes are all the same? > > > > > The sizes are calculated based on firmware published paramters and a > > formula provided by the spec. They do differ but it so happened that > > size1 was larger than size2 and size3 so we did not see failures till > > now. > > can this have a security impact? e.g. can guest access addresses > outside of it's memory with this? > No, this memory is accesible only by firmware for its internal use. > > > > > > --- > > > > > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > > index 189e4385df40..53312f0460ad 100644 > > > > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > > > > @@ -828,9 +828,9 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque > > > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); > > > > > > MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); > > > > > > MLX5_SET(virtio_q, vq_ctx, umem_2_id, mvq->umem2.id); > > > > > > - MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem1.size); > > > > > > + MLX5_SET(virtio_q, vq_ctx, umem_2_size, mvq->umem2.size); > > > > > > MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); > > > > > > - MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem1.size); > > > > > > + MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); > > > > > > MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); > > > > > > if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) > > > > > > MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); > > > > > > -- > > > > > > 2.31.1 > > > > > > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-30 8:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-30 6:31 [PATCH 1/2] vdpa/mlx5: Fix umem sizes assignments on VQ create Eli Cohen 2021-05-30 8:05 ` Michael S. Tsirkin 2021-05-30 8:15 ` Eli Cohen 2021-05-30 8:19 ` Michael S. Tsirkin 2021-05-30 8:26 ` Eli Cohen 2021-05-30 8:36 ` Michael S. Tsirkin 2021-05-30 8:52 ` Eli Cohen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®