Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1662365rdb; Thu, 25 Jan 2024 02:23:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDIWlzISuuzF+b7X6wpa2aVFzpNmGb7bdywRHrsAByMRtu6CFtoEejQS+yuijjtLzd2god X-Received: by 2002:a17:90b:3b41:b0:290:6152:5b44 with SMTP id ot1-20020a17090b3b4100b0029061525b44mr381963pjb.23.1706178239567; Thu, 25 Jan 2024 02:23:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706178239; cv=pass; d=google.com; s=arc-20160816; b=VwAQLyqdMAGIBkSYnnqAkqFlDqDHV1U+b4X+cZg+kyq1UKZ5hPbSrZqdBQ3CJ6sUYC xWwu2DMbf2/87cTxvn8lCLTaUlBlalUc05ovEyn/p/0iQtoG2NRT4uImtKIPdxmF583Q 6Ir3zfkUTnL/c2eJuEA8T2MU6Z8CvpBUAJip7FTD4d5jjT80tgqgFy/XVjT5qi79OoyS T2REA85Dt8FPdfqY7hVv7wRq0EY3/iMTa+xD6PMS4Kkms9s6hksq69v3AMbiCzMGizCH I7aVCOLpkX8j4pOlnXtTkOgHWyS/dfYj5n374o/kN3fz9mppbirDNKO2tADaR9D507DL DaNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:organization:in-reply-to:subject:cc:to :from:dkim-signature; bh=oDh5gdzPJPFQjJEzkObyW/TF2I7YylZaNZvCsVB4KOY=; fh=WkZsHlbvfAVoikONC0Vw3wiDytIidF1XMU2EQ05DOA4=; b=WkXn5KB0qD1deXmnwVkSygsflX7utJ1pymSc2q1SCYJrkwN9HCrJoaSAdZFh2TRWP0 LzMtgcPGLyVep0sKKni9kf612CNsaUahXF9lLniy+VvVkaWSKOHkQ45UbKN1PuOIVPLs 8YCQIxsHSs39/2HlQb7PE7en1FC/Jr/hzpE1m1U0pRDHml9B5V3NUnJfyh0pvzODrA3x Mu1rHYUMPuyvOrB1z65VLNP5Q8bJXnqkqeTIX4rpPWLRDW6kRtfowCVERd3jEruw3a21 8588bmc8TsAMCYAQQFmAF7c3Ln89mTAaHbu6ePEQIkbKjjblRP5F66Kdu/XamPs+mFXx YLPg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bgAzILgj; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b21-20020a17090acc1500b002926a6f71c0si1094008pju.119.2024.01.25.02.23.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:23:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bgAzILgj; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5025BB2DECE for ; Thu, 25 Jan 2024 09:42:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7A841CD07; Thu, 25 Jan 2024 09:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bgAzILgj" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 ED1C21CAA1 for ; Thu, 25 Jan 2024 09:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706175710; cv=none; b=IqTuilKYxnpVpEE/SBfLDrbZ7RsXlRiDy8u7CutHO5BKuwMD6cx4ht5gZH/loFpOZt+LueLUhO7wryOsNFu33uKHRojqwZAsXq4/uzfZgFETbPhbgzeCzCdLnvMCpBl7tL2J/hHrIo6LW0O9sQEr9kFqZmdi1zVVctTR69HKtHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706175710; c=relaxed/simple; bh=WeBZw7CQQ/b0Kuc3VgepmfjtbEo4oCwHmiOwv7/FBic=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=GOB59X6CztC9LkZOn5lqkJtYw7BbL7Hdyp9Ut5CsRqnK36TR9v9QE7hp6rgpV5wih6FQF+Cu1lnZzFMWfGsRcS5PyS64TUpbyiMiFWt045tCvXJkVHMoe2QUcsPFynC3tD9RxnwlSuIhfFSSvvAiEGgixwQ0eVXIsByA9+wAWBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bgAzILgj; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706175709; x=1737711709; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=WeBZw7CQQ/b0Kuc3VgepmfjtbEo4oCwHmiOwv7/FBic=; b=bgAzILgjHtU/QDu5b6EHx7oVirh9vfHb5CCh4r3VTJCcQDr+X51Xky2v 6SBgdZyM9CIy/6matOWw2+F5IDzaKIZdjBVZKHN+0/y1zynE6mwrR0vm7 JcOTMOuZI3t0lB/YvrEgYozlEUCp8Mp/yxVoI0H8q/wRu3RHMzY2Nr5Zg I4rcf4AiUc4Al2gRvpQqdyOcQ1/uifai+tG9zw0IjE5t8S9+J4BW8FGjz ACYMUdLXLWyWv3kuQdzN5bbaI5p22noQauqFsD+WViF60onpppus60stJ KYjMJcf8SI47JEUwdX8+kIUsEGpXW2VDIvcGZRe99JYP3WI/0cNJODpn3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="20662385" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="20662385" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 01:41:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="959789568" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="959789568" Received: from cyrillet-mobl.ger.corp.intel.com (HELO localhost) ([10.252.58.252]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 01:41:43 -0800 From: Jani Nikula To: wangxiaoming321 , lucas.demarchi@intel.com, ogabbay@kernel.org, thomas.hellstrom@linux.intel.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: wangxiaoming321 Subject: Re: [PATCH] drm/xe/display: Fix memleak in display initialization In-Reply-To: <20240125063633.989944-1-xiaoming.wang@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20240125063633.989944-1-xiaoming.wang@intel.com> Date: Thu, 25 Jan 2024 11:41:40 +0200 Message-ID: <87bk99lpgr.fsf@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, 25 Jan 2024, wangxiaoming321 wrote: > In the call stack xe_device_probe -> xe_display_init_nommio -> intel_power_domains_init > Power_domains hasn't been cleaned up if return error, > which has do the clean in i915_driver_late_release call from i915_driver_probe. This has nothing to do with i915_*. If intel_power_domains_init() returns an error, it should have cleaned up after itself, not force its caller to do that. If there's an issue, please fix it in intel_power_domains_init(). BR, Jani. > > unreferenced object 0xffff88811150ee00 (size 512): > comm "systemd-udevd", pid 506, jiffies 4294674198 (age 3605.560s) > hex dump (first 32 bytes): > 10 b4 9d a0 ff ff ff ff ff ff ff ff ff ff ff ff ................ > ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 ................ > backtrace: > [] __kmem_cache_alloc_node+0x1c1/0x2b0 > [] __kmalloc+0x52/0x150 > [] __set_power_wells+0xc3/0x360 [xe] > [] xe_display_init_nommio+0x4c/0x70 [xe] > [] xe_device_probe+0x3c/0x5a0 [xe] > [] xe_pci_probe+0x33f/0x5a0 [xe] > [] local_pci_probe+0x47/0xa0 > [] pci_device_probe+0xc3/0x1f0 > [] really_probe+0x1a2/0x410 > [] __driver_probe_device+0x78/0x160 > [] driver_probe_device+0x1e/0x90 > [] __driver_attach+0xda/0x1d0 > [] bus_for_each_dev+0x7c/0xd0 > [] bus_add_driver+0x119/0x220 > [] driver_register+0x60/0x120 > [] 0xffffffffa05e50a0 > > Signed-off-by: wangxiaoming321 > --- > drivers/gpu/drm/xe/xe_display.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xe/xe_display.c b/drivers/gpu/drm/xe/xe_display.c > index 74391d9b11ae..2725afba4afb 100644 > --- a/drivers/gpu/drm/xe/xe_display.c > +++ b/drivers/gpu/drm/xe/xe_display.c > @@ -146,8 +146,10 @@ int xe_display_init_nommio(struct xe_device *xe) > intel_detect_pch(xe); > > err = intel_power_domains_init(xe); > - if (err) > + if (err) { > + intel_power_domains_cleanup(xe); > return err; > + } > > return drmm_add_action_or_reset(&xe->drm, xe_display_fini_nommio, xe); > } -- Jani Nikula, Intel