Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3481375rwl; Tue, 27 Dec 2022 09:44:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVfkfOTRCSAVj+uQrNtZZAjn8ZvtyIiYNbBfRCS7ISGYYPivs1OB3eaTFbUyBoqvA6dqDz X-Received: by 2002:aa7:87c7:0:b0:57a:9b14:69b7 with SMTP id i7-20020aa787c7000000b0057a9b1469b7mr23745538pfo.0.1672163097981; Tue, 27 Dec 2022 09:44:57 -0800 (PST) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ct6-20020a056a000f8600b0057608f2e67fsi14592912pfb.371.2022.12.27.09.44.49; Tue, 27 Dec 2022 09:44:57 -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=Cf0h+emJ; arc=fail (signature failed); 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 S231981AbiL0ROR (ORCPT + 66 others); Tue, 27 Dec 2022 12:14:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbiL0ROJ (ORCPT ); Tue, 27 Dec 2022 12:14:09 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA042B86C for ; Tue, 27 Dec 2022 09:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672161247; x=1703697247; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=pyu5M35zQN01hXPUqWatuRrmKFr9K+2FFGt8nTIemGE=; b=Cf0h+emJ+FOBB8YvGl8KsK8Hlf1QRDJOZtK0Mtxh32Le1E3YvlDqubBe a0JRdd1BtZcwVQu4boASvC6x/4MUxaxYVk+RMeS8G6xQ8XE035QITcLAt EECVZALEWKlo1xALWtRoL02wEpXvA2+JEp7yvWxbX2LStcINBonHAsVrK /3FsIz690SkhMN83Ji6syDcaN9Pt+PLrgBLelEBa1GI1Dslv6ILC+IiZn izmfn4S4rkAq0vYcBGcfivQMlnP4deeGkz3D/apiD8NGPlyeI7SoUBKo2 5PY1nbdjJIBWxiCR+WCqxUl/oSmZgR68qp4EFATmhX0JkjgxKB8zLXy0p g==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="304233276" X-IronPort-AV: E=Sophos;i="5.96,278,1665471600"; d="scan'208";a="304233276" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 09:14:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="716388068" X-IronPort-AV: E=Sophos;i="5.96,278,1665471600"; d="scan'208";a="716388068" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga008.fm.intel.com with ESMTP; 27 Dec 2022 09:14:06 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 27 Dec 2022 09:14:05 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 27 Dec 2022 09:14:05 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 27 Dec 2022 09:14:05 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.45) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Tue, 27 Dec 2022 09:14:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OMT2yNr+i2h9qY4qi/AH1xcgT91BCzmTf0o6k3ZwB+y7Dfrv1FlmFeFErbeCMVDdoVSu68fCUmfEdOupmZGEI1e70BRLxGcvSZBCL2Pvt/l/E/y8H/91L7KiOyVA+DX45ufsibCdl5aPDDhmYHhFekjRXzbqDABmdSZQK15Tl+fTkBUxAUxFjGTxHtgSoslGO8We6UJXdywpGC945u/CFRzwZMbutFNJhsBXSSfIEQdJPInShl3/L0BwrmxZPYClOrt1PME/9jiFybK9yMbIUxuk6TvPD+NmJhZ7pM3f7xonf25QuwipDLxPOmFtA2UQV8vVBB94IrNsYSGaVnZb6A== 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=NyNthrvMKRoSGcTxw9DBzjOfKbIC5ZtkqQgYY58ePVQ=; b=JbEM5l16lSPCUIFikbSnA9kCrW/AspLCNtFGWLt2cSvdjLqrWIh825xTTfI/ebi1Yq3up1IkZccxcpMqFlO6GF3FqOQ/rTsLhDVvkk3Hjwad2tX5iq+ZVh1mZX8j4e4tcG3Dr3JZhigtIYxf05BUkDPKPt0lfl4TRRVqBUisZ7d94vZCex4ZTExUYxxUqj/B5EShe2uw9mRhM+YANhvQ+adNcT0iKKMA6lpKWSmU5PRH7NMjLMZjmU3V3UngnuHrpg32Kx6nJT8moZWaAcDbGCm4Lt61SxkWHCLODYelg0kycA4+qSjb1bs2YTfF3dn2vSAnQNZXg57vAKePlrTQ7Q== 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 MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by PH7PR11MB5818.namprd11.prod.outlook.com (2603:10b6:510:132::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 27 Dec 2022 17:14:02 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::499c:efe3:4397:808]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::499c:efe3:4397:808%9]) with mapi id 15.20.5944.013; Tue, 27 Dec 2022 17:14:02 +0000 Date: Tue, 27 Dec 2022 12:13:56 -0500 From: Rodrigo Vivi To: Deepak R Varma CC: Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , "Daniel Vetter" , , , , "Saurabh Singh Sengar" , Praveen Kumar Subject: Re: [PATCH] drm/i915/fbc: Avoid full proxy f_ops for FBC debug attributes Message-ID: References: Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BYAPR05CA0069.namprd05.prod.outlook.com (2603:10b6:a03:74::46) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|PH7PR11MB5818:EE_ X-MS-Office365-Filtering-Correlation-Id: 13e12e56-f4f9-4026-fe66-08dae82dc02c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y+Vj3Uk3S9EflgmhKEbiG1y1NnNJKKgqvnfNK0NgAFVzFovR7JDk+4lmkh/ExBBbK+nQ3CdAUC7N26TGc6gULsEPVlbRMoAWNQQAcalQazL+KJSeDarpRmYq1qELiKood+rac0atMxUBeDx1qAZe+k8SViPPAuv5HgmeCTQ6/XOxXFmOW67JY9pNaI8JkXC6uktczTWXRpWlI3Wr/6qM56RT8OzNA1WeV8pukLTpxlfuxzsfAr+lDSSjOUmSLjvo3DyFgzZvLs2y1KnV0w4otBe6RHILZtIEF9oxSIaq+obp5CxT1y31+hoLDbKvYksu69gr+Q5q+HBhrvKqfsxyQ6J+iOOYgrzTMzTtnf4y0Pw7zhMjQO/PgoyXAvpwDbr9ufEUji6Fc15QgHuNMoMKfl/kNcksIMPMfG0DcSMkhrFyGjvuJ9oemhtpIguOE8fa7aVMCtQMPgZ0zj910mx1t4lHBavNH7lRv5rNnZ/HABVDZgLJ0Gj38gXDwMnvJ1qQKWpE3O8mEnXnNdZA4/cZgEeHkgkXOB4aIF5NuuDKLHQjXv/Ho30jrcHA7dPoW0ldh+Gbeo3YErIBtdE4xnF+WSgzrzjg9AWc/bKgIeveMX/aLTQ2UCfmYDikGK0JKHM/p+rwyJzysKeEX4+ppZZSFg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6059.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(366004)(376002)(396003)(346002)(136003)(451199015)(6506007)(41300700001)(316002)(8936002)(2906002)(5660300002)(66556008)(66476007)(86362001)(8676002)(6916009)(7416002)(44832011)(66946007)(54906003)(4326008)(26005)(6512007)(82960400001)(186003)(38100700002)(6666004)(36756003)(83380400001)(2616005)(6486002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Q2Im8FNB1d/hn72bwPJIj8XMGJsH45M/rMV8Tv0X+M7loNn8/SlPiWVHLPWB?= =?us-ascii?Q?NP4DIESQQG5q9kjxR4VSa3fW/o5orJkBTrUF4Wjw4FSFkpJU2iHgr/ynmdv+?= =?us-ascii?Q?WEr3sVRQ8ZJRBolfw8t1QEhIQGFgdY/Rd7DYDa0jF+DT52+iqLDhKaGUnW+w?= =?us-ascii?Q?5Icw493kABr+Y++hF60IKTcoM6ifHB7c/E230TkHsWDKuCKm/INDZzzO4crq?= =?us-ascii?Q?8CyuWs2JkG7vro6Yoq5q0BQgBsTJdKPVLYAZWRcj3bN8ITSk5AH9o7MzlQY7?= =?us-ascii?Q?YzY+70Zn015eyWD46cB9HSFgW5ZksDBpiWeTX2JciAEVe10mLcXn+QMywHxh?= =?us-ascii?Q?k9v95TzT0fz9gVsLgQHLm39Va3kwimyczzqqdXQfd2Mdub9J+rEZEcCzp52q?= =?us-ascii?Q?mIivXfSqxDYUQ/M2bEJckKS+dmGHP0picLtfIIV3JerjUJn56QszK94a7G+j?= =?us-ascii?Q?MH6gkljbJNZwBDaliLL4yGZ4VS1cxEKtdQLah/FPOEjZx/R9nY9Rp8tRLSOM?= =?us-ascii?Q?ycTHbTp2AScQK5m13amWiUU02y3rlVXe/vh1OZW3+xAb2Ci50+Y9rqGBj0jH?= =?us-ascii?Q?cTaxE5lpxdnftw9BU3JWogh+8Nf9No7T8i487jpyDO+sA/eDXiKI2sR6wl0Q?= =?us-ascii?Q?yOSKx/MehXVZBkpj/Ly/v1XytnAuxM6F08+PNkDLR58OvoSDoFF32uYog924?= =?us-ascii?Q?i4xwBYrzK7TLxlRyLMA1wbYm6Vc+ExWeti/eYVKS7yduEcko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ange-CrossTenant-Network-Message-Id: 13e12e56-f4f9-4026-fe66-08dae82dc02c X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2022 17:14:02.4986 (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: Ey3nvggNnmHCCW3NJe5sZWhc2/SDFKwPwaWC3I1kdgV9eUg3f7yFGSx2BwvQHqvGFn8nbgpt0qmC6XQVLI8ZOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5818 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Tue, Dec 27, 2022 at 01:30:53PM +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. > > This Change is reported by the debugfs_simple_attr.cocci Coccinelle > semantic patch. I just checked here with $ make coccicheck M=drivers/gpu/drm/i915/ MODE=context COCCI=./scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci The part reported by the this script is the s/SIMPLE/DEBUGFS but the change to the unsafe option is not. This commit message is not explaining why the unsafe is the suggested or who suggested it. If you remove the unsafe part feel free to resend adding: Reviewed-by: Rodrigo Vivi (to both patches, this and the drrs one. Also, it looks like you could contribute with other 2 patches: drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c:64:0-23: WARNING: pxp_terminate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE drivers/gpu/drm/i915/gvt/debugfs.c:150:0-23: WARNING: vgpu_scan_nonprivbb_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > Signed-off-by: Deepak R Varma > --- > drivers/gpu/drm/i915/display/intel_fbc.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c > index b5ee5ea0d010..4b481e2f908b 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbc.c > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c > @@ -1809,10 +1809,10 @@ static int intel_fbc_debugfs_false_color_set(void *data, u64 val) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(intel_fbc_debugfs_false_color_fops, > - intel_fbc_debugfs_false_color_get, > - intel_fbc_debugfs_false_color_set, > - "%llu\n"); > +DEFINE_DEBUGFS_ATTRIBUTE(intel_fbc_debugfs_false_color_fops, > + intel_fbc_debugfs_false_color_get, > + intel_fbc_debugfs_false_color_set, > + "%llu\n"); > > static void intel_fbc_debugfs_add(struct intel_fbc *fbc, > struct dentry *parent) > @@ -1821,8 +1821,8 @@ static void intel_fbc_debugfs_add(struct intel_fbc *fbc, > fbc, &intel_fbc_debugfs_status_fops); > > if (fbc->funcs->set_false_color) > - debugfs_create_file("i915_fbc_false_color", 0644, parent, > - fbc, &intel_fbc_debugfs_false_color_fops); > + debugfs_create_file_unsafe("i915_fbc_false_color", 0644, parent, > + fbc, &intel_fbc_debugfs_false_color_fops); > } > > void intel_fbc_crtc_debugfs_add(struct intel_crtc *crtc) > -- > 2.34.1 > > >