From patchwork Sat Dec 2 15:51:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 120429 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2512188qgn; Sat, 2 Dec 2017 08:27:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMayqHfEXGyxpfBnDyrfVSlmZ6D/xhRn1XFpgD9oXuPQpa7tFht54p1doxIVFs+bOrcHphHf X-Received: by 10.99.127.25 with SMTP id a25mr9198269pgd.10.1512232034569; Sat, 02 Dec 2017 08:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512232034; cv=none; d=google.com; s=arc-20160816; b=pqgZgZNPw4dR14qZmc5fy4fiRmBPNsEQLjHR2Rp/UcBeRGHE++HMv7nqBjBV6QmNJA 16nOWn+hO1SbRYbboawb8plrmTk8T0g6jqtTNWNI8/ILQI5t/zsJmBn8sgAtNrzI/GH4 hlCJzKpIW/HP+OKw4G4Xxiq30Nak6VYHTiap53Y7zfqkCs4b8afHf5ppLFHRrUHKGgSV 1pUf4apZwBF7BXOT8t4R+L1L3//nMW+dd2T4qPHCnctsGjRPIFRNXMiSvsNOUMR+FtvP TqoaRcGFchxFTzAzyaYsRdcab6dmcLHK8TyB9lTuJpRwOJeP7XBTLzYxwEidAhfQUbpM 4X0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=UqJqfzA4vPu9A9Dcssw75UUXPNjwCNuTLmodG6XYUyA=; b=v9e2bNaonyluWMsUvTIoGxRi0yRDZvYkZUBFhRF1SW33Xsxo8jVZerIgg5qmo7M6wl z4yYptjAdN9kKZ/7Xm/+uOuawgEMw3N6DYkXL3fA7q/WWCCLJmzfkDtXBChljYCtuI4q hdc62fc1eELJWwDHMrnSn6phz4cmc7mL+2uyd02ed/2IXme/AMTJIslqDHpLUB1wjjxl ghpKXFM8MM07HZXIO2FkGvysZhCLml3D0B5H2xbm+RrllGk6fQWgfGdrBCuYStvmcAsw e+OuK79KaosXBcLMOJbKTeG8j3SyAFc6eCV524gRB74ltWepPmMbnFkuhSGp5yrLZxd5 Oj0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=HHIj93e4; dkim=fail header.i=@verizon.com header.s=corp header.b=C56PaSJ1; dkim=fail header.i=@verizon.com header.s=corp header.b=pZj/nDSh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si6699943plr.754.2017.12.02.08.27.14; Sat, 02 Dec 2017 08:27:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=HHIj93e4; dkim=fail header.i=@verizon.com header.s=corp header.b=C56PaSJ1; dkim=fail header.i=@verizon.com header.s=corp header.b=pZj/nDSh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbdLBQ1M (ORCPT + 28 others); Sat, 2 Dec 2017 11:27:12 -0500 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:25146 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbdLBPvs (ORCPT ); Sat, 2 Dec 2017 10:51:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1512229908; x=1543765908; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=QtjiuoNoGIY+sE+mYllZ9oRmxSTMLWzD4tZN3A4u5cs=; b=HHIj93e4Kldz/3vECHZm5SGTiMtOEygnp8MEwM/5/kYENM8vw8Tz7jnr 81M3K5ZHtlVwKrFChTyR8WOuPQVzQ0ZiGj+O3fhT9vWJUYPev4+JwlVvK PS1BtIQDF+XUfu8Q+3GqZnR//kExKnv3DISSkoPAlacvGeK3hn7yZTJnS Q=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by omzsmtpe03.verizonbusiness.com with ESMTP; 02 Dec 2017 15:51:46 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2017 15:51:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1512229877; x=1543765877; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=QtjiuoNoGIY+sE+mYllZ9oRmxSTMLWzD4tZN3A4u5cs=; b=C56PaSJ15oO4bgDji4hkjIM/xv8FacYY6KN52K1w8bVrw4ZoYd5MEtau 6toRvlpt8sekfSuy/7qkXGiaqqLg4fhi6cXvOgYOF+2NhhJ2a8JPWQMWS iPHBFCg/qpEfS6Xy5o5UoX/rZKDBGu03xpbvIZ5vweChKbIAHp/YfFn/C 8=; Received: from surveyor.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.83]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2017 10:51:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1512229877; x=1543765877; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=QtjiuoNoGIY+sE+mYllZ9oRmxSTMLWzD4tZN3A4u5cs=; b=pZj/nDShYa6BcEMt8t6NKuz8L3CwU/gedpYkYytBWn4hXuj6PgVtr+C8 01Ot8kkkZadQeP6wl8imk1/4PZSgX6G0BPtlzXVU8+ChCp4AI3XSOgPrz H50m7zdOVtufgWSZJKb5FiThO1Z4OyclI/4W/byyZMJ/2wD72oSZvpCvr E=; From: alexander.levin@verizon.com Cc: Masahiro Yamada , alexander.levin@verizon.com X-Host: surveyor.tdc.vzwcorp.com Received: from ohtwi1exh001.uswin.ad.vzwcorp.com ([10.144.218.43]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 02 Dec 2017 15:51:17 +0000 Received: from tbwexch28apd.uswin.ad.vzwcorp.com (153.114.162.52) by OHTWI1EXH001.uswin.ad.vzwcorp.com (10.144.218.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sat, 2 Dec 2017 10:51:17 -0500 Received: from OMZP1LUMXCA16.uswin.ad.vzwcorp.com (144.8.22.194) by tbwexch28apd.uswin.ad.vzwcorp.com (153.114.162.52) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sat, 2 Dec 2017 10:51:16 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA16.uswin.ad.vzwcorp.com (144.8.22.194) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sat, 2 Dec 2017 09:51:15 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Sat, 2 Dec 2017 09:51:16 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.14 05/64] coccinelle: fix parallel build with CHECK=scripts/coccicheck Thread-Topic: [PATCH AUTOSEL for 4.14 05/64] coccinelle: fix parallel build with CHECK=scripts/coccicheck Thread-Index: AQHTa4Vi0cTENhT7Z0mHWW1nI7lg3g== Date: Sat, 2 Dec 2017 15:51:15 +0000 Message-ID: <20171202155101.7573-5-alexander.levin@verizon.com> References: <20171202155101.7573-1-alexander.levin@verizon.com> In-Reply-To: <20171202155101.7573-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit d7059ca0147adcd495f3c5b41f260e1ac55bb679 ] The command "make -j8 C=1 CHECK=scripts/coccicheck" produces lots of "coccicheck failed" error messages. Julia Lawall explained the Coccinelle behavior as follows: "The problem on the Coccinelle side is that it uses a subdirectory with the name of the semantic patch to store standard output and standard error for the different threads. I didn't want to use a name with the pid, so that one could easily find this information while Coccinelle is running. Normally the subdirectory is cleaned up when Coccinelle completes, so there is only one of them at a time. Maybe it is best to just add the pid. There is the risk that these subdirectories will accumulate if Coccinelle crashes in a way such that they don't get cleaned up, but Coccinelle could print a warning if it detects this case, rather than failing." When scripts/coccicheck is used as CHECK tool and -j option is given to Make, the whole of build process runs in parallel. So, multiple processes try to get access to the same subdirectory. I notice spatch creates the subdirectory only when it runs in parallel (i.e. --jobs is given and is greater than 1). Setting NPROC=1 is a reasonable solution; spatch does not create the subdirectory. Besides, ONLINE=1 mode takes a single file input for each spatch invocation, so there is no reason to parallelize it in the first place. Signed-off-by: Masahiro Yamada Acked-by: Julia Lawall Signed-off-by: Sasha Levin --- scripts/coccicheck | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/scripts/coccicheck b/scripts/coccicheck index 28ad1feff9e1..dda283aba96b 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -30,12 +30,6 @@ else VERBOSE=0 fi -if [ -z "$J" ]; then - NPROC=$(getconf _NPROCESSORS_ONLN) -else - NPROC="$J" -fi - FLAGS="--very-quiet" # You can use SPFLAGS to append extra arguments to coccicheck or override any @@ -70,6 +64,9 @@ if [ "$C" = "1" -o "$C" = "2" ]; then # Take only the last argument, which is the C file to test shift $(( $# - 1 )) OPTIONS="$COCCIINCLUDE $1" + + # No need to parallelize Coccinelle since this mode takes one input file. + NPROC=1 else ONLINE=0 if [ "$KBUILD_EXTMOD" = "" ] ; then @@ -77,6 +74,12 @@ else else OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE" fi + + if [ -z "$J" ]; then + NPROC=$(getconf _NPROCESSORS_ONLN) + else + NPROC="$J" + fi fi if [ "$KBUILD_EXTMOD" != "" ] ; then