Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp798225ybl; Fri, 6 Dec 2019 06:26:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxhHmmK/AlT/J8VK6p/8ZpGyrx01k7/uF96Tng3uqHQK9rq5NKu8JsJ4v872+z87BXiGBFL X-Received: by 2002:a05:6830:1498:: with SMTP id s24mr11034329otq.208.1575642381910; Fri, 06 Dec 2019 06:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575642381; cv=none; d=google.com; s=arc-20160816; b=vH7FduUzSGJ1rT2vZWXSXid9TcU6NWsbZRFAqpPEsFOF48l/MWsr4rS0F18QuMsvYF NJQ/G8XdAyZYJ8vTbmRh2BAmNWm2i+CoN3Emoc47oOY52/z/eE9TydQcwHQb/u1qB/IJ yv4JW8XQR5o8eIx5uLc0oIK+v2BMWFSTC4Kt57UbSlrW/7mboxH+c2sA5Xd+HAYzWLlP hzoS6sU8FzsDiSFLpX2VQY/yc54a5HGjnUmqn9MT+CeYqxFILI2KBeThTEpcuLnJBmFe vtGE1vcxlXgFOSQVxeGYJSVxGJ/iA9BlhDdVy0/yBsQSlZ/G0NX2ZaS8eSK3UNkWRmxV DICg== 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=vc6cQnfCxKN0uDPrk49B3m1HkxNISZTqI0Pp7rQHqII=; b=qHqahgsWl848KPV++9MIHB/xsDxONG8pwy8GXHiunob3gXMvurb31qmh6HxAnl9nc4 Ly8Cr3zngLV3BXivLVLBVHL/gvCo4UQoH3pFVyGvKG4kC+zLk/OUWWE/QmcNeEjZf0Eh soQd4WQkSGAGpxjnLiQOtN2YbHyyqSOt0+V7z9+Nenn1ErHJZ7gdDotKtS1kEsEQck2z DXdC+6usXEoMihnMuilYk554B5BpSvYRSl2Dn1/oaOuLh1T3skzVInP+142f4yazYlBU 5nNX5+8HVVDJbkDWzoqOS5g1/SPkv5Ocs5sQBv2oZyMLTpLjtk9/YFWIrRG9hvrOR9BL salg== 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 b133si2768396oii.155.2019.12.06.06.26.09; Fri, 06 Dec 2019 06:26:21 -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 S1726410AbfLFOYY (ORCPT + 99 others); Fri, 6 Dec 2019 09:24:24 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43131 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726234AbfLFOYW (ORCPT ); Fri, 6 Dec 2019 09:24:22 -0500 Received: by mail-wr1-f65.google.com with SMTP id d16so7917339wre.10 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=cGr7X6RF7ZcUqQsmj+Tx6kD94zVjwY7czhSIdCoTzdqJkhAcfNjeMCm0o3jK6YvgLU syhv7pP7bcR7KlJHDbPtY5Qt7H4QNW8gAW23AfgowOlmzA4abOI6UbrnmV5FyZcQwj2D MTJriYwtljz4NwzpKuVGQuAz+u/cTM5qcMynPAbospfZhyvdGoZ+gixmftRq+q+8TDGT H12mGNkSXG3vIfHJItdcK/XiMuAXz0xY1pa7BAQxXKfALgjmk0NchKiy53dd3sYU1bZR fkvpXmNXNWI4uQT2WteB3sb071v/Q1Ol5lN1Wm11uuTQcvHpnZAf8LMWAHaNJjSfUS6S SjwQ== X-Gm-Message-State: APjAAAWPFkldamGlnIUc/es8chcg4pv3vSCtXpanDVGhiPvhMV1AocHK vWFUKvPi68nWeIPn2LbH8QE= 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 Content-Transfer-Encoding: 8bit In-Reply-To: <10c4835486275e87334058bc2f406609c55271eb.camel@vmware.com> 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 14:16:10, Thomas Hellstrom wrote: > Hi Michal, > > On Fri, 2019-12-06 at 11:30 +0100, Michal Hocko wrote: > > 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! > > > > 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! -- Michal Hocko SUSE Labs