Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4050795pxv; Tue, 13 Jul 2021 09:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnQMFCn09logtQyEXyBWB7WRQRy8lxScGF4j0eE6W95SU16kDDZpFvjikJeqiQYxFiQ/BK X-Received: by 2002:a17:906:bc84:: with SMTP id lv4mr6613000ejb.493.1626194171621; Tue, 13 Jul 2021 09:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626194171; cv=none; d=google.com; s=arc-20160816; b=E9BJBWC51LiX1UwJ8eg2JWpgTPRi2p9ysbnmQfhDOlykEyDwtmyXIX0xuuILw6mxEm nE3RAJLNz7nDJHUc9NJIErgu/83FUDawAlHc3pygZYrs5SoIBCOyONvCW2HXFuTYWbk6 Rn7Z/mZYX2zknThxrNttijdK2mMQ+7JrMPEfZ8uJgVpcEOuIWcnQgVl8sGGCibKBTdKY zh+TfGZC5Wug4oO4/v8hDl5RvYCduayw8tUPdfzKnNAPIPLV1fis4ArsJAAObQzAijLc bY6pN8DD1EICX5mJqWOFBK7zVAPkT/QsuUYB5Fthv5VXODMlQ2Qg16Sh5XYN3gp4z8S7 xyIQ== 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=2p0iOguwtrAqfZk6csdNwTfhtvIQqe6ewaUZHjQW6QQ=; b=cIcY24+h58zhZs8scrz862r+8TTrVJUif1dnTlVLCT62CmUw7j/uNHQrVAN80W0PP9 +uvTRbY422Fe0qzpcZfeMdVZT2YxaoZbs9bIo8TDsAdNEkOqbBGaPsT/0uLxwRDrAucJ 25vukCucpMebh5O886xTCUyDyFiQHWFt8keAjGVhuTmvnB8VgoRDiRUrLUuZPfkqPY7B aUes+aiySpAXpe2iUBqkvPfH5QgvX/lKGZftbscvecs+Qq0L0UHkmADAK+RydzG16M5d 3krn4609DNRNRFlxr2z3ciZGy/s8sM+1U3fDmMky22Kdr7wOQ+jvEBbZNBZp9tEJgrHj 5oiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bwqJvkBx; 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 o8si21762758edc.250.2021.07.13.09.35.46; Tue, 13 Jul 2021 09:36:11 -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=bwqJvkBx; 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 S234174AbhGMQg7 (ORCPT + 99 others); Tue, 13 Jul 2021 12:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234208AbhGMQgr (ORCPT ); Tue, 13 Jul 2021 12:36:47 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B228C0613E9 for ; Tue, 13 Jul 2021 09:33:56 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id c13-20020a25880d0000b029055492c8987bso27619306ybl.19 for ; Tue, 13 Jul 2021 09:33:56 -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=2p0iOguwtrAqfZk6csdNwTfhtvIQqe6ewaUZHjQW6QQ=; b=bwqJvkBxbRL0/g4Xzd9Ql1plZAvQNrdXHppJu6oYhco63ZmuP/tVS8P+zbXYdG+ZGc gvw4h+9xWoxBp7Ni+vvzkMwTXdP2uW98D7eyuH9AOUG8tN2CSZnhEbvrvAuNV+T7jR0n PbRRy+RcA+q5hJJ5GEKfy6Hpo6oV0P35P49kmXnx7A9Tbn9b0VHHjCRQJFQB96C9DkR9 FwVAqAxZejhBCiIYw67z9X1NLxGm0y8/uXQfYZr95I8YbCv8/Utet/LN+oXxYvtrD/Fb KpNOmI2OBjI7fXZqKkzTI52M118bhAV6FYfVnVU13byy7qYBGMQkF6JBtCYqlybSquwz phJA== 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=2p0iOguwtrAqfZk6csdNwTfhtvIQqe6ewaUZHjQW6QQ=; b=avUIEo5toQ1K33bwTJo88oc/OMQPcOYIh/lUfAwyk5RsEkUkvOFLxw2hWc7ILnPIjX /aVNA+S0ooAQ0QFnAiAhAcpj23AYfAtywp3mIvKVbRfyIoPEXo2RhzPDZsWhc6aoBn5i rshSbUwn6VIqML8HYeldwFRPsufIRnNJHLgjQUfTF3pT7BXprlKFrQjjrjLug9carHiM vK6+8G49km7I0bwjSBesZtkj0fzATgrojxQfun6HLmaE4TS2e9eZIP8E4iy96OppH9LQ J6Wy09a//Dsmrd0Lz/nGpY3q2Ct5oJj93KAknFopklseYR128iX1/mpsWLyaGIitfx74 J86A== X-Gm-Message-State: AOAM531Cs+lsb8yqbwHFDeyszQEo7O0rvDzut52wHgDqybY+KYS1epVN tx55fv/XqOuY7i+UynKp1O3pfjNRjI0= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:825e:11a1:364b:8109]) (user=seanjc job=sendgmr) by 2002:a25:f827:: with SMTP id u39mr6778858ybd.100.1626194035426; Tue, 13 Jul 2021 09:33:55 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 13 Jul 2021 09:32:49 -0700 In-Reply-To: <20210713163324.627647-1-seanjc@google.com> Message-Id: <20210713163324.627647-12-seanjc@google.com> Mime-Version: 1.0 References: <20210713163324.627647-1-seanjc@google.com> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog Subject: [PATCH v2 11/46] KVM: x86: WARN if the APIC map is dirty without an in-kernel local APIC 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, Reiji Watanabe Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WARN if KVM ends up in a state where it thinks its APIC map needs to be recalculated, but KVM is not emulating the local APIC. This is mostly to document KVM's "rules" in order to provide clarity in future cleanups. Signed-off-by: Sean Christopherson --- arch/x86/kvm/lapic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index ba5a27879f1d..add4dd1e3528 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -192,6 +192,9 @@ void kvm_recalculate_apic_map(struct kvm *kvm) if (atomic_read_acquire(&kvm->arch.apic_map_dirty) == CLEAN) return; + WARN_ONCE(!irqchip_in_kernel(kvm), + "Dirty APIC map without an in-kernel local APIC"); + mutex_lock(&kvm->arch.apic_map_lock); /* * Read kvm->arch.apic_map_dirty before kvm->arch.apic_map -- 2.32.0.93.g670b81a890-goog