Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp562165ybl; Fri, 6 Dec 2019 02:31:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwf3S250UqWYIDn27KFWqXtBKO4Aw8InpnEs7Y8iGjvEbPImh3nV/PYQcvA9/a1NjAIyGQF X-Received: by 2002:a9d:3a49:: with SMTP id j67mr3336832otc.264.1575628317232; Fri, 06 Dec 2019 02:31:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575628317; cv=none; d=google.com; s=arc-20160816; b=gxyH+9iVpcdiOCYRFI1FTpFsDFEp2otF6Ga3Bgx74iGssBoOR0BTYxxi7IDc9m9Pk9 i5bJPPNOO9QvSQOrDVm2qgCsjWVMbj+/LDnwSzOMeZgtxu6EosuOQ5bGyNSUlUHBzV4Z JKgxJyzNT5Ixlx4tmvRPWs193JbFdZQ8Xf9fuBkK6EHpjxcmq4OZ77FE371odw3Dglp6 7/kHCA+lk4j6grJdJx1aSsdSx+jITG7gyDPTRsna/mGNi2+tBqti3ABiCTTMOU08Pv7n Xlj/mojFCQkbylsglSt1CkRqSgmdKZHUEu4hIZotRcX11/BTA/2us8jZoucphQUeVqof oZuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mhXoMaU1UVBlyQ18j97xc9RF9JW9UYyQB2n+rphqqfo=; b=csvHXD9NUr996Qvl9BcS7jO6+nGk9FBvlXVSpNrCIntm2pjYLdffz+4Y80Dtrn9NR1 G4gmd0T8h8klv5d3v9CvVOwJ0x9ZeR6SR0/ETvV+6nBsS8PB1mPEIPgy57M99wHXgZJG YVxN1Q38Qn0ZaEdW8FotCNWpj+RYRFuwxBwoYukFxW/Aj4JGrmaXCN0YMgp1ze1okInL cO6DujbYTpqrYdsA+P9yvfYKf15PXbGm3tEuL6oQ3dFDTyVIBK8npOW5Jymn8h2F2Zoi aroj/Ag5g0S/EELhrpSiTJbx8EDfIfpAnKRpNuGxXxZ9pvNTTrQoGzvI85vFBIAu4hwg dRrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si6358145ota.300.2019.12.06.02.31.44; Fri, 06 Dec 2019 02:31:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfLFKa7 (ORCPT + 99 others); Fri, 6 Dec 2019 05:30:59 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37529 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbfLFKa6 (ORCPT ); Fri, 6 Dec 2019 05:30:58 -0500 Received: by mail-wr1-f67.google.com with SMTP id w15so7209354wru.4 for ; Fri, 06 Dec 2019 02:30:57 -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=mhXoMaU1UVBlyQ18j97xc9RF9JW9UYyQB2n+rphqqfo=; b=DN4U2kaQtORqL/JKeZy32W0nRZv7+u8FG41CfyvVT4u4uRHJ67Ccbd6P7HnUmmVVst lcrzh5jOMLx2aeJeMeaYqmzDlaiOzHTAYMnMrhu4TYZOLtn0ccv8vg0/9k8xDiwolTrZ 5eOqy66nLA7071p+882v9RIgwAJq5e7r5ew2/IS3EeXbYGGLygXsEMGXfPgc4Q/E072o nTaqjhdGC/rxIJjOB1sPskXcKZs5DdfnJuKByfpJlN/dvl5tyn9UoVzv1UPG5uElVlCy vod7N9AUwnK/lzSsWrXXZnVRUwryiVVpNG4k7lUnnA1rcUc9CloyMnOPWY73VIqzb89z 0+pA== X-Gm-Message-State: APjAAAUtX1NqKsrL450T93Fcjde7K6RGCYn1323ffmVGD0cjqTW6avYN NW/ZdVskVV2OP9IjnkvP2us= X-Received: by 2002:adf:83c7:: with SMTP id 65mr14202364wre.368.1575628256938; Fri, 06 Dec 2019 02:30:56 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id z13sm2983280wmi.18.2019.12.06.02.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 02:30:56 -0800 (PST) Date: Fri, 6 Dec 2019 11:30:55 +0100 From: Michal Hocko To: Thomas =?iso-8859-1?Q?Hellstr=F6m_=28VMware=29?= Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com, Thomas Hellstrom , Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Ralph Campbell , =?iso-8859-1?B?Suly9G1l?= Glisse , Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [PATCH v3 2/2] mm, drm/ttm: Fix vm page protection handling Message-ID: <20191206103055.GO28317@dhcp22.suse.cz> References: <20191206082426.2958-1-thomas_os@shipmail.org> <20191206082426.2958-3-thomas_os@shipmail.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191206082426.2958-3-thomas_os@shipmail.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 06-12-19 09:24:26, Thomas Hellstr?m (VMware) wrote: [...] > @@ -283,11 +282,26 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, > pfn = page_to_pfn(page); > } > > + /* > + * 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. > + */ 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. Thanks! -- Michal Hocko SUSE Labs