From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE782C2BB54 for ; Tue, 7 Apr 2020 03:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A168220716 for ; Tue, 7 Apr 2020 03:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbgDGDS1 (ORCPT ); Mon, 6 Apr 2020 23:18:27 -0400 Received: from mga07.intel.com ([134.134.136.100]:19262 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbgDGDS0 (ORCPT ); Mon, 6 Apr 2020 23:18:26 -0400 IronPort-SDR: 9vRluI4iJ7LncyDqqP9OOkqmrDCqYY8nZY0vJXvjyyNaUn016xWtinCmu0YWMEidX6uih+VMKy PcbSIPYQYVVQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2020 20:18:26 -0700 IronPort-SDR: 2xR9uCM5BCNi15KKmsOhl436RFPRAMt47uVHr0POCE9sbZmZYVeBcv4l84JGJCChQ2Yo+l3GPc XmGUNL+cWKeg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,353,1580803200"; d="scan'208";a="451069613" Received: from joy-optiplex-7040.sh.intel.com (HELO joy-OptiPlex-7040) ([10.239.13.16]) by fmsmga005.fm.intel.com with ESMTP; 06 Apr 2020 20:18:21 -0700 Date: Mon, 6 Apr 2020 23:08:46 -0400 From: Yan Zhao To: Christoph Hellwig Cc: Linus Torvalds , Andrew Morton , Jens Axboe , Felipe Balbi , amd-gfx@lists.freedesktop.org, "Michael S. Tsirkin" , Felix Kuehling , linux-usb@vger.kernel.org, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , virtualization@lists.linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Al Viro , intel-gfx@lists.freedesktop.org, Alex Deucher , intel-gvt-dev@lists.freedesktop.org, Jason Wang , Zhi Wang Subject: Re: [PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread Message-ID: <20200407030845.GA10586@joy-OptiPlex-7040> Reply-To: Yan Zhao References: <20200404094101.672954-1-hch@lst.de> <20200404094101.672954-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200404094101.672954-3-hch@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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 > --- > 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/20200313031109.7989-1-yan.y.zhao@intel.com/ 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 > intel-gvt-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev