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 X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C3F4C432BE for ; Wed, 4 Aug 2021 09:23:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35B1360FC4 for ; Wed, 4 Aug 2021 09:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237075AbhHDJXd (ORCPT ); Wed, 4 Aug 2021 05:23:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47653 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237088AbhHDJXa (ORCPT ); Wed, 4 Aug 2021 05:23:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628068996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=FWER3PUiYLJeyKlt+stoEJAsT93ZblfwBdX6ZSWC3WZ5TiqOX/looeyccUmR2tdvbzpecD fymCUoMjIZTwmW9VgMVsJ+5GzErKiTkEYjYSCMVia1Pe40/cuohTcxb/qAnIMjRTiewiFC BBQv6KU9+yvYF/QhvrnQtCPk4E4Uaek= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-wb4wyTnNOtG1oFsR391kWA-1; Wed, 04 Aug 2021 05:23:15 -0400 X-MC-Unique: wb4wyTnNOtG1oFsR391kWA-1 Received: by mail-ed1-f70.google.com with SMTP id d6-20020a50f6860000b02903bc068b7717so1147106edn.11 for ; Wed, 04 Aug 2021 02:23:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=KOUZkLiazqbUqRxyuiZLVX2UJ51NJ8CAY13N35YVbsKbCguD9CsHE3jnf5b4SSwJBM xvjlVzqNfL4tDuDlLBbpVmCQk5CGV4SRl2u8F8mBy9fvAGefVjccllDm2hHzI/phEDrS vte6FHhw/wTb4BFQyPc1hIMUeeUFi/LxjvqYyTCJzFQu2WcgjHEDYLWNyappJYIIwbEI sM8RrOusZpFYmXlAWyd+cZPVP1uc7KimRypvC+KRto47DcG76EO6GDA8ss8zN05KJFcv O19IBbMbQBYwpLMzD3uBZDJadrplRDmnZeMFm/g4R8BLJC2GqbFOapc1FRWdTK2QuZQX Fyfg== X-Gm-Message-State: AOAM533YwtVIk460/Y22+VSrgJdYgE/neqm3y6tHdjEdFeT32deIbGuJ 8dx1DidV1H5GlLNBe4hCU+PNz2R4zr9QeQF0YtyiA2mBvYG2FINnnwqAPXQrN+GbMObIdPvXpu8 ieSmsTVzAqObK X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030943edc.164.1628068994307; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE6m2UYvltRQ8Pgjp26MJaVNK+xKyPnxyh9OKvCZbbQ2+R1157cJg4uGkivonAtdYooD+rvg== X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030924edc.164.1628068994149; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id i16sm706151edr.38.2021.08.04.02.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 02:23:13 -0700 (PDT) Date: Wed, 4 Aug 2021 11:23:11 +0200 From: Andrew Jones To: Oliver Upton Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas Subject: Re: [PATCH v6 11/21] KVM: arm64: Refactor update_vtimer_cntvoff() Message-ID: <20210804092311.yhruuke6buiblrel@gator.home> References: <20210804085819.846610-1-oupton@google.com> <20210804085819.846610-12-oupton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210804085819.846610-12-oupton@google.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Aug 04, 2021 at 08:58:09AM +0000, Oliver Upton wrote: > Make the implementation of update_vtimer_cntvoff() generic w.r.t. guest > timer context and spin off into a new helper method for later use. > Require callers of this new helper method to grab the kvm lock > beforehand. > > No functional change intended. > > Signed-off-by: Oliver Upton > --- > arch/arm64/kvm/arch_timer.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c > index 3df67c127489..c0101db75ad4 100644 > --- a/arch/arm64/kvm/arch_timer.c > +++ b/arch/arm64/kvm/arch_timer.c > @@ -747,22 +747,32 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu) > return 0; > } > > -/* Make the updates of cntvoff for all vtimer contexts atomic */ > -static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +/* Make offset updates for all timer contexts atomic */ > +static void update_timer_offset(struct kvm_vcpu *vcpu, > + enum kvm_arch_timers timer, u64 offset) > { > int i; > struct kvm *kvm = vcpu->kvm; > struct kvm_vcpu *tmp; > > - mutex_lock(&kvm->lock); > + lockdep_assert_held(&kvm->lock); > + > kvm_for_each_vcpu(i, tmp, kvm) > - timer_set_offset(vcpu_vtimer(tmp), cntvoff); > + timer_set_offset(vcpu_get_timer(tmp, timer), offset); > > /* > * When called from the vcpu create path, the CPU being created is not > * included in the loop above, so we just set it here as well. > */ > - timer_set_offset(vcpu_vtimer(vcpu), cntvoff); > + timer_set_offset(vcpu_get_timer(vcpu, timer), offset); > +} > + > +static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +{ > + struct kvm *kvm = vcpu->kvm; > + > + mutex_lock(&kvm->lock); > + update_timer_offset(vcpu, TIMER_VTIMER, cntvoff); > mutex_unlock(&kvm->lock); > } > > -- > 2.32.0.605.g8dce9f2422-goog > Reviewed-by: Andrew Jones 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 X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35467C4338F for ; Wed, 4 Aug 2021 09:23:23 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id A1EE460FC4 for ; Wed, 4 Aug 2021 09:23:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A1EE460FC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2D60B49E93; Wed, 4 Aug 2021 05:23:22 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jbS+wKV7aBil; Wed, 4 Aug 2021 05:23:21 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2D83E49F82; Wed, 4 Aug 2021 05:23:21 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9008340CF9 for ; Wed, 4 Aug 2021 05:23:19 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3g02kaE8vlVa for ; Wed, 4 Aug 2021 05:23:17 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F15C64086C for ; Wed, 4 Aug 2021 05:23:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628068996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=FWER3PUiYLJeyKlt+stoEJAsT93ZblfwBdX6ZSWC3WZ5TiqOX/looeyccUmR2tdvbzpecD fymCUoMjIZTwmW9VgMVsJ+5GzErKiTkEYjYSCMVia1Pe40/cuohTcxb/qAnIMjRTiewiFC BBQv6KU9+yvYF/QhvrnQtCPk4E4Uaek= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-DDmba-ryO2S0jicKPZ3CCg-1; Wed, 04 Aug 2021 05:23:15 -0400 X-MC-Unique: DDmba-ryO2S0jicKPZ3CCg-1 Received: by mail-ej1-f69.google.com with SMTP id nb40-20020a1709071ca8b02905992266c319so600528ejc.21 for ; Wed, 04 Aug 2021 02:23:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=my97dJHsO0sgj71FrGn8nzfGvhwqLY5pQnAEwC/940/Cdb4+ULeeCsFm+Pstc/A0Du iUUTLp4li3xm36mm/zdrHM7GAW8qNPUiWgIhjUJlbhrKignGNVP7fsOQ6O5L53vxMvig Z7c0M8ICHBb4h3lD14Gl9KbQGvjGzvjSda1EUWa0AfQCGgzrDzVJkYfmAMmuVCTqelWL 2dqh63SozVmCXV9VSfPqS2xM1/dJxm33vyoIQxqHozgVILWQXu+5h3G7M0PgO2F+4nWq QjMZ0Z0hADWG6VSZB01p9flHKN0cqzvXL4hiZdOGwAPYkDHUngXDTS8qrdZbxbVTLyuf WGYQ== X-Gm-Message-State: AOAM532utiETdPTWFp8IglvS0YRwyMPMb+W2s2ZDCsafoCs7dI1qPhNf XE58UBZ9xcOE3pFK37pMg+oFkkT3QkqrMnxArtOS8i9QLDykb66map45IY3v0fGpmW8IE2O1IZM h0R1MYH5rD1jN5JvonGFnZP+K X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030955edc.164.1628068994391; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE6m2UYvltRQ8Pgjp26MJaVNK+xKyPnxyh9OKvCZbbQ2+R1157cJg4uGkivonAtdYooD+rvg== X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030924edc.164.1628068994149; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id i16sm706151edr.38.2021.08.04.02.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 02:23:13 -0700 (PDT) Date: Wed, 4 Aug 2021 11:23:11 +0200 From: Andrew Jones To: Oliver Upton Subject: Re: [PATCH v6 11/21] KVM: arm64: Refactor update_vtimer_cntvoff() Message-ID: <20210804092311.yhruuke6buiblrel@gator.home> References: <20210804085819.846610-1-oupton@google.com> <20210804085819.846610-12-oupton@google.com> MIME-Version: 1.0 In-Reply-To: <20210804085819.846610-12-oupton@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: Catalin Marinas , kvm@vger.kernel.org, Will Deacon , Marc Zyngier , Raghavendra Rao Anata , Peter Shier , Sean Christopherson , David Matlack , Paolo Bonzini , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, Aug 04, 2021 at 08:58:09AM +0000, Oliver Upton wrote: > Make the implementation of update_vtimer_cntvoff() generic w.r.t. guest > timer context and spin off into a new helper method for later use. > Require callers of this new helper method to grab the kvm lock > beforehand. > > No functional change intended. > > Signed-off-by: Oliver Upton > --- > arch/arm64/kvm/arch_timer.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c > index 3df67c127489..c0101db75ad4 100644 > --- a/arch/arm64/kvm/arch_timer.c > +++ b/arch/arm64/kvm/arch_timer.c > @@ -747,22 +747,32 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu) > return 0; > } > > -/* Make the updates of cntvoff for all vtimer contexts atomic */ > -static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +/* Make offset updates for all timer contexts atomic */ > +static void update_timer_offset(struct kvm_vcpu *vcpu, > + enum kvm_arch_timers timer, u64 offset) > { > int i; > struct kvm *kvm = vcpu->kvm; > struct kvm_vcpu *tmp; > > - mutex_lock(&kvm->lock); > + lockdep_assert_held(&kvm->lock); > + > kvm_for_each_vcpu(i, tmp, kvm) > - timer_set_offset(vcpu_vtimer(tmp), cntvoff); > + timer_set_offset(vcpu_get_timer(tmp, timer), offset); > > /* > * When called from the vcpu create path, the CPU being created is not > * included in the loop above, so we just set it here as well. > */ > - timer_set_offset(vcpu_vtimer(vcpu), cntvoff); > + timer_set_offset(vcpu_get_timer(vcpu, timer), offset); > +} > + > +static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +{ > + struct kvm *kvm = vcpu->kvm; > + > + mutex_lock(&kvm->lock); > + update_timer_offset(vcpu, TIMER_VTIMER, cntvoff); > mutex_unlock(&kvm->lock); > } > > -- > 2.32.0.605.g8dce9f2422-goog > Reviewed-by: Andrew Jones _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BB4EC4338F for ; Wed, 4 Aug 2021 09:33:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56ECD60EE5 for ; Wed, 4 Aug 2021 09:33:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 56ECD60EE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3KMG97YGSo60Gj9R+lZcL6eMjG0lRJ32JyWeZ6Hng3I=; b=gl5+GuSoT5BSmW wrFRv0EJCqbp3YXc/ugXy5AZXPV0/Vs8HnxZbXXJfapZeJQzTwNcBGnvqE+QAw+KOgFZPgJer3Qye PMUTwhN2MY/L3ko+zARQKHNsvb+kHbAj2i/MUgVAZEOFLjjKIqf4EtS0/MwEgIFzJ2rSVfw55kUf0 oF+vF3XaQlMZJU89b6Hprs2lBNmnL99WemMT4RylQHj2EddMjYM1/5ed4aMAL/PwpCNzqp6IHve/6 nySEoWaZCdyVEWj9l5Veo6Isoj7DTfwfqoTVpZxi5/JcroSu6ytRbg5Cdv3dmmS9FP8KX3poJqlwm UfSbKIlGh/U21HlPtx/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBDFK-005SVQ-Kx; Wed, 04 Aug 2021 09:31:30 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBD7N-005P7n-My for linux-arm-kernel@lists.infradead.org; Wed, 04 Aug 2021 09:23:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628068996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=FWER3PUiYLJeyKlt+stoEJAsT93ZblfwBdX6ZSWC3WZ5TiqOX/looeyccUmR2tdvbzpecD fymCUoMjIZTwmW9VgMVsJ+5GzErKiTkEYjYSCMVia1Pe40/cuohTcxb/qAnIMjRTiewiFC BBQv6KU9+yvYF/QhvrnQtCPk4E4Uaek= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-533-R0rLoD8AOnmP1h11NOQg8Q-1; Wed, 04 Aug 2021 05:23:15 -0400 X-MC-Unique: R0rLoD8AOnmP1h11NOQg8Q-1 Received: by mail-ed1-f72.google.com with SMTP id eg53-20020a05640228b5b02903bd6e6f620cso1130241edb.23 for ; Wed, 04 Aug 2021 02:23:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UkRs2HbzdB4h7mTj8+qY8hBZF+eBXTP8p+8ea8LWKp8=; b=rRW9DPh2OpCGmyCG7BJswZQEkyEnG6YKqHSs0CIyxqemwo7qgo7RGjl5pyhq/1GwMf 83X1wy+GwBZaiAiSXkBLgomcL5WzuebsL++nZrToWWk5qfui8eHG1gpO4MaBay7dW9GX HWTCkI7J/S7SwetSZbVfJ67WDTp42kTAOJzPPUmsrSrWkXmccnUeYkuDaS6O4dU23yWI saxeFBwezW5r2F0qqsm+G+Cp3FfGKqaRotBG4M59z0cwh0ina+hFPGrNh6UPH2PyNgvs WP/QbftA6P0qjzdHnW3JZhfzMUwguIWUNgeA+3L4IjAfHLWCNh6Mgtw8Kq64aIXFED/6 6V2Q== X-Gm-Message-State: AOAM530bfATA7UaIurFdzAn2qbFvO6BRxJ5rgsW9dKlrzIgdsuOfr3z0 r6cfZ3NF+Iok/IoKVPqhq1AoeZ1rNmk0/a1/vvHldqLsEtZKacxXOUtJySvGe1YLjWuVUSh7Nq8 rFbfBK2CPa8mmbq5gQ+XjvlRJCl5+KesfEu0= X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030941edc.164.1628068994304; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE6m2UYvltRQ8Pgjp26MJaVNK+xKyPnxyh9OKvCZbbQ2+R1157cJg4uGkivonAtdYooD+rvg== X-Received: by 2002:a50:a6d7:: with SMTP id f23mr31030924edc.164.1628068994149; Wed, 04 Aug 2021 02:23:14 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id i16sm706151edr.38.2021.08.04.02.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 02:23:13 -0700 (PDT) Date: Wed, 4 Aug 2021 11:23:11 +0200 From: Andrew Jones To: Oliver Upton Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas Subject: Re: [PATCH v6 11/21] KVM: arm64: Refactor update_vtimer_cntvoff() Message-ID: <20210804092311.yhruuke6buiblrel@gator.home> References: <20210804085819.846610-1-oupton@google.com> <20210804085819.846610-12-oupton@google.com> MIME-Version: 1.0 In-Reply-To: <20210804085819.846610-12-oupton@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210804_022317_884206_C261E3AB X-CRM114-Status: GOOD ( 20.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 04, 2021 at 08:58:09AM +0000, Oliver Upton wrote: > Make the implementation of update_vtimer_cntvoff() generic w.r.t. guest > timer context and spin off into a new helper method for later use. > Require callers of this new helper method to grab the kvm lock > beforehand. > > No functional change intended. > > Signed-off-by: Oliver Upton > --- > arch/arm64/kvm/arch_timer.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c > index 3df67c127489..c0101db75ad4 100644 > --- a/arch/arm64/kvm/arch_timer.c > +++ b/arch/arm64/kvm/arch_timer.c > @@ -747,22 +747,32 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu) > return 0; > } > > -/* Make the updates of cntvoff for all vtimer contexts atomic */ > -static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +/* Make offset updates for all timer contexts atomic */ > +static void update_timer_offset(struct kvm_vcpu *vcpu, > + enum kvm_arch_timers timer, u64 offset) > { > int i; > struct kvm *kvm = vcpu->kvm; > struct kvm_vcpu *tmp; > > - mutex_lock(&kvm->lock); > + lockdep_assert_held(&kvm->lock); > + > kvm_for_each_vcpu(i, tmp, kvm) > - timer_set_offset(vcpu_vtimer(tmp), cntvoff); > + timer_set_offset(vcpu_get_timer(tmp, timer), offset); > > /* > * When called from the vcpu create path, the CPU being created is not > * included in the loop above, so we just set it here as well. > */ > - timer_set_offset(vcpu_vtimer(vcpu), cntvoff); > + timer_set_offset(vcpu_get_timer(vcpu, timer), offset); > +} > + > +static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff) > +{ > + struct kvm *kvm = vcpu->kvm; > + > + mutex_lock(&kvm->lock); > + update_timer_offset(vcpu, TIMER_VTIMER, cntvoff); > mutex_unlock(&kvm->lock); > } > > -- > 2.32.0.605.g8dce9f2422-goog > Reviewed-by: Andrew Jones _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel