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=-5.3 required=3.0 tests=BAYES_00, 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 58AC8C433B4 for ; Tue, 18 May 2021 13:22:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9085A6008E for ; Tue, 18 May 2021 13:22:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9085A6008E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA6E86B011D; Tue, 18 May 2021 09:22:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7E496B011E; Tue, 18 May 2021 09:22:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D46426B011F; Tue, 18 May 2021 09:22:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id A70326B011D for ; Tue, 18 May 2021 09:22:02 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 45C10824999B for ; Tue, 18 May 2021 13:22:02 +0000 (UTC) X-FDA: 78154414884.17.87A7891 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf25.hostedemail.com (Postfix) with ESMTP id F00DE6000104 for ; Tue, 18 May 2021 13:21:58 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 5293768B05; Tue, 18 May 2021 15:21:57 +0200 (CEST) Date: Tue, 18 May 2021 15:21:56 +0200 From: Christoph Hellwig To: Matthew Auld Cc: Christoph Hellwig , Serge Belyshev , Peter Zijlstra , Daniel Vetter , Intel Graphics Development , Chris Wilson , linux-mm@kvack.org, ML dri-devel , Andrew Morton Subject: Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot Message-ID: <20210518132155.GB2617@lst.de> References: <20210326055505.1424432-1-hch@lst.de> <20210326055505.1424432-5-hch@lst.de> <87pmxqiry6.fsf@depni.sinp.msu.ru> <20210517123716.GD15150@lst.de> <87lf8dik15.fsf@depni.sinp.msu.ru> <20210517131137.GA19451@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=none; spf=none (imf25.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: F00DE6000104 X-Stat-Signature: kqdowmjy3padwyknx8y8awrd7recgois X-HE-Tag: 1621344118-781440 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 Mon, May 17, 2021 at 06:06:44PM +0100, Matthew Auld wrote: > > Looks like it is caused by the validation failure then. Which means the > > existing code is doing something wrong in its choice of the page > > protection bit. I really need help from the i915 maintainers here.. > > AFAIK there are two users of remap_io_sg, the first is our shmem > objects(see i915_gem_shmem.c), and for these we support UC, WC, and WB > mmap modes for userspace. The other user is device local-memory > objects(VRAM), and for this one we have an actual io_mapping which is > allocated as WC, and IIRC this should only be mapped as WC for the > mmap mode, but normal userspace can't hit this path yet. The only caller in current mainline is vm_fault_cpu in i915_gem_mman.c. Is that device local? > What do we need to do here? It sounds like shmem backed objects are > allocated as WB for the pages underneath, but i915 allows mapping them > as UC/WC which trips up this track_pfn thing? To me the warnings looks like system memory is mapped with the wrong permissions, yes. If you want to map it as UC/WC the right set_memory_* needs to be used on the kernel mapping as well to ensure that the attributes don't conflict.