[PATCH v3 2/3] vhost: Use vhost_get_used_size() in vhost_vring_set_addr()

2020-10-03 Thread Greg Kurz
The open-coded computation of the used size doesn't take the event into account when the VIRTIO_RING_F_EVENT_IDX feature is present. Fix that by using vhost_get_used_size(). Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH v3 3/3] vhost: Don't call log_access_ok() when using IOTLB

2020-10-03 Thread Greg Kurz
the used structure when there isn't an IOTLB device around. Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9d2c225fb518..9ad45e1d27f0 100644

[PATCH v3 1/3] vhost: Don't call access_ok() when using IOTLB

2020-10-03 Thread Greg Kurz
t.com CC: sta...@vger.kernel.org # 4.14+ Signed-off-by: Greg Kurz Acked-by: Jason Wang --- drivers/vhost/vhost.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index b45519ca66a7..c3b49975dc28 100644 --- a/drivers/vhost/

[PATCH v3 0/3] vhost: Skip access checks on GIOVAs

2020-10-03 Thread Greg Kurz
tch 2 from v2 v2: - patch 1: move the (vq->ioltb) check from vhost_vq_access_ok() to vq_access_ok() as suggested by MST - patch 2: new patch --- Greg Kurz (3): vhost: Don't call access_ok() when using IOTLB vhost: Use vhost_get_used_size() in vhost_vring_set_

Re: [PATCH v2 2/2] vhost: Don't call log_access_ok() when using IOTLB

2020-10-03 Thread Greg Kurz
On Sat, 3 Oct 2020 09:58:59 +0800 Jason Wang wrote: > > On 2020/9/30 上午12:30, Greg Kurz wrote: > > When the IOTLB device is enabled, the log_guest_addr that is passed by > > userspace to the VHOST_SET_VRING_ADDR ioctl, and which is then written > > to vq->log_addr

[PATCH v2 1/2] vhost: Don't call access_ok() when using IOTLB

2020-09-29 Thread Greg Kurz
t.com CC: sta...@vger.kernel.org # 4.14+ Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index b45519ca66a7..c3b49975dc28 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/

[PATCH v2 2/2] vhost: Don't call log_access_ok() when using IOTLB

2020-09-29 Thread Greg Kurz
the used structure when there isn't an IOTLB device around. Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c3b49975dc28..5996e32fa818 100644

[PATCH v2 0/2] vhost: Skip access checks on GIOVAs

2020-09-29 Thread Greg Kurz
0ULL). https://patchwork.ozlabs.org/project/qemu-devel/patch/160105498386.68108.2145229309875282336.st...@bahia.lan/ v2: - patch 1: move the (vq->ioltb) check from vhost_vq_access_ok() to vq_access_ok() as suggested by MST - patch 2: new patch --- Greg Kurz (2): vhost: Don't call a

Re: [PATCH] vhost: Don't call vq_access_ok() when using IOTLB

2020-09-29 Thread Greg Kurz
On Tue, 29 Sep 2020 03:45:28 -0400 "Michael S. Tsirkin" wrote: > On Mon, Sep 28, 2020 at 02:35:04PM +0200, Greg Kurz wrote: > > When the IOTLB device is enabled, the vring addresses we get from > > userspace are GIOVAs. It is thus wrong to pass them to vq_access_ok()

[PATCH] vhost: Don't call vq_access_ok() when using IOTLB

2020-09-28 Thread Greg Kurz
ed at IOTLB prefetch time anyway. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1883084 Fixes: 6b1e6cc7855b ("vhost: new device IOTLB API") Cc: jasow...@redhat.com CC: sta...@vger.kernel.org # 4.14+ Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c |5 - 1 file change

Re: [V9fs-developer] [PATCH kernel] 9p/trans_fd: Check file mode at opening

2020-07-29 Thread Greg Kurz
On Wed, 29 Jul 2020 09:50:21 +1000 Alexey Kardashevskiy wrote: > > > On 29/07/2020 03:42, Greg Kurz wrote: > > Hi Alexey, > > > > Working on 9p now ?!? ;-) > > No, I am running syzkaller and seeing things :) > :) > > > Cc'ing Dominique Ma

Re: [V9fs-developer] [PATCH kernel] 9p/trans_fd: Check file mode at opening

2020-07-28 Thread Greg Kurz
On Wed, 29 Jul 2020 08:14:49 +0200 Dominique Martinet wrote: > Greg Kurz wrote on Tue, Jul 28, 2020: > > > The "fd" transport layer uses 2 file descriptors passed externally > > > and calls kernel_write()/kernel_read() on these. If files were opened >

Re: [V9fs-developer] [PATCH kernel] 9p/trans_fd: Check file mode at opening

2020-07-28 Thread Greg Kurz
Hi Alexey, Working on 9p now ?!? ;-) Cc'ing Dominique Martinet who appears to be the person who takes care of 9p these days. On Tue, 28 Jul 2020 22:41:29 +1000 Alexey Kardashevskiy wrote: > The "fd" transport layer uses 2 file descriptors passed externally > and calls kernel_write()/kernel_rea

Re: [V9fs-developer] [PATCH] net/9p: fix error path of p9_virtio_probe

2018-05-24 Thread Greg Kurz
; --- Reviewed-by: Greg Kurz > net/9p/trans_virtio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c > index 4d0372263e5d..1c87eee522b7 100644 > --- a/net/9p/trans_virtio.c > +++ b/net/9p/trans_vi

Re: [PATCH] net/9p: avoid -ERESTARTSYS leak to userspace

2018-03-10 Thread Greg Kurz
Hi Andrew, Thank you very much for taking care of this. Please find my answers to your remarks below. On Fri, 9 Mar 2018 14:12:52 -0800 Andrew Morton wrote: > On Fri, 09 Mar 2018 21:41:38 +0100 Greg Kurz wrote: > > > If it was interrupted by a signal, the 9p client may need

[PATCH] net/9p: avoid -ERESTARTSYS leak to userspace

2018-03-09 Thread Greg Kurz
both functions with a trivial label+goto. Thanks to Laurent Dufour for his help and suggestions on how to find the root cause and how to fix it. Signed-off-by: Greg Kurz --- net/9p/client.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/9p/client.c b/net/9p/cli

Re: [V9fs-developer] [PATCH] net/9p: avoid -ERESTARTSYS leak to userspace

2018-02-20 Thread Greg Kurz
Hi Al, It's been two years without any sign of life from 9p maintainers... :-\ Would you apply (or nack) this patch ? Thanks, -- Greg PS: in the case you apply it, probable Cc sta...@vger.kernel.org as well On Thu, 08 Feb 2018 18:38:49 +0100 Greg Kurz wrote: > If it was interrup

Re: [V9fs-developer] [PATCH] 9p/trans_virtio: discard zero-length reply

2018-02-08 Thread Greg Kurz
Ping ? Michael, Since this is virtio code and you have acked the QEMU part of the fix already, would you be kind enough to take this through your tree ? Cheers, -- Greg On Mon, 22 Jan 2018 22:02:05 +0100 Greg Kurz wrote: > When a 9p request is successfully flushed, the server is expected

[PATCH] net/9p: avoid -ERESTARTSYS leak to userspace

2018-02-08 Thread Greg Kurz
tions with a trivial label+goto. Thanks to Laurent Dufour for his help and suggestions on how to find the root cause and how to fix it. Signed-off-by: Greg Kurz --- net/9p/client.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c

[PATCH] 9p/trans_virtio: discard zero-length reply

2018-01-22 Thread Greg Kurz
client will erroneously assume the request has not been flushed. Signed-off-by: Greg Kurz --- net/9p/trans_virtio.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 0845aad4ba51..ca08c72ef4de 100644 --- a/net/9p/trans_virtio.c

Re: [BUG/RFC] vhost: net: big endian viring access despite virtio 1

2017-01-27 Thread Greg Kurz
On Fri, 27 Jan 2017 13:24:13 +0100 Halil Pasic wrote: > On 01/26/2017 08:20 PM, Michael S. Tsirkin wrote: > > On Thu, Jan 26, 2017 at 06:39:14PM +0100, Halil Pasic wrote: > >> > >> Hi! > >> > >> Recently I have been investigating some strange migration problems on > >> s390x. > >> > >> It turne

Re: [PATCH V4 0/3] basic busy polling support for vhost_net

2016-03-09 Thread Greg Kurz
On Fri, 4 Mar 2016 06:24:50 -0500 Jason Wang wrote: > This series tries to add basic busy polling for vhost net. The idea is > simple: at the end of tx/rx processing, busy polling for new tx added > descriptor and rx receive socket for a while. The maximum number of > time (in us) could be spent

Re: [PATCH v2 0/3] vhost: cross-endian code cleanup

2016-02-16 Thread Greg Kurz
On Tue, 16 Feb 2016 17:34:13 +0200 "Michael S. Tsirkin" wrote: > On Tue, Feb 16, 2016 at 03:54:18PM +0100, Greg Kurz wrote: > > This series is a new tentative to have cleaner cross-endian code. > > > > Patches 1/3 is new: it fixes a side-effect in case vhost_init

[PATCH v2 2/3] vhost: rename cross-endian helpers

2016-02-16 Thread Greg Kurz
e is started. The cross-endian mode is disabled when the device is stopped. The current names of the helpers that manipulate vq->user_be are unclear. This patch renames those helpers to clearly show that this is cross-endian stuff and with explicit enable/disable semantics. No behaviour change.

[PATCH v2 3/3] vhost: rename vhost_init_used()

2016-02-16 Thread Greg Kurz
n't related to the vq used ring. This patch simply renames vhost_init_used() to vhost_vq_init_access() as suggested by Michael. No behaviour change. Signed-off-by: Greg Kurz --- drivers/vhost/net.c |2 +- drivers/vhost/scsi.c |2 +- drivers/vhost/test.c |2 +- drivers/vhost

[PATCH v2 0/3] vhost: cross-endian code cleanup

2016-02-16 Thread Greg Kurz
This series is a new tentative to have cleaner cross-endian code. Patches 1/3 is new: it fixes a side-effect in case vhost_init_used() fails. Patch 2/3 comes from v1: it renames cross-endian helpers Patch 3/3 is new: it simply renames vhost_init_used() as suggested by Michael. --- Greg Kurz

[PATCH v2 1/3] vhost: fix error path in vhost_init_used()

2016-02-16 Thread Greg Kurz
We don't want side effects. If something fails, we rollback vq->is_le to its previous value. Signed-off-by: Greg Kurz --- drivers/vhost/vhost.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index ad21

Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness

2016-02-10 Thread Greg Kurz
On Wed, 10 Feb 2016 17:08:52 +0200 "Michael S. Tsirkin" wrote: > On Wed, Feb 10, 2016 at 01:11:34PM +0100, Greg Kurz wrote: > > On Wed, 10 Feb 2016 13:21:22 +0200 > > "Michael S. Tsirkin" wrote: > > > > > On Wed, Jan 13, 2016 at 06:09:41PM

Re: [PATCH 2/2] vhost: disentangle vring endianness stuff from the core code

2016-02-10 Thread Greg Kurz
On Wed, 10 Feb 2016 14:23:33 +0100 Cornelia Huck wrote: > On Wed, 10 Feb 2016 14:08:43 +0100 > Greg Kurz wrote: > > > But you are right, there is a bug: we should rollback if vhost_init_used() > > fails. Something like below: > > > > err_used: >

Re: [PATCH 2/2] vhost: disentangle vring endianness stuff from the core code

2016-02-10 Thread Greg Kurz
On Wed, 10 Feb 2016 13:48:09 +0200 "Michael S. Tsirkin" wrote: > On Wed, Jan 13, 2016 at 06:09:47PM +0100, Greg Kurz wrote: > > The way vring endianness is being handled currently obfuscates > > the code in vhost_init_used(). > > > > This patch tri

Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness

2016-02-10 Thread Greg Kurz
On Wed, 10 Feb 2016 13:21:22 +0200 "Michael S. Tsirkin" wrote: > On Wed, Jan 13, 2016 at 06:09:41PM +0100, Greg Kurz wrote: > > The default use case for vhost is when the host and the vring have the > > same endianness (default native endianness). But there are cases

Re: [PATCH 0/2] vhost: cross-endian code cleanup

2016-01-27 Thread Greg Kurz
On Wed, 13 Jan 2016 18:09:34 +0100 Greg Kurz wrote: > This series is a respin of the following patch: > > http://patchwork.ozlabs.org/patch/565921/ > > Patch 1 is preliminary work: it gives better names to the helpers that are > involved in cross-endian support. > >

Re: [PATCH] vhost: move is_le setup to the backend

2015-12-16 Thread Greg Kurz
On Thu, 12 Nov 2015 15:28:19 +0100 Greg Kurz wrote: > On Thu, 12 Nov 2015 15:46:30 +0200 > "Michael S. Tsirkin" wrote: > > > On Fri, Oct 30, 2015 at 12:42:35PM +0100, Greg Kurz wrote: > > > The vq->is_le field is used to fix endianness when accessing t

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Greg Kurz
On Thu, 12 Nov 2015 15:46:30 +0200 "Michael S. Tsirkin" wrote: > On Fri, Oct 30, 2015 at 12:42:35PM +0100, Greg Kurz wrote: > > The vq->is_le field is used to fix endianness when accessing the vring via > > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Greg Kurz
On Fri, 30 Oct 2015 12:42:35 +0100 Greg Kurz wrote: > The vq->is_le field is used to fix endianness when accessing the vring via > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following cases: > > 1) host is big endian and device is modern virtio > > 2)

[PATCH] vhost: move is_le setup to the backend

2015-10-30 Thread Greg Kurz
ur change. Signed-off-by: Greg Kurz --- drivers/vhost/net.c |6 ++ drivers/vhost/scsi.c |3 +++ drivers/vhost/test.c |2 ++ drivers/vhost/vhost.c | 12 +++- drivers/vhost/vhost.h |1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/vhost

Re: [PATCH] vhost: fix performance on LE hosts

2015-10-27 Thread Greg Kurz
le_endian is > checking is_le flag so there's always a branch. > > To fix, simply check virtio_legacy_is_little_endian first. > > Cc: Greg Kurz > Signed-off-by: Michael S. Tsirkin Oops my bad for this oversight... Reviewed-by: Greg Kurz > --- > drivers

Re: [PATCH v2] Fix AF_PACKET ABI breakage in 4.2

2015-09-25 Thread Greg Kurz
On Thu, 24 Sep 2015 12:50:59 +0300 "Michael S. Tsirkin" wrote: > On Thu, Sep 24, 2015 at 09:25:45AM +0200, Greg Kurz wrote: > > On Wed, 23 Sep 2015 19:45:08 +0100 > > David Woodhouse wrote: > > > > > Commit 7d82410950aa ("virtio: add explicit

Re: [PATCH v2] Fix AF_PACKET ABI breakage in 4.2

2015-09-24 Thread Greg Kurz
On Wed, 23 Sep 2015 19:45:08 +0100 David Woodhouse wrote: > Commit 7d82410950aa ("virtio: add explicit big-endian support to memory > accessors") accidentally changed the virtio_net header used by > AF_PACKET with PACKET_VNET_HDR from host-endian to big-endian. > Hi David, Oops my bad... I obv

Re: [PATCH] KVM: Add Kconfig option to signal cross-endian guests

2015-07-13 Thread Greg Kurz
On Thu, 9 Jul 2015 09:49:05 +0200 Thomas Huth wrote: > The option for supporting cross-endianness legacy guests in > the vhost and tun code should only be available on systems > that support cross-endian guests. > > Signed-off-by: Thomas Huth Acked-by: Greg Kurz -- To unsubs

Re: [PULL] virtio/vhost: cross endian support

2015-07-02 Thread Greg Kurz
On Thu, 2 Jul 2015 08:01:28 +0200 "Michael S. Tsirkin" wrote: > On Wed, Jul 01, 2015 at 12:02:50PM -0700, Linus Torvalds wrote: > > On Wed, Jul 1, 2015 at 2:31 AM, Michael S. Tsirkin wrote: > > > virtio/vhost: cross endian support > > > > Ugh. Does this really have to be dynamic? > > > > Can't