* [PATCH 0/1] vhost, use_mm and KERNEL_DS
@ 2012-06-26 10:59 Christian Borntraeger
2012-06-26 10:59 ` [PATCH 1/1] use USER_DS in vhost_worker thread Christian Borntraeger
0 siblings, 1 reply; 3+ messages in thread
From: Christian Borntraeger @ 2012-06-26 10:59 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm, netdev, Jens Freimann, Christian Borntraeger
Folks,
here is a patch that fixes vhost to use USER_DS before
doing a use_mm/usercopy operation. This was found during
vhost prototyping on s390 were we have a separate user/kernel
address space.
Jens Freimann (1):
use USER_DS in vhost_worker thread
drivers/vhost/vhost.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] use USER_DS in vhost_worker thread
2012-06-26 10:59 [PATCH 0/1] vhost, use_mm and KERNEL_DS Christian Borntraeger
@ 2012-06-26 10:59 ` Christian Borntraeger
2012-06-26 11:42 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Christian Borntraeger @ 2012-06-26 10:59 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm, netdev, Jens Freimann, Christian Borntraeger
From: Jens Freimann <jfrei@linux.vnet.ibm.com>
On some architectures address spaces are set up in a way that this is
not necessary to work properly but on some others (like s390) it is.
Make sure we operate on the user address space to allow copy_xxx_user()
from the vhost_worker() thread by setting it explicitly before calling
use_mm() and revert it after unuse_mm().
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
drivers/vhost/vhost.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 94dbd25..112156f 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -191,7 +191,9 @@ static int vhost_worker(void *data)
struct vhost_dev *dev = data;
struct vhost_work *work = NULL;
unsigned uninitialized_var(seq);
+ mm_segment_t oldfs = get_fs();
+ set_fs(USER_DS);
use_mm(dev->mm);
for (;;) {
@@ -229,6 +231,7 @@ static int vhost_worker(void *data)
}
unuse_mm(dev->mm);
+ set_fs(oldfs);
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] use USER_DS in vhost_worker thread
2012-06-26 10:59 ` [PATCH 1/1] use USER_DS in vhost_worker thread Christian Borntraeger
@ 2012-06-26 11:42 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2012-06-26 11:42 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: kvm, netdev, Jens Freimann
On Tue, Jun 26, 2012 at 12:59:58PM +0200, Christian Borntraeger wrote:
> From: Jens Freimann <jfrei@linux.vnet.ibm.com>
>
> On some architectures address spaces are set up in a way that this is
> not necessary to work properly but on some others (like s390) it is.
> Make sure we operate on the user address space to allow copy_xxx_user()
> from the vhost_worker() thread by setting it explicitly before calling
> use_mm() and revert it after unuse_mm().
>
> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Dave, can you queue this up for 3.5 please?
Thanks.
> ---
> drivers/vhost/vhost.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 94dbd25..112156f 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -191,7 +191,9 @@ static int vhost_worker(void *data)
> struct vhost_dev *dev = data;
> struct vhost_work *work = NULL;
> unsigned uninitialized_var(seq);
> + mm_segment_t oldfs = get_fs();
>
> + set_fs(USER_DS);
> use_mm(dev->mm);
>
> for (;;) {
> @@ -229,6 +231,7 @@ static int vhost_worker(void *data)
>
> }
> unuse_mm(dev->mm);
> + set_fs(oldfs);
> return 0;
> }
>
> --
> 1.7.0.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-26 11:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26 10:59 [PATCH 0/1] vhost, use_mm and KERNEL_DS Christian Borntraeger
2012-06-26 10:59 ` [PATCH 1/1] use USER_DS in vhost_worker thread Christian Borntraeger
2012-06-26 11:42 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.