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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 88058C433C1 for ; Wed, 24 Mar 2021 10:19:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9B9861A04 for ; Wed, 24 Mar 2021 10:19:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9B9861A04 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 533AE6B02AC; Wed, 24 Mar 2021 06:19:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50C4C6B02AD; Wed, 24 Mar 2021 06:19:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AC0E6B02AE; Wed, 24 Mar 2021 06:19:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 1FC886B02AC for ; Wed, 24 Mar 2021 06:19:22 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D42246D8E for ; Wed, 24 Mar 2021 10:19:21 +0000 (UTC) X-FDA: 77954370522.29.F7F21A2 Received: from pio-pvt-msa1.bahnhof.se (pio-pvt-msa1.bahnhof.se [79.136.2.40]) by imf15.hostedemail.com (Postfix) with ESMTP id AC880A0009C5 for ; Wed, 24 Mar 2021 10:19:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 35AF340786; Wed, 24 Mar 2021 11:19:19 +0100 (CET) Authentication-Results: pio-pvt-msa1.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b="p/ga4rbK"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nkyg8rexJ_mO; Wed, 24 Mar 2021 11:19:17 +0100 (CET) Received: by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id DD0D03F59B; Wed, 24 Mar 2021 11:19:15 +0100 (CET) Received: from [192.168.0.209] (unknown [192.198.151.43]) by mail1.shipmail.org (Postfix) with ESMTPSA id 954323605CC; Wed, 24 Mar 2021 11:19:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1616581155; bh=ReL4kU6p0A3xJmm5e9+5DjGbG6+nH8ClqOXvHRKPGkg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=p/ga4rbKAZToQyMybhElmaK3KaJG2OfJ8rJTiUUZ60fnYIQVNXq+hUGO9ItWCrRn/ kkjfPaPXKWL43jWPF028fu94NPagzTH2vO4+6TmU5FGGRqyShfeSdSQUVUg4EoC4Ly 9eKH7HTw77F9aha3mOYK6x/u4msl+c8Na6jhF2pM= Subject: Re: [PATCH] drm/ttm: stop warning on TT shrinker failure To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Michal Hocko Cc: Matthew Wilcox , amd-gfx list , Linux MM , dri-devel , Dave Chinner , Leo Liu References: <75ff80c5-a054-d13d-85c1-0040addb45d2@gmail.com> <20808d08-b66c-13c3-f672-ebce216b2fa2@gmail.com> <03889c00-bb5d-ef20-12c6-7e77df073dd9@amd.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= Message-ID: <762c4597-e9bd-6d8d-51b5-16b04f913eb8@shipmail.org> Date: Wed, 24 Mar 2021 11:19:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <03889c00-bb5d-ef20-12c6-7e77df073dd9@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AC880A0009C5 X-Stat-Signature: nxiz1jq6irfetw1exhx5mhq99e9eydtg Received-SPF: none (shipmail.org>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=pio-pvt-msa1.bahnhof.se; client-ip=79.136.2.40 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616581159-240316 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 3/23/21 4:45 PM, Christian K=C3=B6nig wrote: > Am 23.03.21 um 16:13 schrieb Michal Hocko: >> On Tue 23-03-21 14:56:54, Christian K=C3=B6nig wrote: >>> Am 23.03.21 um 14:41 schrieb Michal Hocko: >> [...] >>>> Anyway, I am wondering whether the overall approach is sound. Why=20 >>>> don't >>>> you simply use shmem as your backing storage from the beginning and=20 >>>> pin >>>> those pages if they are used by the device? >>> Yeah, that is exactly what the Intel guys are doing for their=20 >>> integrated >>> GPUs :) >>> >>> Problem is for TTM I need to be able to handle dGPUs and those have a= ll >>> kinds of funny allocation restrictions. In other words I need to=20 >>> guarantee >>> that the allocated memory is coherent accessible to the GPU without=20 >>> using >>> SWIOTLB. >>> >>> The simple case is that the device can only do DMA32, but you also go= t >>> device which can only do 40bits or 48bits. >>> >>> On top of that you also got AGP, CMA and stuff like CPU cache behavio= r >>> changes (write back vs. write through, vs. uncached). >> OK, so the underlying problem seems to be that gfp mask (thus >> mapping_gfp_mask) cannot really reflect your requirements, right?=C2=A0= Would >> it help if shmem would allow to provide an allocation callback to >> override alloc_page_vma which is used currently? I am pretty sure ther= e >> will be more to handle but going through shmem for the whole life time >> is just so much easier to reason about than some tricks to abuse shmem >> just for the swapout path. > > Well it's a start, but the pages can have special CPU cache settings.=20 > So direct IO from/to them usually doesn't work as expected. > > Additional to that for AGP and CMA I need to make sure that I give=20 > those pages back to the relevant subsystems instead of just dropping=20 > the page reference. > > So I would need to block for the swapio to be completed. > > Anyway I probably need to revert those patches for now since this=20 > isn't working as we hoped it would. > > Thanks for the explanation how stuff works here. Another alternative here that I've tried before without being successful=20 would perhaps be to drop shmem completely and, if it's a normal page (no=20 dma or funny caching attributes) just use add_to_swap_cache()? If it's=20 something else, try alloc a page with relevant gfp attributes, copy and=20 add_to_swap_cache()? Or perhaps that doesn't work well from a shrinker=20 either? /Thomas > > Christian. > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel