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 A7ECCC369BD for ; Wed, 16 Apr 2025 14:55:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4EA1310E95F; Wed, 16 Apr 2025 14:55:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="d3pzRBHM"; dkim-atps=neutral Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2043.outbound.protection.outlook.com [40.107.101.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B036D10E95B; Wed, 16 Apr 2025 14:55:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y839x7qV8S5zQS4iqRXetPBmHn61RfOGtP1ULNcKUovQipmwLBl3xRdfDPNKvyVNdhrbu4D2MSzESTU0QVPY+88N7NTCVTFIbUGb4o9023G+L/SF6gRQ4Ef3B616hjP1vS7u9cXvRuM6U4hJOmQw884DBla2vZTX5A7YdepWTgYydhELM5+489pbwTwFLCTgKskrLuT+CP1BsdMdproEMHSadzRAizJPyOLv1dKeAzbV/sTC9an4zl5WlEpRh4AcehLff3s2u8N9Bv0YmPtMJr94ZjRUfW6BS4zrV3iwMfkEnCmzxhb1H8iyeym6p/WmoYceGwT5Z9M9JVhjMfvOCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CiZx5H2cpxqR/CzM0A2N7YTdeQA69MvixRQ47qYw79c=; b=wC2TAJtEvkBDVbCqPeWKwXPo2suglKrJm2DN0MblCZ574srXWwHKioXUCn7tggCDOeBYdxx7wVxqOmeGDPuK017XMewO4NN8lbZYeqvn14z0l5xJeU1HNqUcDepEiR0FCrmQWlcY2bIo0DSxJvfRGjhbPgwfuPOesu0Fqjhxv+E7UuIZTez9fV4MCa439dvDIT7NRIP4hfvmJybQYSe79Hp3cwBE8155fmMMxUYuKymQtkkHyJgKoNjRFWyHw60kkDjcQjsNekuVSbRU0pC+Sv0x05BRTO8gVvZM6DeV+KTvoOOqzqaeKi23I9jqcLMFgmw1PEI+8Xnn8MscGdsPTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CiZx5H2cpxqR/CzM0A2N7YTdeQA69MvixRQ47qYw79c=; b=d3pzRBHMJB9uGRsJpV7T2vaXXwI4zuD+KcZeoWOO7Oc35HbVghO9AD67d/gQPQ/mWk/fD7lJsbsUgAwOhLfDYeetSkV5G08b49C4P7mR1kCqQxxr9q8K8Nhtch/ma8tKjK8mp/StKLdd8MMYGY4EgwppwuzuBS9Zm0lJ9fof6F4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5753.namprd12.prod.outlook.com (2603:10b6:208:390::15) by SJ5PPFFA661D690.namprd12.prod.outlook.com (2603:10b6:a0f:fc02::9ab) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.34; Wed, 16 Apr 2025 14:55:17 +0000 Received: from BL1PR12MB5753.namprd12.prod.outlook.com ([fe80::2b0e:7fc3:1d21:5d2e]) by BL1PR12MB5753.namprd12.prod.outlook.com ([fe80::2b0e:7fc3:1d21:5d2e%3]) with mapi id 15.20.8655.021; Wed, 16 Apr 2025 14:55:17 +0000 Content-Type: multipart/alternative; boundary="------------P0B0YtBHtcMoPnqsbor5cOxj" Message-ID: <00d67957-e47f-4c7b-a700-c1324e3b03db@amd.com> Date: Wed, 16 Apr 2025 20:25:11 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/5] drm: add macro drm_file_err to print process info To: Jani Nikula , Sunil Khatri , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , Tvrtko Ursulin , Pierre-Eric Pelloux-Prayer References: <20250416133144.862023-1-sunil.khatri@amd.com> <87lds0p4jh.fsf@intel.com> Content-Language: en-US From: "Khatri, Sunil" In-Reply-To: <87lds0p4jh.fsf@intel.com> X-ClientProxiedBy: PN4P287CA0131.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:2b1::9) To BL1PR12MB5753.namprd12.prod.outlook.com (2603:10b6:208:390::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5753:EE_|SJ5PPFFA661D690:EE_ X-MS-Office365-Filtering-Correlation-Id: dbf31e32-e437-4d77-2344-08dd7cf6b369 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|8096899003; X-Microsoft-Antispam-Message-Info: =?utf-8?B?b1NxVHF0S2NsVTN6QWsrczhVTHFXOENRR2xJbkVZMEZUeHlEZStPM3RpNEVG?= =?utf-8?B?MmpoMS9XSU12Z3I0dEluQXhUcjBrSkN6QmdtU2w3U2E1bU9pUm9aNzNaa1dJ?= =?utf-8?B?Smd1V1hvYzVzcXFiL1FzMVZ1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H/5x8/TI=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL1PR12MB5753.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(8096899003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?elFNNzA4L3FrRFRSUHRWNVlQamcra3V1SHIwRDBnTU11RkkxZ0hyVHJoVmdu?= =?utf-8?B?TkxISGhBcDhKQXVvMmJ0dGFlOGdnYUVnUDVYT2lBeUVuNjF3UEZCc1ZjZmY1?= =?utf-8?B?NWd4OGZ1d2dhT1J2a2JsMWNFanpCdCtpVlpzczNaRmxwT3cvU1pxRGdzUG9j?= =?utf-8?B?NDM0UXkzQXViTEVYY1k3bVFhNnlsY3d5Q3NiRENjM1pva05pZ0owMW5acFMx?= =?utf-8?B?Y1NBcnoydHZZZ0lHTC9NZllndFBCZmpuSVVTNmxnOW5MMzE2dlArdDl5RFRn?= =?utf-8?B?eWJKdXVOb0ZMbWRzSDBJZUNhdGdvblFwZm9IK2NMRzlnODR6Q09BUTh1TEpR?= =?utf-8?B?V2tVeEU0Z1VUYUNHK1N3TUE1ZWtoWExxOVJZWnBUVVJXdEgvK2VqeXJFT2Zo?= =?utf-8?B?YmgrbElzTWp4bXQ2QlBnakxDUmJ1dFlMYlhaTFhGQk5ybkdVUWJ6UmJWazJq?= =?utf-8?B?U25Zcnh4SDdOQm9IMHhZUHpMSU9OUGRzSHpaNGlPQ01mTWxOUFZUTzlXU25Z?= =?utf-8?B?ZTFKRHF1aWhoZDhFYlN3bkt6R2FDZkdYSkJjbG1ncWhXcUs0UFgvWHRoYWky?= =?utf-8?B?M09WVDBEZWFPNVc1OTUyNWQzdWxqaENJOHp0SHJNU2F0bng1WnhVM0t0OVE5?= =?utf-8?B?a0ZGYytKeUluREZJRmFnTHVZRzF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Us0Yll6K3dtM0dURGhWMjJmWVloaHFMZEVmd01taFFNaWxjYTFXTXA2?= =?utf-8?B?aUlWV08xNXJjd0pMT1dZSnQ1TmJ4OTcwRzVZMHd0TkRJVTRDRklnUUt0UlFH?= =?utf-8?B?WDMvR3hTTW5pemdtYlB6MTdJbHEwVUwzYWFsYTUvZWhoaGZ3TXZKVWVuTGUv?= =?utf-8?B?UERQODdEeDV1bVl3SmozZEZQWm9EOE9SazNZMHd1S2k3VU10UW9iVXZ1N0NP?= =?utf-8?B?bWFSTEZ5RG1sRGU0L3VpQVJ1UW15aXRsMGVBRThLMm9pejhtR3VEbmlGdXFV?= =?utf-8?B?ZkZTeVN5ZjVPclZFaE5FL1dPd1lzRDVycjdKRnNHaTlEa2N1R1FZNm9nOUxO?= =?utf-8?B?eVJvMHF4YmhUYWNoait2ei9kVFJkMUJlRzFnLzVkQ1NseXgrS2tUZ2YrUWt1?= =?utf-8?B?cjZWZEkxcXRQdVptSExJSlp3VDlnV2crZGF0eFVkdnFyaEpxRmx5c2Q0MnR4?= =?utf-8?B?cVFYRnBLSkNvakFhMjBTTTU5RFRyK0t0WmZkTjJDQnBHaUJhdkN0UjRrQTd3?= =?utf-8?Q?8AsLZzxcr84Ak4uomgKUNwTKh?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbf31e32-e437-4d77-2344-08dd7cf6b369 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5753.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2025 14:55:17.3629 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8PXQFU9OEXOAfFmUHRhSKEwFJHZCfgHq8kRPunUREsAcv18khftl+F9cBGbiEpIaKvYeEz5Rm4aICgLHO7qcxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPFFA661D690 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" --------------P0B0YtBHtcMoPnqsbor5cOxj Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/16/2025 7:55 PM, Jani Nikula wrote: > On Wed, 16 Apr 2025, Sunil Khatri wrote: >> Add a drm helper macro which append the process information for >> the drm_file over drm_err. >> >> Signed-off-by: Sunil Khatri >> --- >> include/drm/drm_file.h | 41 +++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 41 insertions(+) >> >> diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h >> index 94d365b22505..5ae5ad1048fb 100644 >> --- a/include/drm/drm_file.h >> +++ b/include/drm/drm_file.h >> @@ -37,6 +37,7 @@ >> #include >> >> #include >> +#include > Not a fan of including drm_print.h everywhere that drm_file.h is > included. We've been trying to get rid of this, and go the other > way. It's really hard to manage dependencies when everything ends up > including everything. Sure, right thing to do, will update. Not sure why i added it, may be in initial versions needed that :) regards Sunil >> >> struct dma_fence; >> struct drm_file; >> @@ -446,6 +447,46 @@ static inline bool drm_is_accel_client(const struct drm_file *file_priv) >> return file_priv->minor->type == DRM_MINOR_ACCEL; >> } >> >> +static struct task_struct *drm_task_lock(struct drm_file *file_priv) >> + __attribute__((__maybe_unused)); > inline is the keyword you're missing here, and that's why you've had to > add maybe unused... I guess that's true. Let me try that and will make it inline if no warning. Regards Sunil > >> +static struct task_struct *drm_task_lock(struct drm_file *file_priv) >> +{ >> + struct task_struct *task; >> + struct pid *pid; >> + >> + mutex_lock(&file_priv->client_name_lock); >> + rcu_read_lock(); >> + pid = rcu_dereference(file_priv->pid); >> + task = pid_task(pid, PIDTYPE_TGID); >> + return task; >> +} >> + >> +static void drm_task_unlock(struct drm_file *file_priv) __attribute__((__maybe_unused)); >> +static void drm_task_unlock(struct drm_file *file_priv) >> +{ >> + rcu_read_unlock(); >> + mutex_unlock(&file_priv->client_name_lock); >> +} > ...but *why* are you inlining these? To make this header self-contained, > I think you'd need to add maybe sched.h, pid.h, rcupdate.h, mutex.h, or > something. I consider static inlines actively harmful if they force you > to pull in a lot of other headers. It builds and works well and i dont see the need to sched.h and etc. I dont see which function you mean by inlining here, mind to share which functions ? Regards Sunil Khatri > >> +/** >> + * drm_file_err - Fill info string with process name and pid >> + * @file_priv: context of interest for process name and pid >> + * @fmt: prinf() like format string >> + * >> + * This update the user provided buffer with process >> + * name and pid information for @file_priv >> + */ >> +#define drm_file_err(file_priv, fmt, ...) \ >> + do { \ >> + struct task_struct *task; \ >> + struct drm_device *dev = file_priv->minor->dev; \ >> + \ >> + task = drm_task_lock(file_priv); \ >> + drm_err(dev, "comm: %s pid: %d client: %s " fmt, \ >> + task ? task->comm : "", task ? task->pid : 0, \ >> + file_priv->client_name ?: "Unset", ##__VA_ARGS__); \ >> + drm_task_unlock(file_priv); \ >> + } while (0) >> + > For that matter, why is *this* inline? For debugs it makes a little more > sense when it adds the function, but drm_err() doesn't. Not getting to know which function again you mean inline here ? Regards Sunil Khatri > > Make all of these real functions, no need to include drm_print.h, and > everything is better. Sure i will do that and thanks a lot for those inputs. > > BR, > Jani. > >> void drm_file_update_pid(struct drm_file *); >> >> struct drm_minor *drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id); --------------P0B0YtBHtcMoPnqsbor5cOxj Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 4/16/2025 7:55 PM, Jani Nikula wrote:
On Wed, 16 Apr 2025, Sunil Khatri <sunil.khatri@amd.com> wrote:
Add a drm helper macro which append the process information for
the drm_file over drm_err.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
---
 include/drm/drm_file.h | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 94d365b22505..5ae5ad1048fb 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -37,6 +37,7 @@
 #include <uapi/drm/drm.h>
 
 #include <drm/drm_prime.h>
+#include <drm/drm_print.h>
Not a fan of including drm_print.h everywhere that drm_file.h is
included. We've been trying to get rid of this, and go the other
way. It's really hard to manage dependencies when everything ends up
including everything.

Sure, right thing to do, will update. Not sure why i added it, may be in initial versions needed that :)

regards Sunil


    
 
 struct dma_fence;
 struct drm_file;
@@ -446,6 +447,46 @@ static inline bool drm_is_accel_client(const struct drm_file *file_priv)
 	return file_priv->minor->type == DRM_MINOR_ACCEL;
 }
 
+static struct task_struct *drm_task_lock(struct drm_file *file_priv)
+					__attribute__((__maybe_unused));
inline is the keyword you're missing here, and that's why you've had to
add maybe unused...

I guess that's true. Let me try that and will make it inline if no warning.

Regards
Sunil


+static struct task_struct *drm_task_lock(struct drm_file *file_priv)
+{
+	struct task_struct *task;
+	struct pid *pid;
+
+	mutex_lock(&file_priv->client_name_lock);
+	rcu_read_lock();
+	pid = rcu_dereference(file_priv->pid);
+	task = pid_task(pid, PIDTYPE_TGID);
+	return task;
+}
+
+static void drm_task_unlock(struct drm_file *file_priv) __attribute__((__maybe_unused));
+static void drm_task_unlock(struct drm_file *file_priv)
+{
+	rcu_read_unlock();
+	mutex_unlock(&file_priv->client_name_lock);
+}
...but *why* are you inlining these? To make this header self-contained,
I think you'd need to add maybe sched.h, pid.h, rcupdate.h, mutex.h, or
something. I consider static inlines actively harmful if they force you
to pull in a lot of other headers.

It builds and works well and i dont see the need to sched.h and etc. I dont see which function you mean by inlining here, mind to share which functions ?

Regards Sunil Khatri


+/**
+ * drm_file_err - Fill info string with process name and pid
+ * @file_priv: context of interest for process name and pid
+ * @fmt: prinf() like format string
+ *
+ * This update the user provided buffer with process
+ * name and pid information for @file_priv
+ */
+#define drm_file_err(file_priv, fmt, ...)						\
+	do {										\
+		struct task_struct *task;						\
+		struct drm_device *dev = file_priv->minor->dev;				\
+											\
+		task = drm_task_lock(file_priv);					\
+		drm_err(dev, "comm: %s pid: %d client: %s " fmt,			\
+			task ? task->comm : "", task ? task->pid : 0,			\
+			file_priv->client_name ?: "Unset", ##__VA_ARGS__);		\
+		drm_task_unlock(file_priv);						\
+	} while (0)
+
For that matter, why is *this* inline? For debugs it makes a little more
sense when it adds the function, but drm_err() doesn't.

Not getting to know which function again you mean inline here ?

Regards
Sunil Khatri


Make all of these real functions, no need to include drm_print.h, and
everything is better.
Sure i will do that and thanks a lot for those inputs.

BR,
Jani.

 void drm_file_update_pid(struct drm_file *);
 
 struct drm_minor *drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id);

    
--------------P0B0YtBHtcMoPnqsbor5cOxj--