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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 05B59C433E1 for ; Fri, 29 May 2020 07:28:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE566207BC for ; Fri, 29 May 2020 07:28:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="FdD/WjFm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE566207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4BCF7800B6; Fri, 29 May 2020 03:28:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46C7D80010; Fri, 29 May 2020 03:28:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 381F3800B6; Fri, 29 May 2020 03:28:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 1EC4E80010 for ; Fri, 29 May 2020 03:28:23 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CF4BF180ACC31 for ; Fri, 29 May 2020 07:28:22 +0000 (UTC) X-FDA: 76868928444.22.art58_2bff2dc1aa338 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id B0EE918038E7D for ; Fri, 29 May 2020 07:28:22 +0000 (UTC) X-HE-Tag: art58_2bff2dc1aa338 X-Filterd-Recvd-Size: 3714 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 29 May 2020 07:28:22 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 29 May 2020 00:26:56 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 29 May 2020 00:28:21 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 29 May 2020 00:28:21 -0700 Received: from [10.2.62.53] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 29 May 2020 07:28:20 +0000 Subject: Re: Question: "Bare" set_page_dirty_lock() call in vhost.c To: Jan Kara CC: Linux-MM , , Alex Williamson References: <3b2db4da-9e4e-05d1-bf89-a261f0eb6de0@nvidia.com> <20200529070343.GL14550@quack2.suse.cz> X-Nvconfidentiality: public From: John Hubbard Message-ID: <6680c2d2-4b45-0e83-96e0-e7d3d421c571@nvidia.com> Date: Fri, 29 May 2020 00:28:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200529070343.GL14550@quack2.suse.cz> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1590737216; bh=gKHq8sZZl10FvnWlIThaTlMuX+nOHNtKN/6tfQJLkjg=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=FdD/WjFm/dalaRZIqCTxNrPs4XD8Y0wu3t6tJ71Dmq7TSd5FqTIAVpMyO0AmU3ktb RYQXa9KGNsVyc1t9UZqksGmCtmzlU47bkdF+A/cL2kCnF6IX73l3jY9cYbb08bdg5E axyQAqmVNnB8EfjGim59OM/QgxFd00NfrlnroUjPu2uwWK6/5DqeqpJLMOevSVlVmo /Ldf8ACJqNAT/UEwM0+wCgMVUPTU8ULnMitqPk9kXqwY2dGLzOdPQ3FwhpHW+6CE2D lz5nJaIJIfdpVpxwVfZ+ANhTO/PSCN8a5aRi1CBwJsqnUTjiiIHwaLbV2/QHVDDga/ YyVDnP4NjIsxw== X-Rspamd-Queue-Id: B0EE918038E7D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2020-05-29 00:03, Jan Kara wrote: ... >> ...which actually is the the case that pin_user_pages*() is ultimately >> helping to avoid, btw. But in this case, it's all code that runs on a >> CPU, so no DMA or DIO is involved. But still, the "bare" use of >> set_page_dirty_lock() seems like a problem here. > > I agree that the site like above needs pin_user_pages(). The problem has > actually nothing to do with kmap_atomic() - that actually doesn't do > anything interesting on x86_64. The moment GUP_fast() returns, page can be > unmapped from page tables and written back so this site has exactly same > problems as any other using DMA or DIO. As we discussed earlier when > designing the patch set, the problem is really with GUP reference being > used to access page data. And the method of access (DMA, CPU access, GPU > access, ...) doesn't really matter... > > Honza Awesome, I was really starting to wonder what I was missing. This all makes perfect sense, thanks. Maybe I'll add a "Case 5" to Documentation/core-api/pin_user_pages.rst, to cover this sort of situation. It's not completely obvious from the first four cases, that this code is exposed to that problem. thanks, -- John Hubbard NVIDIA