From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB83FC77B7D for ; Thu, 18 May 2023 07:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230190AbjERHia (ORCPT ); Thu, 18 May 2023 03:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbjERHiZ (ORCPT ); Thu, 18 May 2023 03:38:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 163E0ED; Thu, 18 May 2023 00:38:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A75A964D6F; Thu, 18 May 2023 07:38:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEE5CC4339B; Thu, 18 May 2023 07:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684395503; bh=Ceo3lyC/EwdTNGI5NUXzd4YJkOb6wd2EkIraNcTbQQc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RLB6p1ywGt+LBd2Qmq5hcPqfttFG614vnyUj1r5Ty26GytDdISZFSM9DQDaFxm1Px k8BpJsUBr6Sy3j2jenlA32KO3sSxHHhswZjftoqHcHIVGiJ/Wi9VGQTqK0Uyghm0Lq gWnABgKsK6ZbScOvMoYRN3PdQQaUJUrcHVWMoF9bGnlyuI7WhkHOaBYCf+vCh/p3jj /V0GraVhUaJ/waydKdq97ngVY+EYInMqACdDa1LGdS0x1uHVO1KuFJGsrZWthI6SZO 7Z3BtXSqsNecDaP3knbL/DR0NoY4Lpzvv6zpgE17sA4pZvubSxMQ35VNzGU5ClvERL 7ZqcdCa7XsyXw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pzYDM-00G4j7-Op; Thu, 18 May 2023 08:38:20 +0100 Date: Thu, 18 May 2023 08:38:20 +0100 Message-ID: <86jzx6ks2b.wl-maz@kernel.org> From: Marc Zyngier To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , kvmarm@lists.linux.dev, Huacai Chen , Aleksandar Markovic , Anup Patel , Atish Patra , kvm-riscv@lists.infradead.org Subject: Re: [PATCH v2 0/2] KVM: Fix race between reboot and hardware enabling In-Reply-To: <20230512233127.804012-1-seanjc@google.com> References: <20230512233127.804012-1-seanjc@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, chenhuacai@kernel.org, aleksandar.qemu.devel@gmail.com, anup@brainfault.org, atishp@atishpatra.org, kvm-riscv@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 May 2023 00:31:25 +0100, Sean Christopherson wrote: > > Fix a bug where enabling hardware virtualization can race with a forced > reboot, e.g. `reboot -f`, and result in virt hardware being enabled when > the reboot is attempted, and thus hanging the reboot. > > Found by inspection, confirmed by hacking the reboot flow to wait until > KVM loads (the problematic window is ridiculously small). > > Fully tested only on x86, compile tested on other architectures. > > v2: > - Rename KVM's callback to kvm_shutdown() to match the hook. [Marc] > - Don't add a spurious newline. [Marc] > > v1: https://lore.kernel.org/all/20230310221414.811690-1-seanjc@google.com > > Sean Christopherson (2): > KVM: Use syscore_ops instead of reboot_notifier to hook > restart/shutdown > KVM: Don't enable hardware after a restart/shutdown is initiated > > virt/kvm/kvm_main.c | 43 +++++++++++++++++++++++++++---------------- > 1 file changed, 27 insertions(+), 16 deletions(-) Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.