Message ID | 20210601084503.34724-2-jasowang@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Packed virtqueue state support for vDPA | expand |
On Tue, Jun 01, 2021 at 04:45:00PM +0800, Jason Wang wrote: > This patch extends the vdpa_vq_state to support packed virtqueue > state which is basically the device/driver ring wrap counters and the > avail and used index. This will be used for the virito-vdpa support > for the packed virtqueue and the future vhost/vhost-vdpa support for > the packed virtqueue. > > Signed-off-by: Jason Wang <jasowang@redhat.com> You changed interface but did not modify mlx5. Does this compile on your system? > --- > drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++-- > drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- > drivers/vhost/vdpa.c | 4 ++-- > include/linux/vdpa.h | 25 +++++++++++++++++++++++-- > 4 files changed, 29 insertions(+), 8 deletions(-) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c > index ab0ab5cf0f6e..5d3891b1ca28 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_main.c > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c > @@ -264,7 +264,7 @@ static int ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid, > { > struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > > - state->avail_index = ifcvf_get_vq_state(vf, qid); > + state->split.avail_index = ifcvf_get_vq_state(vf, qid); > return 0; > } > > @@ -273,7 +273,7 @@ static int ifcvf_vdpa_set_vq_state(struct vdpa_device *vdpa_dev, u16 qid, > { > struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > > - return ifcvf_set_vq_state(vf, qid, state->avail_index); > + return ifcvf_set_vq_state(vf, qid, state->split.avail_index); > } > > static void ifcvf_vdpa_set_vq_cb(struct vdpa_device *vdpa_dev, u16 qid, > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c > index 98f793bc9376..14e024de5cbf 100644 > --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -374,7 +374,7 @@ static int vdpasim_set_vq_state(struct vdpa_device *vdpa, u16 idx, > struct vringh *vrh = &vq->vring; > > spin_lock(&vdpasim->lock); > - vrh->last_avail_idx = state->avail_index; > + vrh->last_avail_idx = state->split.avail_index; > spin_unlock(&vdpasim->lock); > > return 0; > @@ -387,7 +387,7 @@ static int vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx, > struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; > struct vringh *vrh = &vq->vring; > > - state->avail_index = vrh->last_avail_idx; > + state->split.avail_index = vrh->last_avail_idx; > return 0; > } > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > index fb41db3da611..210ab35a7ebf 100644 > --- a/drivers/vhost/vdpa.c > +++ b/drivers/vhost/vdpa.c > @@ -383,7 +383,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, > if (r) > return r; > > - vq->last_avail_idx = vq_state.avail_index; > + vq->last_avail_idx = vq_state.split.avail_index; > break; > } > > @@ -401,7 +401,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, > break; > > case VHOST_SET_VRING_BASE: > - vq_state.avail_index = vq->last_avail_idx; > + vq_state.split.avail_index = vq->last_avail_idx; > if (ops->set_vq_state(vdpa, idx, &vq_state)) > r = -EINVAL; > break; > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index f311d227aa1b..3357ac98878d 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -28,13 +28,34 @@ struct vdpa_notification_area { > }; > > /** > - * struct vdpa_vq_state - vDPA vq_state definition > + * struct vdpa_vq_state_split - vDPA split virtqueue state > * @avail_index: available index > */ > -struct vdpa_vq_state { > +struct vdpa_vq_state_split { > u16 avail_index; > }; > > +/** > + * struct vdpa_vq_state_packed - vDPA packed virtqueue state > + * @last_avail_counter: last driver ring wrap counter observed by device > + * @last_avail_idx: device available index > + * @last_used_counter: device ring wrap counter > + * @last_used_idx: used index > + */ > +struct vdpa_vq_state_packed { > + u16 last_avail_counter:1; > + u16 last_avail_idx:15; > + u16 last_used_counter:1; > + u16 last_used_idx:15; > +}; > + > +struct vdpa_vq_state { > + union { > + struct vdpa_vq_state_split split; > + struct vdpa_vq_state_packed packed; > + }; > +}; > + > struct vdpa_mgmt_dev; > > /** > -- > 2.25.1 >
Hi Jason, I love your patch! Yet something to improve: [auto build test ERROR on vhost/linux-next] [also build test ERROR on linus/master v5.13-rc4 next-20210601] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jason-Wang/Packed-virtqueue-state-support-for-vDPA/20210601-164715 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: alpha-allyesconfig (attached as .config) compiler: alpha-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/eccc56e52d8c89dd93da5df0362931151417eb6a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jason-Wang/Packed-virtqueue-state-support-for-vDPA/20210601-164715 git checkout eccc56e52d8c89dd93da5df0362931151417eb6a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'mlx5_vdpa_set_vq_state': >> drivers/vdpa/mlx5/net/mlx5_vnet.c:1430:23: error: 'const struct vdpa_vq_state' has no member named 'avail_index' 1430 | mvq->used_idx = state->avail_index; | ^~ drivers/vdpa/mlx5/net/mlx5_vnet.c:1431:24: error: 'const struct vdpa_vq_state' has no member named 'avail_index' 1431 | mvq->avail_idx = state->avail_index; | ^~ drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'mlx5_vdpa_get_vq_state': >> drivers/vdpa/mlx5/net/mlx5_vnet.c:1452:8: error: 'struct vdpa_vq_state' has no member named 'avail_index' 1452 | state->avail_index = mvq->used_idx; | ^~ drivers/vdpa/mlx5/net/mlx5_vnet.c:1461:7: error: 'struct vdpa_vq_state' has no member named 'avail_index' 1461 | state->avail_index = attr.used_index; | ^~ vim +1430 drivers/vdpa/mlx5/net/mlx5_vnet.c 1a86b377aa2147 Eli Cohen 2020-08-04 1417 1a86b377aa2147 Eli Cohen 2020-08-04 1418 static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, 1a86b377aa2147 Eli Cohen 2020-08-04 1419 const struct vdpa_vq_state *state) 1a86b377aa2147 Eli Cohen 2020-08-04 1420 { 1a86b377aa2147 Eli Cohen 2020-08-04 1421 struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); 1a86b377aa2147 Eli Cohen 2020-08-04 1422 struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); 1a86b377aa2147 Eli Cohen 2020-08-04 1423 struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[idx]; 1a86b377aa2147 Eli Cohen 2020-08-04 1424 1a86b377aa2147 Eli Cohen 2020-08-04 1425 if (mvq->fw_state == MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY) { 1a86b377aa2147 Eli Cohen 2020-08-04 1426 mlx5_vdpa_warn(mvdev, "can't modify available index\n"); 1a86b377aa2147 Eli Cohen 2020-08-04 1427 return -EINVAL; 1a86b377aa2147 Eli Cohen 2020-08-04 1428 } 1a86b377aa2147 Eli Cohen 2020-08-04 1429 bc04d93ea30a0a Eli Cohen 2021-04-08 @1430 mvq->used_idx = state->avail_index; 1a86b377aa2147 Eli Cohen 2020-08-04 1431 mvq->avail_idx = state->avail_index; 1a86b377aa2147 Eli Cohen 2020-08-04 1432 return 0; 1a86b377aa2147 Eli Cohen 2020-08-04 1433 } 1a86b377aa2147 Eli Cohen 2020-08-04 1434 1a86b377aa2147 Eli Cohen 2020-08-04 1435 static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa_vq_state *state) 1a86b377aa2147 Eli Cohen 2020-08-04 1436 { 1a86b377aa2147 Eli Cohen 2020-08-04 1437 struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); 1a86b377aa2147 Eli Cohen 2020-08-04 1438 struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); 1a86b377aa2147 Eli Cohen 2020-08-04 1439 struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[idx]; 1a86b377aa2147 Eli Cohen 2020-08-04 1440 struct mlx5_virtq_attr attr; 1a86b377aa2147 Eli Cohen 2020-08-04 1441 int err; 1a86b377aa2147 Eli Cohen 2020-08-04 1442 3176e974a750d6 Si-Wei Liu 2020-10-01 1443 /* If the virtq object was destroyed, use the value saved at 3176e974a750d6 Si-Wei Liu 2020-10-01 1444 * the last minute of suspend_vq. This caters for userspace 3176e974a750d6 Si-Wei Liu 2020-10-01 1445 * that cares about emulating the index after vq is stopped. 3176e974a750d6 Si-Wei Liu 2020-10-01 1446 */ 3176e974a750d6 Si-Wei Liu 2020-10-01 1447 if (!mvq->initialized) { bc04d93ea30a0a Eli Cohen 2021-04-08 1448 /* Firmware returns a wrong value for the available index. bc04d93ea30a0a Eli Cohen 2021-04-08 1449 * Since both values should be identical, we take the value of bc04d93ea30a0a Eli Cohen 2021-04-08 1450 * used_idx which is reported correctly. bc04d93ea30a0a Eli Cohen 2021-04-08 1451 */ bc04d93ea30a0a Eli Cohen 2021-04-08 @1452 state->avail_index = mvq->used_idx; 3176e974a750d6 Si-Wei Liu 2020-10-01 1453 return 0; 3176e974a750d6 Si-Wei Liu 2020-10-01 1454 } 1a86b377aa2147 Eli Cohen 2020-08-04 1455 1a86b377aa2147 Eli Cohen 2020-08-04 1456 err = query_virtqueue(ndev, mvq, &attr); 1a86b377aa2147 Eli Cohen 2020-08-04 1457 if (err) { 1a86b377aa2147 Eli Cohen 2020-08-04 1458 mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n"); 1a86b377aa2147 Eli Cohen 2020-08-04 1459 return err; 1a86b377aa2147 Eli Cohen 2020-08-04 1460 } bc04d93ea30a0a Eli Cohen 2021-04-08 1461 state->avail_index = attr.used_index; 1a86b377aa2147 Eli Cohen 2020-08-04 1462 return 0; 1a86b377aa2147 Eli Cohen 2020-08-04 1463 } 1a86b377aa2147 Eli Cohen 2020-08-04 1464 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
在 2021/6/1 下午6:47, Eli Cohen 写道: > On Tue, Jun 01, 2021 at 04:45:00PM +0800, Jason Wang wrote: >> This patch extends the vdpa_vq_state to support packed virtqueue >> state which is basically the device/driver ring wrap counters and the >> avail and used index. This will be used for the virito-vdpa support >> for the packed virtqueue and the future vhost/vhost-vdpa support for >> the packed virtqueue. >> >> Signed-off-by: Jason Wang <jasowang@redhat.com> > You changed interface but did not modify mlx5. Does this compile on your > system? Yes but I'm using a minimal config without mlx5 enabled :( V2 is posted. Thanks > >> --- >> drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++-- >> drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- >> drivers/vhost/vdpa.c | 4 ++-- >> include/linux/vdpa.h | 25 +++++++++++++++++++++++-- >> 4 files changed, 29 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c >> index ab0ab5cf0f6e..5d3891b1ca28 100644 >> --- a/drivers/vdpa/ifcvf/ifcvf_main.c >> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c >> @@ -264,7 +264,7 @@ static int ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid, >> { >> struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); >> >> - state->avail_index = ifcvf_get_vq_state(vf, qid); >> + state->split.avail_index = ifcvf_get_vq_state(vf, qid); >> return 0; >> } >> >> @@ -273,7 +273,7 @@ static int ifcvf_vdpa_set_vq_state(struct vdpa_device *vdpa_dev, u16 qid, >> { >> struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); >> >> - return ifcvf_set_vq_state(vf, qid, state->avail_index); >> + return ifcvf_set_vq_state(vf, qid, state->split.avail_index); >> } >> >> static void ifcvf_vdpa_set_vq_cb(struct vdpa_device *vdpa_dev, u16 qid, >> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c >> index 98f793bc9376..14e024de5cbf 100644 >> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c >> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c >> @@ -374,7 +374,7 @@ static int vdpasim_set_vq_state(struct vdpa_device *vdpa, u16 idx, >> struct vringh *vrh = &vq->vring; >> >> spin_lock(&vdpasim->lock); >> - vrh->last_avail_idx = state->avail_index; >> + vrh->last_avail_idx = state->split.avail_index; >> spin_unlock(&vdpasim->lock); >> >> return 0; >> @@ -387,7 +387,7 @@ static int vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx, >> struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; >> struct vringh *vrh = &vq->vring; >> >> - state->avail_index = vrh->last_avail_idx; >> + state->split.avail_index = vrh->last_avail_idx; >> return 0; >> } >> >> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c >> index fb41db3da611..210ab35a7ebf 100644 >> --- a/drivers/vhost/vdpa.c >> +++ b/drivers/vhost/vdpa.c >> @@ -383,7 +383,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, >> if (r) >> return r; >> >> - vq->last_avail_idx = vq_state.avail_index; >> + vq->last_avail_idx = vq_state.split.avail_index; >> break; >> } >> >> @@ -401,7 +401,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, >> break; >> >> case VHOST_SET_VRING_BASE: >> - vq_state.avail_index = vq->last_avail_idx; >> + vq_state.split.avail_index = vq->last_avail_idx; >> if (ops->set_vq_state(vdpa, idx, &vq_state)) >> r = -EINVAL; >> break; >> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h >> index f311d227aa1b..3357ac98878d 100644 >> --- a/include/linux/vdpa.h >> +++ b/include/linux/vdpa.h >> @@ -28,13 +28,34 @@ struct vdpa_notification_area { >> }; >> >> /** >> - * struct vdpa_vq_state - vDPA vq_state definition >> + * struct vdpa_vq_state_split - vDPA split virtqueue state >> * @avail_index: available index >> */ >> -struct vdpa_vq_state { >> +struct vdpa_vq_state_split { >> u16 avail_index; >> }; >> >> +/** >> + * struct vdpa_vq_state_packed - vDPA packed virtqueue state >> + * @last_avail_counter: last driver ring wrap counter observed by device >> + * @last_avail_idx: device available index >> + * @last_used_counter: device ring wrap counter >> + * @last_used_idx: used index >> + */ >> +struct vdpa_vq_state_packed { >> + u16 last_avail_counter:1; >> + u16 last_avail_idx:15; >> + u16 last_used_counter:1; >> + u16 last_used_idx:15; >> +}; >> + >> +struct vdpa_vq_state { >> + union { >> + struct vdpa_vq_state_split split; >> + struct vdpa_vq_state_packed packed; >> + }; >> +}; >> + >> struct vdpa_mgmt_dev; >> >> /** >> -- >> 2.25.1 >>
diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index ab0ab5cf0f6e..5d3891b1ca28 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -264,7 +264,7 @@ static int ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid, { struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); - state->avail_index = ifcvf_get_vq_state(vf, qid); + state->split.avail_index = ifcvf_get_vq_state(vf, qid); return 0; } @@ -273,7 +273,7 @@ static int ifcvf_vdpa_set_vq_state(struct vdpa_device *vdpa_dev, u16 qid, { struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); - return ifcvf_set_vq_state(vf, qid, state->avail_index); + return ifcvf_set_vq_state(vf, qid, state->split.avail_index); } static void ifcvf_vdpa_set_vq_cb(struct vdpa_device *vdpa_dev, u16 qid, diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 98f793bc9376..14e024de5cbf 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -374,7 +374,7 @@ static int vdpasim_set_vq_state(struct vdpa_device *vdpa, u16 idx, struct vringh *vrh = &vq->vring; spin_lock(&vdpasim->lock); - vrh->last_avail_idx = state->avail_index; + vrh->last_avail_idx = state->split.avail_index; spin_unlock(&vdpasim->lock); return 0; @@ -387,7 +387,7 @@ static int vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx, struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; struct vringh *vrh = &vq->vring; - state->avail_index = vrh->last_avail_idx; + state->split.avail_index = vrh->last_avail_idx; return 0; } diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index fb41db3da611..210ab35a7ebf 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -383,7 +383,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, if (r) return r; - vq->last_avail_idx = vq_state.avail_index; + vq->last_avail_idx = vq_state.split.avail_index; break; } @@ -401,7 +401,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, break; case VHOST_SET_VRING_BASE: - vq_state.avail_index = vq->last_avail_idx; + vq_state.split.avail_index = vq->last_avail_idx; if (ops->set_vq_state(vdpa, idx, &vq_state)) r = -EINVAL; break; diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index f311d227aa1b..3357ac98878d 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -28,13 +28,34 @@ struct vdpa_notification_area { }; /** - * struct vdpa_vq_state - vDPA vq_state definition + * struct vdpa_vq_state_split - vDPA split virtqueue state * @avail_index: available index */ -struct vdpa_vq_state { +struct vdpa_vq_state_split { u16 avail_index; }; +/** + * struct vdpa_vq_state_packed - vDPA packed virtqueue state + * @last_avail_counter: last driver ring wrap counter observed by device + * @last_avail_idx: device available index + * @last_used_counter: device ring wrap counter + * @last_used_idx: used index + */ +struct vdpa_vq_state_packed { + u16 last_avail_counter:1; + u16 last_avail_idx:15; + u16 last_used_counter:1; + u16 last_used_idx:15; +}; + +struct vdpa_vq_state { + union { + struct vdpa_vq_state_split split; + struct vdpa_vq_state_packed packed; + }; +}; + struct vdpa_mgmt_dev; /**
This patch extends the vdpa_vq_state to support packed virtqueue state which is basically the device/driver ring wrap counters and the avail and used index. This will be used for the virito-vdpa support for the packed virtqueue and the future vhost/vhost-vdpa support for the packed virtqueue. Signed-off-by: Jason Wang <jasowang@redhat.com> --- drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++-- drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- drivers/vhost/vdpa.c | 4 ++-- include/linux/vdpa.h | 25 +++++++++++++++++++++++-- 4 files changed, 29 insertions(+), 8 deletions(-)