Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3670065lfo; Mon, 23 May 2022 10:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVzLly3P7ovhyx1rJLZRpOKhObI2wEOLewM31LIAefjgXRX9tlpdCeMYYp4rbBQAA9dlIE X-Received: by 2002:a17:903:2288:b0:162:23c:c151 with SMTP id b8-20020a170903228800b00162023cc151mr13267331plh.78.1653328540064; Mon, 23 May 2022 10:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653328540; cv=none; d=google.com; s=arc-20160816; b=uS8drzNhCHVnPXJGGbqrfFnsiNCagiE6CrL81fm150XiMAZKSLXCs9OjEz7Ab4HFoL zt1touPCo7FSMGVErsGykq8K1MG6broDML32oJBRElLJOFMbT89qhUU27NDP56Ubj+Wh 6swzyaxB44sY5z4Ujal++ryhYmMOEdrx3r1m+rVHd2lEfXEoVNaUFgNDTVV2+tQD7vVn CVbhQADmlTa4aTC9az7tCOZ7tGDMZzCAvcMGEKlwibJ73fzQJAfwqP4+tBisIlXk4KPV /aSOVERh3FRc2kX+d+6FXF5rbQnjXocajTz7AyqEN74uxWNU1aEICcG8Ft4T9/6Z2AHr eC4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Jyra7hAVNbxUBiQeSeny3J1iXMJn4cpxNxDSkBqSwwc=; b=qJM1/WWN6AnPYmPtqBKlh7odMHbmSyvjvPXTk6Kk+UL5o3XsmHhb9t6Ox9m1KTQWNf De8NQ7wTJsHq2XRkTis2X+ZIiqDp2AGiszkLtmnVySAZ0rWne/l53SNMjLAvYuJJGTDS x6kuLxO0Mvgd10oh9cI7wK6edhOigB+g5g0Bmtgkh6OVdEOgAqjji9OtRP0VtfV5EKVB uj1pqNvb+OR/dbwGn4gKXEVSQ+NeSoTj2YXlua7oZnoAjj5ArZ3mea5YmGPsXxvZFcpv 2HxkZhdQZuKmw6hCkmld5VkXsFGVJPqUrQksZeFu/P/mDdLLmbyrBAOOEVnwO6Rk2ARV XXlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VHi49t2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h8-20020a056a00230800b0050ad51e0abbsi15589034pfh.70.2022.05.23.10.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VHi49t2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 9D57B1116EC; Mon, 23 May 2022 10:55:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242517AbiEWRtV (ORCPT + 99 others); Mon, 23 May 2022 13:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241890AbiEWR1T (ORCPT ); Mon, 23 May 2022 13:27:19 -0400 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC897628A for ; Mon, 23 May 2022 10:22:23 -0700 (PDT) Received: by mail-oo1-xc33.google.com with SMTP id j25-20020a4ad199000000b0040e50cc687cso2179260oor.9 for ; Mon, 23 May 2022 10:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Jyra7hAVNbxUBiQeSeny3J1iXMJn4cpxNxDSkBqSwwc=; b=VHi49t2yJ8XZt3l4544whGRcgSG9/chQbJzw/Wb+5ioQ+fsmX3cRpBx6OQxRGk/Ap+ wPsNDHmdeGfiSYG4yhVoaP8kdesRh7Z3VHHegl8q1JSEQj0W1/AxEFXVJe2KlCYoWN13 25ePZeus2t/0M9W2csYI07b8jnWviHlnRWgHzXP6/J5XohAxHvEmdaxSNcoc7lfQnDsr 8T4k7IU1HI2NNx9aZZvGD+J0Egdg5hSd6Pb1Fq4vl+wFkF6Jrauch0gNhrXAGtT7m/+u B9nF1ndDN2ey4SNsqLm4DJPsUNy/pqBr0mrYuds8wBJOa6h5x0I5D1XD3LaQVxke7Z+C zY6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jyra7hAVNbxUBiQeSeny3J1iXMJn4cpxNxDSkBqSwwc=; b=g2frVU4Gv8SMpYteB9x1jUz14j6SYL0ibzwbR1yINR7tsQrqwmyNk/kU7FNKHG2BiQ N5VYkdrdvLuGiOM4Bm6YgkVqVd8mcLOoYrotDPzJ2u0ygINsVSlZdXkwYxylachgE735 dmZpA5/fj/irQ+RS4C1wgpiYXc+b1tubpgtlJLSMgQ8DePYOlYEbHJ+yGqU50L9lkePN 30AMSUkZpI6o5XMoXNmDmi59rtfjVcsdWHH0P6n2dz/t/q1zPEzYnLlkn+9NkZqBxCHR E5gvpkLzU8Rp2bdSaYPUWrbCRn5ZT54N5P1kA/GDHB3cKebu5T/Ytoyx4WCHjMeR+4CJ 5efw== X-Gm-Message-State: AOAM530JCcZXG8jcH8PglrQXVSBN/O/IcVTj3Oen/DNagpmniVQYBsrY +nLDZw+psq/cRjDwxj1fspYexhTQC/bd79ItKN3vUQ== X-Received: by 2002:a4a:c90a:0:b0:40e:95bf:268d with SMTP id v10-20020a4ac90a000000b0040e95bf268dmr1156358ooq.85.1653326540061; Mon, 23 May 2022 10:22:20 -0700 (PDT) MIME-Version: 1.0 References: <20220427200314.276673-1-mlevitsk@redhat.com> <20220427200314.276673-3-mlevitsk@redhat.com> <65991ac329a32cf4128400b643d5b5ccf3918cfe.camel@redhat.com> In-Reply-To: <65991ac329a32cf4128400b643d5b5ccf3918cfe.camel@redhat.com> From: Jim Mattson Date: Mon, 23 May 2022 10:22:09 -0700 Message-ID: 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. To: Maxim Levitsky 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 Content-Type: text/plain; charset="UTF-8" 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 Sun, May 22, 2022 at 11:50 PM 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. I don't know how this works for you, but *we* are rarely involved when things go wrong. :-( > 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. > > > >