Skip to contentSkip to conversation

unparseable, undocumented /sys/class/drm/.../pstate

DISCUSSION Pavel Machek 5 participants 24 messages Jun 21, 2014 – Jun 24, 2014

lore
Share & tools
lore
#0 lore raw

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 21 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

Quoted 8 lines

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

-ilia

#2 lore raw
Quoted 11 lines · Ilia Mirkin
Quoted 10 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

...

Quoted 5 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a

According to the article, it is only starting to work now. I know articles can be wrong, but I don't have that hardware... Sorry if it is the case.

Quoted 3 lines

lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

debugfs would work, yes.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 14 lines · Pavel Machek
Quoted 11 lines · Ilia Mirkin
Quoted 10 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

...

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a

According to the article, it is only starting to work now. I know articles can be wrong, but I don't have that hardware... Sorry if it is the case.

Commit 26fdd78cce3f51a49e1f2d3ad27ee893a28d220e introduced this particular one. Commit 330c5988ee78045e6a731c3693251aaa5b0d14e3 had introduced the former version, which was removed in 3.13, replaced with the new one.

Quoted 10 lines
Quoted 4 lines

lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

debugfs would work, yes.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

#4 lore raw
In reply to Ilia Mirkin
Quoted 29 lines · Ilia Mirkin
Quoted 28 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

Quoted 8 lines
Quoted 1 line

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

greg k-h

#5 lore raw
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

-ilia

#6 lore raw
Quoted 24 lines · Ilia Mirkin
Quoted 23 lines · Greg KH
Quoted 22 lines · Ilia Mirkin
Quoted 21 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

But it is not. Management tools will want to parse it, sooner or later. What is wrong with solution described above?

Quoted 3 lines

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

Documentation/ABI/testing/

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw
Quoted 25 lines · Pavel Machek
Quoted 24 lines · Ilia Mirkin
Quoted 23 lines · Greg KH
Quoted 22 lines · Ilia Mirkin
Quoted 21 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

But it is not.

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

It is complex and annoying to the people that will actually use it.

Quoted 6 lines
Quoted 4 lines

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

Documentation/ABI/testing/

Yes, I got that far. And then I became confused.

-ilia

#8 lore raw

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

Quoted 8 lines
Quoted 1 line

But it is not.

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

It is complex and annoying to the people that will actually use it.

grep -r . pstate/ is actually not that bad...

And yes, some kind of utility to select right performance level would be nice in future... Or maybe not. Perhaps in not so distant future kernel will use right performance level for given load...?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#9 lore raw
Quoted 17 lines · Pavel Machek

Hi!

Quoted 15 lines
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

But it is not.

Quoted 8 lines
Quoted 6 lines

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

It is complex and annoying to the people that will actually use it.

grep -r . pstate/ is actually not that bad...

While that's a clever trick that anyone who's done a bunch of stuff with sysfs knows, I doubt the average linux user could come up with that on their own. I know I didn't.

Quoted 4 lines

And yes, some kind of utility to select right performance level would be nice in future... Or maybe not. Perhaps in not so distant future kernel will use right performance level for given load...?

Eventually yes. Currently switching between levels varies from unsupported to unreliable depending on the hardware (as in, hangs the card, or does otherwise-not-great things). Automatic switching requires regular switching to be reliable :) [And the performance counters that are presently being worked on to be able to tell the card load.]

-ilia

#10 lore raw
Quoted 23 lines · Ilia Mirkin
Quoted 22 lines · Pavel Machek

Hi!

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

But it is not.

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

It is complex and annoying to the people that will actually use it.

grep -r . pstate/ is actually not that bad...

While that's a clever trick that anyone who's done a bunch of stuff with sysfs knows, I doubt the average linux user could come up with that on their own. I know I didn't.

That's fine, why would an "average" Linux user ever need to poke around in sysfs? Again, please describe what you are wanting to have exported to userspace, and what userspace is supposed to do with that information, before worrying about the actual sysfs file layout.

greg k-h

#11 lore raw
Quoted 28 lines · Greg KH
Quoted 27 lines · Ilia Mirkin
Quoted 25 lines · Pavel Machek

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

Quoted 8 lines
Quoted 1 line

But it is not.

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

It is complex and annoying to the people that will actually use it.

grep -r . pstate/ is actually not that bad...

Quoted 8 lines
Quoted 3 lines

While that's a clever trick that anyone who's done a bunch of stuff with sysfs knows, I doubt the average linux user could come up with that on their own. I know I didn't.

That's fine, why would an "average" Linux user ever need to poke around in sysfs? Again, please describe what you are wanting to have exported to userspace, and what userspace is supposed to do with that information, before worrying about the actual sysfs file layout.

It would be nice to allow the end-user to switch between performance levels on the card.

A particular card exposes some number of levels (well, a particular card's VBIOS), identified by a value between 0-254 (usually identified as a 2-char hex string). Each level has various information associated with it, like timing parameters for various bits of the card, as well as some more user-friendly concepts like "memory clock speed" etc.

The card's current state may or may not correspond to one of the predefined levels; often-times the VBIOS initializes the card into some non-level state. This state may also be of some interest to the user.

We can't switch to arbitrary speeds, only the defined ones (because of the various other timing parameters). The level ids don't carry too much semantic value (higher usually means faster though), so it would additionally be nice to tell the user some of the more user-friendly information about each level. Different hardware versions will be able to expose different types of information (but always in <name> <clock speed/range> pairs).

-ilia

#12 lore raw
In reply to Greg KH
Quoted 28 lines · Greg KH
Quoted 27 lines · Ilia Mirkin
Quoted 25 lines · Pavel Machek

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

Quoted 8 lines
Quoted 1 line

But it is not.

But it is...

Quoted 2 lines

Management tools will want to parse it, sooner or later. What is wrong with solution described above?

It is complex and annoying to the people that will actually use it.

grep -r . pstate/ is actually not that bad...

Quoted 8 lines
Quoted 3 lines

While that's a clever trick that anyone who's done a bunch of stuff with sysfs knows, I doubt the average linux user could come up with that on their own. I know I didn't.

That's fine, why would an "average" Linux user ever need to poke around in sysfs? Again, please describe what you are wanting to have exported to userspace, and what userspace is supposed to do with that information, before worrying about the actual sysfs file layout.

Because, at the moment, we can't by default give any kind of automatic clock management policy due to the fact that in a great number of cases, we'll likely hang the GPU when changing clock speeds. The VBIOS defaults aren't sufficient for more demanding games etc, and people might want to try/risk selecting the highest level anyway to see if it'll work for them. When things actually work, this will all automagically happen based on load and users should never need to touch it.

So, we want a file users can write the level identifier into. Which, shockingly, is exactly what the file currently does.

I, however, also decided that people might actually want to know what this "0x0a" they're echoing into the file actually means; So, in the output (which is a list of valid identifiers), after the identifier there's a bunch of "<name> <value>" pairs giving an overview of that this mysterious "0x0a" is.

Sure, we can remove the information and have the informationless list of identifiers and we'd suddenly be strictly obeying the rules, then we've also made any potential userspace tool that we're worried about a lot more useless (what's it going to do, a drop-down list of 0x07, 0x0a, 0x0e, 0x0f?).

Sure, we can split this all up into a directory structure; and make it a lot more cumbersome for the intended target of the user who just wants to override an unfortunate but currently necessary default. I'm not sure how exactly one-per-line "<id>: <name> <min>-<max> ..." is hard for userspace to deal with (scanf anyone?), but a directory structure won't be any easier, the available files will still differ with each card generation etc and userspace will just have to loop over a directory list instead of each line of a single file.

But, as I said on IRC yesterday, let's just move this to debugfs to save this waste of time argument, and move on.

Ben.

Quoted 6 lines

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw
Quoted 3 lines · Ben Skeggs

But, as I said on IRC yesterday, let's just move this to debugfs to save this waste of time argument, and move on.

I like that idea, great plan :)

greg k-h

#14 lore raw
In reply to Ilia Mirkin
Quoted 42 lines · Ilia Mirkin
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Quoted 7 lines

Could we just say that the format of this file is one-per-line of

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

sysfs files are "one value per file", that's it. Do anything other than that, and it can not be in sysfs, sorry.

greg k-h

#15 lore raw
Quoted 45 lines · Greg KH
Quoted 44 lines · Ilia Mirkin
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Could we just say that the format of this file is one-per-line of

Quoted 8 lines
Quoted 5 lines

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

sysfs files are "one value per file", that's it. Do anything other than that, and it can not be in sysfs, sorry.

I think that's a little inconsistent. There are *tons* of files in sysfs with multiple values. For example "local_cpulist" which contains the string "0-3" for me, the per-connector "modes" file which has a list of modes supported, and a "resource" file which has a list of hex values (which probably have something to do with PCI resources?). [I purposely picked values coming from different parts of the kernel not to focus on one subsystem...]

-ilia

#16 lore raw
Quoted 55 lines · Ilia Mirkin
Quoted 45 lines · Greg KH
Quoted 44 lines · Ilia Mirkin
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Could we just say that the format of this file is one-per-line of

Quoted 8 lines
Quoted 5 lines

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

sysfs files are "one value per file", that's it. Do anything other than that, and it can not be in sysfs, sorry.

Quoted 7 lines

I think that's a little inconsistent. There are *tons* of files in sysfs with multiple values. For example "local_cpulist" which contains the string "0-3" for me, the per-connector "modes" file which has a list of modes supported, and a "resource" file which has a list of hex values (which probably have something to do with PCI resources?). [I purposely picked values coming from different parts of the kernel not to focus on one subsystem...]

A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you know of exceptions to that rule, please point them out and I will be glad to yell at the developers.

PCI device resources are binary sysfs files, which are just pass-through files from the firmware/device to userspace, with no parsing done in the kernel. So that's just a single 'value' as well.

greg k-h

#17 lore raw
Quoted 64 lines · Greg KH
Quoted 55 lines · Ilia Mirkin
Quoted 45 lines · Greg KH
Quoted 44 lines · Ilia Mirkin
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Could we just say that the format of this file is one-per-line of

Quoted 8 lines
Quoted 5 lines

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

sysfs files are "one value per file", that's it. Do anything other than that, and it can not be in sysfs, sorry.

Quoted 7 lines

I think that's a little inconsistent. There are *tons* of files in sysfs with multiple values. For example "local_cpulist" which contains the string "0-3" for me, the per-connector "modes" file which has a list of modes supported, and a "resource" file which has a list of hex values (which probably have something to do with PCI resources?). [I purposely picked values coming from different parts of the kernel not to focus on one subsystem...]

Quoted 3 lines

A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

Quoted 6 lines

know of exceptions to that rule, please point them out and I will be glad to yell at the developers.

PCI device resources are binary sysfs files, which are just pass-through files from the firmware/device to userspace, with no parsing done in the kernel. So that's just a single 'value' as well.

$ cat /sys/class/drm/card0/device/resource
0x00000000f0000000 0x00000000f03fffff 0x0000000000140204
0x0000000000000000 0x0000000000000000 0x0000000000000000

Doesn't seem like "binary" in the true sense, but perhaps that's close enough.

-ilia

#18 lore raw
Quoted 9 lines · Ilia Mirkin
Quoted 4 lines · Greg KH

On Mon, Jun 23, 2014 at 12:18:51PM -0400, Ilia Mirkin wrote:
A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

This means we should also create a new sysfs file per performance level too, right? Is there another way for a driver to expose a list in sysfs?

Since NVIDIA gives different names to performance levels depending on the card family, we may need to abstract the name away in order to provide some consistency and make listing performance levels easier from a program (may it use readdir() or stat()).

Moving the file to debugfs would "fix" the one-value-per-file rule but it would also require users to mount debugfs at boot time in order to write the default configuration they want for PM instead of just changing /etc/sysctl.d/nouveau.conf... On the other hand, I'm not sure we can commit on having a stable ABI on the way we display clocks (unless people take them as a single value and do not try to parse them) as new hardware will alter the semantics of each clock domain, if not drop/split some of them!

Whatever we do, it doesn't look like we can find a nice solution that fits every use cases unless we write a userspace program to access this data, but this seems highly overkill...

#19 lore raw
Quoted 31 lines · Martin Peres
Quoted 9 lines · Ilia Mirkin
Quoted 5 lines · Greg KH

On Mon, Jun 23, 2014 at 12:18:51PM -0400, Ilia Mirkin wrote:
A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Quoted 3 lines

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

This means we should also create a new sysfs file per performance level too, right? Is there another way for a driver to expose a list in sysfs?

Since NVIDIA gives different names to performance levels depending on the card family, we may need to abstract the name away in order to provide some consistency and make listing performance levels easier from a program (may it use readdir() or stat()).

Moving the file to debugfs would "fix" the one-value-per-file rule but it would also require users to mount debugfs at boot time in order to write the default configuration they want for PM instead of just changing /etc/sysctl.d/nouveau.conf... On the other hand, I'm not sure we can commit on having a stable ABI on the way we display clocks (unless people take them as a single value and do not try to parse them) as new hardware will alter the semantics of each clock domain, if not drop/split some of them!

Quoted 3 lines

Whatever we do, it doesn't look like we can find a nice solution that fits every use cases unless we write a userspace program to access this data, but this seems highly overkill...

I was thinking just having the list of level ids in the pstate file, and then stick the current file into debugfs. That way people retain the ability to see things, as well as use pstate directly for a configured system.

-ilia
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#20 lore raw
Quoted 32 lines · Ilia Mirkin
Quoted 31 lines · Martin Peres
Quoted 9 lines · Ilia Mirkin
Quoted 5 lines · Greg KH

On Mon, Jun 23, 2014 at 12:18:51PM -0400, Ilia Mirkin wrote:
A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Quoted 3 lines

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

This means we should also create a new sysfs file per performance level too, right? Is there another way for a driver to expose a list in sysfs?

Since NVIDIA gives different names to performance levels depending on the card family, we may need to abstract the name away in order to provide some consistency and make listing performance levels easier from a program (may it use readdir() or stat()).

Moving the file to debugfs would "fix" the one-value-per-file rule but it would also require users to mount debugfs at boot time in order to write the default configuration they want for PM instead of just changing /etc/sysctl.d/nouveau.conf... On the other hand, I'm not sure we can commit on having a stable ABI on the way we display clocks (unless people take them as a single value and do not try to parse them) as new hardware will alter the semantics of each clock domain, if not drop/split some of them!

Quoted 8 lines
Quoted 3 lines

Whatever we do, it doesn't look like we can find a nice solution that fits every use cases unless we write a userspace program to access this data, but this seems highly overkill...

I was thinking just having the list of level ids in the pstate file, and then stick the current file into debugfs. That way people retain the ability to see things, as well as use pstate directly for a configured system.

In this case, would we still use the * to indicate the current perflvl?

Also, are we supposed to output the current perflvl or the current configuration in use? Right now, we configure it to either auto (WIP), perflvl X at all time or perflvl X when on battery and Y when on sector. However, when we read pstate, we only get the current perflvl if my memory serves me right. Maybe we should create a r-o file that outputs the current perflvl and keep pstate for storing the configuration.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw
Quoted 55 lines · Martin Peres
Quoted 53 lines · Ilia Mirkin
Quoted 49 lines · Martin Peres
Quoted 13 lines · Ilia Mirkin
Quoted 7 lines · Greg KH

On Mon, Jun 23, 2014 at 12:18:51PM -0400, Ilia Mirkin wrote:
A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Quoted 3 lines

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

This means we should also create a new sysfs file per performance level too,
right? Is there another way for a driver to expose a list in sysfs?

Since NVIDIA gives different names to performance levels depending on the card family, we may need to abstract the name away in order to provide some
consistency and make listing performance levels easier from a program (may
it use readdir() or stat()).

Moving the file to debugfs would "fix" the one-value-per-file rule but it would also require users to mount debugfs at boot time in order to write the
default configuration they want for PM instead of just changing /etc/sysctl.d/nouveau.conf... On the other hand, I'm not sure we can commit
on having a stable ABI on the way we display clocks (unless people take them
as a single value and do not try to parse them) as new hardware will alter
the semantics of each clock domain, if not drop/split some of them!

Whatever we do, it doesn't look like we can find a nice solution that fits
every use cases unless we write a userspace program to access this data, but
this seems highly overkill...

Quoted 7 lines
Quoted 4 lines

I was thinking just having the list of level ids in the pstate file, and then stick the current file into debugfs. That way people retain the ability to see things, as well as use pstate directly for a configured system.

In this case, would we still use the * to indicate the current perflvl?

That would only be in debugfs. pstate would just list the available levels and let you set one. (or 'auto', as you point out below)

Quoted 7 lines

Also, are we supposed to output the current perflvl or the current configuration in use? Right now, we configure it to either auto (WIP), perflvl X at all time or perflvl X when on battery and Y when on sector. However, when we read pstate, we only get the current perflvl if my memory serves me right. Maybe we should create a r-o file that outputs the current perflvl and keep pstate for storing the configuration.

Yeah, we could do something like that... ugh, the battery/ac stuff is a complication. Unclear whether that belongs in the kernel in the first place... but I guess other drivers do it?
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw
In reply to Martin Peres
Quoted 7 lines · Martin Peres
Quoted 6 lines · Ilia Mirkin
Quoted 4 lines · Greg KH

On Mon, Jun 23, 2014 at 12:18:51PM -0400, Ilia Mirkin wrote:
A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Quoted 6 lines
Quoted 3 lines

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

This means we should also create a new sysfs file per performance level too, right? Is there another way for a driver to expose a list in sysfs?

What exactly are you wanting to export to userspace? What will userspace do with this information? Why export anything at all?

Start with defining that, and go from there.

thanks,

greg k-h

#23 lore raw
In reply to Ilia Mirkin
Quoted 80 lines · Ilia Mirkin
Quoted 64 lines · Greg KH
Quoted 55 lines · Ilia Mirkin
Quoted 45 lines · Greg KH
Quoted 44 lines · Ilia Mirkin
Quoted 32 lines · Greg KH
Quoted 31 lines · Ilia Mirkin
Quoted 29 lines · Pavel Machek

Hi!

AFAICT, pstate file will contain something like

07: core 100 MHz memory 123 MHz *
08: core 100-200 MHz memory 123 MHz

...which does not look exactly like one-value-per-file, and I'm pretty sure userspace will get it wrong if it tries to parse it. Plus, I don't see required documentation in Documentation/ABI.

Should we disable it for now, so that userspace does not start depending on it and we'll not have to maintain it forever?

I guess better interface would be something like

pstate/07/core_clock_min
core_clock_max
memory_clock_min
memory_clock_max

and then pstate/active containing just the number of active state?

Thanks,
Pavel

PS: I have no nvidia, got the news at

http://www.phoronix.com/scan.php?page=article&item=nouveau_try_linux316&num=2

Quoted 8 lines
Quoted 6 lines

FTR, this file has been in place since 3.13, and there was a different file before it (performance_levels), with a comparable format since much earlier (definitely 3.8, probably earlier). I think it's meant a lot more for people looking at it and echo'ing stuff to it to modify the levels (where supported), than for programs parsing it. Perhaps sysfs is the wrong place for this -- what is the right place? debugfs?

Yes, please move it to debugfs.

Could we just say that the format of this file is one-per-line of

Quoted 8 lines
Quoted 5 lines

level: information-for-the-user

And you can echo a level into it to switch to that level? That seems like a reasonable ABI to have... would be happy to throw it into a file somewhere... not sure where though.

sysfs files are "one value per file", that's it. Do anything other than that, and it can not be in sysfs, sorry.

Quoted 7 lines

I think that's a little inconsistent. There are *tons* of files in sysfs with multiple values. For example "local_cpulist" which contains the string "0-3" for me, the per-connector "modes" file which has a list of modes supported, and a "resource" file which has a list of hex values (which probably have something to do with PCI resources?). [I purposely picked values coming from different parts of the kernel not to focus on one subsystem...]

Quoted 3 lines

A list of valid "values" that a file can be in is fine if you just then write one value back to that file. That's the one exception, but a minor one given the huge number of sysfs files. Other than that, if you

Which is pretty much what the pstate file is. Would it make things better if we removed the descriptive info while leaving the pstate file in place?

Quoted 6 lines

know of exceptions to that rule, please point them out and I will be glad to yell at the developers.

PCI device resources are binary sysfs files, which are just pass-through files from the firmware/device to userspace, with no parsing done in the kernel. So that's just a single 'value' as well.

Quoted 5 lines
$ cat /sys/class/drm/card0/device/resource
0x00000000f0000000 0x00000000f03fffff 0x0000000000140204
0x0000000000000000 0x0000000000000000 0x0000000000000000

Doesn't seem like "binary" in the true sense, but perhaps that's close enough.

It's "close enough" :)