Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1921491ybi; Thu, 18 Jul 2019 00:22:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0oRgMv94AJ19IqXID/lIAfSBX0ncJ0NTT/VbHAROBG0Og6pHc3CPwiT43y4x5FoGfYWoP X-Received: by 2002:a17:90a:fa07:: with SMTP id cm7mr48032664pjb.138.1563434555447; Thu, 18 Jul 2019 00:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563434555; cv=none; d=google.com; s=arc-20160816; b=xAVyNpMsfJo4SKJe/5CZZm87B1WXrISlKAd+MyBTG3xS6/YF5/SW3yTD5Aq64cM04H EjF8LwObzR2rswPECkImSM7qAUK0TKV1ODFQzzxO50c5glUxnnLOjupPsh2KV09d92Nt kvYNezA7y809oS2PKptYYuAlrDkinpw8AaYXfHYPEm4BUrxae96F2lcadEexNKxZNsx1 NK+0tO5GHmIgFI+U0gL8nqPTCWYMR1FVefEnafULgykYOtUpj9ympPyB3XRQ8JatPbgd jxJv83Em9BGmvdNwLPl5MkwDQAI0tcWC96uAicnLnlbGW6vQQVrOXSlxpj0g8AytFiAK OmGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=I7RxY7r3Jgx1B32VLDVMayLONGfb/45rCMfF68XdUAg=; b=OQEGW4powkiXi1LT7gsIGArDli45vjDClHKWtzEQOMhMGIZXkqQcLAgUxdtVA5U6dV KfjTNttlr/tFx60e6Jp0TY6WIbH50XmnZOQKjdf2fQdThHK1UgPZB2Iunh2GYpDphnUP sJBwI9Fh1DYHsxRRCZqH3NBMi8Q7223y+iWeCpCs5rpx44JuDB3gMjwVZoffNSQcVYoE erldFFNpBhEz56RzmoCLLERtHDuQZ3TPbnIUn0ayslzVKb+pSLaNje6JAXC4UC5bYnow mgKqUuqM0AUDiX/EwYSVbhBVwpSdnvROrV2JL36wZc08OUtv7J4GTsBLlFYPLETuk/Os u66A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="eTVCASN/"; 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 f4si726565pgu.194.2019.07.18.00.22.18; Thu, 18 Jul 2019 00:22:35 -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="eTVCASN/"; 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 S1726488AbfGRHVl (ORCPT + 99 others); Thu, 18 Jul 2019 03:21:41 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:40917 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbfGRHVl (ORCPT ); Thu, 18 Jul 2019 03:21:41 -0400 Received: by mail-yw1-f67.google.com with SMTP id b143so11857401ywb.7 for ; Thu, 18 Jul 2019 00:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=I7RxY7r3Jgx1B32VLDVMayLONGfb/45rCMfF68XdUAg=; b=eTVCASN/nT7UvlP4b2X/hXHaLQJXMUscbQC9BC69DYGyPbL5539AeuPk0d0lVuNnFB 94C85zw3keVa0UWRcTL7/iGcxD2GoaJLbsEOeuzl7SzOaXTXuuSkatIwiqUUkz0Ct9xE mGjy62wdb3x1vH6IxM68zd3oFq5NJ7lL4c6N1qGUMn49oUG7bagRqGf2qPFEb2IEzUe3 koODk1TdrlZk8rfnxf3R1i1527woiDDZn1VyNTHdATm+EqtapeyaDGfXCotryhLL6zl8 dXugt/fxJlPXUHWrvY1Fiwv4s6ZgoH08QSVOMRsPpumfPgdGQPiNKaQWD/oHCyK1xxCa rtxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=I7RxY7r3Jgx1B32VLDVMayLONGfb/45rCMfF68XdUAg=; b=IjxenuSEBqIxr/hcVHb0t9bR9rqmPXeYJcHm6JV+VKEWq6KGWOS6A1wVsLbsQggzG2 AZZzyTDg80m/TtYS0avhM+k7OqAg+Ip8WWgh9CZgpqLwpx61NBSml7Nh7Cx4/xMNg/NL BFCUY2t1ZS7VoE+aFtmwVTrRCz/4u/p7lz+JvOgPgGoeF/qF9o0Jyz11SCOBFliMOzGf TIjcMJiU/W7kBJIIndGa+mSMmejYQHQeAo26Frj6f+ln0S1QmIrl7Z4x3tehQ7uowYom YzJiPlYbe6jSkn5Lt4BM89UIUc4n3LbUGLzDX7jVxTsqV2fA7G3h8PJpm6SXx/K6l8KO 6pLA== X-Gm-Message-State: APjAAAVGgv7xvsjuY0EWxFwyjeZtB3ZXojYVj2G045WrXMu+bS5ro6Cv DO0FKCkt3JIuHrGSUXtUFWEm7sHUL1clIqgHPpOWaJcP X-Received: by 2002:a0d:f2c4:: with SMTP id b187mr27527652ywf.103.1563434500147; Thu, 18 Jul 2019 00:21:40 -0700 (PDT) MIME-Version: 1.0 References: <20190711031021.23512-1-huangfq.daxian@gmail.com> <6f28e750-02e4-438a-3680-a4697014689d@amd.com> In-Reply-To: <6f28e750-02e4-438a-3680-a4697014689d@amd.com> From: Fuqian Huang Date: Thu, 18 Jul 2019 15:21:29 +0800 Message-ID: Subject: Re: [PATCH 1/2] drm/ttm: use the same attributes when freeing d_page->vaddr To: "Koenig, Christian" Cc: "Huang, Ray" , Junwei Zhang , David Airlie , Daniel Vetter , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Koenig, Christian =E6=96=BC 2019=E5=B9=B47=E6=9C= =8816=E6=97=A5=E9=80=B1=E4=BA=8C =E4=B8=8B=E5=8D=889:38=E5=AF=AB=E9=81=93= =EF=BC=9A > > Am 11.07.19 um 05:10 schrieb Fuqian Huang: > > In function __ttm_dma_alloc_page(), d_page->addr is allocated > > by dma_alloc_attrs() but freed with use dma_free_coherent() in > > __ttm_dma_free_page(). > > Use the correct dma_free_attrs() to free d_page->vaddr. > > > > Signed-off-by: Fuqian Huang > > Reviewed-by: Christian K=C3=B6nig > > How do you want to upstream that? Should I pull it into our tree? I just came across this misuse case accidentally. I am not very clear about 'How to upstream that'. Are there more than one way to upstream the code and fix the problem? From my side, it is ok that you pull it into your tree and fix it or fix it in other way. :) It will be fine if the problem is fixed. Thanks. > > Thanks, > Christian. > > > --- > > drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm= /ttm/ttm_page_alloc_dma.c > > index d594f7520b7b..7d78e6deac89 100644 > > --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > > +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > > @@ -285,9 +285,13 @@ static int ttm_set_pages_caching(struct dma_pool *= pool, > > > > static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_pag= e *d_page) > > { > > + unsigned long attrs =3D 0; > > dma_addr_t dma =3D d_page->dma; > > d_page->vaddr &=3D ~VADDR_FLAG_HUGE_POOL; > > - dma_free_coherent(pool->dev, pool->size, (void *)d_page->vaddr, d= ma); > > + if (pool->type & IS_HUGE) > > + attrs =3D DMA_ATTR_NO_WARN; > > + > > + dma_free_attrs(pool->dev, pool->size, (void *)d_page->vaddr, dma,= attrs); > > > > kfree(d_page); > > d_page =3D NULL; >