From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25684 invoked by alias); 5 Apr 2016 11:20:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25661 invoked by uid 89); 5 Apr 2016 11:20:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=16GB, 16gb, succeeds, plenty X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 05 Apr 2016 11:20:35 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B80C64385; Tue, 5 Apr 2016 11:20:34 +0000 (UTC) Received: from localhost (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u35BKXWi002238; Tue, 5 Apr 2016 07:20:33 -0400 Date: Tue, 05 Apr 2016 11:20:00 -0000 From: Jonathan Wakely To: Maxim Kuvyrkov Cc: Mike Stump , GCC Patches , libstdc++ Subject: Re: [PATCH] Fix detection of setrlimit in libstdc++ testsuite Message-ID: <20160405112032.GF5814@redhat.com> References: <28F74808-E037-4192-BB5E-A0492BE31172@linaro.org> <9B4A743A-A0A2-4B3F-8564-36685071C1C8@linaro.org> <320A223B-8E93-4938-BFA1-E61809101245@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-04/txt/msg00233.txt.bz2 >This patch fixes an obscure cross-testing problem that crashed (OOMed) our boards at Linaro. Several tests in libstdc++ (e.g., [1]) limit themselves to some reasonable amount of RAM and then try to allocate 32 gigs. Unfortunately, the configure test that checks presence of setrlimit is rather strange: if target is native, then try compile file with call to setrlimit -- if compilation succeeds, then use setrlimit, otherwise, ignore setrlimit. The strange part is that the compilation check is done only for native targets, as if cross-toolchains can't generate working executables. [This is rather odd, and I might be missing some underlaying caveat.] I went spelunking, and the IS_NATIVE check has been there since r70167, which replaced: if test x"$GLIBCXX_IS_CROSS_COMPILING" = xfalse; then # Do checks for memory limit functions. GLIBCXX_CHECK_SETRLIMIT That arrived in r68067, but that seems to eb just a refactoring, and I got lost tracking it further. So there has been a similar check since at least 2003. >Therefore, when testing a cross toolchain, the test [1] still tries to allocate 32GB of RAM with no setrlimit restrictions. On most targets that people use for cross-testing this is not an issue because either >- the target is 32-bit, so there is no 32GB user-space to speak of, or >- the target board has small amount of RAM and no swap, so allocation immediately fails, or >- the target board has plenty of RAM, so allocating 32GB is not an issue. > >However, if one is testing on a 64-bit board with 16GB or RAM and 16GB of swap, then one gets into an obscure near-OOM swapping condition. This is exactly the case with cross-testing aarch64-linux-gnu toolchains on APM Mustang. > >The attached patch removes "native" restriction from configure test for setrlimit. This enables setrlimit restrictions on the testsuite, and the test [1] expectedly fails to allocate 32GB due to setrlimit restriction. > >I have tested it on x86_64-linux-gnu and i686-linux-gnu native toolchains, and aarch64-linux-gnu and arm-linux-gnueabi[hf] cross-toolchains with no regressions [*]. > >OK to commit? This issue has been present for well over a decade so it doesn't seem critical to fix in stage4, but as it only affects the testsuite I am OK with the change if the RMs have no objections.