linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Russell King <linux@arm.linux.org.uk>,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Valentin Schneider <valentin.schneider@arm.com>
Subject: Re: [PATCH 7/7] clocksource/arm_arch_timer: Use arch_timer_read_counter to access stable counters
Date: Fri, 3 May 2019 22:31:42 +0200	[thread overview]
Message-ID: <2f3417f6-95e5-f27a-693d-5aa460fb152d@linaro.org> (raw)
In-Reply-To: <bbe9b8c1-132f-bbfa-e3d0-ad10c4165ad7@arm.com>


Hi Marc,

On 30/04/2019 17:27, Marc Zyngier wrote:
> On 15/04/2019 13:16, Daniel Lezcano wrote:
>> On 08/04/2019 17:49, Marc Zyngier wrote:
>>> Instead of always going via arch_counter_get_cntvct_stable to
>>> access the counter workaround, let's have arch_timer_read_counter
>>> to point to the right method.
>>>
>>> For that, we need to track whether any CPU in the system has a
>>> workaround for the counter. This is done by having an atomic
>>> variable tracking this.
>>>
>>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>>> ---
>>
>> [ ... ]
>>
>>> +
>>>  /*
>>>   * Default to cp15 based access because arm64 uses this function for
>>>   * sched_clock() before DT is probed and the cp15 method is guaranteed
>>> @@ -372,6 +392,7 @@ static u32 notrace sun50i_a64_read_cntv_tval_el0(void)
>>>  DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
>>>  EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
>>>  
>>> +static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0);
>>
>> Wouldn't make sense to READ_ONCE / WRITE_ONCE instead of using an atomic?
> 
> I don't think *_ONCE says anything about the atomicity of the access. It
> only instruct the compiler that this should only be accessed once, and
> not reloaded/rewritten. In this case, WRITE_ONCE() would work just as
> well, but I feel that setting the expectations do matter.
> 
> I also had a vague idea to use this as a refcount to drop the
> workarounds as CPUs get hotplugged off, in which case we'd need the RMW
> operations to be atomic.
> 
> Anyway, I'm not hell bent on this. If you fundamentally disagree with me
> I'll change it.

As you are planning to extend its usage for refcounting in the hotplug
path, I think it is fine.

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


      parent reply	other threads:[~2019-05-03 20:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 15:49 [PATCH 0/7] clocksource/arm_arch_timer: Removing the static branch on errata handling Marc Zyngier
2019-04-08 15:49 ` [PATCH 1/7] ARM: vdso: Remove dependency with the arch_timer driver internals Marc Zyngier
2019-04-08 15:58   ` Mark Rutland
2019-04-15 10:46   ` Marc Zyngier
2019-04-30 14:23   ` Will Deacon
2019-04-08 15:49 ` [PATCH 2/7] watchdog/sbsa: Use arch_timer_read_counter instead of arch_counter_get_cntvct Marc Zyngier
2019-04-08 15:59   ` Mark Rutland
2019-04-08 18:07   ` Guenter Roeck
2019-04-09  7:43     ` Marc Zyngier
2019-04-08 15:49 ` [PATCH 3/7] arm64: " Marc Zyngier
2019-04-08 15:59   ` Mark Rutland
2019-04-08 15:49 ` [PATCH 4/7] clocksource/arm_arch_timer: Direcly assign set_next_event workaround Marc Zyngier
2019-04-08 16:02   ` Mark Rutland
2019-04-11 17:17   ` Daniel Lezcano
2019-04-15 10:18     ` Marc Zyngier
2019-04-08 15:49 ` [PATCH 5/7] clocksource/arm_arch_timer: Drop use of static key in arch_timer_reg_read_stable Marc Zyngier
2019-04-08 16:04   ` Mark Rutland
2019-04-15 11:04   ` Daniel Lezcano
2019-04-08 15:49 ` [PATCH 6/7] clocksource/arm_arch_timer: Remove use of workaround static key Marc Zyngier
2019-04-08 16:05   ` Mark Rutland
2019-04-15 11:07   ` Daniel Lezcano
2019-04-08 15:49 ` [PATCH 7/7] clocksource/arm_arch_timer: Use arch_timer_read_counter to access stable counters Marc Zyngier
2019-04-08 16:08   ` Mark Rutland
2019-04-15 12:16   ` Daniel Lezcano
2019-04-30 15:27     ` Marc Zyngier
2019-04-30 15:39       ` Valentin Schneider
2019-05-03 20:32         ` Daniel Lezcano
2019-05-03 20:31       ` Daniel Lezcano [this message]

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=2f3417f6-95e5-f27a-693d-5aa460fb152d@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=valentin.schneider@arm.com \
    --cc=will.deacon@arm.com \
    --cc=wim@linux-watchdog.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).