linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	James Morse <james.morse@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>
Subject: Re: [PATCH] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity
Date: Fri, 05 Jul 2024 13:08:51 +0100	[thread overview]
Message-ID: <86bk3c3uss.wl-maz@kernel.org> (raw)
In-Reply-To: <171839668434.686757.6430070893119235107.b4-ty@linux.dev>

On Fri, 14 Jun 2024 21:24:51 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
> 
> On Fri, 14 Jun 2024 13:58:58 +0100, Marc Zyngier wrote:
> > The Fine Grained Trap extension is pretty messy as it doesn't
> > consistently use the same polarity for all trap bits. A bunch
> > of them, added later in the life of the architecture, have a
> > *negative* priority.
> > 
> > So if these bits are disabled, they must be RES1 and not RES0.
> > But that's not what the code implements, making the traps for
> > these negative trap bits being always on instead of disabled.
> > 
> > [...]
> 
> Applied to kvmarm/next, thanks!
> 
> [1/1] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity
>       https://git.kernel.org/kvmarm/kvmarm/c/eb9d53d4a949

[+ Anshuman, as I've pointed him to this patch in the past]

OK, I think I have come to my senses, and came to the conclusion that:

- I am officially losing the plot (blame the political climate)

- this "fix" is total b*ll*cks and must be dropped/reverted

Let remember how this whole thing works. A "negative" trap bit has two
essential properties:

- it is writable

- it has an effect when set to 0

If the bit isn't implemented, it is RES0. Only RES0. Not RES1, which
this patch enforces. None of the FGT bits are ever RES1. So at least
on this front, this patch is broken and results in observable nonsense
on the guest side.

But there is more! We are already capable of distinguishing a bit that
traps because it is set to 0 from a bit that is RES0. check_fgt_bit()
already has all the logic, which is evaluated on any trap.

So we already have the proper filtering in place (a RES0 bit won't
result in a trap forwarded to a nested guest), the original code was
correct, and forcing FGT bits to RES1 is just a stupid regression.

Oliver, can you please drop or revert this patch from the kvmarm/next
branch please?

Thanks and sorry for the noise.

	M.

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


  reply	other threads:[~2024-07-05 12:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 12:58 [PATCH] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity Marc Zyngier
2024-06-14 20:24 ` Oliver Upton
2024-07-05 12:08   ` Marc Zyngier [this message]
2024-07-08 19:59     ` Oliver Upton

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=86bk3c3uss.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=anshuman.khandual@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=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).