Message ID | 20220525105922.2413991-4-eperezma@redhat.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Implement vdpasim stop operation | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Hi "Eugenio, Thank you for the patch! Yet something to improve: [auto build test ERROR on mst-vhost/linux-next] [also build test ERROR on next-20220525] [cannot apply to horms-ipvs/master linux/master linus/master v5.18] [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/intel-lab-lkp/linux/commits/Eugenio-P-rez/Implement-vdpasim-stop-operation/20220525-190143 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: x86_64-randconfig-a013 (https://download.01.org/0day-ci/archive/20220525/202205252236.4ysv1ZWg-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-1) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/515f6b6d2a0164df801ddbe61e1cb1ae4e763873 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eugenio-P-rez/Implement-vdpasim-stop-operation/20220525-190143 git checkout 515f6b6d2a0164df801ddbe61e1cb1ae4e763873 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/vhost/vdpa.c: In function 'vhost_vdpa_unlocked_ioctl': >> drivers/vhost/vdpa.c:668:14: error: 'VHOST_STOP' undeclared (first use in this function) 668 | case VHOST_STOP: | ^~~~~~~~~~ drivers/vhost/vdpa.c:668:14: note: each undeclared identifier is reported only once for each function it appears in vim +/VHOST_STOP +668 drivers/vhost/vdpa.c 587 588 static long vhost_vdpa_unlocked_ioctl(struct file *filep, 589 unsigned int cmd, unsigned long arg) 590 { 591 struct vhost_vdpa *v = filep->private_data; 592 struct vhost_dev *d = &v->vdev; 593 void __user *argp = (void __user *)arg; 594 u64 __user *featurep = argp; 595 u64 features; 596 long r = 0; 597 598 if (cmd == VHOST_SET_BACKEND_FEATURES) { 599 if (copy_from_user(&features, featurep, sizeof(features))) 600 return -EFAULT; 601 if (features & ~(VHOST_VDPA_BACKEND_FEATURES | 602 BIT_ULL(VHOST_BACKEND_F_STOP))) 603 return -EOPNOTSUPP; 604 if ((features & BIT_ULL(VHOST_BACKEND_F_STOP)) && 605 !vhost_vdpa_can_stop(v)) 606 return -EOPNOTSUPP; 607 vhost_set_backend_features(&v->vdev, features); 608 return 0; 609 } 610 611 mutex_lock(&d->mutex); 612 613 switch (cmd) { 614 case VHOST_VDPA_GET_DEVICE_ID: 615 r = vhost_vdpa_get_device_id(v, argp); 616 break; 617 case VHOST_VDPA_GET_STATUS: 618 r = vhost_vdpa_get_status(v, argp); 619 break; 620 case VHOST_VDPA_SET_STATUS: 621 r = vhost_vdpa_set_status(v, argp); 622 break; 623 case VHOST_VDPA_GET_CONFIG: 624 r = vhost_vdpa_get_config(v, argp); 625 break; 626 case VHOST_VDPA_SET_CONFIG: 627 r = vhost_vdpa_set_config(v, argp); 628 break; 629 case VHOST_GET_FEATURES: 630 r = vhost_vdpa_get_features(v, argp); 631 break; 632 case VHOST_SET_FEATURES: 633 r = vhost_vdpa_set_features(v, argp); 634 break; 635 case VHOST_VDPA_GET_VRING_NUM: 636 r = vhost_vdpa_get_vring_num(v, argp); 637 break; 638 case VHOST_VDPA_GET_GROUP_NUM: 639 r = copy_to_user(argp, &v->vdpa->ngroups, 640 sizeof(v->vdpa->ngroups)); 641 break; 642 case VHOST_VDPA_GET_AS_NUM: 643 r = copy_to_user(argp, &v->vdpa->nas, sizeof(v->vdpa->nas)); 644 break; 645 case VHOST_SET_LOG_BASE: 646 case VHOST_SET_LOG_FD: 647 r = -ENOIOCTLCMD; 648 break; 649 case VHOST_VDPA_SET_CONFIG_CALL: 650 r = vhost_vdpa_set_config_call(v, argp); 651 break; 652 case VHOST_GET_BACKEND_FEATURES: 653 features = VHOST_VDPA_BACKEND_FEATURES; 654 if (vhost_vdpa_can_stop(v)) 655 features |= BIT_ULL(VHOST_BACKEND_F_STOP); 656 if (copy_to_user(featurep, &features, sizeof(features))) 657 r = -EFAULT; 658 break; 659 case VHOST_VDPA_GET_IOVA_RANGE: 660 r = vhost_vdpa_get_iova_range(v, argp); 661 break; 662 case VHOST_VDPA_GET_CONFIG_SIZE: 663 r = vhost_vdpa_get_config_size(v, argp); 664 break; 665 case VHOST_VDPA_GET_VQS_COUNT: 666 r = vhost_vdpa_get_vqs_count(v, argp); 667 break; > 668 case VHOST_STOP: 669 r = vhost_vdpa_stop(v, argp); 670 break; 671 default: 672 r = vhost_dev_ioctl(&v->vdev, cmd, argp); 673 if (r == -ENOIOCTLCMD) 674 r = vhost_vdpa_vring_ioctl(v, cmd, argp); 675 break; 676 } 677 678 mutex_unlock(&d->mutex); 679 return r; 680 } 681
Hi "Eugenio, Thank you for the patch! Yet something to improve: [auto build test ERROR on mst-vhost/linux-next] [also build test ERROR on next-20220525] [cannot apply to horms-ipvs/master linux/master linus/master v5.18] [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/intel-lab-lkp/linux/commits/Eugenio-P-rez/Implement-vdpasim-stop-operation/20220525-190143 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220526/202205260121.6V500tTl-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d52a6e75b0c402c7f3b42a2b1b2873f151220947) 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/intel-lab-lkp/linux/commit/515f6b6d2a0164df801ddbe61e1cb1ae4e763873 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eugenio-P-rez/Implement-vdpasim-stop-operation/20220525-190143 git checkout 515f6b6d2a0164df801ddbe61e1cb1ae4e763873 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/vhost/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/vhost/vdpa.c:668:7: error: use of undeclared identifier 'VHOST_STOP' case VHOST_STOP: ^ 1 error generated. vim +/VHOST_STOP +668 drivers/vhost/vdpa.c 587 588 static long vhost_vdpa_unlocked_ioctl(struct file *filep, 589 unsigned int cmd, unsigned long arg) 590 { 591 struct vhost_vdpa *v = filep->private_data; 592 struct vhost_dev *d = &v->vdev; 593 void __user *argp = (void __user *)arg; 594 u64 __user *featurep = argp; 595 u64 features; 596 long r = 0; 597 598 if (cmd == VHOST_SET_BACKEND_FEATURES) { 599 if (copy_from_user(&features, featurep, sizeof(features))) 600 return -EFAULT; 601 if (features & ~(VHOST_VDPA_BACKEND_FEATURES | 602 BIT_ULL(VHOST_BACKEND_F_STOP))) 603 return -EOPNOTSUPP; 604 if ((features & BIT_ULL(VHOST_BACKEND_F_STOP)) && 605 !vhost_vdpa_can_stop(v)) 606 return -EOPNOTSUPP; 607 vhost_set_backend_features(&v->vdev, features); 608 return 0; 609 } 610 611 mutex_lock(&d->mutex); 612 613 switch (cmd) { 614 case VHOST_VDPA_GET_DEVICE_ID: 615 r = vhost_vdpa_get_device_id(v, argp); 616 break; 617 case VHOST_VDPA_GET_STATUS: 618 r = vhost_vdpa_get_status(v, argp); 619 break; 620 case VHOST_VDPA_SET_STATUS: 621 r = vhost_vdpa_set_status(v, argp); 622 break; 623 case VHOST_VDPA_GET_CONFIG: 624 r = vhost_vdpa_get_config(v, argp); 625 break; 626 case VHOST_VDPA_SET_CONFIG: 627 r = vhost_vdpa_set_config(v, argp); 628 break; 629 case VHOST_GET_FEATURES: 630 r = vhost_vdpa_get_features(v, argp); 631 break; 632 case VHOST_SET_FEATURES: 633 r = vhost_vdpa_set_features(v, argp); 634 break; 635 case VHOST_VDPA_GET_VRING_NUM: 636 r = vhost_vdpa_get_vring_num(v, argp); 637 break; 638 case VHOST_VDPA_GET_GROUP_NUM: 639 r = copy_to_user(argp, &v->vdpa->ngroups, 640 sizeof(v->vdpa->ngroups)); 641 break; 642 case VHOST_VDPA_GET_AS_NUM: 643 r = copy_to_user(argp, &v->vdpa->nas, sizeof(v->vdpa->nas)); 644 break; 645 case VHOST_SET_LOG_BASE: 646 case VHOST_SET_LOG_FD: 647 r = -ENOIOCTLCMD; 648 break; 649 case VHOST_VDPA_SET_CONFIG_CALL: 650 r = vhost_vdpa_set_config_call(v, argp); 651 break; 652 case VHOST_GET_BACKEND_FEATURES: 653 features = VHOST_VDPA_BACKEND_FEATURES; 654 if (vhost_vdpa_can_stop(v)) 655 features |= BIT_ULL(VHOST_BACKEND_F_STOP); 656 if (copy_to_user(featurep, &features, sizeof(features))) 657 r = -EFAULT; 658 break; 659 case VHOST_VDPA_GET_IOVA_RANGE: 660 r = vhost_vdpa_get_iova_range(v, argp); 661 break; 662 case VHOST_VDPA_GET_CONFIG_SIZE: 663 r = vhost_vdpa_get_config_size(v, argp); 664 break; 665 case VHOST_VDPA_GET_VQS_COUNT: 666 r = vhost_vdpa_get_vqs_count(v, argp); 667 break; > 668 case VHOST_STOP: 669 r = vhost_vdpa_stop(v, argp); 670 break; 671 default: 672 r = vhost_dev_ioctl(&v->vdev, cmd, argp); 673 if (r == -ENOIOCTLCMD) 674 r = vhost_vdpa_vring_ioctl(v, cmd, argp); 675 break; 676 } 677 678 mutex_unlock(&d->mutex); 679 return r; 680 } 681
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 32713db5831d..a5d33bad92f9 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -478,6 +478,21 @@ static long vhost_vdpa_get_vqs_count(struct vhost_vdpa *v, u32 __user *argp) return 0; } +static long vhost_vdpa_stop(struct vhost_vdpa *v, u32 __user *argp) +{ + struct vdpa_device *vdpa = v->vdpa; + const struct vdpa_config_ops *ops = vdpa->config; + int stop; + + if (!ops->stop) + return -EOPNOTSUPP; + + if (copy_from_user(&stop, argp, sizeof(stop))) + return -EFAULT; + + return ops->stop(vdpa, stop); +} + static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, void __user *argp) { @@ -650,6 +665,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, case VHOST_VDPA_GET_VQS_COUNT: r = vhost_vdpa_get_vqs_count(v, argp); break; + case VHOST_STOP: + r = vhost_vdpa_stop(v, argp); + break; default: r = vhost_dev_ioctl(&v->vdev, cmd, argp); if (r == -ENOIOCTLCMD) diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index cab645d4a645..c7e47b29bf61 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -171,4 +171,18 @@ #define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \ struct vhost_vring_state) +/* Stop or resume a device so it does not process virtqueue requests anymore + * + * After the return of ioctl with stop != 0, the device must finish any + * pending operations like in flight requests. It must also preserve all + * the necessary state (the virtqueue vring base plus the possible device + * specific states) that is required for restoring in the future. The + * device must not change its configuration after that point. + * + * After the return of ioctl with stop == 0, the device can continue + * processing buffers as long as typical conditions are met (vq is enabled, + * DRIVER_OK status bit is enabled, etc). + */ +#define VHOST_VDPA_STOP _IOW(VHOST_VIRTIO, 0x7D, int) + #endif
The ioctl adds support for stop the device from userspace. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> --- drivers/vhost/vdpa.c | 18 ++++++++++++++++++ include/uapi/linux/vhost.h | 14 ++++++++++++++ 2 files changed, 32 insertions(+)