Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9946276ybi; Wed, 10 Jul 2019 20:29:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEskYg1T8LgIIcJ+kIUBGgAedKk1JMrcBEsZ3HcHgudg6E2hO52IFgXEeXUacwmnHEYLS3 X-Received: by 2002:a17:902:e011:: with SMTP id ca17mr2043766plb.328.1562815750976; Wed, 10 Jul 2019 20:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562815750; cv=none; d=google.com; s=arc-20160816; b=g2agerpicv0QU5rDsJ69pjd+/EDKSKc+MrRwhg02gQoZ/QBHP2/ytvH1ve57dQrzc8 7dW/ei4cJmtqS1ZODZO9LEPSJVAxhSfEdhkP1bnhUbH9ZSz+lA6a9sxsBJKf6HuvD8yx Tnf6Jjs+H8K5YiAo53O6rga5phJUtXYt0DDt+OjZ5pe4oVN7AXlXUpH4eWQjyVgDtGRh w5uVpC0tglJy+Yz1LMCPDUp65PHNO9rjMJnM+k0SsFurbsVXQg/mGvwRt/zQNRPe0lGX FQeNMTp7JXUy5Ddb44ddMC6vbdzeevZaLRMb7CZ+1VHYr/dSlbXCIdmNstdEHa+6eBuk Q/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=rIHV6cPDPKhX9jkZyhvnHZiEyAQlrV5sCTvAq/yF72U=; b=Du/x/JnOzG1ak3xX5v7+930CD5a0vsQsD+8sfpZr3P3cFEBKrvRFPIJdgyR4tCXFu7 /rxNQKYUTGriMe9Vtk3XW+CbOVbjHSyPxiQhlyOcnLHMyFPRfdaK1gGUUlaQrKchfcqZ uZSmdSJbzOMPMnkzsUSpu9CkYCCI2LQtOtZGvNlaVmIatvElmRY445IiD9PuHNWJCDCc tmCGHDhI/0a+Y0+jeW29qcNebsn7sFm71X2zpsUm/erD14uEUS6P7JPnuB+sLnDpIJ1g UgWHIEJCGlINz0IpjrrgolWOAKLrN6A0T7OctbvDZ0OwVezVUtzFNm/RoTPmjkIse6rj Po8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=gEJ2OiHD; 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=fail (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 m32si3759387pld.236.2019.07.10.20.28.55; Wed, 10 Jul 2019 20:29:10 -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=fail header.i=@gmail.com header.s=20161025 header.b=gEJ2OiHD; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbfGKDKb (ORCPT + 99 others); Wed, 10 Jul 2019 23:10:31 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:38701 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbfGKDKb (ORCPT ); Wed, 10 Jul 2019 23:10:31 -0400 Received: by mail-pg1-f194.google.com with SMTP id z75so2185458pgz.5 for ; Wed, 10 Jul 2019 20:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=rIHV6cPDPKhX9jkZyhvnHZiEyAQlrV5sCTvAq/yF72U=; b=gEJ2OiHD3xfsyfhhrIHY7acOsv6Qmhq6okCyaEE6s5QGewpmPiMaVqagAoR5/gZE6R gGoOxfOGyeeT0QzUltFU3Z4VTps64FBwoPj7DswM5ZiwD9XcG5qcPLhM1URwPJLSibWp Xx5mt9DSFkUnFcfXbXS//GfIi46AfHy/Bg5kHjHL2Wr+CDUpgpeFbGYKGLiP4Kt8xvLg 06zNoJiw+kAAm50bmLvuALPrWB0YCutV3YMeywHvZyQqaaXLlpdMVL897OxRjBoNJqEx Rb9UriVejde7CpAhZ/6hPnRFchFtkO2c3j56UTY0GP6NAPi1I+dMR6JkIMLXMiQN7s4C +z1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rIHV6cPDPKhX9jkZyhvnHZiEyAQlrV5sCTvAq/yF72U=; b=kf+v7qoWB8qbnvj8eHxoVo6GJpbzzMslQecAN7zfbh3Bj/75jX5KdGMm4vBTeIgms2 Q31NIhVIuDWUNS2Cj19JUbq00OLuUcxqTSO8dttjrcQJ1awCCN1B/7xAbHm7wPFJcJEN zcSRKtceROeoKl7sLPwzBBj1e9mBvclEe4zlpo0a0iovvMjchh9T0NBAmiKjtVLIlEHH y4+D+IP+DqxgJ4qixcznGhFBTCnwcLvhffIFwFehJ9fdxqeH0m6cHUB0kdcZW0uofXSu t+TacnmwgNoltA6TAWZOjeyXU7rZjpLEsSEULYaJAtmRgeFbfKz1w6lOFOJPGrozn0Sv FZUA== X-Gm-Message-State: APjAAAXH+lGQzzVVRWi0V+Wb9uJNVwdCDESbSHDwAkPr5igaz9J1Fyt+ 1J8vfXVFSMKPMMP2813OzyRhFeQr84s= X-Received: by 2002:a17:90a:23a4:: with SMTP id g33mr2077739pje.115.1562814630577; Wed, 10 Jul 2019 20:10:30 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id 65sm4043082pff.148.2019.07.10.20.10.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 20:10:29 -0700 (PDT) From: Fuqian Huang Cc: Christian Koenig , Huang Rui , Junwei Zhang , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH 1/2] drm/ttm: use the same attributes when freeing d_page->vaddr Date: Thu, 11 Jul 2019 11:10:21 +0800 Message-Id: <20190711031021.23512-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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_page *d_page) { + unsigned long attrs = 0; dma_addr_t dma = d_page->dma; d_page->vaddr &= ~VADDR_FLAG_HUGE_POOL; - dma_free_coherent(pool->dev, pool->size, (void *)d_page->vaddr, dma); + if (pool->type & IS_HUGE) + attrs = DMA_ATTR_NO_WARN; + + dma_free_attrs(pool->dev, pool->size, (void *)d_page->vaddr, dma, attrs); kfree(d_page); d_page = NULL; -- 2.11.0