mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "John B. Wyatt IV" <jwyatt@redhat.com>
Cc: linux-pm@vger.kernel.org, Thomas Renninger <trenn@suse.com>,
	Shuah Khan <shuah@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, John Kacur <jkacur@redhat.com>,
	Tomas Glozar <tglozar@redhat.com>, Arnaldo Melo <acme@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"John B. Wyatt IV" <sageofredondo@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3 0/4] Add SWIG Bindings to libcpupower
Date: Thu, 5 Sep 2024 19:03:02 -0600	[thread overview]
Message-ID: <428a42ef-2a3b-41ec-b1a0-7886d52d621f@linuxfoundation.org> (raw)
In-Reply-To: <20240905021916.15938-1-jwyatt@redhat.com>

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

      parent reply	other threads:[~2024-09-06  1:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  2:19 John B. Wyatt IV
2024-09-05  2:19 ` [PATCH v3 1/4] pm:cpupower: Add missing powercap_set_enabled() stub function John B. Wyatt IV
2024-09-05  2:19 ` [PATCH v3 2/4] pm:cpupower: Add SWIG bindings files for libcpupower John B. Wyatt IV
2024-09-21 21:23   ` Guenter Roeck
2024-09-22 15:39     ` Linus Torvalds
2024-09-23 13:29       ` John B. Wyatt IV
2024-09-23 16:09         ` Shuah Khan
2024-09-05  2:19 ` [PATCH v3 3/4] pm:cpupower: Include test_raw_pylibcpupower.py John B. Wyatt IV
2024-09-05  2:19 ` [PATCH v3 4/4] MAINTAINERS: Add Maintainers for SWIG Python bindings John B. Wyatt IV
2024-09-06  1:03 ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=428a42ef-2a3b-41ec-b1a0-7886d52d621f@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=acme@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sageofredondo@gmail.com \
    --cc=shuah@kernel.org \
    --cc=tglozar@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=trenn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®