From patchwork Mon Oct 30 11:14:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 159690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2128707vqb; Mon, 30 Oct 2023 04:17:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyoeOu09KwHxTfvndYINeFrtl4Q2kwx+dRKAQ5zOR4X8xW/naX6BgZN8HUsC/y/XJLtiqw X-Received: by 2002:a05:6a00:2d0b:b0:692:6d3f:485b with SMTP id fa11-20020a056a002d0b00b006926d3f485bmr7655606pfb.3.1698664631474; Mon, 30 Oct 2023 04:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698664631; cv=none; d=google.com; s=arc-20160816; b=V3FmVIbiAUN51RhzMfaZjFqfgBQENZO/ytSbJOveZwWrUZ26Uu+rd9kccZ7ZoLnwN/ iItkCb5TiyTnjPLl4V/wymQHhGzeQDAIEfblpBTfY2yJnAUj2Hvp6S0jCUkR+J9IH8z5 Ug43YMn0nVFh1sp0I/ozSCcycT/rIIrb2WOSvHbUIx97wXr74ZtdxVvtWMS+9s1dLnFf qLK6D+QSlJJWQ10tFR7uJGsMQ+aZW340PkINPwBUG9KrngEB2fvOs5PMv9U63gk9uYDo hc79sRv3OatHK5ScB4XAxW3umJ1N1Yg2+T0R9Twm7Sc/GKrldxHi/j8TkWJ21HiJv/uy r0cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qnF85iwLnbfifqJBVEFqUL+kzbGIqPNiSbBllmGGjR0=; fh=JXx1mv1fB650HoTkc5GIgpDQ5Ey550GcDyaNZ/s6bYc=; b=QE0wmMq4nPWlGhB9yxriNSpAEx01fWfeOwk4bdD223MLUIPcx51brsSxXkUYx8XV6y oK5DodYeZ6WtYkB1TwojfZcNcgnVoPzY+yI/8AvaN84jL/XdWAqMnGsyyo5NqvZdE0RY od6GFb7sQdp5jQdNMfbRgwLqB8ebQ6BoulgfpL/jwXS4SVhsqE/OYRNNcNsAZMGJ+J+n I3zp3FCDP/NziqIAppV0KjoocljWY9GD4PbKxd2BkL6xVjf02HRXj4rCOo/EtQ71HNjY D69w5EgbuVpIDYGG1nIjZo8cdXn3Xbl73hD2kyHxUxqq33TuyEOB4OSsc0ywjlx4tRoF Fabw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ka18-20020a056a00939200b006933e8fec67si4931624pfb.227.2023.10.30.04.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 04:17:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 12D34806E153; Mon, 30 Oct 2023 04:17:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232922AbjJ3LQy (ORCPT + 31 others); Mon, 30 Oct 2023 07:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbjJ3LQx (ORCPT ); Mon, 30 Oct 2023 07:16:53 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1764B3; Mon, 30 Oct 2023 04:16:50 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SJrHd2sNqzrTsK; Mon, 30 Oct 2023 19:13:49 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 30 Oct 2023 19:16:48 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 1/2] perf build: Add loading python binding check to python.so build Date: Mon, 30 Oct 2023 11:14:37 +0000 Message-ID: <20231030111438.1357962-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 30 Oct 2023 04:17:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781178964629363735 X-GMAIL-MSGID: 1781178964629363735 Add loading python binding check to python.so build so that problem can be detected in advance in the build phase instead of being left to `perf test` phase. In normal scenarios, the original build is not affected: $ cd tools/perf $ rm -rf /tmp/perf; mkdir /tmp/perf; make O=/tmp/perf $ echo $? 0 $ cd /tmp/perf $ ./perf test python 19: 'import perf' in python : Ok Create an error scenario, for example, delete util/rlimit.c from util/python-ext-sources: $ cd tools/perf $ sed -i 's@util/rlimit.c@#util/rlimit.c@g' util/python-ext-sources $ grep rlimit util/python-ext-sources #util/rlimit.c $ rm -rf /tmp/perf; mkdir /tmp/perf; make JOBS=1 O=/tmp/perf GEN /tmp/perf/python/perf.cpython-310-x86_64-linux-gnu.so Error: Load python binding failed. See /tmp/perf/python_ext_build/lib//build.log for more details make[2]: *** [Makefile.perf:644: /tmp/perf/python/perf.cpython-310-x86_64-linux-gnu.so] Error 1 make[1]: *** [Makefile.perf:242: sub-make] Error 2 make: *** [Makefile:70: all] Error 2 $ cat /tmp/perf/python_ext_build/lib//build.log Traceback (most recent call last): File "", line 1, in ImportError: /tmp/perf/python_ext_build/lib/perf.cpython-310-x86_64-linux-gnu.so: undefined symbol: rlimit__increase_nofile Signed-off-by: Yang Jihong Acked-by: Namhyung Kim --- tools/perf/Makefile.perf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index d80dcaa5a1e3..a2449c4890ad 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -645,7 +645,13 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \ $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ - cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ + $(PYTHON_WORD) -c 'import sys; sys.path.insert(0, "$(PYTHON_EXTBUILD_LIB)"); import perf' 2>$(PYTHON_EXTBUILD_LIB)/build.log; \ + if [ $$? -ne 0 ]; then \ + echo "Error: Load python binding failed. See $(PYTHON_EXTBUILD_LIB)/build.log for more details"; \ + exit 1; \ + else \ + cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/; \ + fi python_perf_target: @echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)"