From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1244DE555 for ; Fri, 12 Sep 2025 20:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757708466; cv=none; b=IZvdSrVyJOomyiXSSTRCzQ4nbDpMuGXRutFWHPX0Rh0kfHDKMN519tONXAgYukzuHmBatZKzY2UKfT2aLLVqYe1/oKC0XzbuQ872L4fLGaQBRWhkV2XfG7jYbIkLpKpEbPATSr1rtH1FXYP9hmdTfl+nC4eBttAkw9H7IOtXHb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757708466; c=relaxed/simple; bh=ha5sACqI+T93S9hNt+6tg8vEBhnD3jRHwOofYElvPzs=; h=Message-ID:Date:MIME-Version:Subject:From:References:To:Cc: In-Reply-To:Content-Type; b=PWw1dG7C315h6duYUtgOlm71mClpLQduw08unUSDNdzVvrzaTA9zfGafyHuDdrU5hO8H3+NkXAeQDbvWiY+tfF+IPz59aLVpQed62HZIosrOB+vP9iQ8+TMGOXUQRBE0a2VApezmN+Ob+vyhiR0TYI/RukCnYbswmeCam90OJto= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dpFzoYMZ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dpFzoYMZ" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58CIAPNM001640 for ; Fri, 12 Sep 2025 20:21:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= uh8HWFGgvQRh4YRN3fk73qzhec8r9FEUaHUe0C5PvU0=; b=dpFzoYMZG1v/fuZZ 2RiOHciNexepsOY2/E+q6hirgSIhID69Ou8BV9gf506j3uZg5Eyg1aOZTn3HJATt izsRV0N8KIa63NihYzi/wdKIsjrvo3Q9Mstv6cveN0mG9y+W5uIkQAuk5nZ7SffF SCpZcWhk1ehi5VrtLFFghTgdwVZiKX9kSYL7uICiT22ybmcz6YAkKtxsSRmAe46V WsgpfZhH7ssf6RKCR/Cv3ITFT9Djgj10pxJzXJdkSQCZfcpynUiSJu1TjunZY4Tn gHQFfBhtAm14Oyd3GlqhuFqV543caaNYYs6ltXn6svrV/nHakTrpOIqeRsCGuK+w BSNxYw== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 493f6h7snj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 12 Sep 2025 20:21:04 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-76e2eb787f2so2227059b3a.3 for ; Fri, 12 Sep 2025 13:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757708463; x=1758313263; h=content-transfer-encoding:in-reply-to:cc:to:content-language :references:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uh8HWFGgvQRh4YRN3fk73qzhec8r9FEUaHUe0C5PvU0=; b=RUlUN+WIt1Z+ZJ77dSBUGqfiV/MO1XIRGmq0te7uXqB1sbiJx1gfd2ug8kNlQy2U6Q dpd2ayWVNl2Wowkf8b5iPDAulyfyIfKV4ZdqE4lf+thCrkoCc6hqomvVHA2usJ0EeDBV Ls/bcB5Xq2z3MfIGrP9+TYmd8fLZXhVSlUfX76uk6NXnq6RTUpJT7xqYyXAXN3Fxhf8d Oeg9eKreMKhWq42uVkmbn/jCEaFe9GqsGraqLo1TWN/2oOZEYymwr8cLWVpEX8SKy1Ws a7eH9isk6rj+vfJn+5Acw3LaDKGMpkRYwvoSvlySoHGAcHXI4q4WOjVuUZiVx4FEEa39 fTOQ== X-Gm-Message-State: AOJu0YykuhWGBDL6BmatJMVyyxC8l7+oBn1AnTdDIONHD3IdbxRm41sU uhtrdGCdPmKDo2KI232wAuaJ0ILmcLLgCGF2t402rc7N0TNtKy05/3xkeK0C7h3RMV6ACfsbUmK pYp/Gc1abIWv6HTp0G7HA7TYf4f9kLwYa/O0obuLNJcrhx2stHlPo+qLNQnXnUoRgT3TgjAg= X-Gm-Gg: ASbGncsCcKsxGjdQOuzyjTMdPNSExOFxukeAVkPVL9oDqyHJABGpIQEU9+BJHi360a5 fhtrH1l6OQi3u900QUV0ETrPvStYidAsZQXGVWw5ON3YLPob674VlbG9xucz4P9YNBoYZpBWizw dDKjzr7Q60dccYHXK2y5QGFu7ZETfnHkRyV31kPo17h99zoSAL3LDsvU42C+46QZ+//+/Yy08HQ 1s8tlgY41EXuHe6XNl6nHfzEwLtar6HFeH9y8rBwWvqfgGPx7bK4kjW5csIclEvWzhmf5hEnoA7 C32sRivtIfJiQi6GXe5wtXqOLSXZyQGHWKQiTPfcWqEzlnYiBzozji36lC5/fvuImqUNb/JNhD/ FjvTSRB8VKYzSIkZ5AWexg5I= X-Received: by 2002:a05:6a00:181e:b0:772:48c5:c75a with SMTP id d2e1a72fcca58-77612091649mr5033559b3a.13.1757708463029; Fri, 12 Sep 2025 13:21:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFy9rA89rMg5iy1ZfZgFDowhXAj7A+YF9TJ6xmj3kp84CbPWPd2rihyHVZcOIc16agMz/VevA== X-Received: by 2002:a05:6a00:181e:b0:772:48c5:c75a with SMTP id d2e1a72fcca58-77612091649mr5033517b3a.13.1757708462327; Fri, 12 Sep 2025 13:21:02 -0700 (PDT) Received: from [10.110.61.161] (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77607a46eedsm6317156b3a.30.2025.09.12.13.21.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Sep 2025 13:21:02 -0700 (PDT) Message-ID: <86bbc54c-3fc9-4c6d-9f93-b684634121bb@oss.qualcomm.com> Date: Fri, 12 Sep 2025 13:21:00 -0700 Precedence: bulk X-Mailing-List: workflows@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [RFC] PatchWise: Unified Static Analysis for Kernel Development From: David Gantman References: <3aa87758-1899-4f7c-aa17-2330e656a467@oss.qualcomm.com> Content-Language: en-US To: workflows@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org In-Reply-To: <3aa87758-1899-4f7c-aa17-2330e656a467@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: m8jesHWu2eI_c7FkAS7HiioXJRxw0gwG X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTEwMDE3NyBTYWx0ZWRfX1bfse8AesyWK WEVMQuiwdEFYELNt8juWyzGPr7g+tIHJFqp+IsdRZjMHkR69eZKLrFkiynCtxsScBEw1SUJfBlG zvLFIa+2+zmXFaGZ5zFqchDeMBM19KYdNERMlYPzb8dX3xW74v92YmyKcaodoG/QEZirZrko2yK Dikz/QlLm8dl0ACkRNtRPQcM/wxojOp170dnvXJjBvQCI4Mth9FOxwlzKU+s1VOxpe2aFL7g3Dr XiobWqdGEeFQXrfBGm0N6Ca6ib9BQFMxNG11MmjjeMU5r1R9phXYn2DMb2lchHXk5+sNcV9/ZMa d6dej5Bhfy6KMTRzsKcm7LUTRFpwtHJoMtC8SQQ4K5QOI6JuCC3vJeZ0YJCc2CC9ioWlDC74Wsx 8TY5D+68 X-Authority-Analysis: v=2.4 cv=WPB/XmsR c=1 sm=1 tr=0 ts=68c480b0 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=NEAV23lmAAAA:8 a=_2PzejVuNbwBRFFAgkYA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-GUID: m8jesHWu2eI_c7FkAS7HiioXJRxw0gwG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-12_07,2025-09-12_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 clxscore=1011 priorityscore=1501 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509100177 Kernel developers and maintainers often need to manually run multiple static analysis tools (checkpatch, coccicheck, sparse, dt_binding_check, dtbs_check, etc.) and create custom scripts to consolidate results. This leads to: - Inconsistent testing environments across different developers - Time spent writing and maintaining custom integration scripts - Missed issues due to incomplete tool coverage - Difficulty in reproducing analysis results I'd like to introduce PatchWise, a tool designed to address this fragmentation and manual orchestration of static analysis tools. I'm seeking feedback from the community on this approach and suggestions for how it could better serve kernel developers and maintainers. Key features (All Optional and Configurable): - Unified interface for checkpatch, coccicheck, sparse, dt_binding_check, dtbs_check - Docker-based execution for consistent, reproducible environments - Simple installation and usage: `$ pip install patchwise` then `$ patchwise` in your kernel tree root - Allows selective review execution (e.g., `$ patchwise --reviews checkpatch sparse`) - Supports both individual commits and commit ranges Optional AI-Powered Review Features: PatchWise also includes optional AI-based code review capabilities that aim to overcome a key limitation in automated patch review: limited context. When enabled, the tool uses Language Server Protocol (LSP) integration with clangd to: - Generate compile_commands.json for accurate code understanding - Fetch relevant function definitions, struct declarations, and related code - Provide context-aware feedback rather than superficial pattern matching - Support multiple LLM providers (OpenAI, etc.) Important note: All features including AI code review can be selectively enabled and disabled based on user preference. Technical Architecture: - Python 3.10+ with pip installation - Docker-based isolation for tool execution - LSP integration for deep AI code understanding - YAML-based configuration - Rich logging and debugging support Source code and current status: https://github.com/qualcomm/PatchWise Upcoming improvements include patch series support and Docker-based dependency management for each tool. Open tasks and planned features are documented in the GitHub issues for visibility and collaboration/ Feedback Requested: - Tool Integration: Are there other static analysis tools you'd like to see supported? - Workflow Integration: How could PatchWise better fit into your existing development and review workflows? - Output Format: What formats would be most useful for your use cases? - AI Features: For those interested, how else can AI code review and commit text analysis be improved? Try it out: $ pip install patchwise $ cd /path/to/your/kernel/tree $ patchwise # Analyzes HEAD commit with all available tools $ patchwise --reviews checkpatch sparse # Runs only specific tools The goal is to eliminate the need for custom scripts to consolidate kernel test tools, while offering optional advanced features for those who want them. Thanks, David