From patchwork Wed Mar 3 21:33:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 1446891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DrS1P02V6z9sSC; Thu, 4 Mar 2021 08:34:00 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lHZ7z-0003qW-8g; Wed, 03 Mar 2021 21:33:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lHZ7w-0003qQ-WA for kernel-team@lists.ubuntu.com; Wed, 03 Mar 2021 21:33:52 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lHZ7w-0007rR-LC for kernel-team@lists.ubuntu.com; Wed, 03 Mar 2021 21:33:52 +0000 Received: by mail-qt1-f197.google.com with SMTP id k15so8097189qtx.15 for ; Wed, 03 Mar 2021 13:33:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V3FhOfqKt/g5KaEnGFsBfOogAD1nCQLKghqrCdbdfrA=; b=geCSkICuqp+zmRfn9k7fg+d+Mk/oh4ykpNOqZlz7AGx/V3QRt8brwW/yPUgKFKC9Dd 6W9YwDmMKj51rO0nzio3cl6900LPgidYeoBaZC+ynPfns8dkwOs58aRZbrMGgX1L07R0 in10w6Hv0jiRHZ3qRRmJTa0XO1FtnBr73wk8UFSZuZWmGq2ru1pITbGYTyTXfrPEu2vI yJtAgPYp7cQd9BGr3Q+/A4xopymEly/7oWcC63u1qTrUVFxtii9Xs4KHg6BN3olQ3DU3 U0gsl0mV3hJVptaOn/TrRS7gHCtV2KHT/Zq0BWiuEb+BIeiwzLc9FONzbpjrNIpABcvS G00Q== X-Gm-Message-State: AOAM533nqxUB9IH1+F7V0Vjrrn5pEaj36nj+qhK+q/5vDMaaY50ZG1JY HJRsOgKDig0t1jD50xy5DCHHaNi3DkoM7oK7FVDQ3OsDgmwuRsHjqMf94IGehzIPTAU+VnVx5gm 6Z/5VPb6bQ8yPntDNoZYsuhn6U7PlEa6DAbwufkZQWQ== X-Received: by 2002:a05:620a:85e:: with SMTP id u30mr1067267qku.427.1614807231747; Wed, 03 Mar 2021 13:33:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHvIQkAstVhaG5HIknJFQAoVX2Rcdw5r2UyXLgzwuNFfoG4ZnylCkK8d9wDbyt/rCnGPicbw== X-Received: by 2002:a05:620a:85e:: with SMTP id u30mr1067244qku.427.1614807231435; Wed, 03 Mar 2021 13:33:51 -0800 (PST) Received: from localhost ([179.225.140.231]) by smtp.gmail.com with ESMTPSA id c22sm9583864qtn.74.2021.03.03.13.33.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Mar 2021 13:33:51 -0800 (PST) From: "Guilherme G. Piccoli" To: kernel-team@lists.ubuntu.com Subject: [B][PATCH 0/1] Bionic kernel 4.15.0-136 causes VMM freezes due to lack of KVM patch Date: Wed, 3 Mar 2021 18:33:47 -0300 Message-Id: <20210303213348.31319-1-gpiccoli@canonical.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1917138 [Impact] * Since kernel 4.15.0-136, Bionic kernel included a very complex KVM fix for a kind of "race" in interrupt window with irqchip-split (reported in [0]). The fix was proposed in the form of a patch series containing 2 patches [1]; this was merged in Ubuntu though the stable tree, in the form of the following commit: 71cc849b7093 ("KVM: x86: Fix split-irqchip vs interrupt injection window request") [2] * The problem is that such commit has a companion required commit, which was not proposed in the stable tree. In fact, there was a confusion among KVM community and the stable maintainer [3], due to the lack of such missing commit - because of that, the series was removed from stable trees 4.14.y and 4.9.y, but the solo commit was merged alone in Ubuntu kernel. * Without the companion patch, we might have a KVM infinite "loop" condition in the core IRQ handling, since the merged commit requires an extra check in kvm_cpu_has_extint() and a condition "inversion" in kvm_cpu_get_extint(), only present in the missing companion patch. Users reported that this manifested as dosemu2 (running in KVM mode) to be stuck in kernel 4.15.0-136 and -137, while works fine in 4.15.0-135 and the -137 plus the companion patch. * So, we hereby backport the companion commit, originally upstream patch: 72c3bcdcda ("KVM: x86: handle !lapic_in_kernel case in kvm_cpu_*_extint") [4] [Test Case] * The test case proposed was the reported bug: try running dosemu2 (with kvm mode enabled) and it fails without the companion commit. * In order to test the correctness of both fixes together, we could rely in the test proposed in [0] (running a guest with "noapic"), but it wasn't consistent and the VMM wasn't mentioned, so we might have a workaround mechanism in qemu, for example, preventing such test to reproduce the issue. [Where problems could occur] * Since this is a KVM core modification, it could affect interrupt handling in KVM but without the fix, we are already experiencing a bug. Also, both commits were backported to 5.4.y and 4.19.y, so Focal and subsequent released are already running with them. [0] https://lore.kernel.org/kvm/62918f65ec78f8990278a6a0db0567968fa23e49.camel@infradead.org/ [1] https://lore.kernel.org/kvm/20201127112114.3219360-1-pbonzini@redhat.com/ [2] http://git.kernel.org/linus/71cc849b70 [3] https://lore.kernel.org/stable/d29c4b25-33f6-8d99-7a45-8f4e06f5ade6@redhat.com/ [4] http://git.kernel.org/linus/72c3bcdcda Paolo Bonzini (1): KVM: x86: handle !lapic_in_kernel case in kvm_cpu_*_extint arch/x86/kvm/irq.c | 65 ++++++++++++++++++++++++-------------------- arch/x86/kvm/lapic.c | 2 +- 2 files changed, 37 insertions(+), 30 deletions(-)