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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 BB255C433C1 for ; Wed, 24 Mar 2021 09:58:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F436619B4 for ; Wed, 24 Mar 2021 09:58:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F436619B4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2A596B01F0; Wed, 24 Mar 2021 05:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD9D16B027E; Wed, 24 Mar 2021 05:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A53E46B02A7; Wed, 24 Mar 2021 05:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 86EE06B01F0 for ; Wed, 24 Mar 2021 05:58:32 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4FEA218016C8A for ; Wed, 24 Mar 2021 09:58:32 +0000 (UTC) X-FDA: 77954318064.22.4D62890 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf01.hostedemail.com (Postfix) with ESMTP id 5C1885001526 for ; Wed, 24 Mar 2021 09:58:31 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id k128so10135137wmk.4 for ; Wed, 24 Mar 2021 02:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=21lx1XKTgIyEE/5VMZ8Qm6fLn097QzloxjnfqNNT1ZQ=; b=IskXKKJt0n34jbY6p0Qq2XnJ3B2KYreze8cG9V12QxYKHqjR1+sMwqd1XwbzUSp4ZD 5OVtuN4oN/u0fC1Lzk6+7syNkfwboqjlLvBQAheeMJtKkJPWfMZAEvyoB+onjTtNIM4x uiDRR9tSDGxpp2cidX9yS5na7MD8H8tVxQurQ= 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 :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=21lx1XKTgIyEE/5VMZ8Qm6fLn097QzloxjnfqNNT1ZQ=; b=VIpu+QpWq+8/zBD3QlE15hSFJzXEvKYhI6tU3Mk16c2xvLDdoe7yIEfMitMwdbAKnZ fsLvcOpPU7KE//5Ap5ITBjV31JhdL1Ub7FUKm0AmeqmKO0Ez4K5O1uFMxwCROTqyb7LC 7FKBeRM7cD083X5+70blN7Lscnwg+x8EFNWkBIMd8puMxsyh2Gempg/6/GpK7c5qjgsn iUuP9jSXvgvzyAwrYJ7ykVDWjI5LCv+KRd4Lv6UFxSshfHbGJF4VGNTVmqXI6IUY5K5g 4ecinaWjPfEHFyjy1UPtldJmR1LG8RzEIX3WVkFSZuZ4dehvptlvL1VncK1MU4mxh0UD +HOQ== X-Gm-Message-State: AOAM532QN8bW3/TXQQftL7D8iini0aEws4qlxcNNkObg6gc5M5qCIvys /FrcPHXLON1WElUheyyVZktPjQ== X-Google-Smtp-Source: ABdhPJwZIBgLGHXn/QNIGKntkctRuF7sTo3S5PNdweokZQ6ttJuFqd/ULSxIfXm5SgSCIgWZXGgd0Q== X-Received: by 2002:a7b:cb89:: with SMTP id m9mr2084820wmi.27.1616579910680; Wed, 24 Mar 2021 02:58:30 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id 9sm1719104wmf.13.2021.03.24.02.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 02:58:30 -0700 (PDT) Date: Wed, 24 Mar 2021 10:58:28 +0100 From: Daniel Vetter To: Thomas =?iso-8859-1?Q?Hellstr=F6m_=28Intel=29?= Cc: "Williams, Dan J" , "dri-devel@lists.freedesktop.org" , "daniel@ffwll.ch" , "christian.koenig@amd.com" , "jgg@nvidia.com" , "airlied@linux.ie" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" Subject: Re: [RFC PATCH 1/2] mm,drm/ttm: Block fast GUP to TTM huge pages Message-ID: Mail-Followup-To: Thomas =?iso-8859-1?Q?Hellstr=F6m_=28Intel=29?= , "Williams, Dan J" , "dri-devel@lists.freedesktop.org" , "christian.koenig@amd.com" , "jgg@nvidia.com" , "airlied@linux.ie" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" References: <20210321184529.59006-1-thomas_os@shipmail.org> <20210321184529.59006-2-thomas_os@shipmail.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 X-Stat-Signature: mf3psmu39k94qamedswaxjbbenqtdqcb X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5C1885001526 Received-SPF: none (ffwll.ch>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-wm1-f54.google.com; client-ip=209.85.128.54 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616579911-552248 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 Tue, Mar 23, 2021 at 09:42:18PM +0100, Thomas Hellstr=F6m (Intel) wrot= e: >=20 > On 3/23/21 8:52 PM, Williams, Dan J wrote: > > On Sun, 2021-03-21 at 19:45 +0100, Thomas Hellstr=F6m (Intel) wrote: > > > TTM sets up huge page-table-entries both to system- and device > > > memory, > > > and we don't want gup to assume there are always valid backing stru= ct > > > pages for these. For PTEs this is handled by setting the pte_specia= l > > > bit, > > > but for the huge PUDs and PMDs, we have neither pmd_special nor > > > pud_special. Normally, huge TTM entries are identified by looking a= t > > > vma_is_special_huge(), but fast gup can't do that, so as an > > > alternative > > > define _devmap entries for which there are no backing dev_pagemap a= s > > > special, update documentation and make huge TTM entries _devmap, > > > after > > > verifying that there is no backing dev_pagemap. > > Please do not abuse p{m,u}d_devmap like this. I'm in the process of > > removing get_devpagemap() from the gup-fast path [1]. Instead there > > should be space for p{m,u}d_special in the page table entries (at lea= st > > for x86-64). So the fix is to remove that old assumption that huge > > pages can never be special. > >=20 > > [1]: > > http://lore.kernel.org/r/161604050866.1463742.7759521510383551055.stg= it@dwillia2-desk3.amr.corp.intel.com > >=20 > Hmm, yes with that patch it will obviously not work as intended. >=20 > Given that, I think we'll need to disable the TTM huge pages for now un= til > we can sort out and agree on using a page table entry bit. Yeah :-/ I think going full pud/pmd_mkspecial should then also mesh well with Jason's request to wrap it all up into a vmf_insert_* helper, so at least it would all look rather pretty in the end. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch