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 9BF35D46C0A for ; Wed, 28 Jan 2026 22:40:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F92010E780; Wed, 28 Jan 2026 22:40:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Ucmejwy+"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1410C10E792 for ; Wed, 28 Jan 2026 22:40: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=1769640005; x=1801176005; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=WZUV0cx/nbBcBJtvYNj/mCMT/R9vF5keKHs585meVWI=; b=Ucmejwy+jGXrEiD1hhDLAgIqlG+vbdQ++WuhdR68Tfrr+9V4AJkcJgDh jGbynFDN8zAsu3Yu4lJA3OV1cyXXjgsyzFTDK+jcIF9RSuhemfRuUZrhL 8R9KxmFMMgxol1YqyNiV8tiDUSEtQ9Zbg00GqaTT7mGl2hIHddvdjxOj6 7lqED8I1DCpbi3ImODF3c6WQ5ucCPi5XzOACzseQVvA/TOlU8+3UE2I9U 9vC+/YYEW7/Qzi0iJvhGJyfXD3tgUD1o7/b20BqrVlKfz5MtjEa4RWiRY pcb5V9h/A0EK+27Uj6mlrBy5HPBF0OPzTrOl8FaNsCY+Nt4I+bTvubHP6 g==; X-CSE-ConnectionGUID: V/zE7BXHRbGvfNRkbLmxOQ== X-CSE-MsgGUID: bWC7PtBLQGq0qqIghx6K8g== X-IronPort-AV: E=McAfee;i="6800,10657,11685"; a="70582841" X-IronPort-AV: E=Sophos;i="6.21,258,1763452800"; d="scan'208";a="70582841" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2026 14:40:05 -0800 X-CSE-ConnectionGUID: BrIn2Fb8RnaiDxY8yyWULA== X-CSE-MsgGUID: /C7cLYqXQzivhVUp/L57QQ== X-ExtLoop1: 1 Received: from egrumbac-mobl6.ger.corp.intel.com (HELO localhost) ([10.245.244.221]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2026 14:40:02 -0800 Date: Wed, 28 Jan 2026 23:39:59 +0100 From: Andi Shyti To: Jani Nikula Cc: Andi Shyti , Krzysztof Karas , intel-gfx@lists.freedesktop.org, Sebastian Brzezinka , Krzysztof Niemiec , Janusz Krzysztofik , =?utf-8?Q?Micha=C5=82?= Grzelak Subject: Re: [PATCH] drm/i915: Add vgpu.entry list initialization Message-ID: References: <7updbd6x7fmw4g3tdf3r27xblf4www7xxsxyrncc35jokiuxvr@rflx6oxm5au5> <3f47d40ba15db7ace414d68934b84b9da8bd69c3@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3f47d40ba15db7ace414d68934b84b9da8bd69c3@intel.com> X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hi Jani, > >> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c > >> index d29a06ea51a5..362282b20f7b 100644 > >> --- a/drivers/gpu/drm/i915/i915_vgpu.c > >> +++ b/drivers/gpu/drm/i915/i915_vgpu.c > >> @@ -67,6 +67,7 @@ void intel_vgpu_detect(struct drm_i915_private *dev_priv) > >> u64 magic; > >> u16 version_major; > >> void __iomem *shared_area; > >> + INIT_LIST_HEAD(&dev_priv->vgpu.entry); > > > > Despite what Sebastian is suggesting, I think the place is right > > (or almost right). > > > > But I wouldn't fix it this way. Initializing virtual GPUs is not > > mandatory, indeed it fails only during delete that is the only > > function that doesn't check whether the list is initialized. > > > > I would rather check whether the list is initialized before > > trying to delete it, with a nice comment saying that the list > > might not have been initialized and we want to avoid accessing an > > invalid list. > > Nope, none of this. > > The problem is intel_gvt_init() and intel_gvt_driver_remove() happening > at different abstraction levels in i915_driver.c, with the calls also > happening at different abstraction levels in the error path. > > Basically when i915_driver_hw_probe() returns with an error, the caller > has no way of knowing whether intel_gvt_init() succeeded or not, and any > call to intel_gvt_driver_remove() is bound to be wrong. > > The fix is not to make intel_gvt_driver_remove() "gracefully" handle > broken probe/cleanup calls, but to fix the probe/cleanup calls. Yes, agree, the initialization of the vgpu is a little fancy (I was about to re-reply right after my reply with a better suggestion, but I didn't want to spam) But as a fast one- liner and correct cleanup we have the choice to gracefully remove the driver or freak out because we are trying to delete a list that is not initialized. [*] https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8711/shard-dg2-5/igt@i915_module_load@fault-injection.html#dmesg-warnings385 > MichaƂ is actually looking into this, Cc'd. Good that Michal is looking into this. Thank you, Andi