From patchwork Mon Jul 10 17:06:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 118006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5213166vqx; Mon, 10 Jul 2023 11:32:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGT8euFtTK1POMAPaGnSqocDM5+iEaaLVx2dgx124aJyA37B+Tcg6iEQ/ACzeG8adg3vB04 X-Received: by 2002:adf:e310:0:b0:313:f371:aede with SMTP id b16-20020adfe310000000b00313f371aedemr13801580wrj.1.1689013965278; Mon, 10 Jul 2023 11:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689013965; cv=none; d=google.com; s=arc-20160816; b=Zwka8VyDAIo9NTAzsuLO+3VTkD+YQpLvvif2BqPUEh+sYJxQsAwhqHGsiXDZhZq49h m0Mekpzi2X2TCq//7MJnleIKgjwLmvXGiySqFB4klDTiogr9Oe3asdOtFKq75MxYEfRE 3uv9kqB6KA7Qz1s75fDzcryxScRf+eZXzSw78aFLMXT0a+yZaynkAG3g63dWAmmO5xfO NFC84IbcFegZIjQ/ZwtM9JxjCzJcFvmotrC3NLd0mTI/Mbxcfee5Z49lOY6SRoisLJuH suaFbokoMjpXBtPKMFmUQih+yDxXggM6z1xjLFkvExQ5+3nADJtlafyYLkiminjRxONL SkbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :reply-to:dkim-signature; bh=cdxQjPxsxT4ZUIAq6MKuRDh+6t1WoZs4Zh6c3B3tQR8=; fh=9NL1A5uSfBFeI3CSw5gDotRSV/In/+WZMBo8h5E1jmQ=; b=ILvV3OdYFeVeZucBoU+l2mMVQv+cetIV/hIaJWRgN4qog0sAAjBe24hqqr911f4SyT RUU+CXL/vk3zQRSh7QRWDHtngwfn+tdVlXSc/OGboRfjHBqUd9DUgFCL7c52f/AAsoeP 34eM9uJYffB9H1P/YmkMbDhrgStJE4I6GMd7W8hfbgKMoorg/0204413K94iAlkX+1Wj A/HeOr9AvPBcy2g/IAo4am+p8dGgcC++zPn4gIiLlb1JUbu8gVPFiQNgP3O7bPep2D2e eNYIHTsZM8yMUfstf1+gSriUjN+wFe5O7X21nKBd3690H1geF6RfV8NDQefPU1Uavxcf h/7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=OFuWj9SV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a056402161600b0051e0d950edbsi85051edv.296.2023.07.10.11.32.21; Mon, 10 Jul 2023 11:32:45 -0700 (PDT) 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=@google.com header.s=20221208 header.b=OFuWj9SV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231230AbjGJRHB (ORCPT + 99 others); Mon, 10 Jul 2023 13:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjGJRG6 (ORCPT ); Mon, 10 Jul 2023 13:06:58 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A856D7 for ; Mon, 10 Jul 2023 10:06:57 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-56942667393so58576387b3.2 for ; Mon, 10 Jul 2023 10:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689008816; x=1691600816; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=cdxQjPxsxT4ZUIAq6MKuRDh+6t1WoZs4Zh6c3B3tQR8=; b=OFuWj9SV3PmArz6QEQllNHpVHH32v6/TFZ9FJ3PKrmZG0wUO3ReJPL3AgALj1B3fpS 0geMi7k78DsZi1fS9ToHQaXRSW7J++GxEDXoCB45wd1h/kb1Yd8ZdphJDfm/lQK4iJCb 5eRTVRSyGP63UOIBxBTW38vXyMWnnGbBu1HQ2h/BUfVC+jAoh8J/q6jpILRL1bQBzEpJ 2gtbHzh6hIfb7dsd1gyMJosn2SVgBjfyMyKG3bKvrABEQ18ia/hsj2LndzGi+NfW7BJR xT3qSyH3c5RxtXswODb7ZAgsAubg+ZZt28VcCk8akEjrwbpPXU+YRm5jRbmFc5utaPCV jArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689008816; x=1691600816; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cdxQjPxsxT4ZUIAq6MKuRDh+6t1WoZs4Zh6c3B3tQR8=; b=Zx953oHY/VPHWR67IT6+fNe2Z58pTIZFDa9F0In0szAgEBFRiUv1r4HoL/nS+1mAmn U+VEB5BWqmwQ8d1JGoR3SqlK08/DfH/W9LzIVFPB4+fCaG8vYnQTWtf0pCo4MQpAwgeH Cc+qEyGdPy+747f9b/4YxtLe89Hd3nxAhcOHiHyLdVwRfhnzkq0yPbjAjtKYN/Q3rbqJ gkkbBrJj0YJBRwm6O3+ePm6Kz7Th01eEMhFgXRqvGNbX/nG/fWaqVkgcSf7YrYNj2Kf7 YSa+PJCAExXo+EMufjoeiWt9h7Ghqy72CXbHLbI+1jaNsHWeCV/XK7A18BnxoR5rm/Jz DJFQ== X-Gm-Message-State: ABy/qLbf6D5s21KnfoF4QzBogIQ5cb4ByNYjjHW54HQisJVeXBkqs0ZU JBmrc8pRx8fhCqj+yAlR6An4cWSTKBQ= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a5b:54b:0:b0:c4e:27df:1a0f with SMTP id r11-20020a5b054b000000b00c4e27df1a0fmr98387ybp.13.1689008816742; Mon, 10 Jul 2023 10:06:56 -0700 (PDT) Reply-To: Sean Christopherson Date: Mon, 10 Jul 2023 10:06:52 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230710170652.473788-1-seanjc@google.com> Subject: [PATCH] Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage" From: Sean Christopherson To: Julia Lawall , Nicolas Palix Cc: linux-kernel@vger.kernel.org, cocci@inria.fr, Paolo Bonzini , Greg Kroah-Hartman , Sean Christopherson X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771055206523051706 X-GMAIL-MSGID: 1771059507303216524 Remove coccinelle's recommendation to use DEFINE_SIMPLE_ATTRIBUTE() instead of DEFINE_SIMPLE_ATTRIBUTE(). Regardless of whether or not the "significant overhead" incurred by debugfs_create_file() is actually meaningful, warnings from the script have led to a rash of low-quality patches that have sowed confusion and consumed maintainer time for little to no benefit. There have been no less than four attempts to "fix" KVM, and a quick search on lore shows that KVM is not alone. This reverts commit 5103068eaca290f890a30aae70085fac44cecaf6. Link: https://lore.kernel.org/all/87tu2nbnz3.fsf@mpe.ellerman.id.au Link: https://lore.kernel.org/all/c0b98151-16b6-6d8f-1765-0f7d46682d60@redhat.com Link: https://lkml.kernel.org/r/20230706072954.4881-1-duminjie%40vivo.com Link: https://lore.kernel.org/all/Y2FsbufV00jbyF0B@google.com Link: https://lore.kernel.org/all/Y2ENJJ1YiSg5oHiy@orome Link: https://lore.kernel.org/all/7560b350e7b23786ce712118a9a504356ff1cca4.camel@kernel.org Suggested-by: Paolo Bonzini Cc: Greg Kroah-Hartman Signed-off-by: Sean Christopherson --- .../api/debugfs/debugfs_simple_attr.cocci | 68 ------------------- 1 file changed, 68 deletions(-) delete mode 100644 scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 diff --git a/scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci b/scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci deleted file mode 100644 index 7c312310547c..000000000000 --- a/scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/// Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE -/// for debugfs files. -/// -//# Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() -//# imposes some significant overhead as compared to -//# DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). -// -// Copyright (C): 2016 Nicolai Stange -// Options: --no-includes -// - -virtual context -virtual patch -virtual org -virtual report - -@dsa@ -declarer name DEFINE_SIMPLE_ATTRIBUTE; -identifier dsa_fops; -expression dsa_get, dsa_set, dsa_fmt; -position p; -@@ -DEFINE_SIMPLE_ATTRIBUTE@p(dsa_fops, dsa_get, dsa_set, dsa_fmt); - -@dcf@ -expression name, mode, parent, data; -identifier dsa.dsa_fops; -@@ -debugfs_create_file(name, mode, parent, data, &dsa_fops) - - -@context_dsa depends on context && dcf@ -declarer name DEFINE_DEBUGFS_ATTRIBUTE; -identifier dsa.dsa_fops; -expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt; -@@ -* DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt); - - -@patch_dcf depends on patch expression@ -expression name, mode, parent, data; -identifier dsa.dsa_fops; -@@ -- debugfs_create_file(name, mode, parent, data, &dsa_fops) -+ debugfs_create_file_unsafe(name, mode, parent, data, &dsa_fops) - -@patch_dsa depends on patch_dcf && patch@ -identifier dsa.dsa_fops; -expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt; -@@ -- DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt); -+ DEFINE_DEBUGFS_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt); - - -@script:python depends on org && dcf@ -fops << dsa.dsa_fops; -p << dsa.p; -@@ -msg="%s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops) -coccilib.org.print_todo(p[0], msg) - -@script:python depends on report && dcf@ -fops << dsa.dsa_fops; -p << dsa.p; -@@ -msg="WARNING: %s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops) -coccilib.report.print_report(p[0], msg)