Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2170479iof; Tue, 7 Jun 2022 22:05:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn3HFqD/SHPw5U4uBoYblXav/7F21B+8ST1BZNMx9h/ZlqdKea8HTrADioX75eHvpU41xW X-Received: by 2002:a17:902:758a:b0:15e:ef4f:fed5 with SMTP id j10-20020a170902758a00b0015eef4ffed5mr32421211pll.1.1654664701055; Tue, 07 Jun 2022 22:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664701; cv=none; d=google.com; s=arc-20160816; b=RovScg+w/L//L+QdF6NG98QdYOqb6XE1glugg2zXhACouvIlgD6T34eFilFvsAmX7R J2EWcDWxWgSaQzS9qff9dnZB0kciLzvMO7I9rLiDcdy+4gaTj2bI8AxgTl/2+bD5I045 UZNP4Yt2+fGVWdBGEqv7Zaad9WXCIE98N9918vUC6v1NyhK94uvCIPEjf4yQbi6MzerA NXXbcQml5pyQUbAs/E/BP4svadeJoJmYGNS+0xggTOr+QNtgIjquQhQ/S6beN6a2yBZ4 6mdFQfi4BceJLcUpasOD5dj6GC7XXxrY5CzEL7U2ylZ5KX2etuxMiJcu+3feUZ0BE6Ol c1DQ== 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=p5gZGK2oHc6INSHHTUFNUO8RNY5gojgeBamGwkE0RTs=; b=AV8XVNz+h8GDzEGinZp19dZov0GY/TwjCOW47KGoqhnf3rv+vsbe0Fm7/A8F2aGpcU 2JAs3S8cf8IsrNbztdvEL7L6hDBJBY91LxNSyh4AV/baluqpFOm+1BMLw/20+awxPRXE rNDy0UXs8D/VN2I9ScB0jC1CRwo7hUPBm0HmQc/2eUY2PxAYVrumKiYGeHourV+5vbH4 I27PEL89jkt2LmlNMKRjAeHyRPPV/k60HH9qjpBuhh2d4k8OiLmrNjGg9eaUuXXDe6gh jLADDTN8kO8+J4oaJuGvOwtJt1rAmBzPylsb9MkVDo7cyIQ/rRKZS5XCDynVCjVsCCJB oOZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BkaqNQ8y; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pc11-20020a17090b3b8b00b001e3103f1128si30398880pjb.113.2022.06.07.22.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:05:01 -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=@redhat.com header.s=mimecast20190719 header.b=BkaqNQ8y; 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=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 179524626CD; Tue, 7 Jun 2022 21:32:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237744AbiFGHxz (ORCPT + 99 others); Tue, 7 Jun 2022 03:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237942AbiFGHxw (ORCPT ); Tue, 7 Jun 2022 03:53:52 -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 78906C9676 for ; Tue, 7 Jun 2022 00:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654588429; 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=p5gZGK2oHc6INSHHTUFNUO8RNY5gojgeBamGwkE0RTs=; b=BkaqNQ8ycvaI9+u6TabB3R2aH9jJeBSC9pBFZiQfcdDWi7uKsAHI7Tm8bOIZqQsU5+Spe4 8lv6/2Qse28b8QG2r12/5IJNUjGX0Rya7HaEImg37MeDZd6p183BZE488mzm6vVtxwQ5Dq PBb4tYyDD/HWhK2gRmOt3kvSDtYRovY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-577-68xVCxi0PDirIBT2rCWd2Q-1; Tue, 07 Jun 2022 03:53:48 -0400 X-MC-Unique: 68xVCxi0PDirIBT2rCWd2Q-1 Received: by mail-qt1-f199.google.com with SMTP id l20-20020ac81494000000b002f91203eeacso13359436qtj.10 for ; Tue, 07 Jun 2022 00:53:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=p5gZGK2oHc6INSHHTUFNUO8RNY5gojgeBamGwkE0RTs=; b=EdKwTrzibJSPC3rp1HXoLaC5JQAppOfLkyr5pyoNZN30VaEwp+4lawnyFAUTCHK2kV YUTmTF5b0YP87HaJgW4aa3/MaDfh7Eh/XzOIUj6QQcYh/cLGVr60R3Gt5QObMlPlujH2 JoLa2O9xmXfVa4odsxOUZ9IBH35ErWbU83slpdl1wUIlshs0YhzhOjtNTQTpASgoSuUk y9RUHaBTzrH7hL1ifuNPauD8x6taP/UygX0GJYZjDA/439rS+0JIEtcvMvvw5yUr2PQH KDfHs4VA8yQXcBP/LEA2jS7NXHRQMpkvNks9ia9JFcHY2bzCc1RyvHmvBqlqRSE+Joow +D+g== X-Gm-Message-State: AOAM532/9TS7v15EnBiJK5/aTaDyGju1cb5IcQ3Gag4QxJyQ40jD7ys8 4HjrxX6R6iM3z6QUK659Y5ixlQurXw5HF3D4eRgYiENugU7aJGO2LzcmCLBKmac0K4EWiun0vpp PFH18PmUf4+dR3W3T/pd1oCd+ X-Received: by 2002:a05:622a:52:b0:304:e646:8d23 with SMTP id y18-20020a05622a005200b00304e6468d23mr11345595qtw.350.1654588427667; Tue, 07 Jun 2022 00:53:47 -0700 (PDT) X-Received: by 2002:a05:622a:52:b0:304:e646:8d23 with SMTP id y18-20020a05622a005200b00304e6468d23mr11345589qtw.350.1654588427429; Tue, 07 Jun 2022 00:53:47 -0700 (PDT) Received: from [10.35.4.238] (bzq-82-81-161-50.red.bezeqint.net. [82.81.161.50]) by smtp.gmail.com with ESMTPSA id v27-20020a05622a189b00b002f937991969sm11558876qtc.24.2022.06.07.00.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 00:53:46 -0700 (PDT) Message-ID: <66b4d9d336884886d04d4d6dd5e517b2634ce625.camel@redhat.com> Subject: Re: [PATCH 2/7] KVM: x86: inhibit APICv/AVIC when the guest and/or host changes either apic id or the apic base from their default values. From: Maxim Levitsky To: Chao Gao Cc: kvm@vger.kernel.org, Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Jim Mattson , "H. Peter Anvin" , Joerg Roedel , Dave Hansen , Ingo Molnar , Suravee Suthikulpanit , linux-kernel@vger.kernel.org, Thomas Gleixner , x86@kernel.org, Borislav Petkov , Paolo Bonzini Date: Tue, 07 Jun 2022 10:53:42 +0300 In-Reply-To: <20220607070515.GA26909@gao-cwp> References: <20220606180829.102503-1-mlevitsk@redhat.com> <20220606180829.102503-3-mlevitsk@redhat.com> <20220607070515.GA26909@gao-cwp> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 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 Tue, 2022-06-07 at 15:05 +0800, Chao Gao wrote: > On Mon, Jun 06, 2022 at 09:08:24PM +0300, Maxim Levitsky wrote: > > +       /* > > +        * For simplicity, the APIC acceleration is inhibited > > +        * first time either APIC ID or APIC base are changed by > > the guest > > +        * from their reset values. > > +        */ > > +       APICV_INHIBIT_REASON_APIC_ID_MODIFIED, > > +       APICV_INHIBIT_REASON_APIC_BASE_MODIFIED, > > + > > + > > Remove one newline. Will do. > > > void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) > > @@ -2666,6 +2683,8 @@ static int kvm_apic_state_fixup(struct > > kvm_vcpu *vcpu, > >                         icr = __kvm_lapic_get_reg64(s->regs, > > APIC_ICR); > >                         __kvm_lapic_set_reg(s->regs, APIC_ICR2, icr > > >> 32); > >                 } > > +       } else { > > +               kvm_lapic_xapic_id_updated(vcpu->arch.apic); > > Strictly speaking, this is needed only for "set" cases. > True, thanks! Best regards, Maxim Levitsky