Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp201297rdb; Mon, 22 Jan 2024 17:35:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjh4GeuU7PA8gVLOYdVCCwLjVSSULjMnAjSSS6pNiTfZqXOTTPyuyQq+NmL0M0frXAWanr X-Received: by 2002:a05:6358:72a3:b0:176:5c15:b7ed with SMTP id w35-20020a05635872a300b001765c15b7edmr1901218rwf.11.1705973737313; Mon, 22 Jan 2024 17:35:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705973737; cv=pass; d=google.com; s=arc-20160816; b=D9wEUnTgqP2rwuGsbVnkHncglzGn/9d0+01aaJMm9RKz5n9mDwBexKMC4ojVTbP3Ak 8Mp5T8nbi6JJ6L7j/FhGAi2ZkceUjGt0gcnHza9LbrIHrqLypTNNM7cSO28k7btmsver HyTOD3TEYjoD4Q24qXFe/IdY9o3Y81Be3kT6obztI3vkQIqdq+usalEJaacxfoDrOCc3 SDfkV+XZlejkx6gsktVO/Z8rge14siTWtlNHK6fnisO/N/OjqkvI/AJtISGEHXNL5z+e QFCFBOx90xVyqzFjCxVWTofC6cms38cEMv+Q22fX0HxzMAEyBz1eaqvpBm4IPJTj/rtt tjpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=St3evKuEoRjEu6fUhkyve7IAIVb8keTQrKT+qAFU0AI=; fh=kAe5hCbvittNft1IHJW+7P8faEtrbSV90H0jaIRwl0c=; b=Q/Y5ayal0k2etAm8CoOZ9EgqyPB0ULZ6r/oBRXI7QCM4fXN/zu85U9SvzOJHBIfLH/ MiyD9wZ1UX5gGOHVH2EfAuxdf9DbjTd8wIa/t6gZf33SwG0alwQr8OaDBuqkfRI4nFji eOA/MeUi/3vi1XePcQiIogx+iONtsANuuR0H9wNJm+N7cq/KXGgAEBWVKUEOjJJklt+s 8DiXSvRNJRYXQig8BouAYFaqIYby2FjJZT/0q4MkbM10qbmHi4ubiFwb1X9ypNA9u1CS l9AhvjyJmRt5/aGSiK3XXgSTpptmVIT4FGCgyf5BHOcAC0WK8CXoVYszIXIkkTZud1iV 7oNg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-34500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34500-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j5-20020a056a00174500b006dd7a7f3730si17572pfc.315.2024.01.22.17.35.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 17:35:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-34500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34500-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 05888284B67 for ; Tue, 23 Jan 2024 01:26:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE46B5C90E; Tue, 23 Jan 2024 00:33:25 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BD004E1D8 for ; Tue, 23 Jan 2024 00:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705970005; cv=none; b=cTvLzDS47Ymk1d0unNw4Exv8OuJMSJCha3aS/rbkpFWjgvBMmZ/9dzOPii6whc9zajZqBSaMsUXAnwbWvyhIchXJkXFZE9o4ni/3taSM19MtIeap5FTgq1+ALp7C8rCj3rsxK+IUFr7crdAvzj9IPPFJILz9HzTERRyhUkx5Vsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705970005; c=relaxed/simple; bh=8YEhmUBBqKXx9e+eKyA5GVKGvoNPGbbleY8pX1/XJeY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TAn3bq1b9SjKYw8wwAxanNUiryU0jiDP5pg1r1mMbpSc37gjFmxJb9iDXzWY+LC146TLGjUMI0RDllV2kaPkgjGyHQb3QvYxzniDRUakpDLsQYYprNRrSqfpr+/hH56VVbGfDSQ0bSle/v171Ojbm4fpBaM0jc2vvU0+jhVsgqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21345C433F1; Tue, 23 Jan 2024 00:33:24 +0000 (UTC) Date: Mon, 22 Jan 2024 19:34:53 -0500 From: Steven Rostedt To: "Bhardwaj, Rajneesh" Cc: LKML , Linus Torvalds , Felix Kuehling , Christian =?UTF-8?B?S8O2bmln?= , dri-devel@lists.freedesktop.org Subject: Re: [BUG] BUG: kernel NULL pointer dereference at ttm_device_init+0xb4 Message-ID: <20240122193453.6096d45f@gandalf.local.home> In-Reply-To: <918ddc13-1cf8-4199-b5be-5719a023de42@amd.com> References: <20240122180605.28daf23a@gandalf.local.home> <918ddc13-1cf8-4199-b5be-5719a023de42@amd.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 22 Jan 2024 19:29:41 -0500 "Bhardwaj, Rajneesh" wrote: > > In one of my previous revisions of this patch when I was experimenting, > I used something like below. Wonder if that could work in your case > and/or in general. > > > diff --git a/drivers/gpu/drm/ttm/ttm_device.c > b/drivers/gpu/drm/ttm/ttm_device.c > > index 43e27ab77f95..4c3902b94be4 100644 > > --- a/drivers/gpu/drm/ttm/ttm_device.c > > +++ b/drivers/gpu/drm/ttm/ttm_device.c > > @@ -195,6 +195,7 @@ int ttm_device_init(struct ttm_device *bdev, struct > ttm_device_funcs *funcs, > > bool use_dma_alloc, bool use_dma32){ > > struct ttm_global *glob = &ttm_glob; > > +bool node_has_cpu = false; > > int ret; > > if (WARN_ON(vma_manager == NULL)) > > @@ -213,7 +214,12 @@ int ttm_device_init(struct ttm_device *bdev, struct > ttm_device_funcs *funcs, > > bdev->funcs = funcs; > > ttm_sys_man_init(bdev); > > -ttm_pool_init(&bdev->pool, dev, NUMA_NO_NODE, use_dma_alloc, use_dma32); > > + > > +node_has_cpu = node_state(dev->numa_node, N_CPU); Considering that qxl_ttm_init() passes in dev = NULL, the above would blow up just the same. -- Steve > > +if (node_has_cpu) > > +ttm_pool_init(&bdev->pool, dev, dev->numa_node, use_dma_alloc, use_dma32); > > +else > > +ttm_pool_init(&bdev->pool, dev, NUMA_NO_NODE, use_dma_alloc, > > +use_dma32); > > bdev->vma_manager = vma_manager; > > spin_lock_init(&bdev->lru_lock); > > > > > > -- Steve