From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Date: Mon, 17 Jul 2023 10:19:08 +0100 Message-ID: <867cqyvqsz.wl-maz@kernel.org> From: Marc Zyngier Subject: Re: [PATCH] clocksource/drivers/arm_arch_timer: Disable timer before programming CVAL In-Reply-To: <20230717090735.19370-1-walter.chang@mediatek.com> References: <20230717090735.19370-1-walter.chang@mediatek.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+lwn-linux-arm-kernel=archive.lwn.net@lists.infradead.org List-Archive: To: walter.chang@mediatek.com Cc: Mark Rutland , Daniel Lezcano , Thomas Gleixner , Matthias Brugger , AngeloGioacchino Del Regno , wsd_upstream@mediatek.com, stanley.chu@mediatek.com, Chun-hung.Wu@mediatek.com, Freddy.Hsin@mediatek.com, stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org On Mon, 17 Jul 2023 10:07:34 +0100, wrote: > > From: Walter Chang > > Due to the fact that the use of `writeq_relaxed()` to program CVAL is > not guaranteed to be atomic, it is necessary to disable the timer before > programming CVAL. > > However, if the MMIO timer is already enabled and has not yet expired, > there is a possibility of unexpected behavior occurring: when the CPU > enters the idle state during this period, and if the CPU's local event > is earlier than the broadcast event, the following process occurs: > > tick_broadcast_enter() > tick_broadcast_oneshot_control(TICK_BROADCAST_ENTER) > __tick_broadcast_oneshot_control() > ___tick_broadcast_oneshot_control() > tick_broadcast_set_event() > clockevents_program_event() > set_next_event_mem() > > During this process, the MMIO timer remains enabled while programming > CVAL. To prevent such behavior, disable timer explicitly prior to > programming CVAL. > > Fixes: 8b82c4f883a7 ("clocksource/drivers/arm_arch_timer: Move MMIO timer programming over to CVAL") > Cc: stable@vger.kernel.org > Signed-off-by: Walter Chang Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel