Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2108441pxv; Sun, 11 Jul 2021 02:58:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/dznP9oyXRdQXJ9sztKkGbGX+NffO/xEGRfYQycV1+EUXLlZxf7uGaNECfKlNursIJs8B X-Received: by 2002:a92:b745:: with SMTP id c5mr4933956ilm.251.1625997511005; Sun, 11 Jul 2021 02:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625997510; cv=none; d=google.com; s=arc-20160816; b=HpHxW3p8HtVWLZxghC1zNyeyNDMqm8GKjd2mttC7O+Ad4VQY9BhfFwqkY42k2dtGH5 BsZ/VWcWPQAChxSw1ScfUQBkAN+eZGlvK5zm/jeWM3uMmBWoLvJgLPL1E6ATrx3CDTm2 fxmXcsc8SG56DJXvOdspa33ffykcuPmVFhjyQ6ln4zO9li4LTvHA49qxoBZ38mAgIij3 04b+zyQ6hTrHI3HFGcUniwe3QCQBIilQz3+FE/ZE+zJjBfw0irmMo23nlFVOgYePzVyU cSF4rhz0Q/6fdwcnTr6KwaCUHjE2dIROVtchqw/ZKXmT8sNxszLR6upTyPtjlZn6pAjJ XT0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=l1FAuk1rUw5q4zSLueseSNqmQ/w0cvo6ffKFOYWF/pg=; b=Gu82wmns9+B0gNOJg0ZdnDm7zfVKBrfzFh+Fosg14kdXUZhz4JcBbMlixgxbAlLSXh 8Xaek/fiyI2+WfdCmPRqXKYPpswt0Dp3BtrufiECNf1MnvsiJ7vsqg9Cbb0BFXnrcaYE Ejmc+D75Lu/kjnCgCLdvcwwL0PyfCxErkyz31XYh/LjpZTxFMS9TY0I3DXaW3Gjy25yg EmZW9UYovoa9hsUyzJik8FiK41RcbZEMUE+OlyL+vIzaqjFs2tR+2RR1L8DIxXqkULrJ l5z8/IchsxIKUKc+glczimIu9uMziOU15QlAOs2TfLB895Mb11nNsIPmayUIbwoRz2Xi IDOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si13519365jap.7.2021.07.11.02.58.18; Sun, 11 Jul 2021 02:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbhGKKAY (ORCPT + 99 others); Sun, 11 Jul 2021 06:00:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:35388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbhGKKAY (ORCPT ); Sun, 11 Jul 2021 06:00:24 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D1D26124B; Sun, 11 Jul 2021 09:57:37 +0000 (UTC) Received: from host31-54-148-101.range31-54.btcentralplus.com ([31.54.148.101] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m2WDP-00CWZR-Cd; Sun, 11 Jul 2021 10:57:35 +0100 Date: Sun, 11 Jul 2021 10:57:34 +0100 Message-ID: <87bl792mwh.wl-maz@kernel.org> From: Marc Zyngier To: Bharat Bhushan Cc: "catalin.marinas@arm.com" , "will@kernel.org" , "daniel.lezcano@linaro.org" , "mark.rutland@arm.com" , "konrad.dybcio@somainline.org" , "saiprakash.ranjan@codeaurora.org" , "robh@kernel.org" , "marcan@marcan.st" , "suzuki.poulose@arm.com" , "broonie@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Linu Cherian Subject: Re: [EXT] Re: [PATCH] clocksource: Add Marvell Errata-38627 workaround In-Reply-To: References: <20210705060843.3150-1-bbhushan2@marvell.com> <87im1p861y.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 31.54.148.101 X-SA-Exim-Rcpt-To: bbhushan2@marvell.com, catalin.marinas@arm.com, will@kernel.org, daniel.lezcano@linaro.org, mark.rutland@arm.com, konrad.dybcio@somainline.org, saiprakash.ranjan@codeaurora.org, robh@kernel.org, marcan@marcan.st, suzuki.poulose@arm.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, lcherian@marvell.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 08 Jul 2021 11:48:18 +0100, Bharat Bhushan wrote: > > Hi Marc, > > Similar questions are asked by Mark, response might be duplicated. Mark had a ton of very good questions, so I won't repeat them. Some more below though: > > -----Original Message----- > > From: Marc Zyngier > > Sent: Monday, July 5, 2021 2:57 PM > > To: Bharat Bhushan > > Cc: catalin.marinas@arm.com; will@kernel.org; daniel.lezcano@linaro.org; > > mark.rutland@arm.com; konrad.dybcio@somainline.org; > > saiprakash.ranjan@codeaurora.org; robh@kernel.org; marcan@marcan.st; > > suzuki.poulose@arm.com; broonie@kernel.org; linux-arm- > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Linu Cherian > > > > Subject: [EXT] Re: [PATCH] clocksource: Add Marvell Errata-38627 workaround > > > > External Email > > > > ---------------------------------------------------------------------- > > On Mon, 05 Jul 2021 07:08:43 +0100, > > Bharat Bhushan wrote: > > > > > > CPU pipeline have unpredicted behavior when timer interrupt appears > > > and then disappears prior to the exception happening. > > > > What kind of unpredictable behaviours? > > This is a race condition where an instruction (except store, system, > load atomic and load exclusive) becomes "nop" if interrupt appears > and disappears before taken by CPU. This can lead to GPR > corruption. For example interrupt appears after the atomic load > instruction starts executing and disappears before the atomic load > instruction completes, in that case instruction (not all) can become > "nop". As interrupt disappears before atomic instruction completes, > cpu continues to execute and while take stale value from register as > other dependent got "nop". So here's what I understand from the above: - Interrupts being a context synchronisation event, the CPU deals with them by preventing in-flight instructions from having any effect (what you above describe as becoming NOP). - If the interrupt is recalled before the exception entry can take place, the exception doesn't occur, but the discarded instructions are not replayed, leaving the program in an inconsistent state. Is this interpretation correct? If so, I have more questions: - Does the erratum trigger when interrupts are masked in PSTATE? Can this erratum be triggered by masking interrupts in PSTATE? - What makes this specific to the timer? Why can't this be triggered with any other interrupt? Spurious interrupts do exist, and happen all the time, specially with level triggered interrupts. - What if *another* CPU masks the interrupt at the GIC redistributor level? > > What happens if a guest isn't aware of the erratum or actively > > tries to trigger it? > > Errata applies to VM (EL1 virtual timer) as well. In addition > extending the workaround to timer context save/restore in kvm seems > to work. Can you help if we are missing something in VM? Maybe. First, I want to understand why this is specific to the timer, and whether this can have any impact when already in an exception context. I'm not convinced that this issue is specific to the timer either. Which revision of the architecture does this CPU implements? Depending on whether the CPU runs VHE or not, we handle things slightly differently. > > > Time interrupt appears on timer > > > expiry and disappears when timer programming or timer disable. This > > > typically can happen when a load instruction misses in the cache, > > > which can take few hundreds of cycles, and an interrupt appears after > > > the load instruction starts executing but disappears before the load > > > instruction completes. > > > > > > Workaround of this is to ensure maximum 2us of time > > > > maximum? I'm not sure how you can bound this. Or did you mean *minimum*? > > It is minimum > > > > > How was this value obtained? What guarantees that it is safe? > > H/w team suggested same This doesn't answer my question. Thanks, M. -- Without deviation from the norm, progress is not possible.