From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8DC2E9A04A for ; Thu, 19 Feb 2026 15:33:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3020F10E6F9; Thu, 19 Feb 2026 15:33:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YtosoK3U"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AFB110E6F9; Thu, 19 Feb 2026 15:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771515185; x=1803051185; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xJL9YtMkcrJPn6SwnI5TmxCDHeUgm0VxLk98ZEya77w=; b=YtosoK3UAh1svebadIQcEVURbBJoTQshxuZ713o65/Daz9yfQU/RwsxI zK/XV+IIZHmdpNAGFO4xF4tXk/vaBKqKjA6q+BdvGb8siWqrSdsFd5e12 ks5RPlM1tobf9+Ti1C+tXbvhECn9jKnOtC3O1BQy+cgp6ZH8LQ5g2I1hO nN+B6iiiJzojfxEwvoXUljEFPggKIJtM8+Pg/Jlv16x+/Xyf8UFvKqvn0 fWY2mUVq/w5BCVEopXsGhiij3zEqOYDWxAT+7dsSFsFf9x/8neOw9IIfm HKTBptu1cuv36uBcrbcBzPv5CUEa/Ua2Mrj3f6Bsx1OSc5RF6QLOoCFMN w==; X-CSE-ConnectionGUID: P5v7ZjXmTAOFj+Ggysjq7g== X-CSE-MsgGUID: QL8ZLPoQRh2x4KcPJeIWUg== X-IronPort-AV: E=McAfee;i="6800,10657,11706"; a="76438115" X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="76438115" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2026 07:32:56 -0800 X-CSE-ConnectionGUID: 0fpRKhS1S5OvC1k/I60fDA== X-CSE-MsgGUID: JgBsK6wqTRmlLBHhymsCBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="237540517" Received: from dhhellew-desk2.ger.corp.intel.com (HELO [10.245.244.167]) ([10.245.244.167]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2026 07:32:53 -0800 Message-ID: <06687482-f94c-44fd-9e8d-e7eadaa0833a@intel.com> Date: Thu, 19 Feb 2026 15:32:51 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] gpu: Fix uninitialized buddy for built-in drivers To: Danilo Krummrich Cc: Koen Koning , dri-devel@lists.freedesktop.org, Joel Fernandes , Dave Airlie , intel-xe@lists.freedesktop.org, Peter Senna Tschudin , dri-devel References: <20260213152047.179628-1-koen.koning@linux.intel.com> <20260216111902.110286-1-koen.koning@linux.intel.com> <318f1dcc-bc95-473e-bdb3-7ea03708395c@intel.com> <1243e2a5-02bd-4b44-9008-6d18a706e44f@intel.com> Content-Language: en-GB From: Matthew Auld In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 19/02/2026 12:56, Danilo Krummrich wrote: > On Thu Feb 19, 2026 at 1:44 PM CET, Matthew Auld wrote: >> On 19/02/2026 11:14, Danilo Krummrich wrote: >>> On Thu Feb 19, 2026 at 11:38 AM CET, Matthew Auld wrote: >>>> On 19/02/2026 10:16, Danilo Krummrich wrote: >>>>> On Mon Feb 16, 2026 at 12:19 PM CET, Koen Koning wrote: >>>>>> Use subsys_initcall instead of module_init for the GPU buddy allocator, >>>>>> so its initialization code runs before any gpu drivers. >>>>>> Otherwise, a built-in driver that tries to use the buddy allocator will >>>>>> run into a kernel NULL pointer dereference because slab_blocks is >>>>>> uninitialized. >>>>>> >>>>>> Specifically, this fixes drm/xe (as built-in) running into a kernel >>>>>> panic during boot, because it uses buddy during device probe. >>>>> >>>>> I just noticed that this patch was sent twice, and I posted my feedback on [1] >>>>> -- pasting it here as well. >>>>> >>>>>> Fixes: ba110db8e1bc ("gpu: Move DRM buddy allocator one level up (part two)") >>>>> >>>>> This Fixes: tag seems wrong. How is this code move related to this problem? >>>> >>>> This popped up as a very recent regression for us internally. It looks >>>> like it worked before since link order ensured drm_buddy came before all >>>> the driver code. With above commit the link order changed and became >>>> drm/ and then buddy. See [1] also, which is maybe clearer to see this. >>> >>> I see, I think this would be a good hint for the commit message. :) >>> >>> However, I think it was never meant to rely on a build system implementation >>> detail, nor would this be correct. So, I think this should add both Fixes: tags. >> >> Yeah, I'm really not sure tbh. From a quick grep there do seem to be >> other users relying on this: >> >> drm/drm_drv.c:1274:module_init(drm_core_init); >> drm/scheduler/sched_fence.c:238:module_init(drm_sched_fence_slab_init); >> >> The sched one looks identical with the slab thing. Do these need to be >> fixed also? > > Yes, those should be fixed as well. > > Also note that module_init() compiles down to device_initcall() when built-in, > i.e. the initcall stage that is mainly for drivers, not for subsystem code. > > Do you want to send a fix for thise as well? Koen will send something. > >>> >>> Whether it should be backported is a different question though, as it seems to >>> work by accident in previous versions, i.e. it is only a "potential bug". >>> >>> My personal opinion is that it should be backported either way, however that's >>> ultimately up to the stable team. >>> >>> - Danilo >>> >>>> >>>> [1] >>>> https://lore.kernel.org/intel-xe/20260213152047.179628-1-koen.koning@linux.intel.com/ >>>> >>>>> >>>>> This should rather be: >>>>> >>>>> Fixes: 6387a3c4b0c4 ("drm: move the buddy allocator from i915 into common drm") >>>>> >>>>> Also, please add: >>>>> >>>>> Cc: stable@vger.kernel.org >>>>> >>>>>> Cc: Joel Fernandes >>>>>> Cc: Dave Airlie >>>>>> Cc: intel-xe@lists.freedesktop.org >>>>>> Cc: Peter Senna Tschudin >>>>>> Cc: Matthew Auld >>>>>> Signed-off-by: Koen Koning >>>>> >>>>> [1] https://lore.kernel.org/all/DGIUUFLC31D5.2OZBF5FWQJWMZ@kernel.org/ >>> >