From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23C3F1D88D0; Thu, 10 Apr 2025 15:35:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744299333; cv=none; b=dR/hntuy0AfY3QMLptdNXBFNDIH35WeD1pG1BsItsXQqQ2HtohYAnyg2kB+n7kUAcHKirki2mp9WsHo3Sle0FwUIxRtoU7HmDu6+wU9xcbz56XIe2NMlBalAuA5o/UFJ34APgX9I5AfdDtA6hFMGE4NiGS7fyCybMUdVkDfwk28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744299333; c=relaxed/simple; bh=0y4gnFMp8pKcQHp3nb3/Gcb5CV00QdElZjckQWOpCrA=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Wfz8jZlyfQkyCC6cn4r/KdcwOI2cnZ0v/OhhjDb8caIBdDW/Lh9LWbpmJGaV0y8N4A+hIVJoyc8zJCyBlleMQ2TmwT48GtZvP9pI1zCXDOvhSzVaOH5lcnjFjDpHeC/q2xegOinePr6W2ZNe60DeDYtPJD3rgbD/gR4Vl1mPkE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cLOHj+nU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cLOHj+nU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F59C4CEDD; Thu, 10 Apr 2025 15:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744299330; bh=0y4gnFMp8pKcQHp3nb3/Gcb5CV00QdElZjckQWOpCrA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cLOHj+nUbI21KS7NP4BXotCDjCsR8thGDgcwBKYzN3HcDddiPWnBvFzR0APfWmknA Gw9FBzvAyWSd/9AYooMu8lcGvjgPz3jws6d/TnECyoD7cpV43Kh9gvlV9g3pekfNvS 5XZF1cIvo2/BBnlJ0nWlEl/ZZS/BANvnZ6F7fJerqQznzLKKENVxpJYK7rT5P+VQYb Ap+lPO0Firgk05DtjKM5kVjhGLVqmORltO6r1xfDIKo9OBV5GdZrNxEVvqzTMsktSk D5wLJmt8tjxpSk8FlwpOxjl/cYrtcB03TXQRrVkVX8ATe6isqE5QkrSPFuEOEvPCAC xSWlRHC1HuM8w== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1u2tw7-004HIw-Uw; Thu, 10 Apr 2025 16:35:28 +0100 Date: Thu, 10 Apr 2025 16:35:27 +0100 Message-ID: <86h62wkp1c.wl-maz@kernel.org> From: Marc Zyngier To: Sebastian Ott Cc: Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: arch_timer_edge_cases failures on ampere-one In-Reply-To: References: 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/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: sebott@redhat.com, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 10 Apr 2025 16:10:43 +0100, Sebastian Ott wrote: > > Hey, > > I'm seeing consistent failures for the arch_timer_edge_cases > selftest one ampere-one(x): > ==== Test Assertion Failure ==== > arm64/arch_timer_edge_cases.c:170: timer_condition == istatus > pid=6277 tid=6277 errno=4 - Interrupted system call > 1 0x0000000000403bcf: test_run at arch_timer_edge_cases.c:962 > 2 0x0000000000401f1f: main at arch_timer_edge_cases.c:1083 > 3 0x0000ffffa8b2625b: ?? ??:0 > 4 0x0000ffffa8b2633b: ?? ??:0 > 5 0x000000000040202f: _start at ??:? > 0x1 != 0x0 (timer_condition != istatus) > > The (first) test that's failing is from test_timers_in_the_past(): > /* Set a timer to counter=0 (in the past) */ > test_timer_cval(timer, 0, wm, true, DEF_CNT); > > If I understand this correctly then the timer condition is met, an > irq should be raised with the istatus bit from SYS_CNTV_CTL_EL0 set. > > What the guest gets for SYS_CNTV_CTL_EL0 is 1 (only the enable bit > set). KVM also reads 1 in timer_save_state() via > read_sysreg_el0(SYS_CNTV_CTL). Is this a HW/FW issue? My hunch is that this is related to AC03_CPU_14 in [1] (now archived locally for future reference...). > > These machines have FEAT_ECV (as a test I disabled that in the kernel > but with the same result). > > As a hack I set ARCH_TIMER_CTRL_IT_STAT in timer_save_state() when > the timer condition is met and set up traps for the register - this > lets the testcase succeed. > > All with the current upstream kernel - but this is not new, I saw > this a couple of months ago but lost access to the machine before > I could debug.. > > Any hints what to do here? Not a lot to do, assuming this is the actual cause. Similar things happen on my QC box, which has a "remarkable" timer implementation and a bunch of terrible hacks to keep it alive. On the other hand, I'm not even convinced that this test-case is legit. It seems to rely on the counter being 64bit wide, which is not always the case. M. [1] https://amperecomputing.com/assets/AmpereOne_Developer_ER_v0_80_20240823_28945022f4.pdf -- Without deviation from the norm, progress is not possible.