linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH 2/3] arm64: arch_timer: Allow an workaround descriptor to provide vdso_clock_mode
Date: Thu, 02 Jul 2020 14:52:25 +0100	[thread overview]
Message-ID: <82ce7e37d05dd184c2e225e5384ce77e@kernel.org> (raw)
In-Reply-To: <20200702102859.GC15391@C02TD0UTHF1T.local>

On 2020-07-02 11:28, Mark Rutland wrote:
> On Wed, Jul 01, 2020 at 05:18:23PM +0100, Marc Zyngier wrote:
>> As we are about to disable the vdso for compat tasks in some 
>> circumstances,
>> let's allow a workaround descriptor to provide the vdso_clock_mode 
>> that
>> matches the platform.
>> 
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>>  arch/arm64/include/asm/arch_timer.h  | 3 +++
>>  drivers/clocksource/arm_arch_timer.c | 3 +++
>>  2 files changed, 6 insertions(+)
>> 
>> diff --git a/arch/arm64/include/asm/arch_timer.h 
>> b/arch/arm64/include/asm/arch_timer.h
>> index 7ae54d7d333a..fb8dfcbf9c01 100644
>> --- a/arch/arm64/include/asm/arch_timer.h
>> +++ b/arch/arm64/include/asm/arch_timer.h
>> @@ -18,6 +18,8 @@
>>  #include <linux/smp.h>
>>  #include <linux/types.h>
>> 
>> +#include <vdso/clocksource.h>
>> +
>>  #include <clocksource/arm_arch_timer.h>
>> 
>>  #if IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND)
>> @@ -58,6 +60,7 @@ struct arch_timer_erratum_workaround {
>>  	u64 (*read_cntvct_el0)(void);
>>  	int (*set_next_event_phys)(unsigned long, struct clock_event_device 
>> *);
>>  	int (*set_next_event_virt)(unsigned long, struct clock_event_device 
>> *);
>> +	enum vdso_clock_mode vdso_clock_mode;
>>  };
>> 
>>  DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *,
>> diff --git a/drivers/clocksource/arm_arch_timer.c 
>> b/drivers/clocksource/arm_arch_timer.c
>> index ecf7b7db2d05..f828835c568f 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>> @@ -566,6 +566,9 @@ void arch_timer_enable_workaround(const struct 
>> arch_timer_erratum_workaround *wa
>>  	if (wa->read_cntvct_el0) {
>>  		clocksource_counter.vdso_clock_mode = VDSO_CLOCKMODE_NONE;
>>  		vdso_default = VDSO_CLOCKMODE_NONE;
>> +	} else {
>> +		clocksource_counter.vdso_clock_mode = wa->vdso_clock_mode;
>> +		vdso_default = wa->vdso_clock_mode;
>>  	}
> 
> I fear that we're liable to forget to set vdso_clock_mode on new errata
> that don't need a read_cntvct_el0 hook, and if so we'll happen to set
> these to 0 (i.e. VDSO_CLOCKMODE_NONE).
> 
> For now could we instead have a boolan disable_compat_vdso, with this
> being:
> 
> | if (wa->read_cntvct_el0) {
> | 	clocksource_counter.vdso_clock_mode = VDSO_CLOCKMODE_NONE;
> | 	vdso_default = VDSO_CLOCKMODE_NONE;
> | } else if (wa->disable_compat_vdso) {
> | 	clocksource_counter.vdso_clock_mode = 
> VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT;
> | 	vdso_default = wa->vdso_clock_mode = 
> VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT;
> | }

Sure, that'd work too.

> Do we need to handle the comination of a workaround seeting NONE and 
> one
> setting ARCHTIMER_NOCOMPAT?

Not yet. Probably coming any time now. Which is why we may need to
look into per-CPU vdso data pages (Broonie has a series that could
be of some use, apparently).

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2020-07-02 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 16:18 [PATCH 0/3] arm64: Allow the compat vdso to be disabled at runtime Marc Zyngier
2020-07-01 16:18 ` [PATCH 1/3] arm64: Introduce a way to disable the 32bit vdso Marc Zyngier
2020-07-02 10:18   ` Mark Rutland
2020-07-01 16:18 ` [PATCH 2/3] arm64: arch_timer: Allow an workaround descriptor to provide vdso_clock_mode Marc Zyngier
2020-07-02 10:28   ` Mark Rutland
2020-07-02 13:52     ` Marc Zyngier [this message]
2020-07-01 16:18 ` [PATCH 3/3] arm64: timers: Disable the compat vdso for cores affected by ARM64_WORKAROUND_1418040 Marc Zyngier

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=82ce7e37d05dd184c2e225e5384ce77e@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@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).