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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12829C64ED6 for ; Tue, 28 Feb 2023 19:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbjB1TTH (ORCPT ); Tue, 28 Feb 2023 14:19:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjB1TTG (ORCPT ); Tue, 28 Feb 2023 14:19:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8FA512840 for ; Tue, 28 Feb 2023 11:19:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8443DB80E72 for ; Tue, 28 Feb 2023 19:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45626C433EF; Tue, 28 Feb 2023 19:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677611942; bh=Bb3h4fAacNfgLwkZc3yB/rJ+a+mFCa2BBHKn4BZOmAs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cK8bH9wQf6AY1Hvk2d2/33/uUdNhTf+B91Qtd5z00nW4y+Vs6xaxfBq8/jFKIvX2Z uacv2cnFcclvpDGvcJCq0t/dqcQm5Sq8TYrYgcdlvLW/F6aGYoQnutuu0wYTp2UijT 7Hr9mNvJG9P4GKSKi1a6/0CKmbPrUVzo7lKrWmVtUlPs4+UVaB8Fk2Jra3PqJjWvve HRdm0oWpSEUaU+moPhBixErhXMRcSQ6KQsEV8MI3aL46R5fXs/l0ptg8FwII1P1gYq R3X/Mki+h3a0/H6rFejB032EUqL/Wh3TJml88DrQKY7/gktv8ynppjjZj8ue6/24yZ FTjQ4fF45M4PA== Received: from [47.176.216.2] (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.95) (envelope-from ) id 1pX5V5-00Dutc-HM; Tue, 28 Feb 2023 19:19:00 +0000 Date: Tue, 28 Feb 2023 19:18:38 +0000 Message-ID: <87sfepha41.wl-maz@kernel.org> From: Marc Zyngier To: Joey Gouly Cc: , , , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Reiji Watanabe , Subject: Re: [PATCH v2] KVM: arm64: timers: Convert per-vcpu virtual offset to a global value In-Reply-To: <20230228112607.GA18683@e124191.cambridge.arm.com> References: <20230224191640.3396734-1-maz@kernel.org> <20230228112607.GA18683@e124191.cambridge.arm.com> 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: 47.176.216.2 X-SA-Exim-Rcpt-To: joey.gouly@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, reijiw@google.com, nd@arm.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: kvm@vger.kernel.org On Tue, 28 Feb 2023 11:26:07 +0000, Joey Gouly wrote: > > Hi Marc, > > On Fri, Feb 24, 2023 at 07:16:40PM +0000, Marc Zyngier wrote: > > Having a per-vcpu virtual offset is a pain. It needs to be synchronized > > on each update, and expands badly to a setup where different timers can > > have different offsets, or have composite offsets (as with NV). > > > > So let's start by replacing the use of the CNTVOFF_EL2 shadow register > > (which we want to reclaim for NV anyway), and make the virtual timer > > carry a pointer to a VM-wide offset. > > > > This simplifies the code significantly. It also addresses two terrible bugs: > > > > - The use of CNTVOFF_EL2 leads to some nice offset corruption > > when the sysreg gets reset, as reported by Joey. > > > > - The kvm mutex is taken from a vcpu ioctl, which goes against > > the locking rules... > > > > Reported-by: Joey Gouly > > Reviewed-by: Reiji Watanabe > > Signed-off-by: Marc Zyngier > > Link: https://lore.kernel.org/r/20230224173915.GA17407@e124191.cambridge.arm.com > > Fixes my mismatched timer offset issues. > > Tested-by: Joey Gouly Thanks for having given it a go. Hopefully Oliver will be able to send this to as a fix shortly. Thanks, M. -- Without deviation from the norm, progress is not possible.