Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp674012pxf; Thu, 25 Mar 2021 11:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgKFce3Ml5KioN5RYOqyb2iZRPaK4EKCWcCoyjdzKjpKsbV360oRaAYxHMw4ptQlmIArkc X-Received: by 2002:a17:906:6c93:: with SMTP id s19mr10845121ejr.151.1616696175936; Thu, 25 Mar 2021 11:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616696175; cv=none; d=google.com; s=arc-20160816; b=BKz2ZTOYc4bWplMq6zR4/6aum+BfH2tC8b4is1pkIRwbEMP+cZF7/5GZ6cOFZr+mMr Lstybt8NUeFKNEVZw0aVwAM7K7IVIUAb4vSOxPSBVwgQVzc+7vjJTHIVHim5Wk91+CxA yeEHnI86zYXCHHv2hmxmuJUY/sZYMRIeX5NmbKeZc4UBWL9Pmj8rX58JtOfseDUx89tZ qoIYfrs/92kqW6/IUE2JoHis6DH2ncTDGVv79nNU0ahSqN0X9ZRtIIbhMXjE7lbxICFA jR86tDjT2TPDd+OhUCPzigj7YIkxZ5iQ3JPFN+6dPCKtXjpw1OjeSmKBmaGmy1Ypzlgu PLsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=imfPW9PtagYQYIGhet/hmOMiagD3XclCPshhqktEibo=; b=UOZSgx/o8OCaCG8aUs/1Bc/wxYEuoyGaL+kWLZWDVbVhCK0UBPdAkl8ilfMd6OBR8H fK3tT8QF9eauEAbMEUcSr6awaFkcgy6HY0nxvlym6l1ZWbeNBeGjCeRzEONqI4nIZ7+j rdWJDegyfwwP1Q38ybtysXw4imVlGbCfx9PuX1pLsvgTyEZMNol6RSmYDzWMj3dOUr64 Fju3DC1nXHrj9HjbhUmbSa0KAwNu9u9SAsV0AL8v160rTGaLo1jS6/z56OnETf98gEjF OMHvF/nuylvbS5MmDH5hruK+6C5kA2ez5Im6rsQLPXVranNfI4BQo9GmKRWOn+cCfpMI PXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=bOXPgDuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc3si5012334edb.57.2021.03.25.11.15.51; Thu, 25 Mar 2021 11:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=bOXPgDuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbhCYSOP (ORCPT + 99 others); Thu, 25 Mar 2021 14:14:15 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:56178 "EHLO pio-pvt-msa1.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhCYSNk (ORCPT ); Thu, 25 Mar 2021 14:13:40 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 1B9DE3F58A; Thu, 25 Mar 2021 19:13:39 +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="bOXPgDuL"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.1 X-Spam-Level: X-Spam-Status: No, score=-2.1 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no 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 36X5fsGQR3cs; Thu, 25 Mar 2021 19:13:38 +0100 (CET) Received: by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id D7A783F377; Thu, 25 Mar 2021 19:13:36 +0100 (CET) Received: from [10.249.254.165] (unknown [192.198.151.44]) by mail1.shipmail.org (Postfix) with ESMTPSA id 880B636059E; Thu, 25 Mar 2021 19:13:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1616696016; bh=ccthR8+3Hk5Ox8PeQv8Va4F118+/tBSCEPzJg3VAxZs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bOXPgDuLyt0NMxRDWcFUkrudDGfPZJamxR9X+vliH4e3m8vKYTc82qLVR8olQEqM8 hcUxNVANfDq+5Nctk1NCiDllhxuzOm4XGIHFqcLQXqRHDFnlY2Vx6P+zBjxrbpuxD8 EqoNkJCXBXHo0CgJvGJiCHN4wBh83heMYUFA76xg= Subject: Re: [RFC PATCH 1/2] mm,drm/ttm: Block fast GUP to TTM huge pages To: Jason Gunthorpe Cc: Dave Hansen , "Williams, Dan J" , "dri-devel@lists.freedesktop.org" , "christian.koenig@amd.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> <75423f64-adef-a2c4-8e7d-2cb814127b18@intel.com> <6b0de827-738d-b3c5-fc79-8ca9047bad35@intel.com> <9f789d64-940f-c728-8d5e-aab74d562fb6@shipmail.org> <20210325175504.GH2356281@nvidia.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= Message-ID: <1ed48d99-1cd9-d87b-41dd-4169afc77f70@shipmail.org> Date: Thu, 25 Mar 2021 19:13:33 +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: <20210325175504.GH2356281@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/25/21 6:55 PM, Jason Gunthorpe wrote: > On Thu, Mar 25, 2021 at 06:51:26PM +0100, Thomas Hellström (Intel) wrote: >> On 3/24/21 9:25 PM, Dave Hansen wrote: >>> On 3/24/21 1:22 PM, Thomas Hellström (Intel) wrote: >>>>> We also have not been careful at *all* about how _PAGE_BIT_SOFTW* are >>>>> used.  It's quite possible we can encode another use even in the >>>>> existing bits. >>>>> >>>>> Personally, I'd just try: >>>>> >>>>> #define _PAGE_BIT_SOFTW5        57      /* available for programmer */ >>>>> >>>> OK, I'll follow your advise here. FWIW I grepped for SW1 and it seems >>>> used in a selftest, but only for PTEs AFAICT. >>>> >>>> Oh, and we don't care about 32-bit much anymore? >>> On x86, we have 64-bit PTEs when running 32-bit kernels if PAE is >>> enabled. IOW, we can handle the majority of 32-bit CPUs out there. >>> >>> But, yeah, we don't care about 32-bit. :) >> Hmm, >> >> Actually it makes some sense to use SW1, to make it end up in the same dword >> as the PSE bit, as from what I can tell, reading of a 64-bit pmd_t on 32-bit >> PAE is not atomic, so in theory a huge pmd could be modified while reading >> the pmd_t making the dwords inconsistent.... How does that work with fast >> gup anyway? > It loops to get an atomic 64 bit value if the arch can't provide an > atomic 64 bit load Hmm, ok, I see a READ_ONCE() in gup_pmd_range(), and then the resulting pmd is dereferenced either in try_grab_compound_head() or __gup_device_huge(), before the pmd is compared to the value the pointer is currently pointing to. Couldn't those dereferences be on invalid pointers? /Thomas > > Jason