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=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 B00A9C433B4 for ; Wed, 19 May 2021 05:47:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1E30661355 for ; Wed, 19 May 2021 05:47:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E30661355 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shipmail.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 98EE76B0075; Wed, 19 May 2021 01:47:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93E326B0088; Wed, 19 May 2021 01:47:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 805A36B0092; Wed, 19 May 2021 01:47:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 4A8C66B0075 for ; Wed, 19 May 2021 01:47:04 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D02348249980 for ; Wed, 19 May 2021 05:47:03 +0000 (UTC) X-FDA: 78156897126.29.DFB506B Received: from pio-pvt-msa2.bahnhof.se (pio-pvt-msa2.bahnhof.se [79.136.2.41]) by imf17.hostedemail.com (Postfix) with ESMTP id DE49B40B8CD6 for ; Wed, 19 May 2021 05:47:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 04A0C402F8; Wed, 19 May 2021 07:47:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se Received: from pio-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vUKUAGRnIPfh; Wed, 19 May 2021 07:46:59 +0200 (CEST) Received: by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 242BC3FB52; Wed, 19 May 2021 07:46:57 +0200 (CEST) Received: from [192.168.0.209] (unknown [192.198.151.44]) by mail1.shipmail.org (Postfix) with ESMTPSA id 8DB823600DD; Wed, 19 May 2021 07:46:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1621403217; bh=7l1J6Wvb7+vMf7L74qCJftf0cfmKUAtZMaBLYoplip0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=BDZtBpnM3TsCJwgPrhr+IXnH3Gg1oGUYXaYAROx4BZrJEssWvLsDmn4buVxjQI2F3 iGds2WLa0cl6tFfESvxobJk/cA5RBSK1YAAp6MjqEIcOH6u09qU05gFFMXMWuYV6Vr rRjHHgl+nrnRzvmkb6ZdNkw+43vIxXRfCXXntc8Y= Subject: Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot To: Matthew Auld , Christoph Hellwig Cc: Serge Belyshev , Peter Zijlstra , Daniel Vetter , Intel Graphics Development , ML dri-devel , Chris Wilson , linux-mm@kvack.org, Andrew Morton 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> <20210518132155.GB2617@lst.de> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= Message-ID: <3d984dd9-9396-d992-5b88-94bcfde0a98d@shipmail.org> Date: Wed, 19 May 2021 07:46:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: DE49B40B8CD6 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=shipmail.org header.s=mail header.b=BDZtBpnM; spf=pass (imf17.hostedemail.com: domain of thomas_os@shipmail.org designates 79.136.2.41 as permitted sender) smtp.mailfrom=thomas_os@shipmail.org; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: wkokm875qtubehiaowda83d9quuuxbss X-HE-Tag: 1621403222-188957 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 5/18/21 5:00 PM, Matthew Auld wrote: > On Tue, 18 May 2021 at 14:21, Christoph Hellwig wrote: >> 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? > The vm_fault_cpu covers both device local and shmem objects. > >>> 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. > AFAIK mmap_offset also supports multiple active mmap modes for a given > object, so set_memory_* should still work here? No, that won't work because there are active maps with conflicting caching attributes. I think the history here is that that was assumed to be OK for integrated graphics that ran only on Intel processors that promise to never write back unmodified cache lines resulting from prefetching, like some AMD processors did way back at least. These conflicting mappings can obviously not be supported for discrete graphics, but for integrated they are part of the uAPI. /Thomas > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx