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=-4.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 85871C4338F for ; Wed, 25 Aug 2021 09:29:33 +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 4851B61100 for ; Wed, 25 Aug 2021 09:29:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4851B61100 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xftUIA6MXdHK+7hhI/rPf2e4l3lFZCa7g7FUAuBr++4=; b=Ar9Ub3xzRuZtfX O5NBBvxU5vSOKGl4Ds3lFQ4xuupYZnroYaZ3cQgioFk3jkXNdtpYynFgL/sBh7xvIE/g0TvKb7X8e hV2zT0TFUdnWS+TzR4RcdEIey/w+iS+9yxH0dd5XWet2pv92nt58fAoVsK96aM576LsFVH7YxMY2w noTLixQTlo/zDsAsaWJHhyfi3qtfNSevms8GFYShbBqiAGM1RnKVUtF1zhONmzFsITXwJMYTVcfcm q9TUraG2c7lrnv3Jg1XA1zd5IRdn2NbzGrgNwgcRd+tX1kBURNLqZNFBAT2e3H1qoSFukIAeCadbK woGHnCRikbuu5J62GHUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIpBy-0068zT-8F; Wed, 25 Aug 2021 09:27:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIpBg-0068ys-Uf for linux-arm-kernel@lists.infradead.org; Wed, 25 Aug 2021 09:27:14 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A62061100; Wed, 25 Aug 2021 09:27:12 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mIpBe-0076Pu-J0; Wed, 25 Aug 2021 10:27:10 +0100 Date: Wed, 25 Aug 2021 10:27:10 +0100 Message-ID: <87mtp5q3gx.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, pshier@google.com, ricarkol@google.com, rananta@google.com, reijiw@google.com, jingzhangos@google.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, Drew Jones , Peter Maydell Subject: Re: KVM/arm64: Guest ABI changes do not appear rollback-safe 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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oupton@google.com, kvmarm@lists.cs.columbia.edu, pshier@google.com, ricarkol@google.com, rananta@google.com, reijiw@google.com, jingzhangos@google.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, drjones@redhat.com, peter.maydell@linaro.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210825_022713_062920_194147B8 X-CRM114-Status: GOOD ( 32.37 ) 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 Hi Oliver, Adding Andrew and Peter to the discussion. On Tue, 24 Aug 2021 22:15:03 +0100, Oliver Upton wrote: > > Hey folks, > > Ricardo and I were discussing hypercall support in KVM/arm64 and > something seems to be a bit problematic. I do not see anywhere that KVM > requires opt-in from the VMM to expose new hypercalls to the guest. To > name a few, the TRNG and KVM PTP hypercalls are unconditionally provided > to the guest. > > Exposing new hypercalls to guests in this manner seems very unsafe to > me. Suppose an operator is trying to upgrade from kernel N to kernel > N+1, which brings in the new 'widget' hypercall. Guests are live > migrated onto the N+1 kernel, but the operator finds a defect that > warrants a kernel rollback. VMs are then migrated from kernel N+1 -> N. > Any guests that discovered the 'widget' hypercall are likely going to > get fussy _very_ quickly on the old kernel. This goes against what we decided to support for the *only* publicly available VMM that cares about save/restore, which is that we only move forward and don't rollback. Hypercalls are the least of your worries, and there is a whole range of other architectural features that will have also appeared/disappeared (your own CNTPOFF series is a glaring example of this). I appreciate that you may have different considerations, but I felt that it was important to state *why* this is the way it is. > > Really, we need to ensure that the exposed guest ABI is > backwards-compatible. Running a VMM that is blissfully unaware of the > 'widget' hypercall should not implicitly expose it to its guest on a new > kernel. > > This conversation was in the context of devising a new UAPI that allows > VMMs to trap hypercalls to userspace. While such an interface would > easily work around the issue, the onus of ABI compatibility lies with > the kernel. > > So, this is all a long-winded way of asking: how do we dig ourselves out > of this situation, and how to we avoid it happening again in the future? > I believe the answer to both is to have new VM capabilities for sets of > hypercalls exposed to the guest. Unfortunately, the unconditional > exposure of TRNG and PTP hypercalls is ABI now, so we'd have to provide > an opt-out at this point. For anything new, require opt-in from the VMM > before we give it to the guest. > > Have I missed something blatantly obvious, or do others see this as an > issue as well? I'll reply with an example of adding opt-out for PTP. > I'm sure other hypercalls could be handled similarly. Why do we need this? For future hypercalls, we could have some buy-in capabilities. For existing ones, it is too late, and negative features are just too horrible. For KVM-specific hypercalls, we could get the VMM to save/restore the bitmap of supported functions. That would be "less horrible". This could be implemented using extra "firmware pseudo-registers" such as the ones described in Documentation/virt/kvm/arm/psci.rst. Thanks, 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