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 6CB7EC4345F for ; Sat, 27 Apr 2024 01:30:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C652610FBD2; Sat, 27 Apr 2024 01:30:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="DWzj92oQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BDEC112603 for ; Sat, 27 Apr 2024 01:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714181446; x=1745717446; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=HOUbIV59lorYw6zAZzrIhfGibEw/FU7tktNG9cKYLRc=; b=DWzj92oQ1OVPNaktVA1NVVaTv50mFwWIYqeZOtwSHsFslwLEuMGkxWHZ hM1BFTvxgkkPe8kdKtmQiSbhGDRO2iQqugCCQ7BVhTDEAG1tOFBJTN30z RIwUk7+W0jMNoJFuxgFwTOJhw0kDE8/e+4rsrngnRT5mKnJiQknGt8+ff Sfi278VCfXEXnVQ8Gdx1mOqzoDyJr2WcFRn2+CeKKHeF9QJwaCfSsTfDt V0+6qEjzgznFfqElAd+isSVfz4pb2TG+rt1YMOeRZ/0hZd3Y1IaPNjq1O uzqgr8pfxlpsCzImR8zmhr/RU7yh6obM/eQjCIywBeg1fy9J63b4bmHQ1 A==; X-CSE-ConnectionGUID: KorIIOV8TX+BapGzmtORng== X-CSE-MsgGUID: hoEpFdFySWWA+qMwfJuPCw== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="20616197" X-IronPort-AV: E=Sophos;i="6.07,234,1708416000"; d="scan'208";a="20616197" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 18:30:45 -0700 X-CSE-ConnectionGUID: uT1B1ZM9SqKBhb+ppcVvQA== X-CSE-MsgGUID: rEdEVUGtQw2aiYirHffdow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,234,1708416000"; d="scan'208";a="30220161" Received: from orsosgc001.jf.intel.com (HELO orsosgc001.intel.com) ([10.165.21.138]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 18:30:45 -0700 Date: Fri, 26 Apr 2024 18:30:44 -0700 Message-ID: <85r0ery4l7.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Rodrigo Vivi Cc: , , Matthew Auld Subject: Re: [PATCH 10/10] drm/xe: Kill xe_device_mem_access_{get*,put} In-Reply-To: <20240307001554.162153-10-rodrigo.vivi@intel.com> References: <20240307001554.162153-1-rodrigo.vivi@intel.com> <20240307001554.162153-10-rodrigo.vivi@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-redhat-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Wed, 06 Mar 2024 16:15:54 -0800, Rodrigo Vivi wrote: > Hi Rodrigo/Matt, > @@ -409,14 +410,14 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, > if (err) > return err; > > - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); > + xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile)); > mutex_lock(&ggtt->lock); > err = drm_mm_insert_node_in_range(&ggtt->mm, &bo->ggtt_node, bo->size, > alignment, 0, start, end, 0); > if (!err) > xe_ggtt_map_bo(ggtt, bo); > mutex_unlock(&ggtt->lock); > - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); > + xe_pm_runtime_put(tile_to_xe(ggtt->tile)); > > return err; > } > @@ -434,7 +435,7 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo) > > void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node) > { > - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); > + xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile)); > mutex_lock(&ggtt->lock); > > xe_ggtt_clear(ggtt, node->start, node->size); > @@ -444,7 +445,7 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node) > xe_ggtt_invalidate(ggtt); > > mutex_unlock(&ggtt->lock); > - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); > + xe_pm_runtime_put(tile_to_xe(ggtt->tile)); Do __xe_ggtt_insert_bo_at and xe_ggtt_insert_bo need a runtime_pm reference held? In this series: https://patchwork.freedesktop.org/series/121084/ I am not holding a runtime_pm reference when these functions are called and it was fine with xe_device_mem_access_get/put (see xe_oa_alloc_oa_buffer/xe_oa_free_oa_buffer if needed). But after changing to xe_pm_runtime_get/put I now get this WARN: [11614.356168] xe 0000:00:02.0: Missing outer runtime PM protection [11614.356187] WARNING: CPU: 1 PID: 13075 at drivers/gpu/drm/xe/xe_pm.c:549 xe_pm_runtime_get_noresume+0x60/0x80 [xe] ... [11614.356377] Call Trace: [11614.356379] [11614.356381] ? __warn+0x7e/0x180 [11614.356387] ? xe_pm_runtime_get_noresume+0x60/0x80 [xe] [11614.356437] ? report_bug+0x1c7/0x1d0 [11614.356442] ? prb_read_valid+0x16/0x20 [11614.356447] ? handle_bug+0x3c/0x70 [11614.356451] ? exc_invalid_op+0x18/0x70 [11614.356453] ? asm_exc_invalid_op+0x1a/0x20 [11614.356460] ? xe_pm_runtime_get_noresume+0x60/0x80 [xe] [11614.356507] xe_ggtt_remove_node+0x22/0x80 [xe] [11614.356546] xe_ttm_bo_destroy+0xea/0xf0 [xe] [11614.356579] xe_oa_stream_destroy+0xf7/0x120 [xe] [11614.356627] xe_oa_release+0x35/0xc0 [xe] [11614.356673] __fput+0xa1/0x2d0 [11614.356679] __x64_sys_close+0x37/0x80 [11614.356697] do_syscall_64+0x6d/0x140 [11614.356700] entry_SYSCALL_64_after_hwframe+0x71/0x79 [11614.356702] RIP: 0033:0x7f2b37314f67 Also, the WARN above happens only for 'free' but not for 'alloc' (so not sure who gets the runtime_pm reference for 'alloc'). Holding the runtime_pm reference across alloc and free seems to be fine and makes this WARN disappear. So maybe I should just do that? Just trying to confirm. Thanks. -- Ashutosh