From patchwork Sun Feb 19 16:31:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1744711 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=iYwsi/0c; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PKWLN57J1z23r4 for ; Mon, 20 Feb 2023 03:32:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AFD1E857E0; Sun, 19 Feb 2023 17:32:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iYwsi/0c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1248180ADF; Sun, 19 Feb 2023 17:31:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: 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_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 412EA83523 for ; Sun, 19 Feb 2023 17:31:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id w22so160266ioc.0 for ; Sun, 19 Feb 2023 08:31:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dGbPmHUhs/LgKdn/Ul+bgNnBHKG4/8HvJMrnJGj15/U=; b=iYwsi/0cSScyhvuHueZ9cDL1mRCzqbFJRKM+4qTwHiE3G4oD1VqybRtu3xZnXRxXO2 buKJPBA7WkqvZt/BGQJf4gj+ul5fzPM5BFE84Q26oqKjrwRjtbEZBRSOE7EaakVrzLIq ff+5/fsT9coc/0WzFg8w6/axgEofFtIGPal3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dGbPmHUhs/LgKdn/Ul+bgNnBHKG4/8HvJMrnJGj15/U=; b=N8B/QdVoqKMwiwdwAFXgp+ihB7ShoI+3MH7Zqt7UQBe+XsWQlUBVHw61Zkz0/UhGAM 5Wz8ZiNUr2cYkj34J2tDWbjPeseGK0P2VIQd23VxLwcD+O1pSm7p/bRij3aPyJPNb//N F8Zby+sjnDLiFshbSjCl0oScfILg37mwO9fjSymnnQ5n2XkxoOfAXxDsrFe+m0gvi5bA iW4iuOMy1N9d9HWfpwIeypYYP2CFcFfQ51bq4gTGqDlnKbK1Pojy7uV5BbvI1uXkehhn laS98Wcezg9feP1xx+gaP4vy8WrdeHrXKsNOIobDgzg8CInaWczr6OMsaoJVRRcJR3uH UWNw== X-Gm-Message-State: AO0yUKUJhrGiY1INXrplYEYKZ7ILYh+KMHxwZ0DV+Ff+yirKS7Rbnj2u KMe1kQDDncuhtZy7GVUYEmU9oPUWldjvBOxw X-Google-Smtp-Source: AK7set+hlHVPQ3gRzOM9VHT17crLkLAtuXN3+bnw7TAAbHZn0Ys/IZrIWjc99+lFrUocu5PcK0luHA== X-Received: by 2002:a05:6602:22c4:b0:704:d17c:7dc1 with SMTP id e4-20020a05660222c400b00704d17c7dc1mr6072367ioe.11.1676824293852; Sun, 19 Feb 2023 08:31:33 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l22-20020a02a896000000b003a0565a5750sm3211922jam.119.2023.02.19.08.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 08:31:33 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Doug Anderson , Simon Glass , Maxim Cournoyer Subject: [PATCH 4/4] patman: Check patches in parallel Date: Sun, 19 Feb 2023 09:31:23 -0700 Message-Id: <20230219163124.1797834-5-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230219163124.1797834-1-sjg@chromium.org> References: <20230219163124.1797834-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean For large series this can take a while. Run checkpatch in parallel to try to reduce the time. The checkpatch information is still reported in sequential order, so a very slow patch at the start can still slow things down. But overall this gives good results. Signed-off-by: Simon Glass --- tools/patmanu/checkpatch.py | 46 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/tools/patmanu/checkpatch.py b/tools/patmanu/checkpatch.py index 55d962f536f..1317f50b464 100644 --- a/tools/patmanu/checkpatch.py +++ b/tools/patmanu/checkpatch.py @@ -3,6 +3,7 @@ # import collections +import concurrent.futures import os import re import sys @@ -244,26 +245,31 @@ def check_patches(verbose, args, use_tree): error_count, warning_count, check_count = 0, 0, 0 col = terminal.Color() - for fname in args: - result = check_patch(fname, verbose, use_tree=use_tree) - if not result.ok: - error_count += result.errors - warning_count += result.warnings - check_count += result.checks - print('%d errors, %d warnings, %d checks for %s:' % (result.errors, - result.warnings, result.checks, col.build(col.BLUE, fname))) - if (len(result.problems) != result.errors + result.warnings + - result.checks): - print("Internal error: some problems lost") - # Python seems to get confused by this - # pylint: disable=E1133 - for item in result.problems: - sys.stderr.write( - get_warning_msg(col, item.get('type', ''), - item.get('file', ''), - item.get('line', 0), item.get('msg', 'message'))) - print - #print(stdout) + with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor: + futures = [] + for fname in args: + f = executor.submit(check_patch, fname, verbose, use_tree=use_tree) + futures.append(f) + + for fname, f in zip(args, futures): + result = f.result() + if not result.ok: + error_count += result.errors + warning_count += result.warnings + check_count += result.checks + print('%d errors, %d warnings, %d checks for %s:' % (result.errors, + result.warnings, result.checks, col.build(col.BLUE, fname))) + if (len(result.problems) != result.errors + result.warnings + + result.checks): + print("Internal error: some problems lost") + # Python seems to get confused by this + # pylint: disable=E1133 + for item in result.problems: + sys.stderr.write( + get_warning_msg(col, item.get('type', ''), + item.get('file', ''), + item.get('line', 0), item.get('msg', 'message'))) + print if error_count or warning_count or check_count: str = 'checkpatch.pl found %d error(s), %d warning(s), %d checks(s)' color = col.GREEN