lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cdb51f00bafa8151a880d8cc7898631e@localhost>
Date:	Sat, 11 Aug 2012 12:17:14 +0200
From:	Marc Zyngier <marc.zyngier@....com>
To:	Rohit Vaswani <rvaswani@...eaurora.org>
Cc:	Russell King <linux@....linux.org.uk>,
	<linux-arm-msm@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] ARM: local timers: Unmask interrupt before new TVAL is set

On Fri, 10 Aug 2012 14:57:34 -0700, Rohit Vaswani
<rvaswani@...eaurora.org>
wrote:
> Level triggered interrupt is deasserted when a new TVAL is written
> only when the interrupt is unmasked. Make sure that the interrupt
> is unmasked in CTL register before TVAL is written.
> If this order is not followed, there are chances that on some
> hardware you would not receive any timer interrupts.
> 
> Signed-off-by: Rohit Vaswani <rvaswani@...eaurora.org>
> ---
>  arch/arm/kernel/arch_timer.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
> index dd58035..1d0d9df 100644
> --- a/arch/arm/kernel/arch_timer.c
> +++ b/arch/arm/kernel/arch_timer.c
> @@ -126,8 +126,8 @@ static int arch_timer_set_next_event(unsigned long
evt,
>  	ctrl |= ARCH_TIMER_CTRL_ENABLE;
>  	ctrl &= ~ARCH_TIMER_CTRL_IT_MASK;
>  
> -	arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt);
>  	arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
> +	arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt);

But by doing so, you're opening a window where TVAL can be negative (from
a previous timer trigger) and the interrupt unmasked, which would lead to
an immediate trigger, before TVAL is updated with the new value.

Does your hardware deassert the interrupt even when the enable bit is not
set? If so, would the following sequence work?

        ctrl &= ~(ARCH_TIMER_CTRL_ENABLE | ARCH_TIMER_CTRL_IT_MASK);
        arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);

	arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt);

        ctrl |= ARCH_TIMER_CTRL_ENABLE;
        arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);

Thanks,

        M.
-- 
Fast, cheap, reliable. Pick two.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ