From patchwork Thu Apr 27 22:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Choo X-Patchwork-Id: 13225775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC04C77B73 for ; Thu, 27 Apr 2023 22:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344221AbjD0WWf (ORCPT ); Thu, 27 Apr 2023 18:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343660AbjD0WW3 (ORCPT ); Thu, 27 Apr 2023 18:22:29 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F49C30EE for ; Thu, 27 Apr 2023 15:22:27 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f19a7f9424so66850065e9.2 for ; Thu, 27 Apr 2023 15:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682634145; x=1685226145; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sQjdAUQbBZ2dyO127HApmyrM90hBdBX7eLKH1Ns4a9c=; b=rf1oYXg20sx9BhG9eBZUeQywi6t/MtAN66w+gwUW9dbnTzCUYkhTk1trwVUKD00uE6 meGojG4D4suYCiNix3a4xldAsSurmjaoehD1bX8wftH9p/6zg3+j2vIDcF+zAYkbuCdG z+SC6D2+INXyJAUHFrR1rsx/7sQThjIRiWBAYVi1GW6LiVlh/x+5KmDCEgQMBS1amNEO pCDc1/f/1XN7OLyXloDhWB7EDKFDqqDwYqmFvtkAQo6X0Vf+1r3q0WGuq8vWO3DpXALq lzL2uwXzCeUcAGuBj1YXNN77k6KztSx1Rzf5bx61eJ/gJjGS69iabTZ1xqSdUNf5CotS qfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682634145; x=1685226145; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sQjdAUQbBZ2dyO127HApmyrM90hBdBX7eLKH1Ns4a9c=; b=LAi/t8XeAYUB6/88+JCjIyFfpMdDnyk1p93L6zDv30siE92oZ3XkK8aIOacwn5JJRK 7X/zQxfBrmK0ddtSqt8g3dEj/sEciDn/a/j3Qxs6Naz5Ff8bXXdvOQx3Kwk//WHrVRd2 WfM1lJdHNuU9MO2OTshHmKBnT2p+fBlJ7fqiEmS5tiA0bkb1kIJ3VAJ0BQzamqwpljR2 PiLcMRnbXbY/MRtOjXMq1KDmNORI2ULGE6QLCF++ahH/LX7CVlxHde17ldpDgE8eWVyr WdHHDcSgajZd9q0ihkGO/I07L4YlooGMq+rFu2hu5vRymU2g14fMhQs7XBn4PHisFif8 JrwA== X-Gm-Message-State: AC+VfDxH5ip6KcDSre+Sf1uUCtR3E1XlmJpF23a5WyvlPrX4SDqLTPNw geMfCOvQXIbFWuPeEj403OpesB1wbu4= X-Google-Smtp-Source: ACHHUZ458ltQMJgjrFlIRfRM5qRVPB4ouauhB06YBcpL6GuAIAGcNfJ1Toa0ZNiMNyB1hlMut17YHw== X-Received: by 2002:a7b:c5d9:0:b0:3f1:8992:3618 with SMTP id n25-20020a7bc5d9000000b003f189923618mr2577735wmk.13.1682634145378; Thu, 27 Apr 2023 15:22:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a18-20020a056000101200b002e61e002943sm19528907wrx.116.2023.04.27.15.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 15:22:25 -0700 (PDT) Message-Id: <4a8b8a2a6745e791e35296e34f530b5f40f51c27.1682634143.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 27 Apr 2023 22:22:22 +0000 Subject: [PATCH v2 1/2] cocci: add headings to and reword README Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , SZEDER =?utf-8?b?R8OhYm9y?= , Glen Choo , Glen Choo Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Glen Choo From: Glen Choo - Drop "examples" since we actually use the patches. - Drop sentences that could be headings instead Signed-off-by: Glen Choo --- contrib/coccinelle/README | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/contrib/coccinelle/README b/contrib/coccinelle/README index d1daa1f6263..9b28ba1c57a 100644 --- a/contrib/coccinelle/README +++ b/contrib/coccinelle/README @@ -1,7 +1,9 @@ -This directory provides examples of Coccinelle (http://coccinelle.lip6.fr/) -semantic patches that might be useful to developers. += coccinelle -There are two types of semantic patches: +This directory provides Coccinelle (http://coccinelle.lip6.fr/) semantic patches +that might be useful to developers. + +== Types of semantic patches * Using the semantic transformation to check for bad patterns in the code; The target 'make coccicheck' is designed to check for these patterns and @@ -42,7 +44,7 @@ There are two types of semantic patches: This allows to expose plans of pending large scale refactorings without impacting the bad pattern checks. -Git-specific tips & things to know about how we run "spatch": +== Git-specific tips & things to know about how we run "spatch": * The "make coccicheck" will piggy-back on "COMPUTE_HEADER_DEPENDENCIES". If you've built a given object file From patchwork Thu Apr 27 22:22:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glen Choo X-Patchwork-Id: 13225776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43D1CC77B61 for ; Thu, 27 Apr 2023 22:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344151AbjD0WWh (ORCPT ); Thu, 27 Apr 2023 18:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344065AbjD0WW3 (ORCPT ); Thu, 27 Apr 2023 18:22:29 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1345B35BD for ; Thu, 27 Apr 2023 15:22:28 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-2f87c5b4635so8182090f8f.1 for ; Thu, 27 Apr 2023 15:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682634146; x=1685226146; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=wpazyE4bbmAlxnqGcVH35HUnUNnOOayZeAuXHUx7b9A=; b=JELT/kBdWEOAi+vFhQfzQk5JACHsddX9jcDexlR9It1/H0dC56wj0QYNLA+doSa+Se rgrqEX6L6rG78zJ5U/GZQiDGkGK2s3fxST3wRBGl9lvWAyj/pUtoeOgMVrM6iLgVdpPG YGhtKKz6ogJMQzEYgV1/7lh0XiuF40U0eM1sdFe1X6IeRT+xEdBbSMEnI+VVRaCpZEyG lYn/Co1dAxZsRZnu7dDRv+FqlUXFtu8t+bDv6aaYK1UDswFDdY3QClvsFF9f5TQMLn0N T++1xPqx9TolhFcNU4v1V6KXRQvUqvlYNexoRu9aShm46OLeJJXGop08F9jRRLNx82CG RPeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682634146; x=1685226146; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wpazyE4bbmAlxnqGcVH35HUnUNnOOayZeAuXHUx7b9A=; b=a/BQ5eKZXOSMCOsTuufmruFRnmi6nBjwqNuajs9nq/N+0hBie6BeLHKtE3zQNm3iTH Otwigf56SlQDUGQQmX6I4bf0Fkf0tk+L3IXPaxepEq3tHMNQ9XwW3bgeBj506YCEJiwq J1v8ril/1Xsbx5xdRC7Q93uqtgnHPaM1g4x/HO/P87kmv/sb+WAPMjY45Ydfl0tVnLiM 6yZ7q4P86ETisctmQyg7NTOLv4s0r3QNdw64PmQXCu2SXQ/8jy88dRl1Ft3y6TbvaC/q LiOD6QhSdxBLKahw5jmnYEhVSXcGyUGZ4sSvd9s9y7Yp4xjiHrNCbxCaeTw3FOJ/aFMR h3iw== X-Gm-Message-State: AC+VfDwx8ljXTcpa2CGgmtcoR1kMA6Zj/aIiztaEsWi1C0m+bPU8km6W 1r5W3nksM6QuYNiC3zh/dHOGyZprg9A= X-Google-Smtp-Source: ACHHUZ5n3RnwFtVOtXarxrNr9rxtkAOv9WA9maAaUrNI78BAuXYl/hAECgwiauAxPlNJda/UJQ/Ryg== X-Received: by 2002:adf:e4c5:0:b0:304:7ff2:f2a3 with SMTP id v5-20020adfe4c5000000b003047ff2f2a3mr2155742wrm.66.1682634146162; Thu, 27 Apr 2023 15:22:26 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i5-20020a5d5585000000b002fa6929eb83sm19454743wrv.21.2023.04.27.15.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 15:22:25 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 27 Apr 2023 22:22:23 +0000 Subject: [PATCH v2 2/2] cocci: codify authoring and reviewing practices Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , SZEDER =?utf-8?b?R8OhYm9y?= , Glen Choo , Glen Choo Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Glen Choo From: Glen Choo These practices largely reflect what we are already doing on the mailing list, which should help new Coccinelle authors and reviewers get up to speed. Signed-off-by: Glen Choo --- contrib/coccinelle/README | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/contrib/coccinelle/README b/contrib/coccinelle/README index 9b28ba1c57a..055ad0e06a7 100644 --- a/contrib/coccinelle/README +++ b/contrib/coccinelle/README @@ -92,3 +92,33 @@ that might be useful to developers. The absolute times will differ for you, but the relative speedup from caching should be on that order. + +== Authoring and reviewing coccinelle changes + +* When a .cocci is made, both the Git changes and .cocci file should be + reviewed. When reviewing such a change, do your best to understand the .cocci + changes (e.g. by asking the author to explain the change) and be explicit + about your understanding of the changes. This helps us decide whether input + from coccinelle experts is needed or not. If you aren't sure of the cocci + changes, indicate what changes you actively endorse and leave an Acked-by + (instead of Reviewed-by). + +* Authors should consider that reviewers may not be coccinelle experts, thus the + the .cocci changes may not be self-evident. A plain text description of the + changes is strongly encouraged, especially when using more esoteric features + of the language. + +* .cocci rules should target only the problem it is trying to solve; "collateral + damage" is not allowed. Reviewers should look out and flag overly-broad rules. + +* Consider the cost-benefit ratio of .cocci changes. In particular, consider the + effect on the runtime of "make coccicheck", and how often your .cocci check + will catch something valuable. As a rule of thumb, rules that can bail early + if a file doesn't have a particular token will have a small impact on runtime, + and vice-versa. + +* .cocci files used for refactoring should be temporarily kept in-tree to aid + the refactoring of out-of-tree code (e.g. in-flight topics). Periodically + evaluate the cost-benefit ratio to determine when the file should be removed. + For example, consider how many out-of-tree users are left and how much this + slows down "make coccicheck".