Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1715430ioo; Mon, 23 May 2022 01:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPvGN9ukuXG9JaWawhSfRmseP9yeCNTqs9DFAYB36advH1kF2/nntiobBoXr8ECtKXLelP X-Received: by 2002:a17:90a:ae14:b0:1e0:51fa:5182 with SMTP id t20-20020a17090aae1400b001e051fa5182mr3356529pjq.60.1653293837300; Mon, 23 May 2022 01:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653293837; cv=none; d=google.com; s=arc-20160816; b=CozYq31PSxITfz4wE9OvpINwW5Tuf0bsW+FJsoAjOmvnFprxCfjMimTfh19fi2JtpH AVwmBRaRmMX0vDVVXw/eCl6pFKEKcc0G65M3RV/0IgatggusHxJF4+JuX2ehXUPuustn FvNVSvFgqyT6Bur5qd2ZtO3ZdxlyFTK7Uj8XJLS31WWSkUb3AhH8eM2/PYt8Evw03B+Z 9wyx38uV77LKwApptE8MpnBzoXU6MbmzxQtjrmWGC2h4LhNXTnZR4+UY0hEKjGJ4tcCS w00lOxIH3CnOty8hnaDySC5zd23eM6YHpLMVRsyuccJNOm9pGJpN7hvjJ2JVPEUnrapS Fb6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=6or0LDEr8+Nq81Rkj47r4fBHy8teKoRGQNGc1avEiUw=; b=avf7mkkaOcC4I+aHXorPHWVdkxAZ/ilux3dmyi/r5QWcNeLqMzFEzmp7FD3Mk1NJ0r 0fFGmFCNx0he9ccBuD5zmiK1fUpIgRVvNYiYdQPNqZuXJUncst9gKQNtMse6bQPCxPsM jnPYlGiTrONVb75IavNwbQf4sk4Woo64PWxF1CrLCH9uYdRPw/lq9sJF22gbTCqMTok3 So5C72zMDLjBDZtW9Q5ivKa9lTnVdPeGGOuiufe14Zn9sWwH0Z6zdKarWePfHZuIs/Lw H//BALNf/DhiICOOfuj0GSSNLH6i9kEyCprNxn1xwwgRVdPdEdVZO9iKjPXmU5IjpSFz 3TPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I68yrpQY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k14-20020a634b4e000000b003c15242c486si8825000pgl.787.2022.05.23.01.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:17:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I68yrpQY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F15AD7379D; Mon, 23 May 2022 00:12:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbiEWGy5 (ORCPT + 99 others); Mon, 23 May 2022 02:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiEWGyy (ORCPT ); Mon, 23 May 2022 02:54:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D93CA54BF2 for ; Sun, 22 May 2022 23:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653288637; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6or0LDEr8+Nq81Rkj47r4fBHy8teKoRGQNGc1avEiUw=; b=I68yrpQY6wYtrKyB1x4shDgHigNQItPovUo/6bFTrUQ9v24K5iO1EVn3k0zioDHWS1P0Vs 6CUaDrHMJDSeeYOgx+NVf9n/GNuJ3h2Mi5tWYASinVs/ekHgwYV6JZbe70tB6R3cv2ELFj m2MDYoOocAXG8fmuBfvUXTA+Hro6ifQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-509-eUJsIwmcNCqspPyOcQzEDw-1; Mon, 23 May 2022 02:50:33 -0400 X-MC-Unique: eUJsIwmcNCqspPyOcQzEDw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43A08801210; Mon, 23 May 2022 06:50:32 +0000 (UTC) Received: from starship (unknown [10.40.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C58041047E8; Mon, 23 May 2022 06:50:25 +0000 (UTC) Message-ID: <65991ac329a32cf4128400b643d5b5ccf3918cfe.camel@redhat.com> Subject: Re: [RFC PATCH v3 02/19] KVM: x86: inhibit APICv/AVIC when the guest and/or host changes apic id/base from the defaults. From: Maxim Levitsky To: Jim Mattson Cc: Sean Christopherson , kvm@vger.kernel.org, Wanpeng Li , Vitaly Kuznetsov , Jani Nikula , Paolo Bonzini , Tvrtko Ursulin , Rodrigo Vivi , Zhenyu Wang , Joonas Lahtinen , Tom Lendacky , Ingo Molnar , David Airlie , Thomas Gleixner , Dave Hansen , x86@kernel.org, intel-gfx@lists.freedesktop.org, Daniel Vetter , Borislav Petkov , Joerg Roedel , linux-kernel@vger.kernel.org, Zhi Wang , Brijesh Singh , "H. Peter Anvin" , intel-gvt-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Mon, 23 May 2022 09:50:24 +0300 In-Reply-To: References: <20220427200314.276673-1-mlevitsk@redhat.com> <20220427200314.276673-3-mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2022-05-22 at 07:47 -0700, Jim Mattson wrote: > On Sun, May 22, 2022 at 2:03 AM Maxim Levitsky wrote: > > On Thu, 2022-05-19 at 16:06 +0000, Sean Christopherson wrote: > > > On Wed, Apr 27, 2022, Maxim Levitsky wrote: > > > > Neither of these settings should be changed by the guest and it is > > > > a burden to support it in the acceleration code, so just inhibit > > > > it instead. > > > > > > > > Also add a boolean 'apic_id_changed' to indicate if apic id ever changed. > > > > > > > > Signed-off-by: Maxim Levitsky > > > > --- > > > > + return; > > > > + > > > > + pr_warn_once("APIC ID change is unsupported by KVM"); > > > > > > It's supported (modulo x2APIC shenanigans), otherwise KVM wouldn't need to disable > > > APICv. > > > > Here, as I said, it would be nice to see that warning if someone complains. > > Fact is that AVIC code was totally broken in this regard, and there are probably more, > > so it would be nice to see if anybody complains. > > > > If you insist, I'll remove this warning. > > This may be fine for a hobbyist, but it's a terrible API in an > enterprise environment. To be honest, I have no way of propagating > this warning from /var/log/messages on a particular host to a > potentially impacted customer. Worse, if they're not the first > impacted customer since the last host reboot, there's no warning to > propagate. I suppose I could just tell every later customer, "Your VM > was scheduled to run on a host that previously reported, 'APIC ID > change is unsupported by KVM.' If you notice any unusual behavior, > that might be the reason for it," but that isn't going to inspire > confidence. I could schedule a drain and reboot of the host, but that > defeats the whole point of the "_once" suffix. Mostly agree, and I read alrady few discussions about exactly this, those warnings are mostly useless, but they are used in the cases where we don't have the courage to just exit with KVM_EXIT_INTERNAL_ERROR. I do not thing though that the warning is completely useless, as we often have the kernel log of the target machine when things go wrong, so *we* can notice it. In other words a kernel warning is mostly useless but better that nothing. About KVM_EXIT_WARNING, this is IMHO a very good idea, probably combined with some form of taint flag, which could be read by qemu and then shown over hmp/qmp interfaces. Best regards, Maxim levitsky > > I know that there's a long history of doing this in KVM, but I'd like > to ask that we: > a) stop piling on > b) start fixing the existing uses > > If KVM cannot emulate a perfectly valid operation, an exit to > userspace with KVM_EXIT_INTERNAL_ERROR is warranted. Perhaps for > operations that we suspect KVM might get wrong, we should have a new > userspace exit: KVM_EXIT_WARNING? > > I'm not saying that you should remove the warning. I'm just asking > that it be augmented with a direct signal to userspace that KVM may no > longer be reliable. >