Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579089 > unrolled thread

[PATCH] clocksource: add __ro_after_init to cyclecounter

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-02-11 20:30 +0100
Last post2017-02-12 20:30 +0100
Articles 10 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] clocksource: add __ro_after_init to cyclecounter Bhumika Goyal <bhumirks@gmail.com> - 2017-02-11 20:30 +0100
    Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-11 21:40 +0100
      Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Thomas Gleixner <tglx@linutronix.de> - 2017-02-11 21:40 +0100
      Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Bhumika Goyal <bhumirks@gmail.com> - 2017-02-12 19:30 +0100
        Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Thomas Gleixner <tglx@linutronix.de> - 2017-02-12 20:00 +0100
          Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Bhumika Goyal <bhumirks@gmail.com> - 2017-02-12 20:10 +0100
          Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-02-12 21:10 +0100
    Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Thomas Gleixner <tglx@linutronix.de> - 2017-02-11 21:40 +0100
      Re: [PATCH] clocksource: add __ro_after_init to cyclecounter Bhumika Goyal <bhumirks@gmail.com> - 2017-02-12 19:30 +0100
    [tip:timers/core] clocksource/drivers/arm_arch_timer:: Mark  cyclecounter __ro_after_init tip-bot for Bhumika Goyal <tipbot@zytor.com> - 2017-02-12 20:30 +0100

#1579089 — [PATCH] clocksource: add __ro_after_init to cyclecounter

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-02-11 20:30 +0100
Subject[PATCH] clocksource: add __ro_after_init to cyclecounter
Message-ID<t9LwR-4DS-1@gated-at.bofh.it>
The object cyclecounter of type cyclecounter is not getting modified
after getting initialized by arch_counter_register. Apart from
initialization in arch_counter_register it is also passed as an argument
to the function timecounter_init but this argument is of type const.
Therefore, add __ro_after_init to its declaration.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 4c8c3fb..a10506b 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc)
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static struct cyclecounter cyclecounter = {
+static struct cyclecounter cyclecounter __ro_after_init = {
 	.read	= arch_counter_read_cc,
 	.mask	= CLOCKSOURCE_MASK(56),
 };
-- 
1.9.1

[toc] | [next] | [standalone]


#1579105

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2017-02-11 21:40 +0100
Message-ID<t9MCB-5gO-19@gated-at.bofh.it>
In reply to#1579089
On 11 February 2017 at 19:20, Bhumika Goyal <bhumirks@gmail.com> wrote:
> The object cyclecounter of type cyclecounter is not getting modified
> after getting initialized by arch_counter_register. Apart from
> initialization in arch_counter_register it is also passed as an argument
> to the function timecounter_init but this argument is of type const.
> Therefore, add __ro_after_init to its declaration.
>

I think adding __ro_after_init is fine if this struct is never
modified after init. But the reference in the commit log to the
constness of the timecounter_init() argument  makes no sense: that
only means timecounter_init() will not modify the object, which allows
pointers to const objects to be passed to it as well. The opposite is
not true, though: there is no requirement whatsoever that objects
passed into const pointer arguments should be const themselves.


> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/clocksource/arm_arch_timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index 4c8c3fb..a10506b 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc)
>         .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
>  };
>
> -static struct cyclecounter cyclecounter = {
> +static struct cyclecounter cyclecounter __ro_after_init = {
>         .read   = arch_counter_read_cc,
>         .mask   = CLOCKSOURCE_MASK(56),
>  };
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[toc] | [prev] | [next] | [standalone]


#1579106

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-11 21:40 +0100
Message-ID<t9MCC-5gO-21@gated-at.bofh.it>
In reply to#1579105
On Sat, 11 Feb 2017, Ard Biesheuvel wrote:

> On 11 February 2017 at 19:20, Bhumika Goyal <bhumirks@gmail.com> wrote:
> > The object cyclecounter of type cyclecounter is not getting modified
> > after getting initialized by arch_counter_register. Apart from
> > initialization in arch_counter_register it is also passed as an argument
> > to the function timecounter_init but this argument is of type const.
> > Therefore, add __ro_after_init to its declaration.
> >
> 
> I think adding __ro_after_init is fine if this struct is never
> modified after init. But the reference in the commit log to the
> constness of the timecounter_init() argument  makes no sense: that
> only means timecounter_init() will not modify the object, which allows
> pointers to const objects to be passed to it as well. The opposite is
> not true, though: there is no requirement whatsoever that objects
> passed into const pointer arguments should be const themselves.

Indeed.

[toc] | [prev] | [next] | [standalone]


#1579258

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-02-12 19:30 +0100
Message-ID<ta74l-1en-9@gated-at.bofh.it>
In reply to#1579105
On Sun, Feb 12, 2017 at 2:01 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
> On 11 February 2017 at 19:20, Bhumika Goyal <bhumirks@gmail.com> wrote:
>> The object cyclecounter of type cyclecounter is not getting modified
>> after getting initialized by arch_counter_register. Apart from
>> initialization in arch_counter_register it is also passed as an argument
>> to the function timecounter_init but this argument is of type const.
>> Therefore, add __ro_after_init to its declaration.
>>
>
> I think adding __ro_after_init is fine if this struct is never
> modified after init. But the reference in the commit log to the
> constness of the timecounter_init() argument  makes no sense: that
> only means timecounter_init() will not modify the object, which allows
> pointers to const objects to be passed to it as well. The opposite is
> not true, though: there is no requirement whatsoever that objects
> passed into const pointer arguments should be const themselves.
>
>

Yes, true. I will change the commit log and send a v2. Thanks for explaining.

Thanks,
Bhumika

>> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
>> ---
>>  drivers/clocksource/arm_arch_timer.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
>> index 4c8c3fb..a10506b 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>> @@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter *cc)
>>         .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
>>  };
>>
>> -static struct cyclecounter cyclecounter = {
>> +static struct cyclecounter cyclecounter __ro_after_init = {
>>         .read   = arch_counter_read_cc,
>>         .mask   = CLOCKSOURCE_MASK(56),
>>  };
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[toc] | [prev] | [next] | [standalone]


#1579261

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-12 20:00 +0100
Message-ID<ta7xn-1pu-1@gated-at.bofh.it>
In reply to#1579258
On Sun, 12 Feb 2017, Bhumika Goyal wrote:

> On Sun, Feb 12, 2017 at 2:01 AM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
> > On 11 February 2017 at 19:20, Bhumika Goyal <bhumirks@gmail.com> wrote:
> >> The object cyclecounter of type cyclecounter is not getting modified
> >> after getting initialized by arch_counter_register. Apart from
> >> initialization in arch_counter_register it is also passed as an argument
> >> to the function timecounter_init but this argument is of type const.
> >> Therefore, add __ro_after_init to its declaration.
> >>
> >
> > I think adding __ro_after_init is fine if this struct is never
> > modified after init. But the reference in the commit log to the
> > constness of the timecounter_init() argument  makes no sense: that
> > only means timecounter_init() will not modify the object, which allows
> > pointers to const objects to be passed to it as well. The opposite is
> > not true, though: there is no requirement whatsoever that objects
> > passed into const pointer arguments should be const themselves.
> >
> >
> 
> Yes, true. I will change the commit log and send a v2. Thanks for explaining.

I've applied it already and fixed up the subject/changelog. You should have
mail from tip-bot ...

[toc] | [prev] | [next] | [standalone]


#1579264

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-02-12 20:10 +0100
Message-ID<ta7H3-1I4-7@gated-at.bofh.it>
In reply to#1579261
On Mon, Feb 13, 2017 at 12:26 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Sun, 12 Feb 2017, Bhumika Goyal wrote:
>
>> On Sun, Feb 12, 2017 at 2:01 AM, Ard Biesheuvel
>> <ard.biesheuvel@linaro.org> wrote:
>> > On 11 February 2017 at 19:20, Bhumika Goyal <bhumirks@gmail.com> wrote:
>> >> The object cyclecounter of type cyclecounter is not getting modified
>> >> after getting initialized by arch_counter_register. Apart from
>> >> initialization in arch_counter_register it is also passed as an argument
>> >> to the function timecounter_init but this argument is of type const.
>> >> Therefore, add __ro_after_init to its declaration.
>> >>
>> >
>> > I think adding __ro_after_init is fine if this struct is never
>> > modified after init. But the reference in the commit log to the
>> > constness of the timecounter_init() argument  makes no sense: that
>> > only means timecounter_init() will not modify the object, which allows
>> > pointers to const objects to be passed to it as well. The opposite is
>> > not true, though: there is no requirement whatsoever that objects
>> > passed into const pointer arguments should be const themselves.
>> >
>> >
>>
>> Yes, true. I will change the commit log and send a v2. Thanks for explaining.
>
> I've applied it already and fixed up the subject/changelog. You should have
> mail from tip-bot ...

Okay. Thanks. I thought the patch is not applied yet because I haven't
received a mail from tip-bot yet.

Thanks,
Bhumika

[toc] | [prev] | [next] | [standalone]


#1579271

FromDaniel Lezcano <daniel.lezcano@linaro.org>
Date2017-02-12 21:10 +0100
Message-ID<ta8D7-2gV-1@gated-at.bofh.it>
In reply to#1579261
On Sun, Feb 12, 2017 at 07:56:41PM +0100, Thomas Gleixner wrote:

[ ... ]

> I've applied it already and fixed up the subject/changelog. You should have
> mail from tip-bot ...

For the record, I did not receive the mails from the tip-bot when the patches
from the PR were applied.

 -- 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

[toc] | [prev] | [next] | [standalone]


#1579109

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-11 21:40 +0100
Message-ID<t9MCC-5gO-25@gated-at.bofh.it>
In reply to#1579089
On Sun, 12 Feb 2017, Bhumika Goyal wrote:

Please be more careful with your subject line. The prefix for this is
definitely not 'clocksource'. git log would have told you the proper one:

clocksource/drivers/arm_arch_timer

'clocksource' is the general subsystem and used for system wide changes or
core changes, but not for a particular driver.

> The object cyclecounter of type cyclecounter is not getting modified
> after getting initialized by arch_counter_register. Apart from
> initialization in arch_counter_register it is also passed as an argument
> to the function timecounter_init but this argument is of type const.
> Therefore, add __ro_after_init to its declaration.

Other than that this is fine. I'll fix it up when applying.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1579259

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-02-12 19:30 +0100
Message-ID<ta74l-1en-11@gated-at.bofh.it>
In reply to#1579109
On Sun, Feb 12, 2017 at 2:05 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Sun, 12 Feb 2017, Bhumika Goyal wrote:
>
> Please be more careful with your subject line. The prefix for this is
> definitely not 'clocksource'. git log would have told you the proper one:
>
> clocksource/drivers/arm_arch_timer
>
> 'clocksource' is the general subsystem and used for system wide changes or
> core changes, but not for a particular driver.
>

I will be more careful about this in future.

Thanks,
Bhumika

>> The object cyclecounter of type cyclecounter is not getting modified
>> after getting initialized by arch_counter_register. Apart from
>> initialization in arch_counter_register it is also passed as an argument
>> to the function timecounter_init but this argument is of type const.
>> Therefore, add __ro_after_init to its declaration.
>
> Other than that this is fine. I'll fix it up when applying.
>
> Thanks,
>
>         tglx

[toc] | [prev] | [next] | [standalone]


#1579267 — [tip:timers/core] clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init

Fromtip-bot for Bhumika Goyal <tipbot@zytor.com>
Date2017-02-12 20:30 +0100
Subject[tip:timers/core] clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init
Message-ID<ta80p-1OM-13@gated-at.bofh.it>
In reply to#1579089
Commit-ID:  3d837bc01c2153565333b2ce71d613b6e7cc761c
Gitweb:     http://git.kernel.org/tip/3d837bc01c2153565333b2ce71d613b6e7cc761c
Author:     Bhumika Goyal <bhumirks@gmail.com>
AuthorDate: Sun, 12 Feb 2017 00:50:18 +0530
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 11 Feb 2017 21:39:04 +0100

clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init

The object cyclecounter of type cyclecounter is only modified during
initialization in arch_counter_register. So it can be marked
__ro_after_init.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Cc: mark.rutland@arm.com
Cc: keescook@chromium.org
Cc: marc.zyngier@arm.com
Cc: daniel.lezcano@linaro.org
Cc: julia.lawall@lip6.fr
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1486840818-22214-1-git-send-email-bhumirks@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 7b06aef..93aa136 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -646,7 +646,7 @@ static struct clocksource clocksource_counter = {
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static struct cyclecounter cyclecounter = {
+static struct cyclecounter cyclecounter __ro_after_init = {
 	.read	= arch_counter_read_cc,
 	.mask	= CLOCKSOURCE_MASK(56),
 };

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web