From: Peng Fan <[email protected]>
sys_ctr_base and cmpcr will not be updated after init, so mark
as __ro_after_init.
Cc: Kees Cook <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
---
drivers/clocksource/timer-imx-sysctr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 18b90fc56bfc..2b309af11266 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -20,8 +20,8 @@
#define SYS_CTR_CLK_DIV 0x3
-static void __iomem *sys_ctr_base;
-static u32 cmpcr;
+static void __iomem *sys_ctr_base __ro_after_init;
+static u32 cmpcr __ro_after_init;
static void sysctr_timer_enable(bool enable)
{
--
2.25.1
From: Peng Fan <[email protected]>
Actually we have CLOCK_EVT_FEAT_DYNIRQ, the irq affinity will be runtime
changed and no issue. But the system counter timer is not tied to CPU0,
so use cpu_possible_mask here.
Signed-off-by: Peng Fan <[email protected]>
---
drivers/clocksource/timer-imx-sysctr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 2b309af11266..55a8e198d2a1 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -119,7 +119,7 @@ static struct timer_of to_sysctr = {
static void __init sysctr_clockevent_init(void)
{
- to_sysctr.clkevt.cpumask = cpumask_of(0);
+ to_sysctr.clkevt.cpumask = cpu_possible_mask;
clockevents_config_and_register(&to_sysctr.clkevt,
timer_of_rate(&to_sysctr),
--
2.25.1
On 01/12/2021 13:50, Peng Fan (OSS) wrote:
> From: Peng Fan <[email protected]>
>
> Actually we have CLOCK_EVT_FEAT_DYNIRQ, the irq affinity will be runtime
> changed and no issue. But the system counter timer is not tied to CPU0,
> so use cpu_possible_mask here.
Did you mean:
"There is no reason to tie the system counter timer to CPU0, change its
affinity to cpu_possible_mask.
Moreover, the timer has the flag CLOCK_EVT_FEAT_DYNIRQ set, changing to
cpu_possibl_mask will reduce the number of wakeups related to the system
timer"
?
Note you may want to explain why 'there is no reason'
> Signed-off-by: Peng Fan <[email protected]>
> ---
> drivers/clocksource/timer-imx-sysctr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
> index 2b309af11266..55a8e198d2a1 100644
> --- a/drivers/clocksource/timer-imx-sysctr.c
> +++ b/drivers/clocksource/timer-imx-sysctr.c
> @@ -119,7 +119,7 @@ static struct timer_of to_sysctr = {
>
> static void __init sysctr_clockevent_init(void)
> {
> - to_sysctr.clkevt.cpumask = cpumask_of(0);
> + to_sysctr.clkevt.cpumask = cpu_possible_mask;
>
> clockevents_config_and_register(&to_sysctr.clkevt,
> timer_of_rate(&to_sysctr),
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Wed, Dec 01, 2021 at 08:50:29PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <[email protected]>
>
> sys_ctr_base and cmpcr will not be updated after init, so mark
> as __ro_after_init.
>
> Cc: Kees Cook <[email protected]>
> Signed-off-by: Peng Fan <[email protected]>
Always nice to get more of these. :)
Reviewed-by: Kees Cook <[email protected]>
Thanks!
-Kees
> ---
> drivers/clocksource/timer-imx-sysctr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
> index 18b90fc56bfc..2b309af11266 100644
> --- a/drivers/clocksource/timer-imx-sysctr.c
> +++ b/drivers/clocksource/timer-imx-sysctr.c
> @@ -20,8 +20,8 @@
>
> #define SYS_CTR_CLK_DIV 0x3
>
> -static void __iomem *sys_ctr_base;
> -static u32 cmpcr;
> +static void __iomem *sys_ctr_base __ro_after_init;
> +static u32 cmpcr __ro_after_init;
>
> static void sysctr_timer_enable(bool enable)
> {
> --
> 2.25.1
>
--
Kees Cook
> Subject: Re: [PATCH 2/2] clocksource: timer-imx-sysctr: set cpumask to
> cpu_possible_mask
>
> On 01/12/2021 13:50, Peng Fan (OSS) wrote:
> > From: Peng Fan <[email protected]>
> >
> > Actually we have CLOCK_EVT_FEAT_DYNIRQ, the irq affinity will be
> > runtime changed and no issue. But the system counter timer is not tied
> > to CPU0, so use cpu_possible_mask here.
>
> Did you mean:
>
> "There is no reason to tie the system counter timer to CPU0, change its
> affinity to cpu_possible_mask.
>
> Moreover, the timer has the flag CLOCK_EVT_FEAT_DYNIRQ set, changing to
> cpu_possibl_mask will reduce the number of wakeups related to the system
> timer"
The syctr interrupt could be set affinity to any cores in the SoC. Default affinity
is set to cpu 0.
This timer will be used as broadcast timer on all the i.MX SoCs. Because DYNIRQ
flag set, the core time framework will runtime set the interrupt affinity to the cores
that needs to wake up and the cpumask will runtime set to the core that will be
wake up. So even the sysctr initialization use cpumask 0, there is no issue,
the current patch is just use cpu_possible_mask to show the fact that the
timer supports routed to all the cpu cores and nothing else.
Thanks,
Peng.
>
> ?
>
> Note you may want to explain why 'there is no reason'
>
>
> > Signed-off-by: Peng Fan <[email protected]>
> > ---
> > drivers/clocksource/timer-imx-sysctr.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/clocksource/timer-imx-sysctr.c
> > b/drivers/clocksource/timer-imx-sysctr.c
> > index 2b309af11266..55a8e198d2a1 100644
> > --- a/drivers/clocksource/timer-imx-sysctr.c
> > +++ b/drivers/clocksource/timer-imx-sysctr.c
> > @@ -119,7 +119,7 @@ static struct timer_of to_sysctr = {
> >
> > static void __init sysctr_clockevent_init(void) {
> > - to_sysctr.clkevt.cpumask = cpumask_of(0);
> > + to_sysctr.clkevt.cpumask = cpu_possible_mask;
> >
> > clockevents_config_and_register(&to_sysctr.clkevt,
> > timer_of_rate(&to_sysctr),
> >
>
>
> --
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.l
> inaro.org%2F&data=04%7C01%7Cpeng.fan%40nxp.com%7C1fec86efbd5
> 4498106c508d9b57d9e2a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%
> 7C0%7C637740373391832133%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
> 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&
> amp;sdata=q98PLDpC8h7jt%2BjvCeXZAf2F5ZzJsMMS613OSHmjDr0%3D&am
> p;reserved=0> Linaro.org ? Open source software for ARM SoCs
>
> Follow Linaro:
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.f
> acebook.com%2Fpages%2FLinaro&data=04%7C01%7Cpeng.fan%40nxp.
> com%7C1fec86efbd54498106c508d9b57d9e2a%7C686ea1d3bc2b4c6fa92cd
> 99c5c301635%7C0%7C0%7C637740373391832133%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI
> 6Mn0%3D%7C3000&sdata=KmuInvkOIYTEcR4sFHhEbQSJczarvwwm8slI
> GfjCa70%3D&reserved=0> Facebook |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitter
> .com%2F%23!%2Flinaroorg&data=04%7C01%7Cpeng.fan%40nxp.com%
> 7C1fec86efbd54498106c508d9b57d9e2a%7C686ea1d3bc2b4c6fa92cd99c5c
> 301635%7C0%7C0%7C637740373391832133%7CUnknown%7CTWFpbGZsb3
> d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D%7C3000&sdata=mS9fXmEPB1798JRJWfhEpXcbdWfRiSb5%2FH6cz7
> 9rl8E%3D&reserved=0> Twitter |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.l
> inaro.org%2Flinaro-blog%2F&data=04%7C01%7Cpeng.fan%40nxp.com%
> 7C1fec86efbd54498106c508d9b57d9e2a%7C686ea1d3bc2b4c6fa92cd99c5c
> 301635%7C0%7C0%7C637740373391832133%7CUnknown%7CTWFpbGZsb3
> d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D%7C3000&sdata=%2BlsiYye7ZBW8jClBsZbSHkcbD0hqvvvx0H9SAlUV
> e7U%3D&reserved=0> Blog
On 01/12/2021 13:50, Peng Fan (OSS) wrote:
> From: Peng Fan <[email protected]>
>
> sys_ctr_base and cmpcr will not be updated after init, so mark
> as __ro_after_init.
>
> Cc: Kees Cook <[email protected]>
> Signed-off-by: Peng Fan <[email protected]>
> ---
> drivers/clocksource/timer-imx-sysctr.c | 4 ++--
Applied, thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Hi Daniel,
> Subject: Re: [PATCH 1/2] clocksource/drivers/imx-sysctr: mark two variable
> with __ro_after_init
>
> On 01/12/2021 13:50, Peng Fan (OSS) wrote:
> > From: Peng Fan <[email protected]>
> >
> > sys_ctr_base and cmpcr will not be updated after init, so mark as
> > __ro_after_init.
> >
> > Cc: Kees Cook <[email protected]>
> > Signed-off-by: Peng Fan <[email protected]>
> > ---
> > drivers/clocksource/timer-imx-sysctr.c | 4 ++--
>
> Applied, thanks
I not see this patch in your tree.
https://git.linaro.org/people/daniel.lezcano/linux.git/log/?h=timers/drivers/next
Thanks,
Peng.
>
>
> --
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.l
> inaro.org%2F&data=04%7C01%7Cpeng.fan%40nxp.com%7C380f2f0784
> d247c95a2408d9bb15f12b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%
> 7C0%7C637746525178346096%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
> 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&
> amp;sdata=09OwJe9RQhLb20On45Q1Pb2R%2BdvHcAmqPWRffJCkyTo%3D&
> amp;reserved=0> Linaro.org ? Open source software for ARM SoCs
>
> Follow Linaro:
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.f
> acebook.com%2Fpages%2FLinaro&data=04%7C01%7Cpeng.fan%40nxp.
> com%7C380f2f0784d247c95a2408d9bb15f12b%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C637746525178346096%7CUnknown%7CTWFpbG
> Zsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
> Mn0%3D%7C3000&sdata=oupiLK7WS1N%2BWKGzzNjP%2FpErz4QxIjlvC
> 0xIY7s1E7Y%3D&reserved=0> Facebook |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitter
> .com%2F%23!%2Flinaroorg&data=04%7C01%7Cpeng.fan%40nxp.com%
> 7C380f2f0784d247c95a2408d9bb15f12b%7C686ea1d3bc2b4c6fa92cd99c5c3
> 01635%7C0%7C0%7C637746525178346096%7CUnknown%7CTWFpbGZsb3d
> 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
> 3D%7C3000&sdata=xepxUkFReOujXx0GAKU%2BvTFzfwjxkIwFj6UndjeOJ
> gY%3D&reserved=0> Twitter |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.l
> inaro.org%2Flinaro-blog%2F&data=04%7C01%7Cpeng.fan%40nxp.com%
> 7C380f2f0784d247c95a2408d9bb15f12b%7C686ea1d3bc2b4c6fa92cd99c5c3
> 01635%7C0%7C0%7C637746525178356054%7CUnknown%7CTWFpbGZsb3d
> 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
> 3D%7C3000&sdata=62SdTlTWr%2FZP2pr7gIx0fGqE30SQR0SKFbOTbPFZd
> %2BQ%3D&reserved=0> Blog
On 14/12/2021 09:25, Peng Fan wrote:
> Hi Daniel,
>
>> Subject: Re: [PATCH 1/2] clocksource/drivers/imx-sysctr: mark two variable
>> with __ro_after_init
>>
>> On 01/12/2021 13:50, Peng Fan (OSS) wrote:
>>> From: Peng Fan <[email protected]>
>>>
>>> sys_ctr_base and cmpcr will not be updated after init, so mark as
>>> __ro_after_init.
>>>
>>> Cc: Kees Cook <[email protected]>
>>> Signed-off-by: Peng Fan <[email protected]>
>>> ---
>>> drivers/clocksource/timer-imx-sysctr.c | 4 ++--
>>
>> Applied, thanks
>
> I not see this patch in your tree.
> https://git.linaro.org/people/daniel.lezcano/linux.git/log/?h=timers/drivers/next
You should see it now
Thanks
-- Daniel
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 0ed9e4ebcebcb36bd1186e68cf2f72b3e0bfbac6
Gitweb: https://git.kernel.org/tip/0ed9e4ebcebcb36bd1186e68cf2f72b3e0bfbac6
Author: Peng Fan <[email protected]>
AuthorDate: Wed, 01 Dec 2021 20:50:30 +08:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Tue, 14 Dec 2021 10:17:27 +01:00
clocksource/drivers/timer-imx-sysctr: Set cpumask to cpu_possible_mask
The syctr interrupt could set the affinity to any cores in the
SoC. However, the default affinity is set to cpu 0.
This timer will be used as broadcast timer on all the i.MX
SoCs. Because DYNIRQ flag is set, the core time framework will runtime
set the interrupt affinity to the cores that needs to wake up and the
cpumask will runtime set to the core that will be wake up. So even the
sysctr initialization use cpumask 0, there is no issue, the current
patch is just use cpu_possible_mask to show the fact that the timer
supports routed to all the cpu cores and nothing else.
Signed-off-by: Peng Fan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/clocksource/timer-imx-sysctr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 2b309af..55a8e19 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -119,7 +119,7 @@ static struct timer_of to_sysctr = {
static void __init sysctr_clockevent_init(void)
{
- to_sysctr.clkevt.cpumask = cpumask_of(0);
+ to_sysctr.clkevt.cpumask = cpu_possible_mask;
clockevents_config_and_register(&to_sysctr.clkevt,
timer_of_rate(&to_sysctr),
The following commit has been merged into the timers/core branch of tip:
Commit-ID: f5bd5fc9d478cdb94f89ccc74870dd81d1919b42
Gitweb: https://git.kernel.org/tip/f5bd5fc9d478cdb94f89ccc74870dd81d1919b42
Author: Peng Fan <[email protected]>
AuthorDate: Wed, 01 Dec 2021 20:50:29 +08:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Thu, 09 Dec 2021 14:13:04 +01:00
clocksource/drivers/imx-sysctr: Mark two variable with __ro_after_init
The variables 'sys_ctr_base' and 'cmpcr' are not be updated after
init, so mark them as __ro_after_init.
Cc: Kees Cook <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/clocksource/timer-imx-sysctr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 18b90fc..2b309af 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -20,8 +20,8 @@
#define SYS_CTR_CLK_DIV 0x3
-static void __iomem *sys_ctr_base;
-static u32 cmpcr;
+static void __iomem *sys_ctr_base __ro_after_init;
+static u32 cmpcr __ro_after_init;
static void sysctr_timer_enable(bool enable)
{