Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp597457lqm; Wed, 1 May 2024 09:47:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWiYqRa5mpN4+3SnnGiI/fP72kAcuYSWI5HBmOU/lZmUmAYlD44Zpr8pxGMi4o+vMGH3djiAq30m6IU/mJ+4/YoHjCWfPgOdW7hXeenMQ== X-Google-Smtp-Source: AGHT+IH8pYlQUPPOP06JxalSb4MwTypIzKz/p8ynCGr8Q8JVzhSJPj1aAm5v6WLU8ME/7hGaoj/m X-Received: by 2002:a05:690c:7088:b0:61b:849d:39d0 with SMTP id jg8-20020a05690c708800b0061b849d39d0mr3648675ywb.16.1714582030411; Wed, 01 May 2024 09:47:10 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c2-20020a05622a024200b0043ae6d1c6c8si7617543qtx.395.2024.05.01.09.47.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MiTNaz2X; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-165602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165602-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D0431C2278E for ; Wed, 1 May 2024 16:47:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE6DF14005; Wed, 1 May 2024 16:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MiTNaz2X" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 AE6A3E542 for ; Wed, 1 May 2024 16:46:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.16 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714582020; cv=fail; b=EFk3nPEAG/UlHjBO9HQ1mSXJENWNdsxgsEQlkCo3gA8fTEjku90m393zYlh15pvcNwj6RVmmuC8FTi4yVaA9XiwyG4pehtdvT5cWyKuLttcNp9UsjfkFtfrZMcrpphtL1dBg3SanmaRLo8HHlkA5jIvJTr/JTuU5ixCNVB7nQ6E= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714582020; c=relaxed/simple; bh=L+6UPKw7xznMKUVCS/aFXdAnwYxxoaXDdYZ1rBT0n2U=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=o2mHEspf7ejiv3dN+SbWm8t7Up+whJmJgC3P1qtfwZJNEky4gMwwb/GuOdDGxEhN0Dajiw2jaxgmaPGTzscHZ8rXi5EFigm2qlcdGU5HYv6PwvFrfRNwfajR6Es0V7/xQGzjWzTGuPeTV8HIFPN2FmqwrzuTEkXJQ9Bbq4lWHTM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MiTNaz2X; arc=fail smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=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=1714582019; x=1746118019; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=L+6UPKw7xznMKUVCS/aFXdAnwYxxoaXDdYZ1rBT0n2U=; b=MiTNaz2XZMZlWDAwmZtPK+ZnK2AeIJQnDpZ1QkpsmuNBTBdi1+Oq+oZY Gq9e7XG5nz9MlTQTLhXX0dUalwWzTxum5Bc/3W5VPrf5y0FpGVJA2NNSY yH903HfNaHmdd8LASQoVPJfrlsmd7vSo/ZwChpMYCylgwFAvoHs0zg14+ J6vvYRE9FM8cpCJ6sK2aCNQfC28237sZEz3vU40lkNeC7yipZXPM2ZvDw pzOBf3f4KRQTctWlctA38kP2aZ4FV/mQ8PrvnqGebSljq8ZbF7d3zDWBK y3GOgtbKXYey+Sz07M6GgMxR/tgaLqeS6gZ0J94SwR2x3qvmJPMxl76pn A==; X-CSE-ConnectionGUID: xKhkNncUQNmvIu/xj0UUVA== X-CSE-MsgGUID: X2Y5/Kp5TbGGPTmB/taxUg== X-IronPort-AV: E=McAfee;i="6600,9927,11061"; a="10443535" X-IronPort-AV: E=Sophos;i="6.07,245,1708416000"; d="scan'208";a="10443535" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2024 09:46:58 -0700 X-CSE-ConnectionGUID: nWbvDOhcRfGcvMoMfViNOA== X-CSE-MsgGUID: rM5vpp2aS+iAYdDfBm7xnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,245,1708416000"; d="scan'208";a="26692240" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa010.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 May 2024 09:46:58 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 1 May 2024 09:46:57 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 1 May 2024 09:46:56 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 1 May 2024 09:46:56 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 1 May 2024 09:46:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=krOUqvW2tXYlbX1ZPgRaqiKE9h558nCTjlC+f3ctCLSmLNFgOeH0tLJfygkgD0VE/3uIBlvMn9ZGFjIIuAD5dsV3BhuxU6+K4/z6ekIggrx0lWWHBLWpOonxYT8tgIM99pdDrwKgttKMGYVGhuxpiC8/tIrTdEC5qKkvtnW7OlvTvE/k25RRgphNIw2yE4hWdtQhNCXtNn12AvzhuAqqx0cb0dik/Yu32/x/RAeHbh0qpvFwTtyFMpsTBjJVzsI8KBvvYf2gKvyNneD17iT/gZkulzh08iE+PjhRucjTMi7jpuAJutsa8VdHg+SgH3OIpd5mjNJVbQqg1HkGjTyNXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=gaPuwEYmutcWzq7YBAtZHOpyovpBQNDb1OkxxukiMf4=; b=M6Y2rXpCNbp6aKLZjLxgyClQms2AG2zuTDQgtYObnAjXO7p8lIZtKnuUdbIIuPBlavkbfo1dMfQxtWY2AZxQAhhgQSmVtcjK2R/DjqQrvsvAB1rr0Dv5S8CVUauOkPlp6ZmBz3dEvHArl7DH6htDEmHR3HshDwebSQ40Nm9vMcg+8t6anFWW8wTyWmVTnp1Y5Fmhh9pFqVBWh8zuJxHtCS07jmamZZljpavFZwrP+1AsZuXGQcC4bQAXNPjsL69cvNy8ZJ2sig+wa4NlJe+busO9KM2JEb+kn8f4OC+C7vIAlRrd95doY47UkM65DhhkttmHfvey36w/KQs5H3ddsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CY5PR11MB6139.namprd11.prod.outlook.com (2603:10b6:930:29::17) by SA2PR11MB5195.namprd11.prod.outlook.com (2603:10b6:806:11a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Wed, 1 May 2024 16:46:54 +0000 Received: from CY5PR11MB6139.namprd11.prod.outlook.com ([fe80::9365:d8e6:4e8d:8711]) by CY5PR11MB6139.namprd11.prod.outlook.com ([fe80::9365:d8e6:4e8d:8711%6]) with mapi id 15.20.7519.031; Wed, 1 May 2024 16:46:53 +0000 Date: Wed, 1 May 2024 11:46:50 -0500 From: Lucas De Marchi To: Rob Clark CC: Tvrtko Ursulin , =?utf-8?Q?Adri=C3=A1n?= Larumbe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Hans de Goede , , Boris Brezillon , Christopher Healy , , Subject: Re: [PATCH] drm/sysfs: Add drm class-wide attribute to get active device clients Message-ID: References: <20240403182951.724488-1-adrian.larumbe@collabora.com> <4btlparspmb47v3nq3mip6cjr2adwejepnglvh6q5nlbmdzwvt@74gg6tjpngbv> <54ebd0a0-dc9d-43d7-b530-065832cda160@ursulin.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: MW4PR04CA0192.namprd04.prod.outlook.com (2603:10b6:303:86::17) To CY5PR11MB6139.namprd11.prod.outlook.com (2603:10b6:930:29::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR11MB6139:EE_|SA2PR11MB5195:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c31a152-fbb5-447c-0f2c-08dc69fe4e59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|376005|366007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WkFDeTFJb3dHbjhOT05xYlM1TzV1WnBQaFlTU3Z1eWdrUkUzM3JYbjJJenJL?= =?utf-8?B?Z3A1dzhBc3E5cHpiTG9XTktKUjd5dUZjSXhmYTBGU05adkU0N3plTzllVmhp?= =?utf-8?B?MndXS2xRYUVFRm5mRTlYczcvaW1VWnRRVHRRdkIyNkt3cXFIM211M0REanhL?= =?utf-8?B?b01aK1NUdWtGZEVnakV3WUlxUDNVd2JhZW5IMXlwQWpackUyYitKZmQvUGcw?= =?utf-8?B?bXQ0bFlwV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= =?utf-8?B?cHpEVGNhY1lNN21KL08velZ3ZlUrYi9oZXIvVXBNMkFPa0wweXgwcnNleDdG?= =?utf-8?B?cTZEbFd4YTYybGZRLzUyaW5yNkxOQkF3RlJKQm9KVk1LaHBNQVN5UEs3MHJz?= =?utf-8?B?ODJyREFCaGNoRXJwR09taEtsVVRkSTBkRnQ3em02eWZnTnJVYkxiN1NZb0tp?= =?utf-8?B?OHdNUnRiSnlkVDU0ZVF1VDU0VnJqV0dVNTk1TDRVeWdoU09PSEFDSnRtL3Vy?= =?utf-8?B?NFBuVXk0TnV4NC9XaDFCN0FjZ1daUGFRRWtTOGdQYkp2dXNWalJmMTRVWWp3?= =?utf-8?B?QVdWREFsdlZiS21GSHR0OWt0QjVZek5ZZXkvVHRIdjMzR1pHOEFGRVVQc0po?= =?utf-8?B?TlZSYlhITHRGOHBhbCsycXpBeW1GZW5TVElUcC9Zc1QvWFNDQVpaRlF1WnI1?= =?utf-8?B?VUlFa0xoZlA5R2QydExwZVJteUxwcGJWdUQ5OHRLYUdZRnRwQUx5NTBoZThx?= =?utf-8?B?YXcxckJYY29oeXlUYS9iMXpUYUNUYzBWcVFTYnB4M2V0bHBSSk94TzJndFNh?= =?utf-8?B?ZUkzRWZ0aU5qZCs3VlZ1VzBRenBmc3pEZEM0VGVtNWRYU1FYQlJCSzZRPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR11MB6139.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NVpMVngwck91TkM1bHdKWUZxZTJRU2JQZm8wUkw3VC9ySUlvRnFjMEV6MzBr?= =?utf-8?B?TWdiNThtK2FKMzl3U1pGN2ttWENDandWZi96QXVEblhoOTU4UTc1QytM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BUzJjN0JGY2M5NXhMbTRhbWpjSzBrWE5aZjZj?= =?utf-8?B?QkVzaEcvRTVWZzFGMFhBWmZodEh1alBJZWVTSDdVVWdPOGsxZWk1My82L3ox?= =?utf-8?B?bWF4N0E1WlozQTZ3ektHbEZZQ05IREZROXVvQkcxMzQ4ZWZXQ05pMVhpQzJo?= =?utf-8?B?WFlLdlZmMEpmQlNheVBGRkdkcGlkeGJyc1E0Slk0ZkhLMW9QMFlyRWY4bmRm?= =?utf-8?B?WCtkM0FyQWtDRlJYTU52eWZaRWFUSFBrbnhtTlJiVENNNEE2d2Q2QVQ5NU50?= =?utf-8?B?anc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5c31a152-fbb5-447c-0f2c-08dc69fe4e59 X-MS-Exchange-CrossTenant-AuthSource: CY5PR11MB6139.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 16:46:53.8683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7q7xiNIhiTRdPO28SQUC9BAK1XvS2wQmaWigCufp6aIsykNJKlGVNaVJE9/cmoiy/kYeIh/PsJoEWzhLBQHngJWRMz9RNcxzA2EwWV2DUlI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5195 X-OriginatorOrg: intel.com On Wed, May 01, 2024 at 09:25:01AM GMT, Rob Clark wrote: >On Wed, May 1, 2024 at 9:19 AM Lucas De Marchi wrote: >> >> On Wed, May 01, 2024 at 04:58:05PM GMT, Tvrtko Ursulin wrote: >> > >> >Hi, >> > >> >On 24/04/2024 15:48, Adrián Larumbe wrote: >> >>Hi Tvrtko, >> >> >> >>On 15.04.2024 13:50, Tvrtko Ursulin wrote: >> >>> >> >>>On 05/04/2024 18:59, Rob Clark wrote: >> >>>>On Wed, Apr 3, 2024 at 11:37 AM Adrián Larumbe >> >>>> wrote: >> >>>>> >> >>>>>Up to this day, all fdinfo-based GPU profilers must traverse the entire >> >>>>>/proc directory structure to find open DRM clients with fdinfo file >> >>>>>descriptors. This is inefficient and time-consuming. >> >>>>> >> >>>>>This patch adds a new device class attribute that will install a sysfs file >> >>>>>per DRM device, which can be queried by profilers to get a list of PIDs for >> >>>>>their open clients. This file isn't human-readable, and it's meant to be >> >>>>>queried only by GPU profilers like gputop and nvtop. >> >>>>> >> >>>>>Cc: Boris Brezillon >> >>>>>Cc: Tvrtko Ursulin >> >>>>>Cc: Christopher Healy >> >>>>>Signed-off-by: Adrián Larumbe >> >>>> >> >>>>It does seem like a good idea.. idk if there is some precedent to >> >>>>prefer binary vs ascii in sysfs, but having a way to avoid walking >> >>>>_all_ processes is a good idea. >> >>> >> >>>I naturally second that it is a needed feature, but I do not think binary >> >>>format is justified. AFAIR it should be used for things like hw/fw >> >>>standardised tables or firmware images, not when exporting a simple list of >> >>>PIDs. It also precludes easy shell/script access and the benefit of avoiding >> >>>parsing a short list is I suspect completely dwarfed by needing to parse all >> >>>the related fdinfo etc. >> >> >> >>I'd rather keep it as a binary file for the sake of easily parsing the number >> >>list on the client side, in gputop or nvtop. For textual access, there's already >> >>a debugfs file that presents the same information, so I thought it was best not >> >>to duplicate that functionality and restrict sysfs to serving the very specific >> >>use case of UM profilers having to access the DRM client list. >> >> >> >>I should mention I did something controversial here, which is a semantically >> >>binary attribute through the regular attribute interface. I guess if I keep it >> >>as a binary attribute in the end, I should switch over to the binary attribute >> >>API. >> >> >> >>Another reason why I implemented it as a binary file is that we can only send >> >>back at most a whole page. If a PID takes 4 bytes, that's usually 1024 clients >> >>at most, which is probably enough for any UM profiler, but will decrease even >> >>more if we turn it into an ASCII readable file. >> > >> >I'm afraid I still think there is no reason for a binary file, even >> >less so artificially limited to 1024 clients. Any consumer will have >> >to parse text fdinfo so a binary list of pids is not adding any real >> >cost. >> >> yeah, I don't really understand why you'd want the binary number that >> you'd then have to turn into a string to open the /proc//. To me it >> sounds more like we want a text output and that output to be: >> >> /fdinfo/ >> >> So gputop could just read this file to know where the info is. >> Too bad we can't symlink cross fs, otherwise we could just add symlinks >> to e.g. /sys/class/drm/card/clients/*, which then nicely separate it >> per gpu too. >> >> But see below. >> >> > >> >>I did some research into sysfs binary attributes, and while some sources mention that >> >>it's often used for dumping or loading of driver FW, none of them claim it cannot >> >>be used for other purposes. >> >> >> >>>>>--- >> >>>>> drivers/gpu/drm/drm_internal.h | 2 +- >> >>>>> drivers/gpu/drm/drm_privacy_screen.c | 2 +- >> >>>>> drivers/gpu/drm/drm_sysfs.c | 89 ++++++++++++++++++++++------ >> >>>>> 3 files changed, 74 insertions(+), 19 deletions(-) >> >>>>> >> >>>>>diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h >> >>>>>index 2215baef9a3e..9a399b03d11c 100644 >> >>>>>--- a/drivers/gpu/drm/drm_internal.h >> >>>>>+++ b/drivers/gpu/drm/drm_internal.h >> >>>>>@@ -145,7 +145,7 @@ bool drm_master_internal_acquire(struct drm_device *dev); >> >>>>> void drm_master_internal_release(struct drm_device *dev); >> >>>>> >> >>>>> /* drm_sysfs.c */ >> >>>>>-extern struct class *drm_class; >> >>>>>+extern struct class drm_class; >> >>>>> >> >>>>> int drm_sysfs_init(void); >> >>>>> void drm_sysfs_destroy(void); >> >>>>>diff --git a/drivers/gpu/drm/drm_privacy_screen.c b/drivers/gpu/drm/drm_privacy_screen.c >> >>>>>index 6cc39e30781f..2fbd24ba5818 100644 >> >>>>>--- a/drivers/gpu/drm/drm_privacy_screen.c >> >>>>>+++ b/drivers/gpu/drm/drm_privacy_screen.c >> >>>>>@@ -401,7 +401,7 @@ struct drm_privacy_screen *drm_privacy_screen_register( >> >>>>> mutex_init(&priv->lock); >> >>>>> BLOCKING_INIT_NOTIFIER_HEAD(&priv->notifier_head); >> >>>>> >> >>>>>- priv->dev.class = drm_class; >> >>>>>+ priv->dev.class = &drm_class; >> >>>>> priv->dev.type = &drm_privacy_screen_type; >> >>>>> priv->dev.parent = parent; >> >>>>> priv->dev.release = drm_privacy_screen_device_release; >> >>>>>diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c >> >>>>>index a953f69a34b6..56ca9e22c720 100644 >> >>>>>--- a/drivers/gpu/drm/drm_sysfs.c >> >>>>>+++ b/drivers/gpu/drm/drm_sysfs.c >> >>>>>@@ -58,8 +58,6 @@ static struct device_type drm_sysfs_device_connector = { >> >>>>> .name = "drm_connector", >> >>>>> }; >> >>>>> >> >>>>>-struct class *drm_class; >> >>>>>- >> >>>>> #ifdef CONFIG_ACPI >> >>>>> static bool drm_connector_acpi_bus_match(struct device *dev) >> >>>>> { >> >>>>>@@ -128,6 +126,62 @@ static const struct component_ops typec_connector_ops = { >> >>>>> >> >>>>> static CLASS_ATTR_STRING(version, S_IRUGO, "drm 1.1.0 20060810"); >> >>>>> >> >>>>>+static ssize_t clients_show(struct device *cd, struct device_attribute *attr, char *buf) >> >>>>>+{ >> >>>>>+ struct drm_minor *minor = cd->driver_data; >> >>>>>+ struct drm_device *ddev = minor->dev; >> >>>>>+ struct drm_file *priv; >> >>>>>+ ssize_t offset = 0; >> >>>>>+ void *pid_buf; >> >>>>>+ >> >>>>>+ if (minor->type != DRM_MINOR_RENDER) >> >>>>>+ return 0; >> >>> >> >>>Why this? >> >> >> >>I return nothing in case of a non-render node because we don't want display drivers >> >>to confuse UM GPU profilers. >> > >> >Feels to arbitrary to me. Let them handle it. >> > >> >>>>>+ >> >>>>>+ pid_buf = kvmalloc(PAGE_SIZE, GFP_KERNEL); >> >>> >> >>>I don't quite get the kvmalloc for just one page (or why even a temporay >> >>>buffer and not write into buf directly?). >> >> >> >>Should've used kmalloc, you're right. Or else I could just write everything straight into 'buf'. >> >> >> >>>>>+ if (!pid_buf) >> >>>>>+ return 0; >> >>>>>+ >> >>>>>+ mutex_lock(&ddev->filelist_mutex); >> >>>>>+ list_for_each_entry_reverse(priv, &ddev->filelist, lhead) { >> >>>>>+ struct pid *pid; >> >>>>>+ >> >>>>>+ if (drm_WARN_ON(ddev, (PAGE_SIZE - offset) < sizeof(pid_t))) >> >>>>>+ break; >> >>> >> >>>Feels bad.. I would suggest exploring implementing a read callback (instead of >> >>>show) and handling arbitrary size output. >> >> >> >>I think regular class attributes can only implement show() and set(). For a more complex >> >>interface, I would have to turn it into an actual binary attribute, and that would be the only >> >>choice if we want the list of clients to be of arbitrary size. >> > >> >Yeah, i915 uses that to dump the error capture file which can be huge >> >and is text so it is doable. >> > >> >>>>>+ >> >>>>>+ rcu_read_lock(); >> >>>>>+ pid = rcu_dereference(priv->pid); >> >>>>>+ (*(pid_t *)(pid_buf + offset)) = pid_vnr(pid); >> >>>>>+ rcu_read_unlock(); >> >>>>>+ >> >>>>>+ offset += sizeof(pid_t); >> >>>>>+ } >> >>>>>+ mutex_unlock(&ddev->filelist_mutex); >> >>>>>+ >> >>>>>+ if (offset < PAGE_SIZE) >> >>>>>+ (*(pid_t *)(pid_buf + offset)) = 0; >> >>> >> >>>Either NULL terminated or PAGE_SIZE/sizeof(pid) entries and not NULL >> >>>terminated feels weird. If I got that right. >> >>> >> >>>For me everything points towards going for text output. >> >> >> >>Yes, I know it might sound weird, but my reasoning was: either there are PAGE_SIZE/sizeof(pid) entries >> >>and the file isn't NULL terminated (which should be picked up by clients as being one page worth >> >>of data, the sysfs attribute maximum transfer unit), or else there aren't enough entries to fill >> >>a page and after the last one there's a NULL entry. >> >> >> >> >> >>>>>+ >> >>>>>+ memcpy(buf, pid_buf, offset); >> >>>>>+ >> >>>>>+ kvfree(pid_buf); >> >>>>>+ >> >>>>>+ return offset; >> >>>>>+ >> >>>>>+} >> >>>>>+static DEVICE_ATTR_RO(clients); >> >> >> /proc//fdinfo/ is only readable by the owner. if we report what are >> the open fds (or even what are the pids with a drm fd), we are >> leaking that info. So we should probably make this >> DEVICE_ATTR_ADMIN_RO. > >I think this is an argument for _only_ listing the PID and not full >paths. I have a use-case where I'd prefer it not to be >DEVICE_ATTR_ADMIN_RO maybe... today you still can't get the pids that have a file open, even if you don't get the exact fd number. And it must have some good reasons because the dir is S_IRUGO|S_IXUGO, yet kernel refuses to let me see what is inside. This is interesting and possibly relevant to the discussion: 7bc3fa0172a4 ("procfs: allow reading fdinfo with PTRACE_MODE_READ") > >That said, I think I do prefer txt rather than binary. If nothing >else, it makes it easier to deal with for scripting, which is also >useful sometimes. agreed. Even if it's only pid, just make it text and the app will use it as is to open the fdinfo path. Lucas De Marchi > >BR, >-R > >> Lucas De Marchi >> >> >>> >> >>>Shouldn't BIN_ATTR_RO be used for binary files in sysfs? >> >> >> >>Like I said above, I sort of faked a binary attribute through the regular sysfs attr API, >> >>which is most likely a bad idea. >> >> >> >>>Regards, >> >>> >> >>>Tvrtko >> >>> >> >>>P.S. Or maybe it is time for drmfs? Where each client gets a directory and >> >>>drivers can populate files. Such as per client logging streams and whatnot. >> >> >> >>Yes, but maybe this is something we can discuss in depth in an RFC at a later time? >> > >> >Yes of course, it is just a long standing idea for flexible per client >> >stuff. >> > >> >Regards, >> > >> >Tvrtko >> > >> >> >> >>>>>+ >> >>>>>+static struct attribute *drm_device_attrs[] = { >> >>>>>+ &dev_attr_clients.attr, >> >>>>>+ NULL, >> >>>>>+}; >> >>>>>+ATTRIBUTE_GROUPS(drm_device); >> >>>>>+ >> >>>>>+struct class drm_class = { >> >>>>>+ .name = "drm", >> >>>>>+ .dev_groups = drm_device_groups, >> >>>>>+}; >> >>>>>+ >> >>>>>+static bool drm_class_initialised; >> >>>>>+ >> >>>>> /** >> >>>>> * drm_sysfs_init - initialize sysfs helpers >> >>>>> * >> >>>>>@@ -142,18 +196,19 @@ int drm_sysfs_init(void) >> >>>>> { >> >>>>> int err; >> >>>>> >> >>>>>- drm_class = class_create("drm"); >> >>>>>- if (IS_ERR(drm_class)) >> >>>>>- return PTR_ERR(drm_class); >> >>>>>+ err = class_register(&drm_class); >> >>>>>+ if (err) >> >>>>>+ return err; >> >>>>> >> >>>>>- err = class_create_file(drm_class, &class_attr_version.attr); >> >>>>>+ err = class_create_file(&drm_class, &class_attr_version.attr); >> >>>>> if (err) { >> >>>>>- class_destroy(drm_class); >> >>>>>- drm_class = NULL; >> >>>>>+ class_destroy(&drm_class); >> >>>>> return err; >> >>>>> } >> >>>>> >> >>>>>- drm_class->devnode = drm_devnode; >> >>>>>+ drm_class.devnode = drm_devnode; >> >>>>>+ >> >>>>>+ drm_class_initialised = true; >> >>>>> >> >>>>> drm_sysfs_acpi_register(); >> >>>>> return 0; >> >>>>>@@ -166,12 +221,12 @@ int drm_sysfs_init(void) >> >>>>> */ >> >>>>> void drm_sysfs_destroy(void) >> >>>>> { >> >>>>>- if (IS_ERR_OR_NULL(drm_class)) >> >>>>>+ if (!drm_class_initialised) >> >>>>> return; >> >>>>> drm_sysfs_acpi_unregister(); >> >>>>>- class_remove_file(drm_class, &class_attr_version.attr); >> >>>>>- class_destroy(drm_class); >> >>>>>- drm_class = NULL; >> >>>>>+ class_remove_file(&drm_class, &class_attr_version.attr); >> >>>>>+ class_destroy(&drm_class); >> >>>>>+ drm_class_initialised = false; >> >>>>> } >> >>>>> >> >>>>> static void drm_sysfs_release(struct device *dev) >> >>>>>@@ -372,7 +427,7 @@ int drm_sysfs_connector_add(struct drm_connector *connector) >> >>>>> return -ENOMEM; >> >>>>> >> >>>>> device_initialize(kdev); >> >>>>>- kdev->class = drm_class; >> >>>>>+ kdev->class = &drm_class; >> >>>>> kdev->type = &drm_sysfs_device_connector; >> >>>>> kdev->parent = dev->primary->kdev; >> >>>>> kdev->groups = connector_dev_groups; >> >>>>>@@ -550,7 +605,7 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor) >> >>>>> minor_str = "card%d"; >> >>>>> >> >>>>> kdev->devt = MKDEV(DRM_MAJOR, minor->index); >> >>>>>- kdev->class = drm_class; >> >>>>>+ kdev->class = &drm_class; >> >>>>> kdev->type = &drm_sysfs_device_minor; >> >>>>> } >> >>>>> >> >>>>>@@ -579,10 +634,10 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor) >> >>>>> */ >> >>>>> int drm_class_device_register(struct device *dev) >> >>>>> { >> >>>>>- if (!drm_class || IS_ERR(drm_class)) >> >>>>>+ if (!drm_class_initialised) >> >>>>> return -ENOENT; >> >>>>> >> >>>>>- dev->class = drm_class; >> >>>>>+ dev->class = &drm_class; >> >>>>> return device_register(dev); >> >>>>> } >> >>>>> EXPORT_SYMBOL_GPL(drm_class_device_register); >> >>>>> >> >>>>>base-commit: 45c734fdd43db14444025910b4c59dd2b8be714a >> >>>>>-- >> >>>>>2.44.0 >> >>>>> >> >> >> >>Adrian Larumbe