Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965002AbcCIXnR (ORCPT ); Wed, 9 Mar 2016 18:43:17 -0500 Received: from mail-bn1on0071.outbound.protection.outlook.com ([157.56.110.71]:61390 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964834AbcCIXml (ORCPT ); Wed, 9 Mar 2016 18:42:41 -0500 Authentication-Results: lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=none action=none header.from=amd.com; Subject: Re: [PATCH 3.13.y-ckt 078/138] drm/radeon: hold reference to fences in radeon_sa_bo_new To: Kamal Mostafa , , , References: <1457565265-15195-1-git-send-email-kamal@canonical.com> <1457565265-15195-79-git-send-email-kamal@canonical.com> From: =?UTF-8?Q?Nicolai_H=c3=a4hnle?= Message-ID: <56E0B4E4.90704@amd.com> Date: Wed, 9 Mar 2016 18:42:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1457565265-15195-79-git-send-email-kamal@canonical.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [181.66.190.196] X-ClientProxiedBy: BY1PR15CA0030.namprd15.prod.outlook.com (25.162.17.168) To SN1PR12MB0750.namprd12.prod.outlook.com (25.164.26.24) X-MS-Office365-Filtering-Correlation-Id: bf59aced-3243-45ba-e624-08d348747ee1 X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0750;2:Hh+lkTz6ofeMFi06eZ+Lr0TrBVo33R8UKdl3cQ5HbQj+DiaIdsww1yqOavMwrTO4f5W5OltyXptiBAIwN6KfloQ1fIi8rO5VtsTrExhEmVkDJiVdwoZcjGX6LhpxAlG1q2YGOvDYGh5X/Tign8cDZnS1MqkLjdkyZLK13EjANsOPbuVgTK2z+mbiKjddg9I6;3:LRRe9yioxIJFaS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;4:rEbiTD8ugV6KOzaALFSjpiMqb3hNykCyiyrkJdKchlY3CUNFkDxgi3CaxbF2sEy7K/rm4R4p34Yvrcron8Gc7bUr8nK5Kdu4YxAP3hUiWz/EcXMQU2nUGgfNMS++ke0Qk8iw1JSkcpsogk9/BuXw/5g8BGk3TGFZKaD6R6ZgIdmE2fIy/KGzoC7obWC1wczoLSvt0kD1O9X1qkrBwkiKY155vA5Jx+wJJ1KB4DxYOAKjkA3sRCZjmn3uEjMd+QR8UeGfyeCnUhyHg0y2R6lZX/wplXpRRbMOgeL4Wp+9RwN+wugL0G3gMgONATrtkGxutQe2DM838QIQREp1xolsWSjdxJ8z+7KWUyHh6woSazJzTVOJt78EqLeBUwyUnUff X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:SN1PR12MB0750;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0750; X-Forefront-PRVS: 0876988AF0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(24454002)(164054003)(54356999)(189998001)(107886002)(66066001)(65806001)(65816999)(36756003)(50986999)(76176999)(65956001)(33656002)(42186005)(2201001)(50466002)(586003)(64126003)(5008740100001)(5001770100001)(2950100001)(81166005)(86362001)(2870700001)(575784001)(117156001)(19580405001)(92566002)(1096002)(23676002)(77096005)(83506001)(5004730100002)(47776003)(3846002)(6116002)(2906002)(19580395003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0750;H:[192.168.7.120];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwNzUwOzIzOlJwQUxwR3BRK2VVRDV1UlZtbkdXcWZTQ3Jj?= =?utf-8?B?Z3phdG5JWjR5dGc4VlZ5aFpqWmJSZjEzVG9JSE1zOWVycHNP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MhWMSvEGnv0B3JiGqJ+M2rY93u31NLSXYMHs2UpZjT53IRJZbKmw4B5v2TDRa7LL4CU4QiLrABT67R1v3XnKGjiDLO8O2+WcIX2xEkfcj03lMlMrwnDylMRz7e8T/QUYH6R7zLJ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2016 23:42:35.3854 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0750 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 48 On 09.03.2016 18:13, Kamal Mostafa wrote: > 3.13.11-ckt36 -stable review patch. If anyone has any objections, please let me know. Please drop the patch for now, it causes a NULL pointer dereference on kernels <= 3.17. We will follow up with a correctly backported patch. Thanks, Nicolai > > ---8<------------------------------------------------------------ > > From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= > > commit f6ff4f67cdf8455d0a4226eeeaf5af17c37d05eb upstream. > > An arbitrary amount of time can pass between spin_unlock and > radeon_fence_wait_any, so we need to ensure that nobody frees the > fences from under us. > > Based on the analogous fix for amdgpu. > > Signed-off-by: Nicolai Hähnle > Reviewed-by: Christian König > Signed-off-by: Kamal Mostafa > --- > drivers/gpu/drm/radeon/radeon_sa.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c > index f0bac68..bb16684 100644 > --- a/drivers/gpu/drm/radeon/radeon_sa.c > +++ b/drivers/gpu/drm/radeon/radeon_sa.c > @@ -349,8 +349,13 @@ int radeon_sa_bo_new(struct radeon_device *rdev, > /* see if we can skip over some allocations */ > } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); > > + for (i = 0; i < RADEON_NUM_RINGS; ++i) > + radeon_fence_ref(fences[i]); > + > spin_unlock(&sa_manager->wq.lock); > r = radeon_fence_wait_any(rdev, fences, false); > + for (i = 0; i < RADEON_NUM_RINGS; ++i) > + radeon_fence_unref(&fences[i]); > spin_lock(&sa_manager->wq.lock); > /* if we have nothing to wait for block */ > if (r == -ENOENT && block) { >