linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/power turbostat: Fix build with musl
@ 2025-06-13 16:54 Calvin Owens
  2025-06-13 17:45 ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Calvin Owens @ 2025-06-13 16:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-pm, Len Brown

    turbostat.c: In function 'parse_int_file':
    turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
     5567 |         char path[PATH_MAX];
          |                   ^~~~~~~~

    turbostat.c: In function 'probe_graphics':
    turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
     6787 |         char path[PATH_MAX];
          |                   ^~~~~~~~

Signed-off-by: Calvin Owens <calvin@wbinvd.org>
---
 tools/power/x86/turbostat/turbostat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 0170d3cc6819..925556b90770 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -67,6 +67,7 @@
 #include <stdbool.h>
 #include <assert.h>
 #include <linux/kernel.h>
+#include <limits.h>
 
 #define UNUSED(x) (void)(x)
 
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/power turbostat: Fix build with musl
  2025-06-13 16:54 [PATCH] tools/power turbostat: Fix build with musl Calvin Owens
@ 2025-06-13 17:45 ` Artem Bityutskiy
  2025-06-16  1:31   ` Zhang, Rui
  0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2025-06-13 17:45 UTC (permalink / raw)
  To: Calvin Owens, linux-kernel; +Cc: linux-pm, Len Brown, rui.zhang

On Fri, 2025-06-13 at 09:54 -0700, Calvin Owens wrote:
>     turbostat.c: In function 'parse_int_file':
>     turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
>      5567 |         char path[PATH_MAX];
>           |                   ^~~~~~~~
> 
>     turbostat.c: In function 'probe_graphics':
>     turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
>      6787 |         char path[PATH_MAX];
>           |                   ^~~~~~~~
> 
> Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/power turbostat: Fix build with musl
  2025-06-13 17:45 ` Artem Bityutskiy
@ 2025-06-16  1:31   ` Zhang, Rui
  2025-06-16  3:47     ` Calvin Owens
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Rui @ 2025-06-16  1:31 UTC (permalink / raw)
  To: dedekind1@gmail.com, calvin@wbinvd.org,
	linux-kernel@vger.kernel.org
  Cc: linux-pm@vger.kernel.org, lenb@kernel.org

On Fri, 2025-06-13 at 20:45 +0300, Artem Bityutskiy wrote:
> On Fri, 2025-06-13 at 09:54 -0700, Calvin Owens wrote:
> >     turbostat.c: In function 'parse_int_file':
> >     turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in
> > this function)
> >      5567 |         char path[PATH_MAX];
> >           |                   ^~~~~~~~
> > 
> >     turbostat.c: In function 'probe_graphics':
> >     turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in
> > this function)
> >      6787 |         char path[PATH_MAX];
> >           |                   ^~~~~~~~
> > 
> > Signed-off-by: Calvin Owens <calvin@wbinvd.org>
> Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> 
May I know how to reproduce this?

-rui

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/power turbostat: Fix build with musl
  2025-06-16  1:31   ` Zhang, Rui
@ 2025-06-16  3:47     ` Calvin Owens
  2025-06-18  3:30       ` Zhang, Rui
  0 siblings, 1 reply; 6+ messages in thread
From: Calvin Owens @ 2025-06-16  3:47 UTC (permalink / raw)
  To: Zhang, Rui
  Cc: dedekind1@gmail.com, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, lenb@kernel.org

On Monday 06/16 at 01:31 +0000, Zhang, Rui wrote:
> On Fri, 2025-06-13 at 20:45 +0300, Artem Bityutskiy wrote:
> > On Fri, 2025-06-13 at 09:54 -0700, Calvin Owens wrote:
> > >     turbostat.c: In function 'parse_int_file':
> > >     turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in
> > > this function)
> > >      5567 |         char path[PATH_MAX];
> > >           |                   ^~~~~~~~
> > > 
> > >     turbostat.c: In function 'probe_graphics':
> > >     turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in
> > > this function)
> > >      6787 |         char path[PATH_MAX];
> > >           |                   ^~~~~~~~
> > > 
> > > Signed-off-by: Calvin Owens <calvin@wbinvd.org>
> > Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> > 
> May I know how to reproduce this?

Hi Rui,

Just build turbostat with musl as libc, here's a quick chroot repro that
works on my Debian laptop:

    wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-musl/stage3-amd64-musl-20250601T163943Z.tar.xz
    mkdir tmp
    sudo tar xf stage3-amd64-musl-20250601T163943Z.tar.xz -C ./tmp
    wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.15.2.tar.xz
    sudo mv linux-6.15.2.tar.xz tmp
    sudo chroot tmp /bin/bash
    gentoo / # tar xf linux-6.15.2.tar.xz
    gentoo / # cd linux-6.15.2/tools/power/x86/turbostat/
    gentoo /linux-6.15.2/tools/power/x86/turbostat # make
    gcc -O2 -Wall -Wextra -I../../../include -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' -DBUILD_BUG_HEADER='"../../../../include/linux/build_bug.h"' -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 turbostat.c -o /root/linux-6.15.2/tools/power/x86/turbostat/turbostat  -lcap -lrt
    turbostat.c: In function 'parse_int_file':
    turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
     5567 |         char path[PATH_MAX];
          |                   ^~~~~~~~
    turbostat.c:5567:19: note: each undeclared identifier is reported only once for each function it appears in
    turbostat.c:5567:14: warning: unused variable 'path' [-Wunused-variable]
     5567 |         char path[PATH_MAX];
          |              ^~~~
    turbostat.c: In function 'probe_graphics':
    turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
     6787 |         char path[PATH_MAX];
          |                   ^~~~~~~~
    turbostat.c:6787:14: warning: unused variable 'path' [-Wunused-variable]
     6787 |         char path[PATH_MAX];
          |              ^~~~
    make: *** [Makefile:23: turbostat] Error 1

Thanks,
Calvin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/power turbostat: Fix build with musl
  2025-06-16  3:47     ` Calvin Owens
@ 2025-06-18  3:30       ` Zhang, Rui
  2025-06-18 14:42         ` Len Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Rui @ 2025-06-18  3:30 UTC (permalink / raw)
  To: calvin@wbinvd.org
  Cc: dedekind1@gmail.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, lenb@kernel.org

On Sun, 2025-06-15 at 20:47 -0700, Calvin Owens wrote:
> On Monday 06/16 at 01:31 +0000, Zhang, Rui wrote:
> > On Fri, 2025-06-13 at 20:45 +0300, Artem Bityutskiy wrote:
> > > On Fri, 2025-06-13 at 09:54 -0700, Calvin Owens wrote:
> > > >     turbostat.c: In function 'parse_int_file':
> > > >     turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use
> > > > in
> > > > this function)
> > > >      5567 |         char path[PATH_MAX];
> > > >           |                   ^~~~~~~~
> > > > 
> > > >     turbostat.c: In function 'probe_graphics':
> > > >     turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use
> > > > in
> > > > this function)
> > > >      6787 |         char path[PATH_MAX];
> > > >           |                   ^~~~~~~~
> > > > 
> > > > Signed-off-by: Calvin Owens <calvin@wbinvd.org>
> > > Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> > > 
> > May I know how to reproduce this?
> 
> Hi Rui,
> 
> Just build turbostat with musl as libc, here's a quick chroot repro
> that
> works on my Debian laptop:

Thanks for the clarification.
I have no objection if that is the case.

thanks,
rui
> 
>     wget
> https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-musl/stage3-amd64-musl-20250601T163943Z.tar.xz
>     mkdir tmp
>     sudo tar xf stage3-amd64-musl-20250601T163943Z.tar.xz -C ./tmp
>     wget
> https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.15.2.tar.xz
>     sudo mv linux-6.15.2.tar.xz tmp
>     sudo chroot tmp /bin/bash
>     gentoo / # tar xf linux-6.15.2.tar.xz
>     gentoo / # cd linux-6.15.2/tools/power/x86/turbostat/
>     gentoo /linux-6.15.2/tools/power/x86/turbostat # make
>     gcc -O2 -Wall -Wextra -I../../../include -
> DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' -
> DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-
> family.h"' -DBUILD_BUG_HEADER='"../../../../include/linux/build_bug.h"'
> -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 turbostat.c -o /root/linux-
> 6.15.2/tools/power/x86/turbostat/turbostat  -lcap -lrt
>     turbostat.c: In function 'parse_int_file':
>     turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in
> this function)
>      5567 |         char path[PATH_MAX];
>           |                   ^~~~~~~~
>     turbostat.c:5567:19: note: each undeclared identifier is reported
> only once for each function it appears in
>     turbostat.c:5567:14: warning: unused variable 'path' [-Wunused-
> variable]
>      5567 |         char path[PATH_MAX];
>           |              ^~~~
>     turbostat.c: In function 'probe_graphics':
>     turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in
> this function)
>      6787 |         char path[PATH_MAX];
>           |                   ^~~~~~~~
>     turbostat.c:6787:14: warning: unused variable 'path' [-Wunused-
> variable]
>      6787 |         char path[PATH_MAX];
>           |              ^~~~
>     make: *** [Makefile:23: turbostat] Error 1
> 
> Thanks,
> Calvin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/power turbostat: Fix build with musl
  2025-06-18  3:30       ` Zhang, Rui
@ 2025-06-18 14:42         ` Len Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Len Brown @ 2025-06-18 14:42 UTC (permalink / raw)
  To: Zhang, Rui
  Cc: calvin@wbinvd.org, dedekind1@gmail.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org

Applied.

thanks!
-Len

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-18 14:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 16:54 [PATCH] tools/power turbostat: Fix build with musl Calvin Owens
2025-06-13 17:45 ` Artem Bityutskiy
2025-06-16  1:31   ` Zhang, Rui
2025-06-16  3:47     ` Calvin Owens
2025-06-18  3:30       ` Zhang, Rui
2025-06-18 14:42         ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).