Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8227445rwl; Tue, 10 Jan 2023 10:32:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXvBfPbIni5RD66NB2HQZ/mcpPVwjjJmzFHbl0P//ijnjoupZV7lOpp6449NSoJN/o90t/+f X-Received: by 2002:a17:907:d50e:b0:7b1:316c:38f5 with SMTP id wb14-20020a170907d50e00b007b1316c38f5mr62930553ejc.30.1673375543923; Tue, 10 Jan 2023 10:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673375543; cv=none; d=google.com; s=arc-20160816; b=LOEs90zis7AzByPLvAiX5+oy07hmgCMCI/te0J6/ka5clrDFPYO//ClrFru6EjUwah 6/1Cw06Km7xTZYpPBo/2xmT4bgTNdNhdpag9pcbQenXUia/jXP87VTnR++2t+PK5tDLP DITwdZ4yj8AY3vSJxU38td9/sm+bCp1kkmBNB2eIG2u0CedzfHqQTLW8/IFCYpaYaVes ol8NXG7Ud3Mp7q5EhNmzY7XJZNzR/b2cfERCUjyVd7IMs8aWXkrJ3sx+KkTVQHSvdvBQ ym3Fb3AYY8RPMz3KIiM/c4ttO+tCy03iZBrPYB+2HeFEbaGhTRN6I3N1Xt7O29bAXawJ tTBg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=v4UeLl7gdvWWXsIkkYPwzX79LPt1pjf/hSOaZlY9R0k=; b=gPDJG4UzE4lMlIWSabttqyi4weR/2zdcfYP5ZjOehYcw7aslJVTAdUfpuYuiPBqzKJ 5j6rL6yLaRTsKc9rAp8aOjjIxYFYDrvCrabj09egcj77kKTmu3K0Y3duSwHOLPihJ37s /DGOLR2K5qnnvTetDDcAqHPZxoL4yxc/10E4stWmXYWghMXJhztn7/8icRByH6X1IkBB 1KGZu0v6aYcc6nHNWj/QXYSaSkJ4zv462/Kof4JPCO7FDDGWFoAD/s4TsiME2YgeQubi Y2c/oB7kCQ94F49GSx2AXa6fGQM/bF8eFlGjKd49bowI63khwZqdtnDvPPBhGp2C7BMl Yu/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="Un/LCm+J"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id da10-20020a056402176a00b00498ebf5a644si7803433edb.190.2023.01.10.10.32.10; Tue, 10 Jan 2023 10:32: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=fail header.i=@mailo.com header.s=mailo header.b="Un/LCm+J"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238666AbjAJSRo (ORCPT + 55 others); Tue, 10 Jan 2023 13:17:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235559AbjAJSQp (ORCPT ); Tue, 10 Jan 2023 13:16:45 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2726CE95 for ; Tue, 10 Jan 2023 10:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673374506; bh=46jOppxp/mRe0pQqJxxPtA8TacbOHy69iOOY75PAV2I=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=Un/LCm+JeI9n6St9MsCyhiCrFmzHYsPDJknNa7kR//l5tlYOkHZnyZOdbOaQcT6oo EnX2AFn/vmyQgd+hiV2mx49D8MQtdLKsWEvVB3kPqRm7AePCfSv4JNDf51/oMg8bXs VWRghoJhbkfGkI/9aazql0dWAOeMibjhAvWP0FBo= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Tue, 10 Jan 2023 19:15:06 +0100 (CET) X-EA-Auth: oa3uAoiVMRg8AVocdZ39yqZX4PN6plfP/DcwLlWgrYiXZmOfEdADt0JfkGi+PE73r+I+Zow0WtJW/txY4KbL2GOt8RJypu/x Date: Tue, 10 Jan 2023 23:45:02 +0530 From: Deepak R Varma To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH v2 1/2] drm/i915/display: Avoid full proxy f_ops for DRRS debug attributes Message-ID: <4f6ae3e9a1f674abd36295772e7ffd0aa3e4a30b.1673343994.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 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: make coccicheck M=drivers/gpu/drm/i915/ MODE=patch COCCI=./scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci Signed-off-by: Deepak R Varma --- Changes in v2: - Include coccicheck make command in the patch log message for clarity. Suggested by Rodrigo Vivi drivers/gpu/drm/i915/display/intel_drrs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c index 5b9e44443814..84ba7379d6f8 100644 --- a/drivers/gpu/drm/i915/display/intel_drrs.c +++ b/drivers/gpu/drm/i915/display/intel_drrs.c @@ -374,16 +374,16 @@ static int intel_drrs_debugfs_ctl_set(void *data, u64 val) return ret; } -DEFINE_SIMPLE_ATTRIBUTE(intel_drrs_debugfs_ctl_fops, - NULL, intel_drrs_debugfs_ctl_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(intel_drrs_debugfs_ctl_fops, + NULL, intel_drrs_debugfs_ctl_set, "%llu\n"); void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc) { debugfs_create_file("i915_drrs_status", 0444, crtc->base.debugfs_entry, crtc, &intel_drrs_debugfs_status_fops); - debugfs_create_file("i915_drrs_ctl", 0644, crtc->base.debugfs_entry, - crtc, &intel_drrs_debugfs_ctl_fops); + debugfs_create_file_unsafe("i915_drrs_ctl", 0644, crtc->base.debugfs_entry, + crtc, &intel_drrs_debugfs_ctl_fops); } static int intel_drrs_debugfs_type_show(struct seq_file *m, void *unused) -- 2.34.1