From patchwork Fri Mar 22 15:42:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 1914974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V1RX91GV6z23r9 for ; Sat, 23 Mar 2024 02:46:48 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rnh6M-0005Rf-9p; Fri, 22 Mar 2024 15:46:38 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rnh6K-0005RR-NK for kernel-team@lists.ubuntu.com; Fri, 22 Mar 2024 15:46:36 +0000 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8B21F3F274 for ; Fri, 22 Mar 2024 15:46:36 +0000 (UTC) Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41405226279so14084285e9.0 for ; Fri, 22 Mar 2024 08:46:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711122396; x=1711727196; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KVfkHNk1II+Iz/1YO8X9zDQu8ZtG+5tTu/ov0tdkrk8=; b=PHA+7P0yn+/GaVCfIVe5qaytv82x5Q1StmWc1ncsBPDj5GbpZ05biv8JB9UPb66vVi XTIY7mYvhzQ7fm0kazR9n9X/EHp+Md3Nbm1X0hLef1DOCUiKRs2zBa9lAY72eYjwz/CD fCF3u34qOSNeeSDDZPLYbVlH79PHJjdaNihwkGErETNq3R29Rx/o9CQZ2zmqeqOBucnP NSYOVpVLgE2fNlKiBPAyFh4y6AxfRHWYL2Z7OMjLY2B1K4iBnDdRHo4he6rDbMtfRPRf gUqVt3OmE/O4qHNbUWq3TV06Gnz+Vvumb0fR1f5LtX4FKuhxcKu0V8wYUdikuC7QSzOA 3Mqw== X-Gm-Message-State: AOJu0YwTeVC83AtrQqXDCpaQe6BcnEFwSg8vOoZUO9ayDjC7wKRaDteS ZMF1p4V+R542cXxiUaaLEdCsaFjxaD4bvrA7EM6xXTNDmOWsANa1iNU/ljQvFaG6U3xI40jMAk/ HKe44xBkzK8qvyxSVowoe0uPdJLpCC/1Mc+XWjUVNYTewlVbbTWO3tOkQM+gzVq9r1ulGRszCM2 HoxmIPlyGr/A== X-Received: by 2002:a05:600c:a03:b0:413:fd90:3d08 with SMTP id z3-20020a05600c0a0300b00413fd903d08mr2276464wmp.41.1711122396099; Fri, 22 Mar 2024 08:46:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLLrVXTJBacpIgm193z9Hps9SdahWeB30q1LEqfKcM9I+lxZTXXP1DNZY91PodXw+4YIOqdg== X-Received: by 2002:a05:600c:a03:b0:413:fd90:3d08 with SMTP id z3-20020a05600c0a0300b00413fd903d08mr2276441wmp.41.1711122395519; Fri, 22 Mar 2024 08:46:35 -0700 (PDT) Received: from gpd.station (net-188-217-54-181.cust.vodafonedsl.it. [188.217.54.181]) by smtp.gmail.com with ESMTPSA id fs7-20020a05600c3f8700b0041465c859d0sm3351286wmb.39.2024.03.22.08.46.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:46:35 -0700 (PDT) From: Andrea Righi To: kernel-team@lists.ubuntu.com Subject: [U/N][PATCH 0/2] Provide python perf module Date: Fri, 22 Mar 2024 16:42:38 +0100 Message-ID: <20240322154631.804565-1-andrea.righi@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" [Impact] We need to provide the python perf module, because some applications (such as tuned) require it. This module is implemented inside perf, provided by the kernel. At the moment we provide a distinct perf for each kernel installed in the system. There is really no reason to do that, because perf is both backward and forward compatible, but this is a different issue and we are not going to solve it in this context and it will be addressed in a separate bug. For now, to solve this specific issue, we need to enable the python module when we build perf (as part of the kernel build) and ship the library inside the linux-tools- package. However, this brings a new problem, because we need to install the module in a standard python path (so that python applications can be able to use it in a regular way), but we need to support multiple installed versions and add some logic to transparently select the right one when a generic user-space python application uses `import perf`. For this reason we need to provide a python wrapper module that is imported via a regular `import perf` and it transparently loads the actual python perf module, based on the kernel that is currently running. [Test case] Install linux-tools- and run the following simple test case: $ python3 -c 'import perf; [print(c) for c in perf.cpu_map()]' [Fix] - Enable the python perf module build during the regular kernel build - Provide a virtual `perf` python module wrapper in linux-tools-common [Regression potential] We are adding a new python module to linux-tools (that is something new, we don't ship any other python module), but we are not changing anything that is already provided, so the only regression that can happen is an increased size of the linux-tools package.