* [PATCH] virtio/test: fix up after IOTLB changes
@ 2020-04-01 16:51 Michael S. Tsirkin
2020-04-02 4:01 ` Jason Wang
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-04-01 16:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Jason Wang, Eugenio Pérez, kvm, virtualization, netdev
Allow building vringh without IOTLB (that's the case for userspace
builds, will be useful for CAIF/VOD down the road too).
Update for API tweaks.
Don't include vringh with kernel builds.
Cc: Jason Wang <jasowang@redhat.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/test.c | 4 ++--
drivers/vhost/vringh.c | 5 +++++
include/linux/vringh.h | 2 ++
tools/virtio/Makefile | 3 ++-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index 394e2e5c772d..9a3a09005e03 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
- VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
+ VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL);
f->private_data = n;
@@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
{
void *priv = NULL;
long err;
- struct vhost_umem *umem;
+ struct vhost_iotlb *umem;
mutex_lock(&n->dev.mutex);
err = vhost_dev_check_owner(&n->dev);
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index ee0491f579ac..878e565dfffe 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -13,9 +13,11 @@
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/export.h>
+#ifdef VHOST_IOTLB
#include <linux/bvec.h>
#include <linux/highmem.h>
#include <linux/vhost_iotlb.h>
+#endif
#include <uapi/linux/virtio_config.h>
static __printf(1,2) __cold void vringh_bad(const char *fmt, ...)
@@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh)
}
EXPORT_SYMBOL(vringh_need_notify_kern);
+#ifdef VHOST_IOTLB
+
static int iotlb_translate(const struct vringh *vrh,
u64 addr, u64 len, struct bio_vec iov[],
int iov_size, u32 perm)
@@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh)
}
EXPORT_SYMBOL(vringh_need_notify_iotlb);
+#endif
MODULE_LICENSE("GPL");
diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index bd0503ca6f8f..ebff121c0b02 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -14,8 +14,10 @@
#include <linux/virtio_byteorder.h>
#include <linux/uio.h>
#include <linux/slab.h>
+#ifdef VHOST_IOTLB
#include <linux/dma-direction.h>
#include <linux/vhost_iotlb.h>
+#endif
#include <asm/barrier.h>
/* virtio_ring with information needed for host access. */
diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile
index f33f32f1d208..d3f152f4660b 100644
--- a/tools/virtio/Makefile
+++ b/tools/virtio/Makefile
@@ -22,7 +22,8 @@ OOT_CONFIGS=\
CONFIG_VHOST=m \
CONFIG_VHOST_NET=n \
CONFIG_VHOST_SCSI=n \
- CONFIG_VHOST_VSOCK=n
+ CONFIG_VHOST_VSOCK=n \
+ CONFIG_VHOST_RING=n
OOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
oot-build:
echo "UNSUPPORTED! Don't use the resulting modules in production!"
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio/test: fix up after IOTLB changes
2020-04-01 16:51 [PATCH] virtio/test: fix up after IOTLB changes Michael S. Tsirkin
@ 2020-04-02 4:01 ` Jason Wang
2020-04-02 12:53 ` Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2020-04-02 4:01 UTC (permalink / raw)
To: Michael S. Tsirkin, linux-kernel
Cc: Eugenio Pérez, kvm, virtualization, netdev
On 2020/4/2 上午12:51, Michael S. Tsirkin wrote:
> Allow building vringh without IOTLB (that's the case for userspace
> builds, will be useful for CAIF/VOD down the road too).
> Update for API tweaks.
> Don't include vringh with kernel builds.
I'm not quite sure we need this.
E.g the userspace accessor is not used by CAIF/VOP.
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Eugenio Pérez <eperezma@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/test.c | 4 ++--
> drivers/vhost/vringh.c | 5 +++++
> include/linux/vringh.h | 2 ++
> tools/virtio/Makefile | 3 ++-
> 4 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> index 394e2e5c772d..9a3a09005e03 100644
> --- a/drivers/vhost/test.c
> +++ b/drivers/vhost/test.c
> @@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
> vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
> n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
> vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
> - VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
> + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL);
>
> f->private_data = n;
>
> @@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
> {
> void *priv = NULL;
> long err;
> - struct vhost_umem *umem;
> + struct vhost_iotlb *umem;
>
> mutex_lock(&n->dev.mutex);
> err = vhost_dev_check_owner(&n->dev);
> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
> index ee0491f579ac..878e565dfffe 100644
> --- a/drivers/vhost/vringh.c
> +++ b/drivers/vhost/vringh.c
> @@ -13,9 +13,11 @@
> #include <linux/uaccess.h>
> #include <linux/slab.h>
> #include <linux/export.h>
> +#ifdef VHOST_IOTLB
Kbuild bot reports build issues with this.
It looks to me we should use #if IS_ENABLED(CONFIG_VHOST_IOTLB) here and
following checks.
Thanks
> #include <linux/bvec.h>
> #include <linux/highmem.h>
> #include <linux/vhost_iotlb.h>
> +#endif
> #include <uapi/linux/virtio_config.h>
>
> static __printf(1,2) __cold void vringh_bad(const char *fmt, ...)
> @@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh)
> }
> EXPORT_SYMBOL(vringh_need_notify_kern);
>
> +#ifdef VHOST_IOTLB
> +
> static int iotlb_translate(const struct vringh *vrh,
> u64 addr, u64 len, struct bio_vec iov[],
> int iov_size, u32 perm)
> @@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh)
> }
> EXPORT_SYMBOL(vringh_need_notify_iotlb);
>
> +#endif
>
> MODULE_LICENSE("GPL");
> diff --git a/include/linux/vringh.h b/include/linux/vringh.h
> index bd0503ca6f8f..ebff121c0b02 100644
> --- a/include/linux/vringh.h
> +++ b/include/linux/vringh.h
> @@ -14,8 +14,10 @@
> #include <linux/virtio_byteorder.h>
> #include <linux/uio.h>
> #include <linux/slab.h>
> +#ifdef VHOST_IOTLB
> #include <linux/dma-direction.h>
> #include <linux/vhost_iotlb.h>
> +#endif
> #include <asm/barrier.h>
>
> /* virtio_ring with information needed for host access. */
> diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile
> index f33f32f1d208..d3f152f4660b 100644
> --- a/tools/virtio/Makefile
> +++ b/tools/virtio/Makefile
> @@ -22,7 +22,8 @@ OOT_CONFIGS=\
> CONFIG_VHOST=m \
> CONFIG_VHOST_NET=n \
> CONFIG_VHOST_SCSI=n \
> - CONFIG_VHOST_VSOCK=n
> + CONFIG_VHOST_VSOCK=n \
> + CONFIG_VHOST_RING=n
> OOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
> oot-build:
> echo "UNSUPPORTED! Don't use the resulting modules in production!"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio/test: fix up after IOTLB changes
2020-04-02 4:01 ` Jason Wang
@ 2020-04-02 12:53 ` Michael S. Tsirkin
2020-04-02 14:18 ` Jason Wang
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-04-02 12:53 UTC (permalink / raw)
To: Jason Wang; +Cc: linux-kernel, Eugenio Pérez, kvm, virtualization, netdev
On Thu, Apr 02, 2020 at 12:01:56PM +0800, Jason Wang wrote:
>
> On 2020/4/2 上午12:51, Michael S. Tsirkin wrote:
> > Allow building vringh without IOTLB (that's the case for userspace
> > builds, will be useful for CAIF/VOD down the road too).
> > Update for API tweaks.
> > Don't include vringh with kernel builds.
>
>
> I'm not quite sure we need this.
>
> E.g the userspace accessor is not used by CAIF/VOP.
Well any exported symbols are always compiled in, right?
So we can save some kernel memory by not building unused stuff ...
> >
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Eugenio Pérez <eperezma@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/vhost/test.c | 4 ++--
> > drivers/vhost/vringh.c | 5 +++++
> > include/linux/vringh.h | 2 ++
> > tools/virtio/Makefile | 3 ++-
> > 4 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> > index 394e2e5c772d..9a3a09005e03 100644
> > --- a/drivers/vhost/test.c
> > +++ b/drivers/vhost/test.c
> > @@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
> > vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
> > n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
> > vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
> > - VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
> > + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL);
> > f->private_data = n;
> > @@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
> > {
> > void *priv = NULL;
> > long err;
> > - struct vhost_umem *umem;
> > + struct vhost_iotlb *umem;
> > mutex_lock(&n->dev.mutex);
> > err = vhost_dev_check_owner(&n->dev);
> > diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
> > index ee0491f579ac..878e565dfffe 100644
> > --- a/drivers/vhost/vringh.c
> > +++ b/drivers/vhost/vringh.c
> > @@ -13,9 +13,11 @@
> > #include <linux/uaccess.h>
> > #include <linux/slab.h>
> > #include <linux/export.h>
> > +#ifdef VHOST_IOTLB
>
>
> Kbuild bot reports build issues with this.
>
> It looks to me we should use #if IS_ENABLED(CONFIG_VHOST_IOTLB) here and
> following checks.
>
> Thanks
>
In fact IS_REACHEABLE is probably the right thing to do.
>
> > #include <linux/bvec.h>
> > #include <linux/highmem.h>
> > #include <linux/vhost_iotlb.h>
> > +#endif
> > #include <uapi/linux/virtio_config.h>
> > static __printf(1,2) __cold void vringh_bad(const char *fmt, ...)
> > @@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh)
> > }
> > EXPORT_SYMBOL(vringh_need_notify_kern);
> > +#ifdef VHOST_IOTLB
> > +
> > static int iotlb_translate(const struct vringh *vrh,
> > u64 addr, u64 len, struct bio_vec iov[],
> > int iov_size, u32 perm)
> > @@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh)
> > }
> > EXPORT_SYMBOL(vringh_need_notify_iotlb);
> > +#endif
> > MODULE_LICENSE("GPL");
> > diff --git a/include/linux/vringh.h b/include/linux/vringh.h
> > index bd0503ca6f8f..ebff121c0b02 100644
> > --- a/include/linux/vringh.h
> > +++ b/include/linux/vringh.h
> > @@ -14,8 +14,10 @@
> > #include <linux/virtio_byteorder.h>
> > #include <linux/uio.h>
> > #include <linux/slab.h>
> > +#ifdef VHOST_IOTLB
> > #include <linux/dma-direction.h>
> > #include <linux/vhost_iotlb.h>
> > +#endif
> > #include <asm/barrier.h>
> > /* virtio_ring with information needed for host access. */
> > diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile
> > index f33f32f1d208..d3f152f4660b 100644
> > --- a/tools/virtio/Makefile
> > +++ b/tools/virtio/Makefile
> > @@ -22,7 +22,8 @@ OOT_CONFIGS=\
> > CONFIG_VHOST=m \
> > CONFIG_VHOST_NET=n \
> > CONFIG_VHOST_SCSI=n \
> > - CONFIG_VHOST_VSOCK=n
> > + CONFIG_VHOST_VSOCK=n \
> > + CONFIG_VHOST_RING=n
> > OOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
> > oot-build:
> > echo "UNSUPPORTED! Don't use the resulting modules in production!"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio/test: fix up after IOTLB changes
2020-04-02 12:53 ` Michael S. Tsirkin
@ 2020-04-02 14:18 ` Jason Wang
0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2020-04-02 14:18 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Eugenio Pérez, kvm, virtualization, netdev
On 2020/4/2 下午8:53, Michael S. Tsirkin wrote:
> On Thu, Apr 02, 2020 at 12:01:56PM +0800, Jason Wang wrote:
>> On 2020/4/2 上午12:51, Michael S. Tsirkin wrote:
>>> Allow building vringh without IOTLB (that's the case for userspace
>>> builds, will be useful for CAIF/VOD down the road too).
>>> Update for API tweaks.
>>> Don't include vringh with kernel builds.
>>
>> I'm not quite sure we need this.
>>
>> E.g the userspace accessor is not used by CAIF/VOP.
> Well any exported symbols are always compiled in, right?
> So we can save some kernel memory by not building unused stuff ...
Yes, just want to mention that the there's no user for userspace
accessors now.
>
>
>>> Cc: Jason Wang <jasowang@redhat.com>
>>> Cc: Eugenio Pérez <eperezma@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> ---
>>> drivers/vhost/test.c | 4 ++--
>>> drivers/vhost/vringh.c | 5 +++++
>>> include/linux/vringh.h | 2 ++
>>> tools/virtio/Makefile | 3 ++-
>>> 4 files changed, 11 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
>>> index 394e2e5c772d..9a3a09005e03 100644
>>> --- a/drivers/vhost/test.c
>>> +++ b/drivers/vhost/test.c
>>> @@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
>>> vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
>>> n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
>>> vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
>>> - VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
>>> + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL);
>>> f->private_data = n;
>>> @@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
>>> {
>>> void *priv = NULL;
>>> long err;
>>> - struct vhost_umem *umem;
>>> + struct vhost_iotlb *umem;
>>> mutex_lock(&n->dev.mutex);
>>> err = vhost_dev_check_owner(&n->dev);
>>> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
>>> index ee0491f579ac..878e565dfffe 100644
>>> --- a/drivers/vhost/vringh.c
>>> +++ b/drivers/vhost/vringh.c
>>> @@ -13,9 +13,11 @@
>>> #include <linux/uaccess.h>
>>> #include <linux/slab.h>
>>> #include <linux/export.h>
>>> +#ifdef VHOST_IOTLB
>>
>> Kbuild bot reports build issues with this.
>>
>> It looks to me we should use #if IS_ENABLED(CONFIG_VHOST_IOTLB) here and
>> following checks.
>>
>> Thanks
>>
> In fact IS_REACHEABLE is probably the right thing to do.
Yes.
Thanks
>
>
>>> #include <linux/bvec.h>
>>> #include <linux/highmem.h>
>>> #include <linux/vhost_iotlb.h>
>>> +#endif
>>> #include <uapi/linux/virtio_config.h>
>>> static __printf(1,2) __cold void vringh_bad(const char *fmt, ...)
>>> @@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh)
>>> }
>>> EXPORT_SYMBOL(vringh_need_notify_kern);
>>> +#ifdef VHOST_IOTLB
>>> +
>>> static int iotlb_translate(const struct vringh *vrh,
>>> u64 addr, u64 len, struct bio_vec iov[],
>>> int iov_size, u32 perm)
>>> @@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh)
>>> }
>>> EXPORT_SYMBOL(vringh_need_notify_iotlb);
>>> +#endif
>>> MODULE_LICENSE("GPL");
>>> diff --git a/include/linux/vringh.h b/include/linux/vringh.h
>>> index bd0503ca6f8f..ebff121c0b02 100644
>>> --- a/include/linux/vringh.h
>>> +++ b/include/linux/vringh.h
>>> @@ -14,8 +14,10 @@
>>> #include <linux/virtio_byteorder.h>
>>> #include <linux/uio.h>
>>> #include <linux/slab.h>
>>> +#ifdef VHOST_IOTLB
>>> #include <linux/dma-direction.h>
>>> #include <linux/vhost_iotlb.h>
>>> +#endif
>>> #include <asm/barrier.h>
>>> /* virtio_ring with information needed for host access. */
>>> diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile
>>> index f33f32f1d208..d3f152f4660b 100644
>>> --- a/tools/virtio/Makefile
>>> +++ b/tools/virtio/Makefile
>>> @@ -22,7 +22,8 @@ OOT_CONFIGS=\
>>> CONFIG_VHOST=m \
>>> CONFIG_VHOST_NET=n \
>>> CONFIG_VHOST_SCSI=n \
>>> - CONFIG_VHOST_VSOCK=n
>>> + CONFIG_VHOST_VSOCK=n \
>>> + CONFIG_VHOST_RING=n
>>> OOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
>>> oot-build:
>>> echo "UNSUPPORTED! Don't use the resulting modules in production!"
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-02 14:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 16:51 [PATCH] virtio/test: fix up after IOTLB changes Michael S. Tsirkin
2020-04-02 4:01 ` Jason Wang
2020-04-02 12:53 ` Michael S. Tsirkin
2020-04-02 14:18 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).