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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 7AD8AC5519F for ; Fri, 20 Nov 2020 15:02:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0B0D22252 for ; Fri, 20 Nov 2020 15:02:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Za9K5ZBR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0B0D22252 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 C97516B005C; Fri, 20 Nov 2020 10:02:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C1F006B005D; Fri, 20 Nov 2020 10:02:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9A236B006E; Fri, 20 Nov 2020 10:02:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 669FF6B005C for ; Fri, 20 Nov 2020 10:02:03 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F1EA91EF2 for ; Fri, 20 Nov 2020 15:02:02 +0000 (UTC) X-FDA: 77505111684.09.voice34_4f0a9f12734c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 8C817180AD83A for ; Fri, 20 Nov 2020 15:02:02 +0000 (UTC) X-HE-Tag: voice34_4f0a9f12734c X-Filterd-Recvd-Size: 7989 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Nov 2020 15:02:01 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id 23so10316996wrc.8 for ; Fri, 20 Nov 2020 07:02:01 -0800 (PST) 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=jqz5UUOEhQicM8GI1n91U9BhGV2BVxiLUJ6mo3aw7K4=; b=Za9K5ZBRRUOSU+0PZlbgfXPoH9UJHcGZJXwkFjGFMJH1oiLnbIPrrDVhiJxSyC16Ax IOXjrzfxBVKv4jkQm7Ufl+ViL6OnMvjv9Clx+XkaaiRWogoWhDQY+pCfWbOerFbIqzUT RIt3OBcx+tHFlmzAIMMtC8HZwqxhBlw4cwXnc= 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=jqz5UUOEhQicM8GI1n91U9BhGV2BVxiLUJ6mo3aw7K4=; b=Hs3QzJI0WQ2b3aJYXcVdoxTiwgURDptfymzBb5b/B3NYVSUd+2P6ARSuDQqFWz0JwP wOIxxbG8C81phq62rtqyyatGK+F9Sz/BdeNN9gsG5Q3uz5NmbUeHDaRTqVb18Q2RzW3r nEZ2qbzlxD7GlJTeEE4w6rLarWp29krgMB6/fUcJA0bz+lutPmvM9YBVyFXfWofSL5fY XA3y9V9didrjBmKOE0vLjw4FTUxZqqySYq6lvTs3kBJg15MvqfIl8I7/r5UtgtSjiryl vN4+Mh3jgjUM1ejSP460F09D4S1yExqbxLSTEiyQuBD3Bvh8sZKsVH763HXCb684Ss9Q IARQ== X-Gm-Message-State: AOAM531kIOXO6nEXy5YDbna+TCYp8EjLzlflh8nVxnYrLEPw6War9vtu ZZ8eoIXln3zL0vKESWTgKryb3g== X-Google-Smtp-Source: ABdhPJwCO3CSQICPk9Pv96NQEDcEp0urkvsbCS2ctV63pmGILJUA9/JLkDue0FlOM93UAlTT4tyiyg== X-Received: by 2002:a05:6000:14a:: with SMTP id r10mr4302070wrx.149.1605884511731; Fri, 20 Nov 2020 07:01:51 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x63sm5104218wmb.48.2020.11.20.07.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2020 07:01:50 -0800 (PST) Date: Fri, 20 Nov 2020 16:01:48 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Daniel Vetter , DRI Development , Intel Graphics Development , Linux MM , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , Thomas Hellstrom , Brian Paul , Daniel Vetter , Huang Rui Subject: Re: [PATCH] drm/ttm: don't set page->mapping Message-ID: <20201120150148.GJ401619@phenom.ffwll.local> Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , DRI Development , Intel Graphics Development , Linux MM , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , Thomas Hellstrom , Brian Paul , Daniel Vetter , Huang Rui References: <20201120095445.1195585-1-daniel.vetter@ffwll.ch> <20201120095445.1195585-5-daniel.vetter@ffwll.ch> <26a62dfb-02e4-1707-c833-a3c8d5cbe828@amd.com> <0b853a0e-b737-e02c-b885-0b0249449cb3@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <0b853a0e-b737-e02c-b885-0b0249449cb3@amd.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 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 Fri, Nov 20, 2020 at 11:08:31AM +0100, Christian K=F6nig wrote: > Am 20.11.20 um 11:05 schrieb Daniel Vetter: > > On Fri, Nov 20, 2020 at 11:04 AM Christian K=F6nig > > wrote: > > > Am 20.11.20 um 10:54 schrieb Daniel Vetter: > > > > Random observation while trying to review Christian's patch serie= s to > > > > stop looking at struct page for dma-buf imports. > > > >=20 > > > > This was originally added in > > > >=20 > > > > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7 > > > > Author: Thomas Hellstrom > > > > Date: Fri Jan 3 11:47:23 2014 +0100 > > > >=20 > > > > drm/ttm: Correctly set page mapping and -index members > > > >=20 > > > > Needed for some vm operations; most notably unmap_mapping_r= ange() with > > > > even_cows =3D 0. > > > >=20 > > > > Signed-off-by: Thomas Hellstrom > > > > Reviewed-by: Brian Paul > > > >=20 > > > > but we do not have a single caller of unmap_mapping_range with > > > > even_cows =3D=3D 0. And all the gem drivers don't do this, so ano= ther > > > > small thing we could standardize between drm and ttm drivers. > > > >=20 > > > > Plus I don't really see a need for unamp_mapping_range where we d= on't > > > > want to indiscriminately shoot down all ptes. > > > >=20 > > > > Cc: Thomas Hellstrom > > > > Cc: Brian Paul > > > > Signed-off-by: Daniel Vetter > > > > Cc: Christian Koenig > > > > Cc: Huang Rui > > > This is still a NAK as long as we can't come up with a better way t= o > > > track TTMs page allocations. > > >=20 > > > Additional to that page_mapping() is used quite extensively in the = mm > > > code and I'm not sure if that isn't needed for other stuff as well. > > Apologies, I'm honestly not quite sure how this lone patch here ended > > up in this submission. I didn't want to send it out. >=20 > No problem. >=20 > But looking a bit deeper into the mm code that other drm drivers don't = set > this correctly and still use unmap_mapping_range() sounds like quite a = bug > to me. >=20 > Going to track down what exactly that is used for. Pagecache shootdown. unmap_mapping_range only shoots down from the virtua= l side. Since that's all we care about, we don't need to set up the address_space in the page. -Daniel >=20 > Christian. >=20 > > -Daniel > >=20 > > > Regards, > > > Christian. > > >=20 > > > > --- > > > > drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------ > > > > 1 file changed, 12 deletions(-) > > > >=20 > > > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/t= tm_tt.c > > > > index da9eeffe0c6d..5b2eb6d58bb7 100644 > > > > --- a/drivers/gpu/drm/ttm/ttm_tt.c > > > > +++ b/drivers/gpu/drm/ttm/ttm_tt.c > > > > @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bde= v, struct ttm_tt *ttm) > > > > return ret; > > > > } > > > >=20 > > > > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struc= t ttm_tt *ttm) > > > > -{ > > > > - pgoff_t i; > > > > - > > > > - if (ttm->page_flags & TTM_PAGE_FLAG_SG) > > > > - return; > > > > - > > > > - for (i =3D 0; i < ttm->num_pages; ++i) > > > > - ttm->pages[i]->mapping =3D bdev->dev_mapping; > > > > -} > > > > - > > > > int ttm_tt_populate(struct ttm_bo_device *bdev, > > > > struct ttm_tt *ttm, struct ttm_operation_ctx *= ctx) > > > > { > > > > @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bde= v, > > > > if (ret) > > > > return ret; > > > >=20 > > > > - ttm_tt_add_mapping(bdev, ttm); > > > > ttm->page_flags |=3D TTM_PAGE_FLAG_PRIV_POPULATED; > > > > if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) { > > > > ret =3D ttm_tt_swapin(ttm); > >=20 >=20 --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch