From: Zhang Rui <rui.zhang@intel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnd Bergmann <arnd@arndb.de>,
"open list:GENERIC INCLUDE/ASM HEADER FILES"
<linux-arch@vger.kernel.org>
Subject: Re: [PATCH 3/7] thermal/drivers/core: Add init section table for self-encapsulation
Date: Mon, 22 Apr 2019 16:43:05 +0800 [thread overview]
Message-ID: <1555922585.26198.19.camel@intel.com> (raw)
In-Reply-To: <20190402161256.11044-3-daniel.lezcano@linaro.org>
Hi, Daniel,
Thanks for the patches, it looks good to me except this one and patch
4/7.
First, I don't think this is a cyclic dependency issue as they are in
the same module.
Second, I have not read include/asm-generic/vmlinux.lds.h before, it
seems that it is used for architecture specific stuff. Fix a thermal
issue in this way seems overkill to me.
IMO, to make the code clean, we can build the governors as separate
modules just like we do for cpu governors.
This brings to the old commit 80a26a5c22b9("Thermal: build thermal
governors into thermal_sys module"), and that was introduced to fix a
problem when CONFIG_THERMAL is set to 'm'. So I think we can switch
back to the old way as the problem is gone now.
what do you think?
Patch 1,2,5,6,7 applied first.
thanks,
rui
On 二, 2019-04-02 at 18:12 +0200, Daniel Lezcano wrote:
> Currently the governors are declared in their respective files but
> they
> export their [un]register functions which in turn call the
> [un]register
> the governors core's functions. That implies a cyclic dependency
> which is
> not desirable. There is a way to self-encapsulate the governors by
> letting
> them to declare themselves in a __init section table.
>
> Define the table in the asm generic linker description like the other
> tables and provide the specific macros to deal with.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/thermal/thermal_core.h | 16 ++++++++++++++++
> include/asm-generic/vmlinux.lds.h | 11 +++++++++++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/thermal/thermal_core.h
> b/drivers/thermal/thermal_core.h
> index 0df190ed82a7..28d18083e969 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -15,6 +15,22 @@
> /* Initial state of a cooling device during binding */
> #define THERMAL_NO_TARGET -1UL
>
> +/* Init section thermal table */
> +extern struct thermal_governor * __governor_thermal_table[];
> +extern struct thermal_governor * __governor_thermal_table_end[];
> +
> +#define THERMAL_TABLE_ENTRY(table, name) \
> + static typeof(name) * __thermal_table_entry_##name \
> + __used __section(__##table##_thermal_table) \
> + = &name;
> +
> +#define THERMAL_GOVERNOR_DECLARE(name) THERMAL_TABLE_ENTRY(go
> vernor, name)
> +
> +#define for_each_governor_table(__governor) \
> + for (__governor = __governor_thermal_table; \
> + __governor < __governor_thermal_table_end; \
> + __governor++)
> +
> /*
> * This structure is used to describe the behavior of
> * a certain cooling device on a certain trip point
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-
> generic/vmlinux.lds.h
> index f8f6f04c4453..9893a3ed242a 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -239,6 +239,16 @@
> #define ACPI_PROBE_TABLE(name)
> #endif
>
> +#ifdef CONFIG_THERMAL
> +#define THERMAL_TABLE(name)
> \
> + . = ALIGN(8);
> \
> + __##name##_thermal_table = .;
> \
> + KEEP(*(__##name##_thermal_table))
> \
> + __##name##_thermal_table_end = .;
> +#else
> +#define THERMAL_TABLE(name)
> +#endif
> +
> #define KERNEL_DTB()
> \
> STRUCT_ALIGN();
> \
> __dtb_start = .;
> \
> @@ -609,6 +619,7 @@
> IRQCHIP_OF_MATCH_TABLE()
> \
> ACPI_PROBE_TABLE(irqchip)
> \
> ACPI_PROBE_TABLE(timer)
> \
> + THERMAL_TABLE(governor)
> \
> EARLYCON_TABLE()
> \
> LSM_TABLE()
>
next prev parent reply other threads:[~2019-04-22 8:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 16:12 [PATCH 1/7] thermal/drivers/core: Remove the module Kconfig's option Daniel Lezcano
2019-04-02 16:12 ` [PATCH 2/7] thermal/drivers/core: Remove module unload code Daniel Lezcano
2019-04-02 16:12 ` [PATCH 3/7] thermal/drivers/core: Add init section table for self-encapsulation Daniel Lezcano
2019-04-22 8:43 ` Zhang Rui [this message]
2019-04-22 8:43 ` Zhang Rui
2019-04-22 12:11 ` Daniel Lezcano
2019-04-22 12:11 ` Daniel Lezcano
2019-04-23 5:59 ` Zhang Rui
2019-04-23 5:59 ` Zhang Rui
2019-04-28 23:23 ` Daniel Lezcano
2019-04-28 23:23 ` Daniel Lezcano
2019-04-30 13:25 ` Arnd Bergmann
2019-04-30 13:25 ` Arnd Bergmann
2019-05-03 20:28 ` Daniel Lezcano
2019-05-03 20:28 ` Daniel Lezcano
2019-05-06 12:44 ` Zhang Rui
2019-05-06 12:44 ` Zhang Rui
2019-04-02 16:12 ` [PATCH 4/7] thermal/drivers/core: Use governor table to initialize Daniel Lezcano
2019-04-23 10:33 ` Amit Kucheria
2019-04-23 10:33 ` Amit Kucheria
2019-04-02 16:12 ` [PATCH 5/7] thermal/drivers/core: Remove depends on THERMAL in Kconfig Daniel Lezcano
2019-04-02 18:51 ` Amit Kucheria
2019-04-03 3:32 ` Daniel Lezcano
2019-04-23 10:35 ` Amit Kucheria
2019-04-23 10:35 ` Amit Kucheria
2019-04-02 16:12 ` [PATCH 6/7] thermal/drivers/core: Fix typo in the option name Daniel Lezcano
2019-04-02 16:12 ` [PATCH 7/7] hwmon/drivers/core: Simplify complex dependency Daniel Lezcano
2019-04-02 18:23 ` Guenter Roeck
2019-04-03 22:55 ` [PATCH 1/7] thermal/drivers/core: Remove the module Kconfig's option Paul Burton
2019-04-04 20:40 ` Robert Jarzmik
2019-04-23 15:52 ` Eduardo Valentin
2019-04-23 15:52 ` Eduardo Valentin
2019-04-24 5:45 ` Amit Kucheria
2019-04-24 5:45 ` Amit Kucheria
2019-04-24 13:02 ` Zhang Rui
2019-04-24 13:02 ` Zhang Rui
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=1555922585.26198.19.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=arnd@arndb.de \
--cc=daniel.lezcano@linaro.org \
--cc=edubezval@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).