Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp683930rdb; Tue, 31 Oct 2023 21:52:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEL1iODVKXXzeOsu5r/XmgjVOkgb2ojnLkEfv5y19TRT8jlwU+Oy7fF1JAx4AkJWoWCn8NU X-Received: by 2002:a25:db0a:0:b0:da0:88a1:1e8a with SMTP id g10-20020a25db0a000000b00da088a11e8amr11735676ybf.44.1698814322279; Tue, 31 Oct 2023 21:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698814322; cv=none; d=google.com; s=arc-20160816; b=WoL6zT7HWZzwK0bxQSqk0rldNroLSE677Xq3gD6Q/ORffGe1OSwDBREyUBEx+sDXUO citBbGbckYZVNhCClkCI1U26PlUcNb55YNnAHN9HYm0dFxOswfJEt4PPFFlJTbfmryaS Kl/LYwFNVR4rpmVuMRuGIF+WYEBiJfdCYJhQFDoYJhVnI3Yp+nemJbci35TQWVgdmUEF j73skf3KJ5NX7v5jHraz34u6CIXcFzOav2/VfSYsPppRnT9MiCYCTvt9ERJ1zPt3sxiS S1YcEtkr2QP+/NvDhhLbJhBCbrrbV3nFAQB5D1Dmm3QhXYnxeuDeD6Lu7VnCoOnlAj4r SE/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=MmtP8e93GLRY1uL1+yPZ3hrIZq0kkl+JXaTnSh7Z53I=; fh=5oP/1UXqGTJCn9EhtPaD4mnUJdzyrxl2TCHfeacTi9c=; b=YvZP/b+cTSROGfuFdRUN25V4f8N6k5O5rG3J9IX8Pn1Kqy/mhuW4Zoo0v21TsqnaBc nJGKbRLFC13Wm4DdxRe9QLUOOx56JXTFnTn+7AFEZ4s9dht+FZBvYXQDaquV85dPvc3m VKW8SUSM/DtRyda1vUgJFqcKXZ/eWXi5hZUTXA1ES2ZebN+BdbSrk2AaHIr+KI8CPhTj aEPhQeoh7nr4iTUPptbfAPAMcp11lzyavs2XrlbIHtcR6IR4ojnud/a6KesbshyMmkmq Oruf0s6Kt68oQtvca4W9bQjCNrzKqL7eODeS4TaC2DTpqSRscbeitCjjsCa4aDuYlCiS 0iUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b15-20020a056a00114f00b006b1fec25a82si831381pfm.403.2023.10.31.21.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 21:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EEA3980C2542; Tue, 31 Oct 2023 21:51:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346893AbjKAEv2 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 1 Nov 2023 00:51:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345092AbjKAEv0 (ORCPT ); Wed, 1 Nov 2023 00:51:26 -0400 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6091E103; Tue, 31 Oct 2023 21:51:20 -0700 (PDT) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6b7f0170d7bso6414679b3a.2; Tue, 31 Oct 2023 21:51:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698814280; x=1699419080; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TflHzLL9mwHfj7Sd/OTyc8fpg+bR2C6DIqUfv6/8H1g=; b=SBziHYS4TmgI0AWh+WxKmxF+NxYpnnGzYS8yaAVrM94GyrDXKO8fUVtDTQhYFe3xIj +qQuL/8O/uHwOpyOS53rQXVZ7ahmT9+KyATWVY/sdXvHM/WBXuMYar3ZLxB73WRt9phO F6TeGSIK206lV7y9yrMZEr1OUSxulzH1y8nFQnx4GgPgBHOdtPMvuRighr2G4ypKxLQJ TjOlzmx/FOwmp+sJ7rzamESrYDXJD7O72OkECpInSx/iWsCX4jaYyvrFpOR05cLREANp mGVdRx39APLIhwpxhPIx4ZuBcP1sXs3qaudfM/b3guHSe92SUZ8XOKTSVVHWL/C0XwEl PHFg== X-Gm-Message-State: AOJu0YwUlWEcI37yNUVgvxTHWovsdt0JhgdN7YStR93nkEiHF5UEnXED BGGAhXRmRBk3MY97XYkeVjrKTmfAZLdmQQzlgLcwt7No X-Received: by 2002:a05:6a20:8c19:b0:161:2607:d815 with SMTP id j25-20020a056a208c1900b001612607d815mr12922828pzh.24.1698814279625; Tue, 31 Oct 2023 21:51:19 -0700 (PDT) MIME-Version: 1.0 References: <20231030111438.1357962-1-yangjihong1@huawei.com> In-Reply-To: <20231030111438.1357962-1-yangjihong1@huawei.com> From: Namhyung Kim Date: Tue, 31 Oct 2023 21:51:07 -0700 Message-ID: Subject: Re: [PATCH 1/2] perf build: Add loading python binding check to python.so build To: Yang Jihong Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 21:51:57 -0700 (PDT) Hello, On Mon, Oct 30, 2023 at 4:16 AM Yang Jihong wrote: > > 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 For both patches, Acked-by: Namhyung Kim Thanks, Namhyung > --- > 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 >