Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1794548pxy; Fri, 23 Apr 2021 17:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5yLHJ7eUfOnT528WyzBhx6p7HtRNqZfwSwtothWW2cgP1Tnec7PkrmeGIDZO68pZXXk98 X-Received: by 2002:a17:906:c44f:: with SMTP id ck15mr6873434ejb.269.1619225582572; Fri, 23 Apr 2021 17:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619225582; cv=none; d=google.com; s=arc-20160816; b=GWKQaiFlASZJDCQM0DmZnyV3Fb3NBg6FbNTtVgraOxdCZ0UCNhr1bH/nBtM2gRANfu g/tj6DiPQTIZe7H1O9HwSY71QABOxAcKvup1ovX4d6K4oxFa240IP7z6aEzE8Jq1FffG P8UQhV/1QMPoslfSTHpK5tPb/GVgJ85a/mco4BIfWtPd/G+oV77zAl8btEsD2JDPjzd+ lZQ1RXEti8MFgJ2PR0WvrNr6vkzhQea3M1tTBZrX7+xAyKLgrV9fCxgHOiONTrB71/YZ O7eGrrP2Njn8ydkRsEYj4kB8bZbLqvKml6uWrNQqKfAswXES91x1CVtuZEkW2cBHIXfL zZZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=nJ0Vx6GbmijZ7PDR3hwIYLOvt4K+KdVv1iVkzVPrEHQ=; b=d7gmCha9pMchNowsRMD0RMg0XlTaVEffMiRtw2/O7hpCbdbYiMaMal4JP4h7KLEgf5 8eykCUJ+bf4mpgYzJtgRMlfffpSkxztBuDDOkbfC4R6tm3kJdsUfALqcSgMdFfocsHUr KZFm8RpMsvZ4mYJCUY4elTRbwJ/65BHSoyGb5Fib6vJFpxQjanaTrdkIPwaDx8jxv5+y v1Jy4+ueBrF50/xsvywOPwo6wES3777UXQWlQX+x5UGREk83yZKFZUD2HM4AJYaAmUOi vuK129dXgs6RH24HWQYXZPZgv1/U4r0cfTRiPbUt1gtWU2Zt/0+s3y2W1m5XSVjjdZER 3sPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CHIwF6Up; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si7046738edm.362.2021.04.23.17.52.39; Fri, 23 Apr 2021 17:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CHIwF6Up; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237243AbhDXAtp (ORCPT + 99 others); Fri, 23 Apr 2021 20:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244209AbhDXAs1 (ORCPT ); Fri, 23 Apr 2021 20:48:27 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E43C06134B for ; Fri, 23 Apr 2021 17:47:27 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id b20-20020a0cf0540000b02901a471b6ccbaso15004855qvl.22 for ; Fri, 23 Apr 2021 17:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=nJ0Vx6GbmijZ7PDR3hwIYLOvt4K+KdVv1iVkzVPrEHQ=; b=CHIwF6Upat5nEcmPw+p2goGG9yaxiZOo90wW5j+8Ba6nIAr/qCVhZjxVzBatY501fR eV5lT1JFrSyfjrhrfANk8BrRdSZ7U6BmPXGHRFpY2dF/AmqrRf+73RYscgZ5s2Hb2Ev0 y3hm3xcNsxFKAHYTkjDIceYwbdND7SkIwvU4s+RsLvNxG7NzeoYNc6KyMnObn96yaKPW +6pBQA7hpeshb4tY5GN+CgmVw6UUni99Ou+1XR6kYBsGrjEA1x0EWTi48+Z+fd37bA6+ Xi9pdfp9oVXpyc1g0PUqzF7plNbRkQ7AoRRWB0Pxj59OvWTEabRdBw4AyHl/Mi76w56y l3hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=nJ0Vx6GbmijZ7PDR3hwIYLOvt4K+KdVv1iVkzVPrEHQ=; b=EUEwS+NgWsjlPwdgafEdg/2yMNDGiYnylmmrfVAitsyFOUv06ux7VAIHVt1W6OAAM6 jJvxzT3FCEC5xFFENUL5b8SS56dZdcnYE8sLSe6LcDrWh6Ya8E9DMswIgGb7K7986+1e hpwRI8zwoEZlxJE01c8GEzC/CkdxWPSU90QpLsGdTuFeW4MEbOGEzb2ACgluPNeqPI7v WQcHpyzuYqfdF4xi33Ln1m3H0yESXg0k6NsaGwm471+wXJkfbJUeXomRa9xzkU7BG68i 0Pi5JpBH7uGfSEIxXqKHoUwUkIGIB+neney6l9tG0kteYFbX8cWqYDlh1wj8MI3juvkR 1hEg== X-Gm-Message-State: AOAM530MLuLjLDpDrqmumpu14ggGj/1I5FM1Uop6NNrc04kHm2f01PPd 0IA49vm1TpMrFWLBN1gsbMDt3BzD8uE= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:ad52:3246:e190:f070]) (user=seanjc job=sendgmr) by 2002:a0c:db05:: with SMTP id d5mr7191402qvk.41.1619225246707; Fri, 23 Apr 2021 17:47:26 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 23 Apr 2021 17:46:14 -0700 In-Reply-To: <20210424004645.3950558-1-seanjc@google.com> Message-Id: <20210424004645.3950558-13-seanjc@google.com> Mime-Version: 1.0 References: <20210424004645.3950558-1-seanjc@google.com> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog Subject: [PATCH 12/43] KVM: x86: Remove defunct BSP "update" in local APIC reset From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove a BSP APIC update in kvm_lapic_reset() that is a glorified and confusing nop. When the code was originally added, kvm_vcpu_is_bsp() queried kvm->arch.bsp_vcpu, i.e. the intent was to set the BSP bit in the BSP vCPU's APIC. But, stuffing the BSP bit at INIT was wrong since the guest can change its BSP(s); this was fixed by commit 58d269d8cccc ("KVM: x86: BSP in MSR_IA32_APICBASE is writable"). In other words, kvm_vcpu_is_bsp() is now purely a reflection of vcpu->arch.apic_base.MSR_IA32_APICBASE_BSP, thus the update will always set the current value and kvm_lapic_set_base() is effectively a nop if the new and old values match. The RESET case, which does need to stuff the BSP for the reset vCPU, is handled by vendor code (though this will soon be moved to common code). No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm/lapic.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 655eb1d07344..b99630c6d7fe 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2351,9 +2351,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event) apic->highest_isr_cache = -1; update_divide_count(apic); atomic_set(&apic->lapic_timer.pending, 0); - if (kvm_vcpu_is_bsp(vcpu)) - kvm_lapic_set_base(vcpu, - vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP); + vcpu->arch.pv_eoi.msr_val = 0; apic_update_ppr(apic); if (vcpu->arch.apicv_active) { -- 2.31.1.498.g6c1eba8ee3d-goog