Re: [PATCH 4/9] cpuidle: Introduce .abbr (abbrevation) for cpuidlestates

From: Len Brown
Date: Wed Jan 12 2011 - 17:25:31 EST


> > If the display tools can only handle 3 characters,
> > then why not have them simply use the 1st 3 characters
> > of the existing name field?

> You mean use:
> C3 NHM
> instead of
> NHM-C3
> for intel_idle?

Yes.
is there a reason that would be a problem?

If only 3 characters are useful,
then I'd rather see you simly do this:

#define CPUIDLE_NAME_LEN 3

> Then userspace has to parse the two informations glued
> together, get rid of the whitespace, etc.

what "two informations"?
why is kernel bloat the instrument of choice
to avoid the expense of string truncation
in user-space tools?

> But by sysfs convention a separate file must be used
> if two data are passed to userspace which is the case here.

what two data?

It is fine for a string to include space characters.

> > If that is not unique,
> > then re-arrange the strings so that it is unique...

> See above, it would unnecessarily make life hard for
> userspace.
> Afaik sysfs entries do not consume resources as long as
> they do not get accessed.

they clutter the source code,
they create an additional name for something
that arguably already has 3 names --
the state #, the name, and the description.
I'd rather delete a few of the fields than add a 4th...

> >Of course the ACPI part of this patch will not apply,
> > as it depends on patch 1 in this series, which was erroneous.
> > For ACPI, the existing name field is already fine,
> > as C%d fits into 3 characters.

> For acpi_idle only it would work, but this is (nearly) the only
> one.
> For example for sh arch:
> name: SuperH
> "SH SuperH" contains two data and should get split up into:
> name: SuperH
> abbr: SH

acpi/arch/sh/kernel/cpu/shmobile/cpuidle.c
already uses state->name = "C0", "C1", "C2".

Just use them and be done.

> By convention the first characters of "description" could be
> used, but you would again end up in userspace parsing and
> double info in one sysfs file.
>
> I hope that's enough for convincing, I'd really like to go
> the .abbr way. Do you give me an acked-by for that one?

No.

We should not invent an additional abbreviation field.
The tools should use the existing name field.
If the existing name field is not sufficient, then
the states should simply be enumerated and numbers
be shown in the GUI.

thanks,
Len Brown, Intel Open Source Technology Center



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/