Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp264009pxj; Wed, 16 Jun 2021 01:39:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLMJJmjkzJyc4sNs8OpBDedUuNx/19PyQOEel7asZxCVOsuB9vP7rm0zXkUq+RRKnaGAmc X-Received: by 2002:a17:906:b2cb:: with SMTP id cf11mr1512913ejb.448.1623832787624; Wed, 16 Jun 2021 01:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623832787; cv=none; d=google.com; s=arc-20160816; b=MuI7pXI9UPg5HMNSCXy8tFI8KjR/uF78KXNfbQGwFXL+2d9M5fQYMVGOovBkJQEk3L iKIHO072yLdb9anMlestcU8rnb3wgRMoPaH2CX/bq9Dds0dd29VEfTtWUZOjaJkEn/Y9 j8vulwCFkHXvfqGyd3PVZGoewI9PZ2uheNlC4x3CHbHe5+UUjk5jj39pekQ/IODkzvSM Kv0Wxd6oZypLKpj/lCOdfTIwP6dmebduNFS3dpD+KF6/nNcjJ5FdPM0b+RBfLlYT8+N2 RyOT3IJeRSedxUNrVZFaaIXgKAuGemSkC79eWRT++BYSQBTO2LlHlwu8Dv/e1S8ZrKN2 lQkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1gflDtV265seh+MHrLlcgWdJG8g8fxQjYrRcYA0G8kk=; b=pfBTbz7+4g+RV6x1Q0ZABN8JOQdup1Ixw/8IcUImyWDR99MEMMGuALTrxds4uoX72V YHJiWk9a0R/2N4u4Cx3aFrJ88WazKiAALPnA3gEfuXum/JWcmSuuUpPA6a2vQ0OIpTZn pqmlnHc2p4VCLaKavdAFlxK6y8rSiYRVDJhIgSNgbZo8L8nTKAUoxoW578fEvh++Xfxj kTmAPGtR0QXSeHACjz0V3MiA6kWqwHGUD99XuOK3ALY6huOSFmly+6p/A+N4W+v5nCdT XHk4muj2gJQjN1rr4+4f/ZHDNy9IPLrvPfNHzpnXDaQy2LyU6N5VT82mOmUU6+bVNntJ wqrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=tNEp+KB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si1601520edr.505.2021.06.16.01.39.24; Wed, 16 Jun 2021 01:39:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=tNEp+KB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbhFPIke (ORCPT + 99 others); Wed, 16 Jun 2021 04:40:34 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:24410 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231318AbhFPIke (ORCPT ); Wed, 16 Jun 2021 04:40:34 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15G8Zbks028128; Wed, 16 Jun 2021 08:38:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2020-01-29; bh=1gflDtV265seh+MHrLlcgWdJG8g8fxQjYrRcYA0G8kk=; b=tNEp+KB31FAmNvawbO0ZYGFSv9YLdjgeaXzI+GzqdEbYYHOxYpMU6gM267k6pbgDmkho 9xpnwJM3ytRunbCGUv00U9EDg4u8llULjR2dgsio0xcj8OnNbH7TEBkS4ndlDjx4bca7 gGdFUMmjguE3WfxJankVvceVRgp3zn4Hcvs3BWob/Lx6ooOMDUQSY6E147VDa491Bjew yw+O4Htwo+EEYfLYy1U41eXjADCd4Xwkr6qEqLjwQub3La3SQoalJYW76fLz0y8ZVmt5 8MNERP2sroRfUtRb1gCHBOaLsWArz29SXGeweDfLlVo+8INuuSskZxLqgZi5M/ZSLiEI Cw== Received: from oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 396tjdsqg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 08:38:23 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 15G8aE0x162476; Wed, 16 Jun 2021 08:38:22 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 396wanj7u7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 08:38:22 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 15G8cLLd166760; Wed, 16 Jun 2021 08:38:21 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 396wanj7t2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 08:38:21 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 15G8c9E3018177; Wed, 16 Jun 2021 08:38:09 GMT Received: from kadam (/41.212.42.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 16 Jun 2021 08:38:08 +0000 Date: Wed, 16 Jun 2021 11:37:58 +0300 From: Dan Carpenter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Thomas Hellstr , B6@mwanda, m , Huang Rui , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/ttm: fix error handling in ttm_bo_handle_move_mem() Message-ID: <20210616083758.GC1901@kadam> References: <03d0b798-d1ab-5b6f-2c27-8140d923d445@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <03d0b798-d1ab-5b6f-2c27-8140d923d445@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-ORIG-GUID: goOkPdFG9ndrNJUlbPLkAgpvhrm8v5Nh X-Proofpoint-GUID: goOkPdFG9ndrNJUlbPLkAgpvhrm8v5Nh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 08:46:33AM +0200, Christian K?nig wrote: > Sending the first message didn't worked, so let's try again. > > Am 16.06.21 um 08:30 schrieb Dan Carpenter: > > There are three bugs here: > > 1) We need to call unpopulate() if ttm_tt_populate() succeeds. > > 2) The "new_man = ttm_manager_type(bdev, bo->mem.mem_type);" assignment > > was wrong and it was really assigning "new_mem = old_mem;". There > > is no need for this assignment anyway as we already have the value > > for "new_mem". > > 3) The (!new_man->use_tt) condition is reversed. > > > > Fixes: ba4e7d973dd0 ("drm: Add the TTM GPU memory manager subsystem.") > > Signed-off-by: Dan Carpenter > > --- > > This is from reading the code and I can't swear that I have understood > > it correctly. My nouveau driver is currently unusable and this patch > > has not helped. But hopefully if I fix enough bugs eventually it will > > start to work. > > Well NAK, the code previously looked quite well and you are breaking it now. > > What's the problem with nouveau? > The new Firefox seems to excersize nouveau more than the old one so when I start 10 firefox windows it just hangs the graphics. I've added debug code and it seems like the problem is that nv50_mem_new() is failing. > > drivers/gpu/drm/ttm/ttm_bo.c | 14 ++++++++------ > > 1 file changed, 8 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > > index ebcffe794adb..72dde093f754 100644 > > --- a/drivers/gpu/drm/ttm/ttm_bo.c > > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > > @@ -180,12 +180,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > > */ > > ret = ttm_tt_create(bo, old_man->use_tt); > > if (ret) > > - goto out_err; > > + return ret; > > if (mem->mem_type != TTM_PL_SYSTEM) { > > ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx); > > if (ret) > > - goto out_err; > > + goto err_destroy; > > } > > } > > @@ -193,15 +193,17 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > > if (ret) { > > if (ret == -EMULTIHOP) > > return ret; > > - goto out_err; > > + goto err_unpopulate; > > } > > ctx->bytes_moved += bo->base.size; > > return 0; > > -out_err: > > - new_man = ttm_manager_type(bdev, bo->mem.mem_type); > > This here switches new and old manager. E.g. the new_man is now pointing to > the existing resource manager. Why not just use "old_man" instead of basically the equivalent to "new_man = old_man"? Can the old_man change part way through the function? regards, dan carpenter