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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 F36DEC2BB85 for ; Tue, 14 Apr 2020 07:00:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE07C206E9 for ; Tue, 14 Apr 2020 07:00:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE07C206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 255276E456; Tue, 14 Apr 2020 07:00:21 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E89D6E456; Tue, 14 Apr 2020 07:00:19 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 024D068BEB; Tue, 14 Apr 2020 09:00:13 +0200 (CEST) Date: Tue, 14 Apr 2020 09:00:13 +0200 From: Christoph Hellwig To: Yan Zhao Message-ID: <20200414070013.GA23680@lst.de> References: <20200404094101.672954-1-hch@lst.de> <20200404094101.672954-3-hch@lst.de> <20200407030845.GA10586@joy-OptiPlex-7040> <20200413132730.GB14455@lst.de> <20200414000410.GE10586@joy-OptiPlex-7040> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200414000410.GE10586@joy-OptiPlex-7040> User-Agent: Mutt/1.5.17 (2007-11-01) Subject: Re: [Intel-gfx] [PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Axboe , Felipe Balbi , Alex Deucher , "Michael S. Tsirkin" , Linus Torvalds , Jason Wang , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, io-uring@vger.kernel.org, linux-mm@kvack.org, intel-gfx@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, Felix Kuehling , Andrew Morton , virtualization@lists.linux-foundation.org, intel-gvt-dev@lists.freedesktop.org, Christoph Hellwig , Al Viro Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, Apr 13, 2020 at 08:04:10PM -0400, Yan Zhao wrote: > > I can't think of another way for a kernel thread to have a mm indeed. > for example, before calling to vfio_dma_rw(), a kernel thread has already > called use_mm(), then its current->mm is not null, and it has flag > PF_KTHREAD. > in this case, we just want to allow the copy_to_user() directly if > current->mm == mm, rather than call another use_mm() again. > > do you think it makes sense? I mean no other way than using use_mm. That being said nesting potentional use_mm callers sounds like a rather bad idea, and we should avoid that. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx