Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2771138rwb; Sun, 15 Jan 2023 22:18:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0SfuBmvQkJGbkFoBNI1lF7GWkkPa7pR4XbRNRmrVuJx2iCffzbgh8ixrL1yWX04XBZF90 X-Received: by 2002:a05:6402:54b:b0:49c:96f9:417e with SMTP id i11-20020a056402054b00b0049c96f9417emr9924188edx.2.1673849920373; Sun, 15 Jan 2023 22:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673849920; cv=none; d=google.com; s=arc-20160816; b=aaHQFvqpDbCg3Lnzqq7WWhFXpvC2YF5aawwPUHwWPEKour1WsUVBcQ5bOfOPvv9OuY G60QtPTPiyvjALAaMLtlJyg/GCYSs0OioKNbI7EsdGs/iBt0NmQB2WIyQowi3mKJCYe8 3Okya2tcrus1RPK+fHJafxZL24o0bE6SwwdccCl+MyJtZhuN4ayxHWkce+tHLGRKtffR pxtRKMamPcX1gffiytJBEfWRPWR5tZOqjcZH15FH5aDzUbCZveFFEAL9li5V/a5SCbkE W0mvHO605Ay4H/D1GIG6gN8XphAcxcWWbBsTzIuVJdxcoKKPdEpgscaQos12bdtrzNt8 IE4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=rBTPWyj79UsBCm2Gjb8wvXIuyAWW/0JocDzuLfwi/8E=; b=rCCBT6tPbeBfOfG7h9R5uFjntT8wZhoPPuWkdpKcc5BuqB3xBDQgbZMZxuPWdlDuxv 8dbejhjRusMnPw/CpkCT0lPMqt74hiw0flFQ2kKlnLe3rV/o1cer5llKgC414OOVlLg2 9N9ReBqIpO1pvqfIPVWLr2iNTIaFS3dT7/8kiPGF+qTKcKMujAO/niRVsglyOwPdl3zn KU45AOaqmS0lhKMEbciUlUtKvmuGnGOsZeCiYxbMRqoelOB5Y0H7/9FVrprCXGgmpD1l Pr+6lsBOUbU2DyBDknzpaXcFI8gtJj61z/huvroBndXnTMMJeohSz/m/wDwzrEPLHOqD uuEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="R/cVY+IU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec18-20020a0564020d5200b0046b0205ab58si25230828edb.580.2023.01.15.22.18.26; Sun, 15 Jan 2023 22:18:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="R/cVY+IU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbjAPGFp (ORCPT + 54 others); Mon, 16 Jan 2023 01:05:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbjAPGFm (ORCPT ); Mon, 16 Jan 2023 01:05:42 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ACF9A242 for ; Sun, 15 Jan 2023 22:05:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673849141; x=1705385141; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=3DzfFkJlxyL6+WAZYtHcFZtPqjNL1ubLVlcCB3tZvjw=; b=R/cVY+IU6lJklO/4PtJYwQmRV1UO34ybI5J54vSq/Rvim2plgEd0vzVC OAQWpZ3/mAorqvIvzI6OyvNjv8LIr4mVptV+91M13MgR2Da9xKMKD2KaF 6+jp/8JtQaIzIaBVTVXC8cDEKssTZCNOpVtxwRINJ786w3ceC/nJ3N9AF ZifuofnJE93uBKtF6DOg5RZogtJC7ZsQjXEIh+zjnmC1Rod1z7fCqG6Yr FQQNmvChVKU7AFPU4B39EexveDRTLYR4AkFaAjYpNU8DpVBDEqFjyrEEd RdsooJywtxzmZtUeMqXWvMRD8R+xLGjWDrFC9Z3psX2Pv2dfVDJ/267ZQ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="324451203" X-IronPort-AV: E=Sophos;i="5.97,220,1669104000"; d="asc'?scan'208";a="324451203" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 22:05:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="722185818" X-IronPort-AV: E=Sophos;i="5.97,220,1669104000"; d="asc'?scan'208";a="722185818" Received: from zhen-hp.sh.intel.com (HELO zhen-hp) ([10.239.159.108]) by fmsmga008.fm.intel.com with ESMTP; 15 Jan 2023 22:05:36 -0800 Date: Mon, 16 Jan 2023 13:44:46 +0800 From: Zhenyu Wang To: Rodrigo Vivi Cc: Deepak R Varma , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Praveen Kumar , Saurabh Singh Sengar Subject: Re: [PATCH 2/2] drm/i915/gvt: Avoid full proxy f_ops for vgpu_status debug attributes Message-ID: Reply-To: Zhenyu Wang References: <188df08e0feba0cda2c92145f513dd4e57c6e6cf.1673375066.git.drv@mailo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MccZDuc/f2Etrv5V" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --MccZDuc/f2Etrv5V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2023.01.10 13:49:57 -0500, Rodrigo Vivi wrote: > On Wed, Jan 11, 2023 at 12:00:12AM +0530, Deepak R Varma wrote: > > Using DEFINE_SIMPLE_ATTRIBUTE macro with the debugfs_create_file() > > function adds the overhead of introducing a proxy file operation > > functions to wrap the original read/write inside file removal protection > > functions. This adds significant overhead in terms of introducing and > > managing the proxy factory file operations structure and function > > wrapping at runtime. > > As a replacement, a combination of DEFINE_DEBUGFS_ATTRIBUTE macro paired > > with debugfs_create_file_unsafe() is suggested to be used instead. The > > DEFINE_DEBUGFS_ATTRIBUTE utilises debugfs_file_get() and > > debugfs_file_put() wrappers to protect the original read and write > > function calls for the debug attributes. There is no need for any > > runtime proxy file operations to be managed by the debugfs core. > > Following coccicheck make command helped identify this change: > >=20 > > make coccicheck M=3Ddrivers/gpu/drm/i915/ MODE=3Dpatch COCCI=3D./script= s/coccinelle/api/debugfs/debugfs_simple_attr.cocci > >=20 > > Signed-off-by: Deepak R Varma >=20 > I believe these 2 gvt cases could be done in one patch. > But anyways, >=20 > Reviewed-by: Rodrigo Vivi >=20 > for both patches... and will leave these 2 patches for gvt folks > to apply. Unless they ack and I apply in the drm-intel along with the oth= er ones. > yeah, they're fine with me, feel free to apply them directly. Acked-by: Zhenyu Wang thanks! > > --- > > drivers/gpu/drm/i915/gvt/debugfs.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > >=20 > > diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/= gvt/debugfs.c > > index 03f081c3d9a4..baccbf1761b7 100644 > > --- a/drivers/gpu/drm/i915/gvt/debugfs.c > > +++ b/drivers/gpu/drm/i915/gvt/debugfs.c > > @@ -165,7 +165,7 @@ static int vgpu_status_get(void *data, u64 *val) > > return 0; > > } > > =20 > > -DEFINE_SIMPLE_ATTRIBUTE(vgpu_status_fops, vgpu_status_get, NULL, "0x%l= lx\n"); > > +DEFINE_DEBUGFS_ATTRIBUTE(vgpu_status_fops, vgpu_status_get, NULL, "0x%= llx\n"); > > =20 > > /** > > * intel_gvt_debugfs_add_vgpu - register debugfs entries for a vGPU > > @@ -182,8 +182,8 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *= vgpu) > > &vgpu_mmio_diff_fops); > > debugfs_create_file_unsafe("scan_nonprivbb", 0644, vgpu->debugfs, vgp= u, > > &vgpu_scan_nonprivbb_fops); > > - debugfs_create_file("status", 0644, vgpu->debugfs, vgpu, > > - &vgpu_status_fops); > > + debugfs_create_file_unsafe("status", 0644, vgpu->debugfs, vgpu, > > + &vgpu_status_fops); > > } > > =20 > > /** > > --=20 > > 2.34.1 > >=20 > >=20 > >=20 --MccZDuc/f2Etrv5V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTXuabgHDW6LPt9CICxBBozTXgYJwUCY8TkSQAKCRCxBBozTXgY J3FGAJ4wFe9wnMtxUPhaCOCDkSZhBAzzgQCglj/FAfmvPCFfTpHDMapaW6QFeTY= =AIVR -----END PGP SIGNATURE----- --MccZDuc/f2Etrv5V--