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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 76608C3F68F for ; Wed, 4 Dec 2019 15:36:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28AE8206DF for ; Wed, 4 Dec 2019 15:36:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=shipmail.org header.i=@shipmail.org header.b="a3Sxiu0a" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28AE8206DF 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 BA5546B0B45; Wed, 4 Dec 2019 10:36:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B56316B0B46; Wed, 4 Dec 2019 10:36:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6BC36B0B47; Wed, 4 Dec 2019 10:36:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 8D6B26B0B45 for ; Wed, 4 Dec 2019 10:36:46 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 56AD92C93 for ; Wed, 4 Dec 2019 15:36:46 +0000 (UTC) X-FDA: 76227861612.05.offer79_75265a2092b4c X-HE-Tag: offer79_75265a2092b4c X-Filterd-Recvd-Size: 5960 Received: from pio-pvt-msa2.bahnhof.se (pio-pvt-msa2.bahnhof.se [79.136.2.41]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Dec 2019 15:36:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 31F713F390; Wed, 4 Dec 2019 16:36:43 +0100 (CET) Authentication-Results: pio-pvt-msa2.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=a3Sxiu0a; dkim-atps=neutral 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 JTceQxKzietN; Wed, 4 Dec 2019 16:36:42 +0100 (CET) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 0740A3F413; Wed, 4 Dec 2019 16:36:36 +0100 (CET) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id 11D4D360608; Wed, 4 Dec 2019 16:36:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1575473796; bh=+P2lL4Bk8IOmIyYiEAJEi2EHSZtLBY0TVxFIVaQgcJw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=a3Sxiu0aBnFV7FZPZMCsRIPHG0lgkyWS4ulmn+2AkMNL2HcwAlL+eOHXKZKWy4AYc sHYuIN8rny3O1VEDgLtSXHJBMKEBr+DeLhRYl6yjuij2krolQhyGaEn4QJbQK1P56/ 7blMjZ0b3gt5051zqvAUhaJajkzQP/WLvvJ0XMbc= Subject: Re: [PATCH 6/8] drm: Add a drm_get_unmapped_area() helper To: =?UTF-8?Q?Christian_K=c3=b6nig?= , linux-mm@kvack.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com, Thomas Hellstrom , Andrew Morton , Michal Hocko , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Ralph Campbell , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= References: <20191203132239.5910-1-thomas_os@shipmail.org> <20191203132239.5910-7-thomas_os@shipmail.org> <98af5b11-1034-91fa-aa38-5730f116d1cd@shipmail.org> <3cc5b796-20c6-9f4c-3f62-d844f34d81b7@amd.com> <90a8d09a-b3ab-cd00-0cfb-1a4c72e91836@shipmail.org> <016a9187-1703-2d7d-0114-7fc0cbf1d121@amd.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= Organization: VMware Inc. Message-ID: <14f319fd-e2ca-8f13-7bb8-4452f58c6c7e@shipmail.org> Date: Wed, 4 Dec 2019 16:36:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <016a9187-1703-2d7d-0114-7fc0cbf1d121@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US 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 12/4/19 3:40 PM, Christian K=C3=B6nig wrote: > Am 04.12.19 um 13:32 schrieb Thomas Hellstr=C3=B6m (VMware): >> On 12/4/19 1:08 PM, Christian K=C3=B6nig wrote: >>> Am 04.12.19 um 12:36 schrieb Thomas Hellstr=C3=B6m (VMware): >>>> On 12/4/19 12:11 PM, Christian K=C3=B6nig wrote: >>>>> Am 03.12.19 um 14:22 schrieb Thomas Hellstr=C3=B6m (VMware): >>>>>> From: Thomas Hellstrom >>>>>> >>>>>> This helper is used to align user-space buffer object addresses to >>>>>> huge page boundaries, minimizing the chance of alignment mismatch >>>>>> between user-space addresses and physical addresses. >>>>> >>>>> Mhm, I'm wondering if that is really such a good idea. >>>> >>>> Could you elaborate? What drawbacks do you see? >>> >>> Main problem for me seems to be that I don't fully understand what=20 >>> the get_unmapped_area callback is doing. >> >> It makes sure that, if there is a chance that we could use huge=20 >> page-table entries, virtual address huge page boundaries are=20 >> perfectly aligned to physical address huge page boundaries, which is=20 >> if not a CPU hardware requirement, at least a kernel requirement=20 >> currently. >> >> >>> >>> For example why do we need to use drm_vma_offset_lookup_locked() to=20 >>> adjust the pgoff? >>> >>> The mapped offset should be completely irrelevant for finding some=20 >>> piece of userspace address space or am I totally off here? >> >> >> Because the unmodified pgoff assumes that physical address boundaries=20 >> are perfectly aligned with file offset boundaries, which is typical=20 >> for all other subsystems. >> >> That's not true for TTM, however, where a buffer object start=20 >> physical address may be huge page aligned, but the file offset is=20 >> always page aligned. We could of course change that to align also=20 >> file offsets to huge page size boundaries, but with the above=20 >> adjustment, that's not needed. I opted for the adjustment. > > I would opt for aligning the file offsets instead. Yes but that adds additional complexity and considerations which made me=20 think that lookup was the by far simplest choice: - We need to modify the vma manager to care about alignments. - Fragmentation issues. Do we want to align > 1G BOs - For which drivers do we want to do this, how do we handle drivers that=20 want to opt out in TTM mmap()? - Non TTM drivers. Could they still reuse the same get_unmapped_area. > > Now that you explained it that the rest of the kernel enforces this=20 > actually makes sense. So is that an ack? Thanks, Thomas > > Regards, > Christian. > >> >> Thanks, >> >> Thomas >> >>