Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2662808rdh; Mon, 30 Oct 2023 04:17:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjaKLjrLfaunJ0QGBiuIQDTguRmNXLxSouQaMyxAqEsD1BNtdKStef9KpZtcmqY4kjQ6VK X-Received: by 2002:a17:90a:ed03:b0:27d:1822:f3de with SMTP id kq3-20020a17090aed0300b0027d1822f3demr6592872pjb.16.1698664628023; Mon, 30 Oct 2023 04:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698664628; cv=none; d=google.com; s=arc-20160816; b=XYbn4wEVPx6PzCO9eI2EnSkEjb8VdXhSSSD5w7lZSD35UE9I1ItVlIf5biNOmO8KSM X245Tbn0XBWeUxvpcoYJlWMY/hGxR9syZr5xZJ7hfY8WVLK04g1lY71hfvSes1HZcGb0 aBe8XJCQABkQd7bEAqPj9r2J7SfGM5u8VuGITXT5jtCsekg6YLJl+iYm/LQVC+EeFEZK /c0AktDrFNUr7Ns5sRddEjHnOWJNtVR4/LkzMy92ndaYhWD7BE0zxvDdVIEKis36roF4 O9V4+Yh46OauCBn1GyFTjrJ5AVHSEn3vn0BTFJ48Vv0Q7O8CYub6AQL04nwUSEY7QsoC +Log== 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.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y13-20020a17090ad70d00b002740f8fa612si4734817pju.21.2023.10.30.04.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 04:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 9F43780AC8C5; Mon, 30 Oct 2023 04:17:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232912AbjJ3LQy (ORCPT + 99 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 04:17:05 -0700 (PDT) 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 --- 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)" -- 2.34.1