From: Yan Zhao <[email protected]>
To: Christoph Hellwig <[email protected]>
Cc: Linus Torvalds <[email protected]>,
Andrew Morton <[email protected]>,
Jens Axboe <[email protected]>, Felipe Balbi <[email protected]>,
[email protected],
"Michael S. Tsirkin" <[email protected]>,
Felix Kuehling <[email protected]>,
[email protected], [email protected],
[email protected],
Zhenyu Wang <[email protected]>,
[email protected], [email protected],
[email protected], Al Viro <[email protected]>,
[email protected],
Alex Deucher <[email protected]>,
[email protected],
Jason Wang <[email protected]>, Zhi Wang <[email protected]>
Subject: Re: [PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread
Date: Mon, 6 Apr 2020 23:08:46 -0400 [thread overview]
Message-ID: <20200407030845.GA10586@joy-OptiPlex-7040> (raw)
In-Reply-To: <[email protected]>
On Sat, Apr 04, 2020 at 11:40:57AM +0200, Christoph Hellwig wrote:
> Use the proper API instead.
>
> Fixes: f440c8a572d7 ("drm/i915/gvt/kvmgt: read/write GPA via KVM API")
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
> drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 074c4efb58eb..5848400620b4 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -2037,7 +2037,7 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa,
> struct kvmgt_guest_info *info;
> struct kvm *kvm;
> int idx, ret;
> - bool kthread = current->mm == NULL;
> + bool kthread = (current->flags & PF_KTHREAD);
>
> if (!handle_valid(handle))
> return -ESRCH;
> --
> 2.25.1
>
hi
we were removing this code. see
https://lore.kernel.org/kvm/[email protected]/
The implementation of vfio_dma_rw() has been in vfio next tree.
https://github.com/awilliam/linux-vfio/commit/8d46c0cca5f4dc0538173d62cd36b1119b5105bc
in vfio_dma_rw(), we still use
bool kthread = current->mm == NULL.
because if current->mm != NULL and current->flags & PF_KTHREAD, instead
of calling use_mm(), we first check if (current->mm == mm) and allow copy_to_user() if it's true.
Do you think it's all right?
Thanks
Yan
> _______________________________________________
> intel-gvt-dev mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
next prev parent reply other threads:[~2020-04-07 3:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-04 9:40 improve use_mm / unuse_mm Christoph Hellwig
2020-04-04 9:40 ` [PATCH 1/6] amdgpu: a NULL ->mm does not mean a thread is a kthread Christoph Hellwig
2020-04-06 16:07 ` Felix Kuehling
2020-04-04 9:40 ` [PATCH 2/6] i915/gvt/kvm: " Christoph Hellwig
2020-04-04 10:05 ` Sergei Shtylyov
2020-04-07 3:08 ` Yan Zhao [this message]
2020-04-13 13:27 ` Christoph Hellwig
2020-04-14 0:04 ` Yan Zhao
2020-04-14 7:00 ` Christoph Hellwig
2020-04-14 7:03 ` Yan Zhao
2020-04-04 9:40 ` [PATCH 3/6] i915/gvt: remove unused xen bits Christoph Hellwig
2020-04-08 1:44 ` Zhenyu Wang
2020-04-13 13:08 ` Christoph Hellwig
2020-04-14 3:04 ` Zhenyu Wang
2020-04-04 9:40 ` [PATCH 4/6] kernel: move use_mm/unuse_mm to kthread.c Christoph Hellwig
2020-04-06 16:09 ` Felix Kuehling
2020-04-04 9:41 ` [PATCH 5/6] kernel: better document the use_mm/unuse_mm API contract Christoph Hellwig
2020-04-04 13:07 ` [Intel-gfx] " Pavel Begunkov
2020-04-06 16:10 ` Felix Kuehling
2020-04-04 9:41 ` [PATCH 6/6] kernel: set USER_DS in kthread_use_mm Christoph Hellwig
2020-04-06 21:49 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200407030845.GA10586@joy-OptiPlex-7040 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox