From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70E69634 for ; Fri, 6 Sep 2024 01:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725584587; cv=none; b=CNksgVBALDianEmWcTpaf3Q8Nus1pjQtPgpWnsyXYWxKMnUWvbOd0JUV7JGXMRbWa54EUv0YMOVqW0PwMpSyQtweHDiVqr6Ss0LBiemaXJ74tH3T/2D9Lk334YIR66MZ+m4pu1KK1rd9NK4A3TTOJcOPszDJbQCTnGt+mlDRKQk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725584587; c=relaxed/simple; bh=z4m4o2/drN603NiUF70RgY7/WIJvRfsJfDnzeGXC0qo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Nc3jFIQ5LPHVU7Z3HFqFTNQDL5Q4O/l6+5oTeggcjwX1e4P2uTqocKhnwmkeSf5wV0lasFWmAftOgKYgpOrb/MtaxmfwHNv412FMiHdJ1I2d5Bx4ilLKF0ia1TRaMrPdYK/qFZyW1YnSbLc0OasAuWPtOuwNmqFOmIkX2oXp0ZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=c+0xw3Ez; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="c+0xw3Ez" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2059112f0a7so14546915ad.3 for ; Thu, 05 Sep 2024 18:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1725584585; x=1726189385; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dOGqKcCZS3m+coWkXftBCip2jTDTfVTP0RKG8IcdHp8=; b=c+0xw3EzIQpfKnDqnjyAQkd4MqwN8bJHtuntHwTTjH3O0zzt4bQ4qRq6VYouowktxR P4nDEsyJNQ8TYg8UyhniRwyvKvK18vHFVnzqbyC6yn0kmQPH3aL+xq70JqXSCEVwpmI4 E9Gs03Ax7YB0LfM5yPN9cioKkObDE6HBYxXsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725584585; x=1726189385; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dOGqKcCZS3m+coWkXftBCip2jTDTfVTP0RKG8IcdHp8=; b=aGYFfjMDyDNhp/sO2QDR6h42BBrFBaVbe5QQ4SU18mNXoZf7Mb7k59pJ1fCPFFEoZD 1wtXLYDcQgsE3SN9dDlJWixyPVlO5f4Th1MDmctZ/Mx3M8vt0eTkARxXVj3SDgooUSzW Il+5nXVZ9xV+9jBCYuM2U40UWcgIrLu2RtXl1QCJQWhkBhoHWG7lJthEdmIjJWv6xkCl GXcUZWG8tnvE6ln6znQLufCv/cjlPvB5yzVvu7DMrEWKfHQefyaBfwMQDvO+/gx3MnDw NbBWEqtbIEVfuI1LMhtM4JmazkrnVnTKnw/oXpGUaSD3bk9T6Zu1L7vt0Fr5Md24BKW9 LnWw== X-Forwarded-Encrypted: i=1; AJvYcCWwb9SgkC/UY73F+xLv4q9k7iMkhphmHvsx15A1sKG6WuXFDyOivNnjFKcD1W01DkNDLG6mckzIS1IlS7M=@vger.kernel.org X-Gm-Message-State: AOJu0YwhKH5fhcJOnEiLj8bKFPTiEH7XTyh4YcSMXdirvYgEQE2PFH/T 7Y6lV9UuzeVHARfRI1109P52wg29u/VKidqfnFvSM2HUvMPVYp3XpfgH5qxqvf8= X-Google-Smtp-Source: AGHT+IGQS+zlVQH8e863up19r0CoJnbE9Az0nr/PClGUOKV1rszxTZ+R67nI2CgGD6MOFohQXJrtIw== X-Received: by 2002:a17:902:d4cd:b0:206:96ae:dc57 with SMTP id d9443c01a7336-20696aee0a4mr135653185ad.48.1725584584485; Thu, 05 Sep 2024 18:03:04 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206aea37ccdsm34167785ad.168.2024.09.05.18.03.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Sep 2024 18:03:03 -0700 (PDT) Message-ID: <428a42ef-2a3b-41ec-b1a0-7886d52d621f@linuxfoundation.org> Date: Thu, 5 Sep 2024 19:03:02 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/4] Add SWIG Bindings to libcpupower To: "John B. Wyatt IV" Cc: linux-pm@vger.kernel.org, Thomas Renninger , Shuah Khan , "Rafael J. Wysocki" , Linus Torvalds , linux-kernel@vger.kernel.org, John Kacur , Tomas Glozar , Arnaldo Melo , Greg Kroah-Hartman , "John B. Wyatt IV" , Shuah Khan References: <20240905021916.15938-1-jwyatt@redhat.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20240905021916.15938-1-jwyatt@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/4/24 20:19, John B. Wyatt IV wrote: > SWIG is a tool packaged in Fedora and other distros that can generate > bindings from C and C++ code for several languages including Python, > Perl, and Go. Providing bindings for scripting languages is a common feature > to make use of libraries more accessible to more users and programs. My team > specifically wants to expand the features of rteval. rteval is a Python program > used to measure real time performance. We wanted to test the effect of enabling > some levels of idle-stat to see how it affects latency, and didn't want to > reinvent the wheel. Since SWIG requires the .o files created by libcpupower at > compilation it makes sense to include this in the cpupower directory so that > others can make use of them. > > The V3 of this patchset includes: > * renaming header messages as requested and adding people to Cc as > requested > * moving the stub (dummy) commit to the front of the patchset > * small punctuation fixes > > The V2 of this patchset includes: > * the full definition of libcpupower headers that is needed for the bindings > * dummy implementation in C of a function listed in the header of libcpupower > (requested by Shuah Khan) > * test_raw_pylibcpupower.py demonstrates an example of using the bindings > * adding myself and John Kacur to the cpupower section of the maintainers file > (requested by Shuah Khan) > * addressed review comments about doc, makefile, and maintainers file > * small style and other fixes > > The name raw_pylibcpupower is used because a wrapper `pylibcpupower` may be > needed to make the bindings more 'pythonic' in the future. The bindings folder > is used because Go or Perl bindings may be useful for other users in the > future. > > Note that while SWIG itself is GPL v3+ licensed; the resulting output, the > bindings code, has the same license as the .o files used to generate the > bindings (GPL v2 only). Please see > https://swig.org/legal.html > and > https://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/#t > for more details on the license. > > Sincerely, > John Wyatt > Software Engineer, Core Kernel > Red Hat > > John B. Wyatt IV (4): > pm:cpupower: Add missing powercap_set_enabled() stub function > pm:cpupower: Add SWIG bindings files for libcpupower > pm:cpupower: Include test_raw_pylibcpupower.py > MAINTAINERS: Add Maintainers for SWIG Python bindings > > MAINTAINERS | 3 + > .../power/cpupower/bindings/python/.gitignore | 8 + > tools/power/cpupower/bindings/python/Makefile | 31 +++ > tools/power/cpupower/bindings/python/README | 59 +++++ > .../bindings/python/raw_pylibcpupower.i | 247 ++++++++++++++++++ > .../bindings/python/test_raw_pylibcpupower.py | 42 +++ > tools/power/cpupower/lib/powercap.c | 8 + > 7 files changed, 398 insertions(+) > create mode 100644 tools/power/cpupower/bindings/python/.gitignore > create mode 100644 tools/power/cpupower/bindings/python/Makefile > create mode 100644 tools/power/cpupower/bindings/python/README > create mode 100644 tools/power/cpupower/bindings/python/raw_pylibcpupower.i > create mode 100755 tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py > Applied the series for Linux 6.12-rc1 to https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git cpupower branch I chose to walk through the steps without installing SWIG to see what make would do. Some things to improve: Running make in tools/power/cpupower/bindings/python directory without installing SWIG gives me the following errors: make: python-config: No such file or directory swig -python raw_pylibcpupower.i make: swig: No such file or directory make: *** [Makefile:27: raw_pylibcpupower_wrap.c] Error 127 I think it would be good to provide better help message walking user through installing the dependencies. Documentation/Makefile is a good example to look at for useful message on the dependencies to be installed. You can send me patch on top of https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git cpupower branch thanks, -- Shuah