All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Fuad Tabba <tabba@google.com>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	will@kernel.org, qperret@google.com, seanjc@google.com,
	alexandru.elisei@arm.com, catalin.marinas@arm.com,
	philmd@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com,
	oliver.upton@linux.dev, mark.rutland@arm.com, joey.gouly@arm.com,
	rananta@google.com, yuzenghui@huawei.com
Subject: Re: [PATCH v4 6/9] KVM: arm64: Eagerly restore host fpsimd/sve state in pKVM
Date: Tue, 04 Jun 2024 14:52:52 +0100	[thread overview]
Message-ID: <86ed9clsqz.wl-maz@kernel.org> (raw)
In-Reply-To: <e8e7928b-9f79-4015-a144-fade7ac84c6e@sirena.org.uk>

On Tue, 04 Jun 2024 14:13:16 +0100,
Mark Brown <broonie@kernel.org> wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> On Tue, Jun 04, 2024 at 01:03:07PM +0100, Fuad Tabba wrote:
> > On Mon, Jun 3, 2024 at 4:52 PM Mark Brown <broonie@kernel.org> wrote:
> > > On Mon, Jun 03, 2024 at 01:28:48PM +0100, Fuad Tabba wrote:
> 
> > > > +static void fpsimd_sve_flush(void)
> > > > +{
> > > > +     *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED;
> > > > +}
> 
> > > My previous comments about this being confusing still stand.
> 
> > Sorry, I missed this in my reply to v3.
> 
> > This follows the convention for save/flush in hyp-main.c. Since the
> > act of flushing the fpsimd/sve state is lazy, i.e., only takes place
> > if the guest were to use fpsimd/sve, then the only thing that we need
> > to do to flush is to mark the state as owned by the host.
> 
> I think this needs a comment mentioning what's going on here.
> 
> > You suggested inlining this, but since this is static, I think the
> > compiler would do that. Even though it's only one line, it maintains
> > symmetry with fpsimd_sve_sync().
> 
> The reason I was suggesting inlining was that it removes the need to
> name the function.

You're missing the point.

The name is important, and the current name is correct. We use *flush
(resp. *sync) for operations that need to happen before (resp. after)
the entry into the guest. This is consistent with the rest of the code
base for most of the subsystems KVM/arm64 deals with.

So the current form of this function, as a standalone function with
its current name, stays.

	M.

-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Fuad Tabba <tabba@google.com>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	will@kernel.org, qperret@google.com, seanjc@google.com,
	alexandru.elisei@arm.com, catalin.marinas@arm.com,
	philmd@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com,
	oliver.upton@linux.dev, mark.rutland@arm.com, joey.gouly@arm.com,
	rananta@google.com, yuzenghui@huawei.com
Subject: Re: [PATCH v4 6/9] KVM: arm64: Eagerly restore host fpsimd/sve state in pKVM
Date: Tue, 04 Jun 2024 14:52:52 +0100	[thread overview]
Message-ID: <86ed9clsqz.wl-maz@kernel.org> (raw)
In-Reply-To: <e8e7928b-9f79-4015-a144-fade7ac84c6e@sirena.org.uk>

On Tue, 04 Jun 2024 14:13:16 +0100,
Mark Brown <broonie@kernel.org> wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> On Tue, Jun 04, 2024 at 01:03:07PM +0100, Fuad Tabba wrote:
> > On Mon, Jun 3, 2024 at 4:52 PM Mark Brown <broonie@kernel.org> wrote:
> > > On Mon, Jun 03, 2024 at 01:28:48PM +0100, Fuad Tabba wrote:
> 
> > > > +static void fpsimd_sve_flush(void)
> > > > +{
> > > > +     *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED;
> > > > +}
> 
> > > My previous comments about this being confusing still stand.
> 
> > Sorry, I missed this in my reply to v3.
> 
> > This follows the convention for save/flush in hyp-main.c. Since the
> > act of flushing the fpsimd/sve state is lazy, i.e., only takes place
> > if the guest were to use fpsimd/sve, then the only thing that we need
> > to do to flush is to mark the state as owned by the host.
> 
> I think this needs a comment mentioning what's going on here.
> 
> > You suggested inlining this, but since this is static, I think the
> > compiler would do that. Even though it's only one line, it maintains
> > symmetry with fpsimd_sve_sync().
> 
> The reason I was suggesting inlining was that it removes the need to
> name the function.

You're missing the point.

The name is important, and the current name is correct. We use *flush
(resp. *sync) for operations that need to happen before (resp. after)
the entry into the guest. This is consistent with the rest of the code
base for most of the subsystems KVM/arm64 deals with.

So the current form of this function, as a standalone function with
its current name, stays.

	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

  reply	other threads:[~2024-06-04 13:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 12:28 [PATCH v4 0/9] KVM: arm64: Fix handling of host fpsimd/sve state in protected mode Fuad Tabba
2024-06-03 12:28 ` Fuad Tabba
2024-06-03 12:28 ` [PATCH v4 1/9] KVM: arm64: Reintroduce __sve_save_state Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 13:55   ` Mark Brown
2024-06-03 13:55     ` Mark Brown
2024-06-03 14:11     ` Fuad Tabba
2024-06-03 14:11       ` Fuad Tabba
2024-06-03 14:16       ` Mark Brown
2024-06-03 14:16         ` Mark Brown
2024-06-03 12:28 ` [PATCH v4 2/9] KVM: arm64: Fix prototype for __sve_save_state/__sve_restore_state Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 14:19   ` Mark Brown
2024-06-03 14:19     ` Mark Brown
2024-06-03 12:28 ` [PATCH v4 3/9] KVM: arm64: Abstract set/clear of CPTR_EL2 bits behind helper Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 12:28 ` [PATCH v4 4/9] KVM: arm64: Specialize handling of host fpsimd state on trap Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 12:28 ` [PATCH v4 5/9] KVM: arm64: Allocate memory mapped at hyp for host sve state in pKVM Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 14:50   ` Mark Brown
2024-06-03 14:50     ` Mark Brown
2024-06-04  8:24     ` Fuad Tabba
2024-06-04  8:24       ` Fuad Tabba
2024-06-03 12:28 ` [PATCH v4 6/9] KVM: arm64: Eagerly restore host fpsimd/sve " Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 15:52   ` Mark Brown
2024-06-03 15:52     ` Mark Brown
2024-06-04 12:03     ` Fuad Tabba
2024-06-04 12:03       ` Fuad Tabba
2024-06-04 13:13       ` Mark Brown
2024-06-04 13:13         ` Mark Brown
2024-06-04 13:52         ` Marc Zyngier [this message]
2024-06-04 13:52           ` Marc Zyngier
2024-06-04 14:07           ` Mark Brown
2024-06-04 14:07             ` Mark Brown
2024-06-03 12:28 ` [PATCH v4 7/9] KVM: arm64: Consolidate initializing the host data's fpsimd_state/sve " Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 15:43   ` Mark Brown
2024-06-03 15:43     ` Mark Brown
2024-06-03 12:28 ` [PATCH v4 8/9] KVM: arm64: Refactor CPACR trap bit setting/clearing to use ELx format Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 12:28 ` [PATCH v4 9/9] KVM: arm64: Ensure that SME controls are disabled in protected mode Fuad Tabba
2024-06-03 12:28   ` Fuad Tabba
2024-06-03 14:43   ` Mark Brown
2024-06-03 14:43     ` Mark Brown
2024-06-04 14:30 ` [PATCH v4 0/9] KVM: arm64: Fix handling of host fpsimd/sve state " Marc Zyngier
2024-06-04 14:30   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ed9clsqz.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=oliver.upton@linux.dev \
    --cc=philmd@linaro.org \
    --cc=qperret@google.com \
    --cc=rananta@google.com \
    --cc=seanjc@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.