Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2161031ioo; Mon, 23 May 2022 11:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx7efbGQij5Q3/zZ32QSSiqpIgepX06p+1pSbhBmhwlEj1YE7Mod4+ecJ36xoRLTT5XZI9 X-Received: by 2002:a17:902:d544:b0:161:c3fc:5de5 with SMTP id z4-20020a170902d54400b00161c3fc5de5mr24240313plf.112.1653330731450; Mon, 23 May 2022 11:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330731; cv=none; d=google.com; s=arc-20160816; b=lN5n792a5e0it204vQMpFPwlHlLRy8CQf2ww4GtmPt1TnBImJ+DrAkqlub4ClHyrE/ zeunQdwGXyxBzFz+xvU74cgrKXDrbGedwO/tAbQQTMEQ39LhmogSjNf0Ecm2UUZhGgU3 nqBUpf+TWzHdaB7a7W6YrNQfxG3uqCka6jVJfffatiHFfXc/9VqtCaIHBn54+hPqz1tA lSE6031Q7d3y9byiPdeb4fBidSthKJ3SnRtKSvNHogXElzZNb5XjdsaLrxzEDQ082UxN G9YLLwXFBbop6V/zouYYDL/nsbXB/IUaO3ySzvCPitDWK5LDGAdaVcDXZ8kOKalo1Qbd xCAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oCNJML7eA2j9L8f72NkyeKZiPIyN20wsxD5r9Tzx9cA=; b=NyembRvR7w88DEtqoqiynYyxo7rB0ytkZWojW/E6Iw8F7dQf26GW8wNp9LQXj/RBO0 GnS0TgI74kFaMkrpty7VEm4pt6Nwcin1vfLkziYKq5Q1qRSomQ36W1qZ6iso1d0BO++i s85WNXkMyRVYP99rAdIMgbmoz7lpa8jEZGm8/sl6eyZmqLzbtRUqgyzPo7jGBNMULw1m US8IO7/WFKj2tMgEZzgP1YI3OLIvvpK86nc97qlTsZFeDWZJWZA9WgIDB5cZGG5mu21q aOHIkNs4kPAvFsaW37tHsn/JZ2W1/Uf8gSeS2huSuafo4yOJKpU1QxrdwNYupV9yLYwi AYBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VQuspDaa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z15-20020a170902cccf00b00156eeb5cd6bsi10348342ple.562.2022.05.23.11.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:32:11 -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=@google.com header.s=20210112 header.b=VQuspDaa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF92B29CB5; Mon, 23 May 2022 11:30:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241833AbiEWSFg (ORCPT + 99 others); Mon, 23 May 2022 14:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242971AbiEWRhv (ORCPT ); Mon, 23 May 2022 13:37:51 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 238E85D5E6 for ; Mon, 23 May 2022 10:31:56 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id b135so2562397pfb.12 for ; Mon, 23 May 2022 10:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oCNJML7eA2j9L8f72NkyeKZiPIyN20wsxD5r9Tzx9cA=; b=VQuspDaagiDbr8zDGAJevmwHk6IYCwXe0OQNbOee7Tu2IHo33cYxokGiFfbrhTIFD6 62hu7cw8t4yvx3aEBc40atCX/ZCXQYPABJD3A7WMv5dpWaPn1sujmMA8KBgCJG/jH4eb Smd147syr5WmIcn7pwELo2ONgSQiNPsmRFuoyQ1Iuk1z/gxUK17CLFKinM4+1W81nEFo hEWLTqC7ODI5yO9MfnJOT+geXR0KYCSJNoxov70DOAkLXuLYrQlTnAq0q3/2sT9qy69d B46Q3eeaiIlELv+ptqM+emBDuE/X1ivWqBecmrCvvRl7jwiPmbCsJ3mCYHkXRYTX9XnL 9ZeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oCNJML7eA2j9L8f72NkyeKZiPIyN20wsxD5r9Tzx9cA=; b=058I9JufCLo/z+RcXgadaYPlwXpIIN+mTa9oS4WcPc6qKPgDdEWt+HGRN2wh5K8hg5 zCNBkuPZFXjSY1N3Lm3cJYRnRJHEwKgTvbYY+Da7iD9ah9doXRrY4Ph8Hca3HP7ahT2l z2urgEeMbpcodmHXrsLUpmvfRqsDdV+fUO7GOFxoritQGpU/lncFoBJPRBUFS6DtkbzK uUEv943kRxbQqhd5wP6x3O2Ui9uREY8fsO5mC+YyLPQuYJxM8FKtqt1WKjN1HjbB5Wu0 ADPQ9uMC2xXhfE3RwwCpYDHFtLmYMK2o1xcuBH9bV3bqNdNMKBo+xKyIbT51k/awq0ah N6Tw== X-Gm-Message-State: AOAM530jwPyZI57/EiBV/TVjl+EKTUPhi+5L23IiZi+aFHiTMfbPazXg xr0vh1YhZRY51wcm9Uu8yoV5gg== X-Received: by 2002:a05:6a00:140a:b0:4e0:54d5:d01 with SMTP id l10-20020a056a00140a00b004e054d50d01mr24742544pfu.20.1653327068687; Mon, 23 May 2022 10:31:08 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id ru13-20020a17090b2bcd00b001df4a0e9357sm7512221pjb.12.2022.05.23.10.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:31:08 -0700 (PDT) Date: Mon, 23 May 2022 17:31:04 +0000 From: Sean Christopherson To: Maxim Levitsky Cc: Jim Mattson , 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 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. Message-ID: References: <20220427200314.276673-1-mlevitsk@redhat.com> <20220427200314.276673-3-mlevitsk@redhat.com> <65991ac329a32cf4128400b643d5b5ccf3918cfe.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <65991ac329a32cf4128400b643d5b5ccf3918cfe.camel@redhat.com> X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Mon, May 23, 2022, Maxim Levitsky wrote: > 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. IMO, it's worse than doing nothing. Us developers become desensitized to the kernel message due to running tests, the existence of these message propagates the notion that they are a good thing (and we keep rehashing these discussions...), users may not realize it's a _once() printk and so think they _aren't_ affected when re-running a workload, etc... And in this case, "APIC ID change is unsupported by KVM" is partly wrong. KVM fully models Intel's behavior where the ID change isn't carried across x2APIC enabling, the only unsupported behavior is that the guest will lose APICv acceleration. > 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.