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.5 required=3.0 tests=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 3086FC43603 for ; Fri, 6 Dec 2019 14:24:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECDA220659 for ; Fri, 6 Dec 2019 14:24:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECDA220659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8C4746B166F; Fri, 6 Dec 2019 09:24:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 827456B1670; Fri, 6 Dec 2019 09:24:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EE486B1671; Fri, 6 Dec 2019 09:24:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 555276B166F for ; Fri, 6 Dec 2019 09:24:22 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 0A22480A379C for ; Fri, 6 Dec 2019 14:24:22 +0000 (UTC) X-FDA: 76234936764.10.move68_2611b5e56b73f X-HE-Tag: move68_2611b5e56b73f X-Filterd-Recvd-Size: 5217 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Dec 2019 14:24:21 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id j42so7908298wrj.12 for ; Fri, 06 Dec 2019 06:24:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=vc6cQnfCxKN0uDPrk49B3m1HkxNISZTqI0Pp7rQHqII=; b=mctsqKkRba7P1pKwMLG9evztLkdlxoGFgKA58cgw1xQIR3pBWph7fuR9wQHHUGbO/V EfQdhWvaKk64XMtZRqfR1ef7w5ToRAMllOTMrtl6MpTuxIUS6uWfnzr2zxTqgqT1tnZy h2/PsfqskYnciMexyRqSGadDShdY8AP8MgTxwk4JZWO/nQU/jp8rioocr1xBqpFST8r1 6VIYjLXSNDzdYV8z/he/600Gw7M5Jj4UESVhXKd8s7xb3bBD6yUzkzyBSoK1Gaw07Psv 9zld6rug+YBKK1EFysmlt+jOYaevjp+pyZrbt0hz7Fjeo5eEbn14ABJ7RSCFLkXjQtvs GyUA== X-Gm-Message-State: APjAAAXE2k+IL3qMuraaXIaaXoBjUX+anywTeGO1X1Oa9+5LCmgDHkRZ 8Bulbfr3gZuZtzecUTpE2HI= X-Google-Smtp-Source: APXvYqwwmMDnS2FZLfKG16pLce1tzYWbto9tStZ6peuTR2ohVxYhKW7GPLX8eCkxS/T2ph8KLjhUOw== X-Received: by 2002:adf:82e7:: with SMTP id 94mr16211867wrc.60.1575642260421; Fri, 06 Dec 2019 06:24:20 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id z6sm17140998wrw.36.2019.12.06.06.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 06:24:19 -0800 (PST) Date: Fri, 6 Dec 2019 15:24:18 +0100 From: Michal Hocko To: Thomas Hellstrom Cc: "thomas_os@shipmail.org" , "linux-kernel@vger.kernel.org" , "kirill.shutemov@linux.intel.com" , "willy@infradead.org" , "linux-mm@kvack.org" , "christian.koenig@amd.com" , "akpm@linux-foundation.org" , Pv-drivers , "rcampbell@nvidia.com" , "dri-devel@lists.freedesktop.org" , "jglisse@redhat.com" , Linux-graphics-maintainer Subject: Re: [PATCH v3 2/2] mm, drm/ttm: Fix vm page protection handling Message-ID: <20191206142418.GP28317@dhcp22.suse.cz> References: <20191206082426.2958-1-thomas_os@shipmail.org> <20191206082426.2958-3-thomas_os@shipmail.org> <20191206103055.GO28317@dhcp22.suse.cz> <10c4835486275e87334058bc2f406609c55271eb.camel@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <10c4835486275e87334058bc2f406609c55271eb.camel@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Transfer-Encoding: quoted-printable 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 Fri 06-12-19 14:16:10, Thomas Hellstrom wrote: > Hi Michal, >=20 > On Fri, 2019-12-06 at 11:30 +0100, Michal Hocko wrote: > > On Fri 06-12-19 09:24:26, Thomas Hellstr=F6m (VMware) wrote: > > [...] > > > @@ -283,11 +282,26 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct > > > vm_fault *vmf, > > > pfn =3D page_to_pfn(page); > > > } > > > =20 > > > + /* > > > + * Note that the value of @prot at this point may > > > differ from > > > + * the value of @vma->vm_page_prot in the caching- and > > > + * encryption bits. This is because the exact location > > > of the > > > + * data may not be known at mmap() time and may also > > > change > > > + * at arbitrary times while the data is mmap'ed. > > > + * This is ok as long as @vma->vm_page_prot is not used > > > by > > > + * the core vm to set caching- and encryption bits. > > > + * This is ensured by core vm using pte_modify() to > > > modify > > > + * page table entry protection bits (that function > > > preserves > > > + * old caching- and encryption bits), and the @fault > > > + * callback being the only function that creates new > > > + * page table entries. > > > + */ > >=20 > > While this is a very valuable piece of information I believe we need > > to > > document this in the generic code where everybody will find it. > > vmf_insert_mixed_prot sounds like a good place to me. So being > > explicit > > about VM_MIXEDMAP. Also a reference from vm_page_prot to this > > function > > would be really helpeful. > >=20 > > Thanks! > >=20 >=20 > Just to make sure I understand correctly. You'd prefer this (or > similar) text to be present at the vmf_insert_mixed_prot() and > vmf_insert_pfn_prot() definitions for MIXEDMAP and PFNMAP respectively, > and a pointer from vm_page_prot to that text. Is that correct? Yes. You can keep whatever is specific to TTM here but the rest should be somewhere visible to users of the interface and a note at vm_page_prot should help anybody touching the generic/core code to not break those expectations. Thanks! --=20 Michal Hocko SUSE Labs