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.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 D99C6C433DB for ; Tue, 9 Mar 2021 13:33:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 1A9A464F35 for ; Tue, 9 Mar 2021 13:33:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A9A464F35 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=LVpqGZZJFqusathntbhdvSNwo6vtrVeWiEITGXVLJ7Q=; b=PtJEuFz8TW+hka70jiOKDVwwj msBI7zOCTH8e/aixph93Kk8ORLPJj4n/G5WTJZe39ooU2Y8jG3q/jqjcb+soCRyyaWe3Qn7sOOEqv b7erYaHDHkoWtzJtpIg0JaahefaJuUSIz6+a+W9ErhIXAhPgIvjMu8g5pbLLdMhCRjuujZv54jQcI BVI4UWucwu265PelG+0CGbLzCPLha6LpYa5FcHyJn8neOIdmLUON4d30lLjH6NV7Ktt/4mdox9dvg iZARONmeb35Xz9UI4jBt7m6xVTafAzVrkJEYORaxXSraQsXoeV+/6Irfa98vBoEnNW99Uf281SYk7 47s64HxOQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJcSF-004eIS-IS; Tue, 09 Mar 2021 13:31:22 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJcJI-004agJ-FM for linux-arm-kernel@lists.infradead.org; Tue, 09 Mar 2021 13:22:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615296121; 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=vnG6VAZGUSIfQJb+HRGgF9NNG2xl2aHTWM0Qb7o+3ag=; b=cXNri4bK2FYQF/YOu9zhB9vuzQL6QhfRWSAozmIbQykOETvltxn0gOHqiJqbV7UFc2dWq4 bk3bgQZ0IoiiTpoGzqbpHG+7pF4GJERNg73MbaCVc5jCa4oVcYckNVC5QXRqbtX3kn9vGd CUt1gUkp5GHAhCa+ZZT1l932Cag8K1c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-558-1noFX22NOMKwnU5HOldGvg-1; Tue, 09 Mar 2021 08:20:29 -0500 X-MC-Unique: 1noFX22NOMKwnU5HOldGvg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4024C101F013; Tue, 9 Mar 2021 13:20:27 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.40.193.217]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CE895C266; Tue, 9 Mar 2021 13:20:24 +0000 (UTC) Date: Tue, 9 Mar 2021 14:20:21 +0100 From: Andrew Jones To: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH] KVM: arm64: Cap default IPA size to the host's own size Message-ID: <20210309132021.7vuuf73joybhlhg3@kamzik.brq.redhat.com> References: <20210308174643.761100-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210308174643.761100-1-maz@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_132205_231528_08955DB3 X-CRM114-Status: GOOD ( 25.23 ) 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 Marc, On Mon, Mar 08, 2021 at 05:46:43PM +0000, Marc Zyngier wrote: > KVM/arm64 has forever used a 40bit default IPA space, partially > due to its 32bit heritage (where the only choice is 40bit). > > However, there are implementations in the wild that have a *cough* > much smaller *cough* IPA space, which leads to a misprogramming of > VTCR_EL2, and a guest that is stuck on its first memory access > if userspace dares to ask for the default IPA setting (which most > VMMs do). > > Instead, cap the default IPA size to what the host can actually > do, and spit out a one-off message on the console. The boot warning > is turned into a more meaningfull message, and the new behaviour > is also documented. > > Although this is a userspace ABI change, it doesn't really change > much for userspace: > > - the guest couldn't run before this change, while it now has > a chance to if the memory range fits the reduced IPA space > > - a memory slot that was accepted because it did fit the default > IPA space but didn't fit the HW constraints is now properly > rejected I'm not sure deferring the misconfiguration error until memslot request time is better than just failing to create a VM. If userspace doesn't use KVM_CAP_ARM_VM_IPA_SIZE to determine the limit (which it hasn't been obliged to do) and it is able to successfully create a VM, then it will assume up to 40-bit IPAs are supported. Later, when it tries to add memslots and fails it may be confused, especially if that later is much, much later with memory hotplug. > > The other thing that's left doing is to convince userspace to > actually use the IPA space setting instead of relying on the > antiquated default. Failing to create any VM which hasn't selected a valid IPA limit should be pretty convincing :-) Thanks, drew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel