Received: by 10.192.165.148 with SMTP id m20csp4083137imm; Mon, 30 Apr 2018 11:23:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqzB3hPVWRiVO2DpgID9+rVFvCtWSGBMrqjeWO6jVcBo99SDUMUF0GKglbRKgxo3hNQNbZM X-Received: by 2002:a17:902:ab93:: with SMTP id f19-v6mr12415401plr.392.1525112584810; Mon, 30 Apr 2018 11:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525112584; cv=none; d=google.com; s=arc-20160816; b=khc14wYqcr+QWsVD+YzO8/EV00WdqIxlKoyO7QYDUh0fNx0mAYjw+i49RjWwtZivtB AWCgtTopQgNtkWKC0tSXw+rz4mE1cbnCF+4/HhUT4+MpVIyU3mvekVXOxq9lFYQYWcQG 6475Sw0m9/ib8nnanVaNWozNsZc9J9v+B2JW0a3h9MQopKGBlXFyWlKFHVXIR3pvWJ+m eKxMRO4nyTv/Tk99FsfCrasFD13Yi2Cvv+pPEXPm7pywLLPQCjnFXZNVq9kc+6X5KOSa k+EOlYf4+okDQwRZrKV68DZ/iZNpp11fD3svdfic4djzxp77jrh7y4666GvZ6joTOCKf CsZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=EUXJ1LE0BF1y9JI9qaiyyXDlJbu9aCH9xwGinV/aLBU=; b=iLMlHipYCted6NtS1ZCyWqZw8Xim4VpZepNLtTBCHTmRNFf5hZpz4bJhObPzdJI/Jy 12Pt5KWEAL/AING3YslT+12pMNlxquQjg/YVnKi/cFzzqDAiXSopaskI22Q2I4ol85Eu 79DgQDj3kUxRDivMXKvt1kntyRiqZA4kadal/NREMwYRb8TaZUDHQt3Yd1/qSQpTTxuW ACT7tUcuMlXxTU1nvRDOePB8Qj67FKjfXRof6gA/05FSOopJWRt/0pWsntJgE6DuhYFG cl5gyUJw0yB4k52rx2yzX8XcONMmhc2MbKQlmFiCf0VuqBvV3yNj+pk8UM7S213kLe+0 wV+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aC8c4WA9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1-v6si7890885plb.430.2018.04.30.11.22.50; Mon, 30 Apr 2018 11:23:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aC8c4WA9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754571AbeD3SWj (ORCPT + 99 others); Mon, 30 Apr 2018 14:22:39 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36532 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbeD3SWd (ORCPT ); Mon, 30 Apr 2018 14:22:33 -0400 Received: by mail-wr0-f193.google.com with SMTP id u18-v6so8895486wrg.3 for ; Mon, 30 Apr 2018 11:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=EUXJ1LE0BF1y9JI9qaiyyXDlJbu9aCH9xwGinV/aLBU=; b=aC8c4WA9chN2UqDT3G2Wdb+dN7rUKA5Wihr5EOf9BYLU//+IL4Z6FZRWHKqYTVY3YQ 547FyNeQhpfUkw/d2ExfwQlAMx16aynT4PqPyWyMDJTgfApLtG8N4ymgfNmHF2o3tnvF CocI8bHzOBpPRt2sxygUw6nEx65ucrkBjI3MsBJINptf28CrHqheCBW4PFZnYI5CjyT8 2WFvp+DjZux8UcrBM/9+a4SEURN72VJfsZgsjRw5EcWcoqWAepMdDym/dXh1iZToUHgO sJ4pLiVvT56/2+5bvuNKONjpPWaXrE0JOrEot+4e3wsV3zT271Q3b8W1uRD7EiAF6fqt dwOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=EUXJ1LE0BF1y9JI9qaiyyXDlJbu9aCH9xwGinV/aLBU=; b=QR88EiJo/EyMaPeIUsEEdmQPrvweay0y9AdfIESpuASbXVUTT6qYTk6z/F3RtNqnCJ lQ/trlQS9x1pWBwiNA1rldrKRq24Pdt1UF1zVQ9d50WH4/In4tEuc9JDeotBLY2HjeGw PpiIa9qDiNWZ7zich4jVOlzJ3KtcfbzpH/y+lkBkl8Ldc6/zJm0Q68+3THDYq1VVirMn +OJ/3qVNcs8LXYE1q1qt8929ojZtaZfguvo1ybpgLdQinZiCuE1dcBEfHRZf3wlI9+ld zKK5rBW3SI3tjZq4qJaiDydiYgebDYOlSYKdJb0YCAr0j07tYImdNvuwnhE5jeuT4Kj5 CsNA== X-Gm-Message-State: ALQs6tBpxbA3jdSrrIm8BWH0SdgIiDBKtIzxKZIaL227yKlEGntT0P3y Iju1x6G0J1c/9FSTksc2c7UwadWI X-Received: by 2002:adf:87e1:: with SMTP id c30-v6mr9119155wrc.246.1525112551468; Mon, 30 Apr 2018 11:22:31 -0700 (PDT) Received: from ?IPv6:2a02:908:1257:4460:1ab8:55c1:a639:6740? ([2a02:908:1257:4460:1ab8:55c1:a639:6740]) by smtp.gmail.com with ESMTPSA id b18-v6sm14476884wrb.55.2018.04.30.11.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 11:22:30 -0700 (PDT) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH v2 1/2] drm/ttm: Only allocate huge pages with new flag TTM_PAGE_FLAG_TRANSHUGE To: =?UTF-8?Q?Michel_D=c3=a4nzer?= , =?UTF-8?Q?Christian_K=c3=b6nig?= , Ilia Mirkin Cc: dri-devel , amd-gfx mailing list , LKML References: <20180426150618.13470-1-michel@daenzer.net> <20180427130811.7642-1-michel@daenzer.net> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <361a765a-f491-4450-867e-fa88857827ee@gmail.com> Date: Mon, 30 Apr 2018 20:22:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 30.04.2018 um 18:33 schrieb Michel Dänzer: > On 2018-04-29 09:02 AM, Christian König wrote: >> Am 29.04.2018 um 01:02 schrieb Michel Dänzer: >>> On 2018-04-28 06:30 PM, Ilia Mirkin wrote: >>>> On Fri, Apr 27, 2018 at 9:08 AM, Michel Dänzer >>>> wrote: >>>>> From: Michel Dänzer >>>>> >>>>> Previously, TTM would always (with CONFIG_TRANSPARENT_HUGEPAGE enabled) >>>>> try to allocate huge pages. However, not all drivers can take advantage >>>>> of huge pages, but they would incur the overhead for allocating and >>>>> freeing them anyway. >>>>> >>>>> Now, drivers which can take advantage of huge pages need to set the new >>>>> flag TTM_PAGE_FLAG_TRANSHUGE to get them. Drivers not setting this flag >>>>> no longer incur any overhead for allocating or freeing huge pages. >>>>> >>>>> v2: >>>>> * Also guard swapping of consecutive pages in ttm_get_pages >>>>> * Reword commit log, hopefully clearer now >>>>> >>>>> Cc: stable@vger.kernel.org >>>>> Signed-off-by: Michel Dänzer >>>> Both I and lots of other people, based on reports, are still seeing >>>> plenty of issues with this as late as 4.16.4. >>> "lots of other people", "plenty of issues" sounds a bit exaggerated from >>> what I've seen. FWIW, while I did see the original messages myself, I >>> haven't seen any since Christian's original fix (see below), neither >>> with amdgpu nor radeon, even before this patch you followed up to. >>> >>> >>>> Admittedly I'm on nouveau, but others have reported issues with >>>> radeon/amdgpu as well. It's been going on since the feature was merged >>>> in v4.15, with what seems like little investigation from the authors >>>> introducing the feature. >>> That's not a fair assessment. See >>> https://bugs.freedesktop.org/show_bug.cgi?id=104082#c40 and following >>> comments. >>> >>> Christian fixed the original issue in >>> d0bc0c2a31c95002d37c3cc511ffdcab851b3256 "swiotlb: suppress warning when >>> __GFP_NOWARN is set". Christian did his best to try and get the fix in >>> before 4.15 final, but for reasons beyond his control, it was delayed >>> until 4.16-rc1 and then backported to 4.15.5. >>> >>> Unfortunately, there was an swiotlb regression (not directly related to >>> Christian's work) shortly after this fix, also in 4.16-rc1, which is now >>> fixed in 4.17-rc1 and will be backported to 4.16.y. >> And that's exactly the reason why I intentionally kept this enabled for >> all users of the TTM DMA page pool and not put it behind a flag. >> >> This change has surfaced quite a number of bugs in the swiotlb code >> which could have caused issues before. It's just that those code path >> where never exercised massively before. >> >> Additional to that using huge pages is beneficial for the MM and CPU TLB >> (not implemented yet) even when the GPU driver can't make much use of it. > Do I understand correctly that you're against this patch? Not completely, I've considered adding that multiple times myself. I'm just torn apart between keeping it enabled so that the underlying bugs gets fixed and disabling it for a better end user experience. But in general I would opt out for a pool configuration option, not a per driver flag. > AFAIU the only benefit of huge pages with a driver which doesn't take > advantage of them directly is "for the MM". Can you describe a bit more > what that benefit is exactly? When transparent huge pages are in effect we should have more huge pages than small pages in the system allocator. So by enforcing allocation of small pages we fragment the huge pages once more and give khugepaged quite a bunch of work todo to gather them together into huge pages again. > Is it expected to outweigh the cost of allocating / freeing huge pages? Yes, and actually quite well (at least in theory). >>> It looks like there's at least one more bug left, but it's not clear yet >>> when that was introduced, whether it's directly related to Christian's >>> work, or indeed what the impact is. Let's not get ahead of ourselves. >> Well my patches surfaced the problems, but the underlying issues where >> present even before those changes and I'm very well involved in fixing >> the underlying issues. >> >> I even considered to just revert the huge page path for the DMA pool >> allocator, but it's just that the TTM patches seem to work exactly as >> they are intended. So that doesn't feel like doing the right thing here. > I agree. Has anyone reported this to the DMA/SWIOTLB developers? Yes, I fixed the original false positive messages myself with the swiotlb maintainer and I was CCed in fixing the recent fallout from Chris changes as well. Regards, Christian.