Message ID | 9hhbnki6uvp.fsf@e105922-lin.cambridge.arm.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Eduardo Valentin |
Headers | show |
Punit, On Wed, Feb 25, 2015 at 12:25:14PM +0000, Punit Agrawal wrote: > Eduardo Valentin <edubezval@gmail.com> writes: > <cut> > > What is your optionion? > > Although I understand your motivation for suggesting (1), I am not sure > this will work in practice. As soon as one platform enables the option > in the defconfig (arm64) or multi_v7_defconfig (arm), all platforms will > have it enabled. Well, just because it is enabled by default, it does not mean that everybody has to follow what is in defconfig. In practice, when building production kernels, defconfigs are changed. My concern now is more about allowing people to have the possibility to change the expected behavior. Only with the original patch, it will always be writable. > > But if you think it's worth merging, something like below should do it. > > > > > I am copying Srinivas here too. Srinivas, do you think that option (1) > > above will break things in userspace on your side? > > > >> > >> Cheers, > >> Punit > >> > >> > > >> > > >> > BR, > >> > > >> > Eduardo Valentin > >> > > >> >> > >> >> Comments welcome. > >> >> > >> >> Cheers, > >> >> Punit > >> >> > > -- >8 -- > > Subject: [PATCH] thermal: core: Add Kconfig option to enable writable trips > > Add a Kconfig option to allow system integrators to control whether > userspace tools can change trip temperatures. This option overrides > the thermal zone setup in the driver code and must be enabled for > platform specified writable trips to come into effect. > > The original behaviour of requiring root privileges to change trip > temperatures remains unchanged. > > Signed-off-by: Punit Agrawal <punit.agrawal@arm.com> Yes, something like this is what I was suggesting. Thanks. > --- > drivers/thermal/Kconfig | 11 +++++++++++ > drivers/thermal/thermal_core.c | 3 ++- > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index af40db0..5d2d39b 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -42,6 +42,17 @@ config THERMAL_OF > Say 'Y' here if you need to build thermal infrastructure > based on device tree. > > +config THERMAL_WRITABLE_TRIPS > + bool "Enable writable trip points" > + help > + This option allows the system integrator to choose whether > + trip temperatures can be changed from userspace. The > + writable trips need to be specified when setting up the > + thermal zone but the choice here takes precedence. > + > + Say 'Y' here if you would like to allow userspace tools to > + change trip temperatures. > + > choice > prompt "Default Thermal governor" > default THERMAL_DEFAULT_GOV_STEP_WISE > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 48491d1..15111c1 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -1378,7 +1378,8 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) > tz->trip_temp_attrs[indx].name; > tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; > tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; > - if (mask & (1 << indx)) { > + if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) && > + mask & (1 << indx)) { > tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; > tz->trip_temp_attrs[indx].attr.store = > trip_point_temp_store; > -- > 2.1.4
Eduardo Valentin <edubezval@gmail.com> writes: > Punit, > > On Wed, Feb 25, 2015 at 12:25:14PM +0000, Punit Agrawal wrote: >> Eduardo Valentin <edubezval@gmail.com> writes: >> > > <cut> > >> > What is your optionion? >> >> Although I understand your motivation for suggesting (1), I am not sure >> this will work in practice. As soon as one platform enables the option >> in the defconfig (arm64) or multi_v7_defconfig (arm), all platforms will >> have it enabled. > > Well, just because it is enabled by default, it does not mean that > everybody has to follow what is in defconfig. In practice, when building > production kernels, defconfigs are changed. > > My concern now is more about allowing people to have the possibility to > change the expected behavior. Only with the original patch, it will > always be writable. Makes sense. With the patch below, where required the Kconfig can be turned off. [...] >> >> -- >8 -- >> >> Subject: [PATCH] thermal: core: Add Kconfig option to enable writable trips >> >> Add a Kconfig option to allow system integrators to control whether >> userspace tools can change trip temperatures. This option overrides >> the thermal zone setup in the driver code and must be enabled for >> platform specified writable trips to come into effect. >> >> The original behaviour of requiring root privileges to change trip >> temperatures remains unchanged. >> >> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com> > > Yes, something like this is what I was suggesting. Can you pick it up from here, or do you prefer for me to re-send the two patches? Cheers, Punit > > > Thanks. > >> --- >> drivers/thermal/Kconfig | 11 +++++++++++ >> drivers/thermal/thermal_core.c | 3 ++- >> 2 files changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig >> index af40db0..5d2d39b 100644 >> --- a/drivers/thermal/Kconfig >> +++ b/drivers/thermal/Kconfig >> @@ -42,6 +42,17 @@ config THERMAL_OF >> Say 'Y' here if you need to build thermal infrastructure >> based on device tree. >> >> +config THERMAL_WRITABLE_TRIPS >> + bool "Enable writable trip points" >> + help >> + This option allows the system integrator to choose whether >> + trip temperatures can be changed from userspace. The >> + writable trips need to be specified when setting up the >> + thermal zone but the choice here takes precedence. >> + >> + Say 'Y' here if you would like to allow userspace tools to >> + change trip temperatures. >> + >> choice >> prompt "Default Thermal governor" >> default THERMAL_DEFAULT_GOV_STEP_WISE >> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c >> index 48491d1..15111c1 100644 >> --- a/drivers/thermal/thermal_core.c >> +++ b/drivers/thermal/thermal_core.c >> @@ -1378,7 +1378,8 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) >> tz->trip_temp_attrs[indx].name; >> tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; >> tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; >> - if (mask & (1 << indx)) { >> + if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) && >> + mask & (1 << indx)) { >> tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; >> tz->trip_temp_attrs[indx].attr.store = >> trip_point_temp_store; >> -- >> 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index af40db0..5d2d39b 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -42,6 +42,17 @@ config THERMAL_OF Say 'Y' here if you need to build thermal infrastructure based on device tree. +config THERMAL_WRITABLE_TRIPS + bool "Enable writable trip points" + help + This option allows the system integrator to choose whether + trip temperatures can be changed from userspace. The + writable trips need to be specified when setting up the + thermal zone but the choice here takes precedence. + + Say 'Y' here if you would like to allow userspace tools to + change trip temperatures. + choice prompt "Default Thermal governor" default THERMAL_DEFAULT_GOV_STEP_WISE diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 48491d1..15111c1 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1378,7 +1378,8 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_temp_attrs[indx].name; tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; - if (mask & (1 << indx)) { + if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) && + mask & (1 << indx)) { tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_temp_attrs[indx].attr.store = trip_point_temp_store;