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=-7.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 B2508C2BBC7 for ; Mon, 13 Apr 2020 13:27:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C03E2075E for ; Mon, 13 Apr 2020 13:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729848AbgDMN1f (ORCPT ); Mon, 13 Apr 2020 09:27:35 -0400 Received: from verein.lst.de ([213.95.11.211]:34773 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728649AbgDMN1e (ORCPT ); Mon, 13 Apr 2020 09:27:34 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id AEBD868BEB; Mon, 13 Apr 2020 15:27:30 +0200 (CEST) Date: Mon, 13 Apr 2020 15:27:30 +0200 From: Christoph Hellwig To: Yan Zhao Cc: Christoph Hellwig , 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: <20200413132730.GB14455@lst.de> References: <20200404094101.672954-1-hch@lst.de> <20200404094101.672954-3-hch@lst.de> <20200407030845.GA10586@joy-OptiPlex-7040> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200407030845.GA10586@joy-OptiPlex-7040> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Mon, Apr 06, 2020 at 11:08:46PM -0400, Yan Zhao wrote: > hi > we were removing this code. see > https://lore.kernel.org/kvm/20200313031109.7989-1-yan.y.zhao@intel.com/ This didn't make 5.7-rc1. > The implementation of vfio_dma_rw() has been in vfio next tree. > https://github.com/awilliam/linux-vfio/commit/8d46c0cca5f4dc0538173d62cd36b1119b5105bc This made 5.7-rc1, so I'll update the series to take it into account. T > 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? I can't think of another way for a kernel thread to have a mm indeed.