Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp313411rwb; Wed, 18 Jan 2023 18:13:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyuDvuWw2uQQYdm1sXjhhwaAJjGjIDJ0k6o4spp0UwTms7hc6zQtPrpTrdWpME2e8h0XXy X-Received: by 2002:aa7:c0d4:0:b0:49d:9bd8:6253 with SMTP id j20-20020aa7c0d4000000b0049d9bd86253mr10282213edp.17.1674094403319; Wed, 18 Jan 2023 18:13:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674094403; cv=none; d=google.com; s=arc-20160816; b=yJUpksYt3EFtBCiLGpgPPwrY7r2YbItcaZutS+hsFMoJmYeBEfa9wOyQrGZo94P3Mo +B46XSIqAwtKkUjeLtBuqUe641Xsp5zgOcilqoW2rctITSh5cLQfHsDqXEAKy4VcJIp3 DGf+4few35nZLxweruTt1NPNmg1/MJ01JpZmyxScvYEfWEsjTur+oOINmLitRWG72OZ0 A8nr3S6J5RVpKHchFbIFcsBbH6125xVEmlJKMpk4JaWJu+er8rMtWIuLIVpKURbLmagi lWuQy0+fkniwaglCm3DDaxXvBlE+eCKTYYa4JEGIWXATaAZNWf8aa2el02B2rHvQUXW4 6G2A== 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=aHpDzcWwBQBmqkV7RBRjpH5sKUPtDXSBUR9mLFGoEIc=; b=NHf254NnYLaRE/Uo3tHBvo6NvJ/uv1a8TblVA5ALhzJBaB433ww5cc/rV2Id3/luzh P1FIOD8eYsn4K+HVP+UlvqhtFtaTRNiRW6qMbtIUBa3W3kmnnWAqm6CtEqFKJwrmdGgV IftgS5VBptzPkivXQKRYpK2oA6z5a6cQ2yildpXpkS3eXwYLHzLN0mvHQj2e5cE0cu5Y pgD7rCN0OhYnF7zFo5ypUztZ4Mep+CzS0TES7PXx1U9Ec9W5yQHWhB/FN0PBVlldOd2u BT2lwDbEubXS9Vm+LI4oYy1cNPenp3W6rBLdct5C8zZFwPmtetnXl0vyhE0qy5ho+7KG s1Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IS9nmjDX; 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 a16-20020aa7cf10000000b0049e05973164si11953743edy.148.2023.01.18.18.13.12; Wed, 18 Jan 2023 18:13:23 -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=IS9nmjDX; 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 S229561AbjASBuS (ORCPT + 44 others); Wed, 18 Jan 2023 20:50:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjASBrl (ORCPT ); Wed, 18 Jan 2023 20:47:41 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A518E3BDB8 for ; Wed, 18 Jan 2023 17:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674092842; x=1705628842; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=rKLFpP4rDqSelqFQXcW8rq5vU0H/8DBsHiwom/vp9P8=; b=IS9nmjDXXoX16Yr9mmhI7hyiahDmIsIs1wIxoHb7DSqBNHrfpSuUAfBL xp6UzL4Tfx0skgKJeFsM4BM2F1A5AtOh+hThodn3JmkgqEyAGIyTM57RX hAbWreDYTF2nQYKHNj3PAZkTYdm9YrT7kYSAsUyceKpiNMQHaRwyWz7h/ 0cHCh7nUV9w6Q4VDigs+jiCc7VCmxQVK+V1uqCOigr86Z0x6GZ/wCdMm6 ldabZiHMckP50jTe/rPnYxdH5KwiPucMmHW/u8gUpT/6MR5++bwtft1SW HBr5vyjFSZDFUnDgGaTAtxcSitecEgSzed3dpPL6u2YywCRt/f/FDGXSH w==; X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="305538065" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="asc'?scan'208";a="305538065" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 17:47:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="988819731" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="asc'?scan'208";a="988819731" Received: from zhen-hp.sh.intel.com (HELO zhen-hp) ([10.239.159.108]) by fmsmga005.fm.intel.com with ESMTP; 18 Jan 2023 17:47:17 -0800 Date: Thu, 19 Jan 2023 09:26:20 +0800 From: Zhenyu Wang To: Rodrigo Vivi Cc: Deepak R Varma , Zhenyu Wang , Saurabh Singh Sengar , dri-devel@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Praveen Kumar , Daniel Vetter , David Airlie Subject: Re: [Intel-gfx] [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="ZXQGCj+hEvN7Ovv3" 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 --ZXQGCj+hEvN7Ovv3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2023.01.18 11:44:55 -0500, Rodrigo Vivi wrote: > On Wed, Jan 18, 2023 at 10:18:11AM +0530, Deepak R Varma wrote: > > On Tue, Jan 17, 2023 at 02:29:37PM -0500, Rodrigo Vivi wrote: > > > On Mon, Jan 16, 2023 at 01:44:46PM +0800, Zhenyu Wang wrote: > > > > 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_fil= e() > > > > > > function adds the overhead of introducing a proxy file operation > > > > > > functions to wrap the original read/write inside file removal p= rotection > > > > > > functions. This adds significant overhead in terms of introduci= ng and > > > > > > managing the proxy factory file operations structure and functi= on > > > > > > wrapping at runtime. > > > > > > As a replacement, a combination of DEFINE_DEBUGFS_ATTRIBUTE mac= ro paired > > > > > > with debugfs_create_file_unsafe() is suggested to be used inste= ad. The > > > > > > DEFINE_DEBUGFS_ATTRIBUTE utilises debugfs_file_get() and > > > > > > debugfs_file_put() wrappers to protect the original read and wr= ite > > > > > > function calls for the debug attributes. There is no need for a= ny > > > > > > 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= =2E/scripts/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 other ones. > > > > > > > > >=20 > > > > yeah, they're fine with me, feel free to apply them directly. > > > >=20 > > > > Acked-by: Zhenyu Wang > > >=20 > > > Unfortunately I got some conflicts when trying to apply on drm-intel-= next. > > >=20 > > > We probably need a new version, and probably through gvt branches it > > > will be easier to handle conflicts if they appear. > >=20 > > Hello Rodrigo, > > Sure. I will send in a new version. I am current using linux-next git r= epo as my > > remote origin [tag 20230113]. Are there any specific instruction/locati= on from > > where I should access the gvt branch? >=20 > https://github.com/intel/gvt-linux.git >=20 > but with the linux-next your patch is probably right for them. >=20 yeah, I think so as currently from last pull request I don't have other updates in gvt tree, maybe it's just d-i-n hasn't included recent gvt change. I saw Deepak sent a new one, feel free to apply. Let me know if there's still any issue. thanks! > > > >=20 > > > > > > --- > > > > > > 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/d= rm/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, NUL= L, "0x%llx\n"); > > > > > > +DEFINE_DEBUGFS_ATTRIBUTE(vgpu_status_fops, vgpu_status_get, NU= LL, "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 inte= l_vgpu *vgpu) > > > > > > &vgpu_mmio_diff_fops); > > > > > > debugfs_create_file_unsafe("scan_nonprivbb", 0644, vgpu->debu= gfs, vgpu, > > > > > > &vgpu_scan_nonprivbb_fops); > > > > > > - debugfs_create_file("status", 0644, vgpu->debugfs, vgpu, > > > > > > - &vgpu_status_fops); > > > > > > + debugfs_create_file_unsafe("status", 0644, vgpu->debugfs, vgp= u, > > > > > > + &vgpu_status_fops); > > > > > > } > > > > > > =20 > > > > > > /** > > > > > > --=20 > > > > > > 2.34.1 > > > > > >=20 > > > > > >=20 > > > > > >=20 > > >=20 > > >=20 > >=20 > >=20 --ZXQGCj+hEvN7Ovv3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTXuabgHDW6LPt9CICxBBozTXgYJwUCY8icNgAKCRCxBBozTXgY JxqRAJ4mPEIhMcJ+GIK42L38hfdcpJvByACglaFTkYJ6rUDkesdylanplx0Kur8= =/lPp -----END PGP SIGNATURE----- --ZXQGCj+hEvN7Ovv3--